:root {
  color-scheme: dark;
  --bg: #030304;
  --bg-2: #090908;
  --panel: #0b0b0b;
  --panel-2: #11110f;
  --panel-border: #363127;
  --panel-border-bright: rgba(214, 168, 79, 0.42);
  --glass: rgba(7, 7, 7, 0.82);
  --glass-strong: rgba(4, 4, 4, 0.94);
  --text: #f4ead2;
  --muted: rgba(213, 202, 174, 0.76);
  --dim: #7f7868;
  --gold: #d4af37;
  --gold-bright: #f0d36d;
  --gold-dark: #8f7020;
  --teal: #48b6a3;
  --green: #3c8f64;
  --amber: #b8862f;
  --red: #a74842;
  --ink: #050504;
  --tile-empty: #151511;
  --tile-border: #4b4538;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
  --shadow-tight: 0 16px 34px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-padding-top: 76px;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: clip;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  background: #030304;
  -webkit-text-size-adjust: 100%;
}

body[data-drawer-open="true"] {
  overflow: hidden;
}

body.embed-mode .site-header,
body.embed-mode .site-footer,
body.fullscreen-active .site-header,
body.fullscreen-active .site-footer {
  display: none;
}

body.fullscreen-active {
  overflow: hidden;
}

body.embed-mode .page-shell {
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(2, 2, 2, 0.26), rgba(2, 2, 2, 0.8)),
    url("assets/witness-word-backdrop.png") center / cover no-repeat;
  filter: grayscale(0.45) sepia(0.18) saturate(0.78);
  transform: scale(1.012);
}

body::after {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(1, 1, 1, 0.82) 0%, rgba(1, 1, 1, 0.2) 34%, rgba(1, 1, 1, 0.22) 66%, rgba(1, 1, 1, 0.84) 100%),
    linear-gradient(180deg, rgba(2, 2, 2, 0.36), rgba(2, 2, 2, 0.1) 42%, rgba(2, 2, 2, 0.76)),
    linear-gradient(rgba(212, 175, 55, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 168, 79, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 58px 58px, 58px 58px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 20;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--gold);
  color: var(--ink);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding:
    max(10px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    10px
    max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(214, 168, 79, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(3, 3, 3, 0.86);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(24px) saturate(1.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 224px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(214, 168, 79, 0.72);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(214, 168, 79, 0.16), rgba(72, 182, 163, 0.05)),
    rgba(5, 9, 8, 0.5);
  color: #f1d18b;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow:
    inset 0 0 18px rgba(214, 168, 79, 0.12),
    0 8px 22px rgba(0, 0, 0, 0.32);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-nav a {
  position: relative;
  padding: 5px 0;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus {
  color: var(--gold);
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214, 168, 79, 0.7), transparent);
  opacity: 0;
  transform: translateY(3px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  content: "";
}

.site-nav a:hover::after,
.site-nav a:focus::after {
  opacity: 1;
  transform: translateY(0);
}

.header-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    rgba(3, 3, 3, 0.72);
  color: var(--text);
  font-weight: 850;
  box-shadow: inset 0 0 16px rgba(212, 175, 55, 0.04);
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(240, 211, 109, 0.72);
  color: var(--gold-bright);
}

.page-shell {
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.intro-band {
  order: 1;
}

.console-layout {
  order: 2;
}

.mode-dock {
  order: 3;
}

.intro-band {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 190px;
  padding: 24px 0;
}

.eyebrow,
.kicker,
.label {
  margin: 0;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 10px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 5.15rem;
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.18),
    0 18px 52px rgba(0, 0, 0, 0.7);
}

h2 {
  margin: 4px 0 0;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 680px;
  margin: 0;
  color: rgba(244, 234, 210, 0.82);
  font-size: 1.02rem;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.72);
}

.intro-title {
  min-width: 0;
}

.daily-briefing {
  display: grid;
  width: min(100%, 390px);
  flex: 0 0 min(390px, 42%);
  gap: 11px;
  padding: 16px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.11), transparent 46%),
    rgba(4, 4, 4, 0.78);
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 248, 220, 0.05);
  backdrop-filter: blur(16px);
}

.daily-briefing > div:first-child {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 14px;
  align-items: end;
}

.daily-briefing .kicker {
  grid-column: 1 / -1;
}

.daily-briefing strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  line-height: 1;
}

.daily-briefing span,
.daily-briefing > p {
  color: var(--muted);
  font-size: 0.82rem;
}

.daily-briefing > p {
  margin: 0;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: 360px;
}

.control-button,
.text-button {
  min-height: 42px;
  border: 1px solid rgba(255, 218, 139, 0.52);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(180deg, #e0b95f, #9f6f25);
  color: #100d08;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 209, 0.42),
    inset 0 -1px 0 rgba(74, 43, 5, 0.34),
    0 14px 34px rgba(0, 0, 0, 0.34);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    filter 150ms ease,
    box-shadow 150ms ease;
}

.control-button {
  padding: 10px 14px;
}

.control-button:hover,
.control-button:focus {
  border-color: rgba(255, 224, 157, 0.95);
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 209, 0.48),
    inset 0 -1px 0 rgba(74, 43, 5, 0.34),
    0 18px 40px rgba(0, 0, 0, 0.44);
}

.control-button.quiet,
.text-button {
  border-color: rgba(183, 192, 181, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    rgba(14, 26, 24, 0.82);
  color: var(--text);
}

.control-button.full {
  width: 100%;
}

.mode-dock {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(214, 168, 79, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), transparent 130px),
    linear-gradient(145deg, rgba(214, 168, 79, 0.075), transparent 38%),
    rgba(4, 4, 4, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.16);
}

.mode-dock-heading,
.mode-options {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 7px;
  background: rgba(3, 3, 3, 0.5);
  color: rgba(244, 234, 210, 0.88);
  font-size: 0.88rem;
  font-weight: 800;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.mode-card {
  display: grid;
  min-height: 102px;
  align-content: space-between;
  gap: 8px;
  padding: 13px;
  border: 1px solid rgba(183, 192, 181, 0.16);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(5, 5, 5, 0.7);
  color: var(--text);
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 10px 22px rgba(0, 0, 0, 0.18);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.mode-card span {
  font-weight: 900;
}

.mode-card small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.mode-card:hover,
.mode-card:focus,
.mode-card.active {
  border-color: rgba(214, 168, 79, 0.58);
  background:
    linear-gradient(180deg, rgba(214, 168, 79, 0.12), transparent),
    rgba(8, 8, 7, 0.9);
  transform: translateY(-1px);
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(183, 192, 181, 0.16);
  border-radius: 8px;
  background: rgba(4, 8, 7, 0.44);
}

.segmented-control button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #c6d0c9;
  font-size: 0.83rem;
  font-weight: 850;
}

.segmented-control button.active,
.segmented-control button:hover,
.segmented-control button:focus {
  border-color: rgba(214, 168, 79, 0.44);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent),
    rgba(214, 168, 79, 0.12);
  color: #f5dfaa;
}

.mode-summary {
  max-width: 500px;
  padding: 11px 12px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 7px;
  background: rgba(3, 3, 3, 0.4);
  color: var(--muted);
  font-size: 0.9rem;
}

.level-shelf {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.level-shelf[hidden] {
  display: none;
}

.level-chip {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid rgba(183, 192, 181, 0.15);
  border-radius: 7px;
  background: rgba(5, 9, 8, 0.38);
  color: #dfe5dc;
  text-align: left;
}

.level-chip span,
.level-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-chip span {
  font-size: 0.78rem;
  font-weight: 850;
}

.level-chip small {
  color: #97a59e;
  font-size: 0.7rem;
}

.level-chip.active,
.level-chip:hover:not(:disabled),
.level-chip:focus:not(:disabled) {
  border-color: rgba(212, 175, 55, 0.54);
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.11), transparent),
    rgba(7, 7, 6, 0.78);
}

.level-chip.cleared {
  border-color: rgba(99, 210, 162, 0.28);
}

.mode-dock-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.14);
  color: var(--muted);
  font-size: 0.8rem;
}

.text-link-button {
  min-height: 34px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--gold-bright);
  font-weight: 850;
}

.console-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: start;
}

.game-panel,
.intel-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(214, 168, 79, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 132px),
    linear-gradient(145deg, rgba(212, 175, 55, 0.055), transparent 36%),
    var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.18);
}

.game-panel::before,
.intel-panel::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 232, 177, 0.3), transparent 18%, transparent 82%, rgba(212, 175, 55, 0.13)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%);
  opacity: 0.62;
  content: "";
}

.game-panel::after,
.intel-panel::after {
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  content: "";
}

body[data-game-result="won"] .game-panel {
  border-color: rgba(99, 210, 162, 0.48);
  box-shadow:
    0 0 0 1px rgba(99, 210, 162, 0.08),
    0 34px 96px rgba(0, 0, 0, 0.56),
    0 0 64px rgba(72, 182, 163, 0.12);
}

body[data-game-result="lost"] .game-panel {
  border-color: rgba(167, 72, 66, 0.52);
}

.game-panel {
  display: grid;
  gap: 18px;
  min-height: 620px;
  padding: clamp(16px, 3vw, 26px);
}

.intel-panel {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 22px);
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading.compact {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(183, 192, 181, 0.16);
}

.mode-pill {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(212, 175, 55, 0.56);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.11), rgba(212, 175, 55, 0.03)),
    rgba(3, 8, 7, 0.42);
  color: var(--gold-bright);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 22px rgba(0, 0, 0, 0.24);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: min(100%, 360px);
  padding: 4px;
  border: 1px solid rgba(183, 192, 181, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(3, 6, 6, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 14px 28px rgba(0, 0, 0, 0.18);
}

.mini-action {
  min-height: 34px;
  min-width: 66px;
  padding: 6px 9px;
  border: 1px solid rgba(183, 192, 181, 0.2);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    rgba(5, 9, 8, 0.72);
  color: rgba(244, 234, 210, 0.88);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 18px rgba(0, 0, 0, 0.2);
}

.mini-action:hover,
.mini-action:focus-visible {
  border-color: rgba(240, 211, 109, 0.6);
  color: var(--gold-bright);
}

.mini-action.strong {
  border-color: rgba(255, 218, 139, 0.56);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, #d8af51, #8f631e);
  color: #100d08;
}

.mini-action.strong[aria-pressed="true"] {
  border-color: rgba(140, 240, 190, 0.76);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(180deg, #5fc48b, #2c7658);
  color: #04100d;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.status-line {
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(4, 4, 4, 0.62);
  color: rgba(244, 234, 210, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -16px 32px rgba(0, 0, 0, 0.18);
}

.status-line.alert {
  border-color: rgba(167, 72, 66, 0.56);
  color: #f0c2ba;
}

.status-line.success {
  border-color: rgba(72, 182, 163, 0.7);
  color: #bdf0e4;
}

.status-line.ready {
  border-color: rgba(240, 211, 109, 0.68);
  background:
    linear-gradient(180deg, rgba(240, 211, 109, 0.12), transparent 62%),
    rgba(4, 4, 4, 0.7);
  color: #f7df9d;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 209, 0.12),
    0 0 0 1px rgba(240, 211, 109, 0.08),
    0 16px 34px rgba(0, 0, 0, 0.28);
}

.submit-guess-button {
  min-width: 76px;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 218, 139, 0.58);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 42%),
    linear-gradient(180deg, #d8af51, #8f631e);
  color: #100d08;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 209, 0.34),
    0 12px 26px rgba(0, 0, 0, 0.24);
}

.submit-guess-button:disabled {
  border-color: rgba(183, 192, 181, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(7, 12, 11, 0.56);
  color: rgba(244, 234, 210, 0.38);
  box-shadow: none;
}

body.ready-to-submit .submit-guess-button,
body.ready-to-submit .key.enter-key {
  border-color: rgba(240, 211, 109, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 38%),
    linear-gradient(180deg, #f1cf6d, #b9822d);
  color: #080604;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 209, 0.36),
    0 0 0 1px rgba(240, 211, 109, 0.1),
    0 0 24px rgba(240, 211, 109, 0.16),
    0 14px 30px rgba(0, 0, 0, 0.3);
  animation: ready-command-pulse 1100ms ease-in-out infinite alternate;
}

body.ready-to-submit .submit-guess-button:not(:disabled) {
  min-width: 98px;
}

body.ready-to-submit .keyboard {
  border-color: rgba(240, 211, 109, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 0 0 1px rgba(240, 211, 109, 0.05),
    var(--shadow-tight);
}

.run-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.run-meter div {
  min-width: 0;
  padding: 10px 9px;
  border: 1px solid rgba(183, 192, 181, 0.13);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(3, 3, 3, 0.42);
}

.run-meter strong,
.run-meter span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-meter strong {
  font-size: 1.05rem;
  line-height: 1;
}

.run-meter span {
  margin-top: 5px;
  color: #9faca5;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
  width: min(100%, 392px);
  aspect-ratio: 5 / 6;
  margin: 0 auto;
  perspective: 1100px;
  filter: drop-shadow(0 24px 34px rgba(0, 0, 0, 0.32));
}

.board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  min-width: 0;
}

.board-row.locked-row {
  opacity: 0.26;
  filter: saturate(0.35);
}

.tile {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(116, 131, 125, 0.46);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 35%),
    linear-gradient(145deg, rgba(72, 182, 163, 0.07), transparent 54%),
    var(--tile-empty);
  color: var(--text);
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -14px 26px rgba(0, 0, 0, 0.24),
    0 9px 18px rgba(0, 0, 0, 0.28);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 240ms ease;
}

.tile.filled {
  border-color: rgba(231, 224, 202, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.095), transparent 35%),
    linear-gradient(145deg, rgba(72, 182, 163, 0.08), transparent 54%),
    #18211e;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -14px 26px rgba(0, 0, 0, 0.24),
    0 10px 20px rgba(0, 0, 0, 0.28);
}

.tile.correct {
  border-color: #8cf0be;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 38%),
    linear-gradient(180deg, #5fc48b, var(--green));
  color: #07100f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(231, 255, 240, 0.36),
    inset 0 -14px 24px rgba(4, 43, 27, 0.22),
    0 12px 24px rgba(18, 85, 55, 0.28);
}

.tile.present {
  border-color: #f3ca72;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 38%),
    linear-gradient(180deg, #d6a84f, var(--amber));
  color: #100d08;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tile.absent {
  border-color: rgba(91, 105, 99, 0.54);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 36%),
    #202b28;
  color: #a5b0aa;
}

.tile.pop {
  animation: tile-pop 150ms ease;
}

.tile.reveal {
  animation: tile-reveal 440ms ease both;
}

.keyboard {
  display: grid;
  gap: 8px;
  max-width: 720px;
  margin: 4px auto 0;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(183, 192, 181, 0.11);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(4, 8, 7, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    var(--shadow-tight);
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.key {
  display: grid;
  width: min(8vw, 48px);
  min-width: 29px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(183, 192, 181, 0.24);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
    #1b2b28;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 7px 12px rgba(0, 0, 0, 0.22);
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.key.wide {
  width: min(17vw, 78px);
  min-width: 55px;
  padding: 0 8px;
}

.key:hover,
.key:focus {
  border-color: rgba(214, 168, 79, 0.64);
  background: #263833;
  transform: translateY(-1px);
}

.key.correct {
  border-color: rgba(140, 240, 190, 0.66);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 38%),
    var(--green);
  color: #06100d;
}

.key.present {
  border-color: rgba(243, 202, 114, 0.7);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 38%),
    var(--amber);
  color: #100d08;
}

.key.absent {
  background: #28332f;
  color: var(--dim);
}

.dossier-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(183, 192, 181, 0.16);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(5, 9, 8, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 12px 26px rgba(0, 0, 0, 0.18);
}

.clue-copy {
  min-height: 72px;
  margin: 0;
  color: var(--muted);
}

.legend-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.92rem;
  list-style: none;
}

.legend-list li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
}

.legend-box {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 5px;
}

.legend-box.correct {
  background: var(--green);
}

.legend-box.present {
  background: var(--amber);
}

.legend-box.absent {
  background: #28332f;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats-grid div {
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid rgba(214, 168, 79, 0.22);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(214, 168, 79, 0.065);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  font-size: 1.55rem;
  line-height: 1;
}

.stats-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.achievement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.achievement-badge,
.empty-note {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(214, 168, 79, 0.24);
  border-radius: 999px;
  background: rgba(214, 168, 79, 0.08);
  color: #edd59b;
  font-size: 0.76rem;
  font-weight: 850;
}

.empty-note {
  border-color: rgba(183, 192, 181, 0.14);
  background: transparent;
  color: #9da8a2;
}

.compact-block {
  gap: 8px;
}

.record-list {
  display: grid;
  gap: 8px;
  color: #b9c4bd;
  font-size: 0.9rem;
}

.record-list span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.record-list strong {
  color: #f1d18b;
}

.text-button {
  width: 100%;
  padding: 10px 12px;
}

.result-dialog {
  width: min(520px, calc(100% - 32px));
  overflow: hidden;
  border: 1px solid rgba(214, 168, 79, 0.52);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 150px),
    linear-gradient(145deg, rgba(212, 175, 55, 0.08), transparent 42%),
    rgba(5, 5, 5, 0.97);
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 34px 90px rgba(0, 0, 0, 0.68),
    0 0 80px rgba(72, 182, 163, 0.12);
  backdrop-filter: blur(22px) saturate(1.16);
}

.result-dialog[open] {
  animation: dialog-rise 190ms ease-out;
}

body[data-game-result="won"] .result-dialog {
  border-color: rgba(99, 210, 162, 0.56);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 34px 90px rgba(0, 0, 0, 0.68),
    0 0 92px rgba(72, 182, 163, 0.16);
}

body[data-game-result="lost"] .result-dialog {
  border-color: rgba(167, 72, 66, 0.56);
}

.result-dialog::backdrop {
  background:
    linear-gradient(180deg, rgba(1, 3, 3, 0.62), rgba(1, 3, 3, 0.84)),
    rgba(1, 3, 3, 0.72);
}

.dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(183, 192, 181, 0.28);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.result-dialog h2 {
  margin-top: 6px;
  padding-right: 36px;
  font-size: 1.7rem;
}

.result-dialog p {
  color: var(--muted);
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.result-meta span {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid rgba(214, 168, 79, 0.2);
  border-radius: 7px;
  background: rgba(214, 168, 79, 0.065);
}

.result-meta strong,
.result-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-grid {
  min-height: 34px;
  margin: 14px 0 0;
  padding: 11px 12px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font: 800 1rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  white-space: pre-wrap;
}

.result-meta strong {
  color: #f5dfaa;
  font-size: 0.92rem;
}

.result-meta small {
  margin-top: 3px;
  color: #9faca5;
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.answer-dossier {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(72, 182, 163, 0.34);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(72, 182, 163, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 34px rgba(0, 0, 0, 0.22);
}

.answer-dossier p {
  margin: 0;
}

.answer-dossier .label {
  margin-bottom: 8px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.game-drawer {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-width: 680px;
  max-height: min(76dvh, 640px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 150px),
    rgba(4, 4, 4, 0.98);
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.78),
    inset 0 0 0 1px rgba(255, 248, 220, 0.03);
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  backdrop-filter: blur(20px);
}

.game-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.drawer-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
}

.drawer-body {
  overflow-y: auto;
  padding: 18px;
  color: var(--muted);
  overscroll-behavior: contain;
}

.drawer-body h3 {
  margin: 18px 0 6px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  letter-spacing: 0;
}

.drawer-body h3:first-child {
  margin-top: 0;
}

.drawer-body p {
  margin: 0 0 10px;
}

.drawer-example {
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 5px;
  margin: 12px 0 18px;
}

.drawer-example span {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 5px;
  background: #1b1b17;
  color: var(--text);
  font-weight: 900;
}

.drawer-example .correct {
  background: var(--green);
}

.drawer-example .present {
  background: var(--amber);
  color: var(--ink);
}

.drawer-example .absent {
  background: #2c2c28;
  color: var(--dim);
}

.setting-list {
  display: grid;
  gap: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  color: var(--text);
}

.setting-row small {
  margin-top: 2px;
  color: var(--dim);
}

.setting-row input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--gold);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 29;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 max(32px, env(safe-area-inset-bottom));
  color: #9fa9a3;
  font-size: 0.86rem;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.72);
}

@keyframes tile-pop {
  50% {
    transform: scale(1.05);
  }
}

@keyframes tile-reveal {
  0% {
    transform: rotateX(0deg);
  }

  50% {
    transform: rotateX(88deg);
  }

  100% {
    transform: rotateX(0deg);
  }
}

@keyframes ready-command-pulse {
  from {
    filter: saturate(1);
  }

  to {
    filter: saturate(1.14) brightness(1.05);
    box-shadow:
      inset 0 1px 0 rgba(255, 244, 209, 0.42),
      0 0 0 1px rgba(240, 211, 109, 0.16),
      0 0 30px rgba(240, 211, 109, 0.24),
      0 16px 34px rgba(0, 0, 0, 0.34);
  }
}

@keyframes dialog-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 900px) {
  .intro-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .intro-actions {
    justify-content: flex-start;
  }

  .site-header {
    flex-wrap: wrap;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .console-layout {
    grid-template-columns: 1fr;
  }

  .mode-dock-heading,
  .mode-options {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .level-shelf {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  h1 {
    font-size: 4.15rem;
  }

  .intro-band {
    min-height: 0;
  }

  .daily-briefing {
    width: 100%;
    flex-basis: auto;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(calc(100% - 20px), 1180px);
    padding-top: 8px;
  }

  .site-header {
    flex-direction: row;
    align-items: center;
    padding:
      max(8px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      8px
      max(10px, env(safe-area-inset-left));
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .site-nav {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .intro-band {
    gap: 14px;
    padding: 17px 0 12px;
  }

  .intro-copy {
    display: none;
  }

  h1 {
    margin-top: 6px;
    font-size: 3rem;
  }

  h2 {
    font-size: 1.22rem;
  }

  .game-panel,
  .intel-panel {
    padding: 14px 10px;
  }

  .game-panel {
    gap: 12px;
    min-height: 0;
  }

  .game-panel > .panel-heading {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .mode-pill {
    width: fit-content;
    font-size: 0.7rem;
  }

  .mode-dock {
    gap: 12px;
    padding: 12px 10px;
  }

  .mode-dock-heading {
    flex-direction: row;
    align-items: center;
  }

  .mode-grid {
    display: flex;
    gap: 7px;
    margin-right: -10px;
    margin-left: -10px;
    padding: 1px 10px 7px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .mode-grid::-webkit-scrollbar {
    display: none;
  }

  .mode-card {
    min-width: 142px;
    min-height: 72px;
    flex: 0 0 142px;
    padding: 9px 10px;
    scroll-snap-align: start;
  }

  .mode-card small {
    font-size: 0.68rem;
  }

  .level-shelf {
    gap: 7px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-summary {
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  .intro-actions {
    display: grid;
    grid-template-columns: 1.1fr 1fr 0.8fr;
    width: 100%;
    max-width: none;
  }

  .intro-actions .control-button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0.78rem;
  }

  .daily-briefing {
    gap: 9px;
    padding: 13px;
  }

  .daily-briefing strong {
    font-size: 1.35rem;
  }

  .console-layout {
    display: contents;
  }

  .game-panel {
    order: 2;
  }

  .mode-dock {
    order: 3;
    margin-top: 12px;
  }

  .intel-panel {
    order: 4;
    margin-top: 12px;
  }

  .run-meter {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .run-meter div {
    padding: 8px 5px;
    text-align: center;
  }

  .run-meter span {
    font-size: 0.61rem;
  }

  .result-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .board {
    gap: 6px;
    width: min(100%, 340px);
  }

  .board-row {
    gap: 6px;
  }

  .key-row {
    gap: 3px;
  }

  .keyboard {
    position: sticky;
    bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 5;
    padding: 8px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
      rgba(4, 4, 4, 0.94);
    backdrop-filter: blur(18px);
  }

  .key {
    flex: 1 1 0;
    width: auto;
    height: 44px;
    min-width: 0;
    padding: 0 2px;
    font-size: 0.74rem;
  }

  .key.wide {
    flex-grow: 1.45;
    min-width: 0;
  }

  .game-drawer {
    right: 0;
    bottom: 0;
    left: 0;
    max-height: min(82dvh, 680px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .drawer-body {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .drawer-example {
    grid-template-columns: repeat(5, minmax(0, 42px));
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .site-header {
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 5px 10px;
  }

  .site-nav {
    display: none;
  }

  .brand small {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .intro-band {
    display: none;
  }

  .page-shell {
    padding-top: 6px;
  }

  .mode-dock {
    margin-bottom: 8px;
  }

  .game-panel {
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
    align-items: center;
  }

  .game-panel > .panel-heading,
  .run-meter,
  .status-line {
    grid-column: 1;
  }

  .board {
    grid-column: 1;
    width: min(100%, 280px);
  }

  .keyboard {
    position: static;
    grid-column: 2;
    grid-row: 1 / span 4;
  }
}

body.embed-mode,
body.fullscreen-active {
  height: var(--ww-viewport-height, 100dvh);
  min-height: var(--ww-viewport-height, 100dvh);
  overflow: hidden;
}

body.embed-mode::before,
body.fullscreen-active::before {
  filter: sepia(0.08) saturate(0.78);
  transform: none;
}

body.embed-mode::after,
body.fullscreen-active::after {
  background-size: auto, auto, 70px 70px, 70px 70px;
  opacity: 0.74;
}

body.embed-mode .page-shell,
body.fullscreen-active .page-shell {
  width: 100%;
  height: var(--ww-viewport-height, 100dvh);
  min-height: 0;
  margin: 0;
  padding:
    max(6px, env(safe-area-inset-top))
    max(6px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(6px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

body.embed-mode .intro-band,
body.embed-mode .mode-dock,
body.embed-mode .intel-panel,
body.fullscreen-active .intro-band,
body.fullscreen-active .mode-dock,
body.fullscreen-active .intel-panel {
  display: none;
}

body.embed-mode .console-layout,
body.fullscreen-active .console-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  gap: 0;
}

body.embed-mode .game-panel,
body.fullscreen-active .game-panel {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto minmax(0, auto) auto;
  align-content: center;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.7vh, 16px);
  gap: clamp(5px, 1.1vh, 12px);
  border-radius: clamp(10px, 2vw, 18px);
  backdrop-filter: none;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.44),
    inset 0 0 0 1px rgba(255, 248, 220, 0.025);
}

body.embed-mode .game-panel::before,
body.fullscreen-active .game-panel::before {
  opacity: 0.4;
}

body.embed-mode .panel-heading,
body.fullscreen-active .panel-heading {
  align-items: center;
  gap: 8px;
}

body.embed-mode .panel-heading .kicker,
body.fullscreen-active .panel-heading .kicker {
  display: none;
}

body.embed-mode .panel-heading h2,
body.fullscreen-active .panel-heading h2 {
  margin: 0;
  font-size: clamp(1rem, 2.2vh, 1.25rem);
}

body.embed-mode .panel-actions,
body.fullscreen-active .panel-actions {
  min-width: 0;
  flex-wrap: nowrap;
}

body.embed-mode .mode-pill,
body.fullscreen-active .mode-pill {
  max-width: 118px;
  overflow: hidden;
  padding: 6px 8px;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.embed-mode .mini-action,
body.fullscreen-active .mini-action {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 0.66rem;
}

body.embed-mode .run-meter,
body.fullscreen-active .run-meter {
  gap: 4px;
}

body.embed-mode .run-meter div,
body.fullscreen-active .run-meter div {
  padding: 6px 5px;
  text-align: center;
}

body.embed-mode .run-meter strong,
body.fullscreen-active .run-meter strong {
  font-size: clamp(0.86rem, 2.1vh, 1.05rem);
}

body.embed-mode .run-meter span,
body.fullscreen-active .run-meter span {
  margin-top: 3px;
  font-size: clamp(0.5rem, 1.25vh, 0.62rem);
}

body.embed-mode .status-strip,
body.fullscreen-active .status-strip {
  gap: 5px;
}

body.embed-mode .status-line,
body.fullscreen-active .status-line {
  min-height: 0;
  padding: clamp(6px, 1.25vh, 9px) 10px;
  font-size: clamp(0.76rem, 1.75vh, 0.9rem);
}

body.embed-mode .submit-guess-button,
body.fullscreen-active .submit-guess-button {
  min-width: 64px;
  min-height: 0;
  padding: 6px 9px;
  font-size: 0.7rem;
}

body.embed-mode .board,
body.fullscreen-active .board {
  grid-column: auto;
  width: min(100%, var(--ww-board-size, 340px));
  max-width: 392px;
  gap: clamp(4px, 1vh, 7px);
  filter: none;
}

body.embed-mode .board-row,
body.fullscreen-active .board-row {
  gap: clamp(4px, 1vh, 7px);
}

body.embed-mode .tile,
body.fullscreen-active .tile {
  border-radius: clamp(4px, 1.2vw, 6px);
  font-size: clamp(1.18rem, 7.2vw, 2rem);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -10px 18px rgba(0, 0, 0, 0.22);
}

body.embed-mode .tile.filled,
body.fullscreen-active .tile.filled,
body.embed-mode .tile.correct,
body.fullscreen-active .tile.correct,
body.embed-mode .tile.present,
body.fullscreen-active .tile.present {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -10px 18px rgba(0, 0, 0, 0.2);
}

body.embed-mode .keyboard,
body.fullscreen-active .keyboard {
  position: static;
  grid-column: auto;
  grid-row: auto;
  width: 100%;
  max-width: 720px;
  margin-top: 0;
  padding: clamp(4px, 1vh, 8px);
  gap: clamp(3px, 0.75vh, 6px);
  border-color: rgba(183, 192, 181, 0.08);
  background: rgba(4, 4, 4, 0.68);
  box-shadow: none;
  backdrop-filter: none;
}

body.embed-mode .key-row,
body.fullscreen-active .key-row {
  gap: clamp(2px, 0.7vw, 5px);
}

body.embed-mode .key,
body.fullscreen-active .key {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: clamp(32px, 6.2vh, 46px);
  padding: 0 2px;
  border-radius: 5px;
  font-size: clamp(0.64rem, 2.45vw, 0.88rem);
  box-shadow: none;
}

body.embed-mode .key.wide,
body.fullscreen-active .key.wide {
  flex-grow: 1.45;
  min-width: 0;
}

body.embed-mode .game-drawer,
body.fullscreen-active .game-drawer {
  backdrop-filter: none;
}

.drawer-mode-grid,
.drawer-difficulty-grid,
.drawer-level-grid {
  display: grid;
  gap: 8px;
}

.drawer-mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drawer-difficulty-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drawer-level-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drawer-option-button {
  min-height: 48px;
  padding: 10px;
  border: 1px solid rgba(183, 192, 181, 0.16);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(5, 9, 8, 0.54);
  color: var(--text);
  text-align: left;
  font-weight: 850;
}

.drawer-option-button small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.drawer-option-button.active,
.drawer-option-button:hover,
.drawer-option-button:focus-visible {
  border-color: rgba(214, 168, 79, 0.56);
  background:
    linear-gradient(180deg, rgba(214, 168, 79, 0.12), transparent),
    rgba(8, 8, 7, 0.86);
}

.drawer-option-button:disabled {
  color: var(--dim);
}

.drawer-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.drawer-section:first-child {
  margin-top: 0;
}

.drawer-mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.drawer-mini-stats span {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(214, 168, 79, 0.18);
  border-radius: 7px;
  background: rgba(214, 168, 79, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.drawer-mini-stats strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  text-transform: none;
}

@media (max-width: 430px) {
  body.embed-mode .game-panel,
  body.fullscreen-active .game-panel {
    padding: 6px;
    gap: 5px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  body.embed-mode .panel-heading,
  body.fullscreen-active .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  body.embed-mode .panel-actions,
  body.fullscreen-active .panel-actions {
    display: grid;
    grid-template-columns: minmax(58px, auto) repeat(4, minmax(0, 1fr));
  }

  body.embed-mode .mode-pill,
  body.fullscreen-active .mode-pill,
  body.embed-mode .mini-action,
  body.fullscreen-active .mini-action {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 30px;
    padding: 5px 4px;
    text-align: center;
  }

  body.embed-mode .status-line,
  body.fullscreen-active .status-line {
    padding: 5px 7px;
  }

  body.embed-mode .submit-guess-button,
  body.fullscreen-active .submit-guess-button {
    min-width: 58px;
    padding: 5px 7px;
  }

  .drawer-mode-grid,
  .drawer-difficulty-grid,
  .drawer-level-grid {
    grid-template-columns: 1fr;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  body.embed-mode .game-panel,
  body.fullscreen-active .game-panel {
    grid-template-columns: minmax(170px, 0.82fr) minmax(340px, 1.18fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    align-content: stretch;
    align-items: center;
    padding: 6px 8px;
    gap: 5px 8px;
  }

  body.embed-mode .panel-heading,
  body.fullscreen-active .panel-heading {
    grid-column: 1 / -1;
  }

  body.embed-mode .run-meter,
  body.fullscreen-active .run-meter,
  body.embed-mode .status-strip,
  body.fullscreen-active .status-strip,
  body.embed-mode .board,
  body.fullscreen-active .board {
    grid-column: 1;
  }

  body.embed-mode .keyboard,
  body.fullscreen-active .keyboard {
    grid-column: 2;
    grid-row: 2 / span 3;
    align-self: center;
    max-width: none;
  }

  body.embed-mode .tile,
  body.fullscreen-active .tile {
    font-size: clamp(1rem, 5.2vh, 1.55rem);
  }

  body.embed-mode .key,
  body.fullscreen-active .key {
    height: clamp(28px, 8.4vh, 38px);
    font-size: clamp(0.58rem, 1.8vw, 0.76rem);
  }
}
