:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-strong: #fffaf2;
  --surface: rgba(255, 250, 242, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-muted: rgba(255, 255, 255, 0.66);
  --line: rgba(123, 93, 63, 0.12);
  --text: #1d2533;
  --text-soft: #586072;
  --text-faint: #7f8798;
  --accent: #dd6a3c;
  --accent-strong: #c95222;
  --accent-soft: rgba(221, 106, 60, 0.14);
  --shadow: 0 24px 60px rgba(78, 52, 28, 0.12);
  --shadow-soft: 0 14px 40px rgba(85, 59, 34, 0.08);
  --player-bubble: linear-gradient(135deg, #ea7446, #cb582b);
  --bot-bubble: rgba(255, 255, 255, 0.92);
  --system-bubble: rgba(255, 255, 255, 0.72);
  --backdrop-word: rgba(92, 74, 58, 0.075);
  --page-glow: radial-gradient(circle at top left, rgba(244, 200, 152, 0.52), transparent 40%);
  --page-glow-alt: radial-gradient(circle at bottom right, rgba(255, 168, 113, 0.28), transparent 38%);
  --focus: 0 0 0 3px rgba(221, 106, 60, 0.24);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --header-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --body-font: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  --shell-width: 980px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11151f;
  --bg-strong: #151b28;
  --surface: rgba(20, 27, 40, 0.82);
  --surface-strong: rgba(17, 24, 37, 0.92);
  --surface-muted: rgba(33, 42, 58, 0.72);
  --line: rgba(160, 181, 219, 0.12);
  --text: #edf3ff;
  --text-soft: #b8c5da;
  --text-faint: #91a0b9;
  --accent: #f38f5d;
  --accent-strong: #ffb285;
  --accent-soft: rgba(243, 143, 93, 0.18);
  --shadow: 0 28px 80px rgba(2, 5, 11, 0.48);
  --shadow-soft: 0 18px 42px rgba(2, 5, 11, 0.28);
  --player-bubble: linear-gradient(135deg, #f38f5d, #de6d38);
  --bot-bubble: rgba(36, 45, 63, 0.9);
  --system-bubble: rgba(29, 38, 54, 0.84);
  --backdrop-word: rgba(214, 225, 255, 0.06);
  --page-glow: radial-gradient(circle at top left, rgba(251, 162, 111, 0.18), transparent 42%);
  --page-glow-alt: radial-gradient(circle at bottom right, rgba(89, 141, 255, 0.14), transparent 34%);
  --focus: 0 0 0 3px rgba(243, 143, 93, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--body-font);
  color: var(--text);
  background:
    var(--page-glow),
    var(--page-glow-alt),
    linear-gradient(180deg, var(--bg-strong), var(--bg));
  overscroll-behavior: none;
  transition:
    background-color 220ms ease,
    color 220ms ease;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.page-shell {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.category-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.backdrop-word {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  font-family: var(--header-font);
  font-size: clamp(2rem, calc(var(--size) * 0.55rem + 0.75rem), 5.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--backdrop-word);
  transform: rotate(calc(var(--rotate) * 1deg));
  animation: drift calc(var(--duration) * 1s) ease-in-out infinite alternate;
  animation-delay: calc(var(--delay) * -1s);
  user-select: none;
  white-space: nowrap;
}

.site-header,
.site-main {
  position: relative;
  width: min(100%, var(--shell-width));
  margin-inline: auto;
}

.site-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 64px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 10px 20px rgba(221, 106, 60, 0.22);
}

.brand-name {
  margin: 0;
  font-family: var(--header-font);
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
}

.header-controls > select,
#wordInput {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  min-height: 48px;
  padding: 0 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.header-controls > select {
  width: 118px;
  min-width: 0;
  padding-inline: 12px 40px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3.25 5.5 7 9.25 10.75 5.5' stroke='%23586072' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  text-overflow: ellipsis;
}

.theme-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
}

.theme-option {
  min-height: 38px;
  min-width: 48px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.theme-option[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.site-main {
  flex: 1;
  min-height: 0;
  padding-top: 10px;
  display: flex;
}

.game-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
}

.status-label {
  display: inline;
  margin: 0;
  color: var(--text-faint);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.2rem;
  font-size: 0.92rem;
  font-weight: 800;
}

.status-value--accent {
  min-width: 1.6rem;
  padding-inline: 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-value--danger {
  color: #e5484d;
  animation: time-pulse 1s ease-in-out infinite;
}

@keyframes time-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .status-value--danger {
    animation: none;
  }
}

.chat-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.opponent-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.opponent-bar[hidden] {
  display: none;
}

.opponent-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.opponent-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--text);
}

.opponent-name strong {
  font-weight: 700;
}

.opponent-flag {
  font-size: 1rem;
  line-height: 1;
}

.opponent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.opponent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.22);
}

.opponent-rating {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.avatar-chip {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--avatar-color, var(--accent));
  color: #fff;
  font-weight: 700;
}

.avatar-chip--md {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}

.avatar-chip__initial {
  line-height: 1;
}

.avatar-chip__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quick-links {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding-inline: 2px;
  color: var(--text-faint);
}

.quick-links[hidden] {
  display: none;
}

.quick-links__label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.quick-links__items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

/* App download call-to-action (homepage shell + SEO pages). */
.app-cta {
  flex: 0 0 auto;
  width: min(100%, var(--shell-width));
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(130% 160% at 0% 0%, var(--accent-soft), transparent 62%),
    var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.app-cta__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.app-cta__title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
}

.app-cta__subtitle {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.app-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 138px;
  padding: 7px 15px 7px 12px;
  border-radius: 12px;
  background: #0f0f12;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

a.app-badge:hover,
a.app-badge:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.app-badge--soon {
  cursor: default;
}

.app-badge__logo {
  width: 22px;
  height: 22px;
  fill: #fff;
  flex: 0 0 auto;
}

.app-badge__text {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.app-badge__line1 {
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.85;
}

.app-badge__line2 {
  font-size: 0.95rem;
  font-weight: 700;
}

.app-badge__soon {
  position: absolute;
  top: -8px;
  right: -7px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}

@media (max-width: 560px) {
  .app-cta {
    justify-content: center;
    text-align: center;
  }
  .app-cta__text {
    align-items: center;
    width: 100%;
  }
  .app-badges {
    justify-content: center;
    width: 100%;
  }
}

.site-footer {
  flex: 0 0 auto;
  width: min(100%, var(--shell-width));
  margin: 4px auto 0;
  padding-bottom: 2px;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.site-footer__credit {
  color: var(--text-faint);
  font-size: 0.78rem;
  opacity: 0.84;
}

.site-footer__credit a {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    border-color 180ms ease,
    opacity 180ms ease;
}

.header-controls > select option:disabled {
  color: rgba(127, 135, 152, 0.75);
}

.chat-feed {
  flex: 1;
  min-height: 0;
  padding: 14px 14px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.chat-feed::-webkit-scrollbar {
  width: 10px;
}

.chat-feed::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(127, 135, 152, 0.35);
  background-clip: padding-box;
}

.message {
  width: fit-content;
  max-width: min(84%, 30rem);
  margin-bottom: 10px;
  animation: message-rise 260ms ease both;
}

.message--player {
  margin-left: auto;
}

.message--system {
  width: 100%;
  max-width: none;
  display: flex;
  justify-content: center;
}

.message__meta {
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 700;
}

.message__bubble {
  padding: 12px 14px;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  line-height: 1.42;
  word-break: break-word;
}

.message--bot .message__bubble {
  border-top-left-radius: 10px;
  background: var(--bot-bubble);
  color: var(--text);
  border: 1px solid var(--line);
}

.message--player .message__bubble {
  border-top-right-radius: 10px;
  background: var(--player-bubble);
  color: #fff;
}

.message--system .message__bubble {
  max-width: min(100%, 28rem);
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--system-bubble);
  color: var(--text-soft);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 0.88rem;
}

.message[data-kind="invalid"] .message__bubble,
.message[data-kind="repeated"] .message__bubble,
.message[data-kind="wrong-letter"] .message__bubble {
  color: var(--accent-strong);
}

.message[data-kind="gameover"] .message__bubble {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.message[data-kind="summary"] .message__bubble {
  background: rgba(127, 135, 152, 0.12);
  color: var(--text-soft);
}

.message[data-kind="hint"] .message__bubble {
  background: rgba(116, 153, 255, 0.12);
  color: var(--text);
}

.message[data-kind="success"] .message__bubble {
  background: rgba(102, 179, 122, 0.14);
  color: #2f7c49;
}

:root[data-theme="dark"] .message[data-kind="success"] .message__bubble {
  color: #9be2b0;
}

.message[data-kind="thinking"] .message__bubble {
  background: rgba(127, 135, 152, 0.12);
  color: var(--text-soft);
}

/* A draft the bot mistypes before correcting itself. */
.message[data-kind="draft"] .message__bubble {
  color: var(--text-faint);
  opacity: 0.85;
}

/* An invalid word the bot "tries" and then takes back. */
.message[data-kind="rejected"] .message__bubble {
  color: var(--text-faint);
  text-decoration: line-through;
  opacity: 0.7;
}

/* Animated "typing…" dots. */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dots span {
    animation: none;
  }
}

.message[data-kind="play-again"] .message__bubble {
  padding: 4px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.end-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.control-bar {
  position: sticky;
  bottom: 0;
  flex: 0 0 auto;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--surface);
  backdrop-filter: blur(20px);
}

.control-main {
  display: grid;
  gap: 8px;
}

#wordInput::placeholder {
  color: var(--text-faint);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.action-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  padding-inline: 14px;
  font-weight: 800;
  white-space: nowrap;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.action-button--ghost {
  background: transparent;
}

.action-button--primary {
  border-color: transparent;
  min-width: 84px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 16px 32px rgba(221, 106, 60, 0.28);
}

.action-button--inline {
  min-width: 132px;
}

.action-button:disabled,
#wordInput:disabled,
.header-controls > select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.helper-note {
  margin: 0;
  padding-top: 8px;
  color: var(--text-faint);
  font-size: 0.78rem;
  line-height: 1.3;
}

#wordInput[data-feedback="success"] {
  border-color: rgba(86, 170, 107, 0.45);
  background: rgba(103, 185, 123, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px rgba(103, 185, 123, 0.14);
}

#wordInput[data-feedback="error"] {
  border-color: rgba(221, 106, 60, 0.55);
  background: rgba(221, 106, 60, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px rgba(221, 106, 60, 0.12);
  animation: input-shake 220ms ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:hover,
button:focus-visible,
select:hover,
select:focus-visible,
#wordInput:hover,
#wordInput:focus-visible {
  outline: none;
}

.theme-option:hover,
.action-button:hover,
.quick-link:hover,
.site-footer__links a:hover,
.site-footer__credit a:hover {
  transform: translateY(-1px);
}

.action-button:focus-visible,
.theme-option:focus-visible,
.quick-link:focus-visible,
.site-footer__links a:focus-visible,
.site-footer__credit a:focus-visible,
.header-controls > select:focus-visible,
#wordInput:focus-visible {
  box-shadow: var(--focus);
}

.site-footer__credit a:hover,
.site-footer__credit a:focus-visible {
  border-bottom-color: currentColor;
  opacity: 1;
}

@keyframes message-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes input-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-2px);
  }
  70% {
    transform: translateX(2px);
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) rotate(calc(var(--rotate) * 1deg));
  }
  to {
    transform: translate3d(0, -14px, 0)
      rotate(calc((var(--rotate) + 3) * 1deg));
  }
}

@media (min-width: 720px) {
  .page-shell {
    padding: 12px;
  }

  .site-header {
    min-height: 68px;
    padding: 10px 14px;
  }

  .header-controls {
    gap: 10px;
  }

  .header-controls > select {
    width: 124px;
  }

  .control-main {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .action-row {
    flex-wrap: nowrap;
  }

  .helper-note {
    padding-top: 6px;
  }
}

@media (max-width: 680px) {
  .quick-links {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .site-footer__links {
    gap: 6px 10px;
  }
}

@media (max-width: 460px) {
  .page-shell {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  .site-header {
    gap: 6px;
    min-height: 54px;
    padding: 6px 8px;
    border-radius: 18px;
  }

  .brand-lockup {
    display: none;
  }

  .header-controls {
    flex: 1 1 100%;
    width: 100%;
    gap: 6px;
    justify-content: stretch;
  }

  .header-controls > select {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 42px;
    padding-inline: 10px 38px;
    font-size: 0.98rem;
    background-position: right 12px center;
  }

  .theme-switch {
    flex: 0 0 118px;
    gap: 3px;
    padding: 3px;
    border-radius: 14px;
  }

  .theme-option {
    min-width: 44px;
    min-height: 36px;
    padding-inline: 10px;
    border-radius: 10px;
    font-size: 0.95rem;
  }
}

@media (max-width: 380px) {
  .header-controls > select {
    min-width: 0;
    font-size: 0.94rem;
    padding-inline: 10px 36px;
    background-position: right 11px center;
  }

  .theme-switch {
    flex-basis: 104px;
  }

  .theme-option {
    min-width: 0;
    padding-inline: 0;
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
