:root {
  color-scheme: dark;
  --ink: #ffffff;
  --soft-ink: rgba(255, 255, 255, 0.74);
  --glass: rgba(4, 5, 7, 0.58);
  --glass-strong: rgba(3, 4, 6, 0.82);
  --blue: #101fba;
  --blue-light: #2c4cff;
  --gold: #f4c54f;
  --line: rgba(255, 255, 255, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: #020303;
  font-family: "Trebuchet MS", Arial, sans-serif;
  overflow: hidden;
}

button,
canvas {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #050706;
}

.top-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: center;
  gap: clamp(22px, 8vw, 96px);
  padding: 24px 18px 42px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.28) 58%, transparent);
}

.hud-box {
  min-width: 86px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.hud-box span {
  display: block;
  margin-bottom: 2px;
  color: #ffffff;
  font-size: clamp(0.9rem, 1.8vw, 1.18rem);
  font-weight: 800;
  letter-spacing: 0;
}

.hud-box strong {
  display: block;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1;
}

.hud-box:nth-child(2) strong::before {
  content: "★";
  display: inline-block;
  margin-right: 5px;
  color: var(--gold);
  font-size: 0.72em;
  text-shadow: 0 0 8px rgba(244, 197, 79, 0.85);
  vertical-align: 8%;
}

.board-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #050706;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

.command-deck {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.78fr) minmax(210px, 0.76fr) minmax(220px, 0.82fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px 16px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.48) 64%, transparent);
}

.panel,
.objective-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(6px);
}

.selected-panel {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 10px 14px 10px 72px;
  border-radius: 0 8px 8px 0;
  background:
    linear-gradient(90deg, rgba(14, 30, 184, 0.82), rgba(14, 30, 184, 0.36) 58%, rgba(0, 0, 0, 0.48)),
    var(--glass);
}

.selected-panel::before {
  content: "";
  position: absolute;
  left: 14px;
  bottom: 9px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.22), transparent 45%),
    url("human_lancer_idle.png") center bottom / auto 54px no-repeat;
  filter: drop-shadow(0 0 8px rgba(40, 255, 206, 0.72));
}

.panel h2,
.objective-panel h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.selected-panel h2 {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.panel p,
.objective-panel p {
  margin: 0;
  color: var(--soft-ink);
  line-height: 1.22;
}

#selectedInfo {
  grid-column: 1 / -1;
  color: #ffffff;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#cityInfo,
#unitInfo {
  font-size: 0.88rem;
}

.city-status-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 2px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  line-height: 1.18;
}

.city-status-panel:empty {
  display: none;
}

.city-status-panel strong {
  color: #ffffff;
}

.status-pill {
  display: inline-block;
  min-width: 52px;
  margin-left: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #061006;
  background: #72e06a;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.status-idle {
  background: #f4c54f;
}

.status-working {
  background: #7db7ff;
}

.status-threat {
  background: #ff5448;
  color: #250202;
}

.recommendation {
  color: #ffffff;
  font-weight: 800;
}

.objective-panel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  min-height: 76px;
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 21, 43, 0.78), rgba(0, 0, 0, 0.58));
}

.objective-panel img {
  width: 42px;
  height: 42px;
  align-self: center;
  object-fit: contain;
}

#objectiveText {
  margin-top: 2px;
  font-size: 0.9rem;
}

#objectiveList {
  display: none;
}

.production-panel {
  min-height: 76px;
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(24, 31, 33, 0.78), rgba(0, 0, 0, 0.58));
}

.attention-panel {
  min-height: 76px;
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 24, 18, 0.82), rgba(0, 0, 0, 0.58));
}

.attention-panel h2::after {
  content: "!";
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-left: 7px;
  place-items: center;
  border-radius: 50%;
  color: #201400;
  background: var(--gold);
  font-size: 0.74rem;
  line-height: 1;
  vertical-align: 1px;
}

.needs-attention-list {
  display: grid;
  gap: 6px;
  max-height: 156px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.structure-attention-detail {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  border: 1px solid rgba(244, 197, 79, 0.48);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.34);
}

.structure-attention-detail[hidden] {
  display: none;
}

.structure-attention-detail p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  line-height: 1.24;
}

.structure-attention-detail strong {
  color: #ffffff;
}

.attention-item {
  display: grid;
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-left: 4px solid #f4c54f;
  border-radius: 8px;
  padding: 6px 9px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.36);
  cursor: pointer;
  text-align: left;
}

.attention-item:disabled {
  cursor: default;
  opacity: 0.72;
}

.attention-item strong,
.attention-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-item strong {
  font-size: 0.82rem;
}

.attention-item span,
.attention-empty {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.76rem;
}

.attention-enemy-nearby {
  border-left-color: #ff5448;
}

.attention-unit-ready,
.attention-harvest {
  border-left-color: #72e06a;
}

.attention-research-choice,
.attention-research-complete {
  border-left-color: #7db7ff;
}

.attention-production-complete {
  border-left-color: #ffffff;
}

.attention-item:hover,
.attention-item:focus-visible {
  outline: 2px solid rgba(73, 238, 255, 0.7);
  outline-offset: 2px;
}

.production-panel p {
  font-size: 0.84rem;
}

.train-actions,
.research-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.research-status {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #e7e0c8;
}

.train-choice,
#harvestButton,
#helpButton,
#helpDialog button {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  padding: 4px 9px;
  color: #ffffff;
  background: rgba(16, 31, 186, 0.68);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
}

.train-choice:disabled,
#harvestButton:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.train-choice:not(:disabled):hover,
.train-choice:not(:disabled):focus-visible,
#harvestButton:not(:disabled):hover,
#harvestButton:not(:disabled):focus-visible,
#helpButton:hover,
#helpButton:focus-visible,
#helpDialog button:hover,
#helpDialog button:focus-visible {
  outline: 2px solid rgba(73, 238, 255, 0.7);
  outline-offset: 2px;
}

.action-panel {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

#endTurnButton,
#newGameButton,
#clearSaveButton {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.45);
}

#endTurnButton {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%),
    #ffffff;
}

#newGameButton {
  background: radial-gradient(circle at 50% 42%, #45515c 0 34%, #151a1f 35% 100%);
}

#clearSaveButton {
  background: radial-gradient(circle at 50% 42%, #6d4233 0 34%, #1f1210 35% 100%);
}

#endTurnButton:disabled,
#newGameButton:disabled,
#clearSaveButton:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#endTurnButton span,
#newGameButton span,
#clearSaveButton span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#newGameButton span,
#clearSaveButton span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0;
}

#endTurnButton:hover,
#endTurnButton:focus-visible,
#newGameButton:not(:disabled):hover,
#newGameButton:not(:disabled):focus-visible,
#clearSaveButton:not(:disabled):hover,
#clearSaveButton:not(:disabled):focus-visible {
  outline: 3px solid rgba(73, 238, 255, 0.72);
  outline-offset: 3px;
}

#messageLog {
  grid-column: 1 / -1;
  align-self: end;
  max-width: 420px;
  max-height: 2.8em;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 2px 8px #000;
}

#messageLog li {
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#messageLog li + li {
  display: none;
}

.fatal {
  display: grid;
  min-height: 100vh;
  place-content: center;
  padding: 24px;
  text-align: center;
}

@media (max-width: 820px) {
  .top-hud {
    gap: clamp(12px, 5vw, 34px);
    padding-top: 18px;
  }

  .hud-box {
    min-width: 72px;
  }

  .command-deck {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 10px 12px;
  }

  .objective-panel {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 58px;
    padding: 8px 10px;
  }

  .selected-panel {
    grid-column: 1;
    grid-row: 2;
    min-height: 70px;
    padding-left: 64px;
  }

  .selected-panel::before {
    left: 10px;
    width: 44px;
    height: 44px;
  }

  .production-panel {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 64px;
    padding: 8px 10px;
  }

  .attention-panel {
    grid-column: 1 / -1;
    grid-row: 4;
    min-height: 64px;
    padding: 8px 10px;
  }

  .needs-attention-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 104px;
  }

  .action-panel {
    grid-column: 2;
    grid-row: 2;
  }

  #endTurnButton,
  #newGameButton,
  #clearSaveButton {
    width: 64px;
    height: 64px;
  }

  #cityInfo,
  #unitInfo,
  .city-status-panel,
  .production-panel p,
  #objectiveText {
    font-size: 0.78rem;
  }

  #messageLog {
    display: none;
  }
}

@media (max-width: 520px) {
  .top-hud {
    justify-content: space-between;
  }

  .hud-box span {
    font-size: 0.78rem;
  }

  .hud-box strong {
    font-size: 1.7rem;
  }

  .objective-panel {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .objective-panel img {
    width: 34px;
    height: 34px;
  }

  .selected-panel h2,
  #cityInfo,
  #unitInfo,
  #resourceInfo {
    display: none;
  }

  .needs-attention-list {
    grid-template-columns: 1fr;
  }
}

#helpDialog {
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--glass-strong);
}

#helpDialog::backdrop {
  background: rgba(0, 0, 0, 0.64);
}

#helpDialog form {
  display: grid;
  gap: 10px;
}

#helpDialog p {
  margin: 0;
  color: var(--soft-ink);
}

/* Mobile-first shell redesign. This layer intentionally preserves the
   existing JS-facing IDs while moving their presentation into drawers. */
:root {
  --panel-bg: rgba(17, 22, 20, 0.9);
  --panel-bg-strong: rgba(12, 15, 14, 0.96);
  --panel-edge: rgba(238, 222, 166, 0.42);
  --cream: #f7efd5;
  --muted: rgba(247, 239, 213, 0.72);
  --red: #b83c35;
  --green: #5f9b52;
  --cyan: #75d8e7;
}

.compat-value,
.compat-line[aria-hidden="true"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 26%, rgba(90, 128, 91, 0.26), transparent 42%),
    linear-gradient(180deg, #17211d 0%, #07100e 58%, #030605 100%);
}

.top-hud {
  z-index: 7;
  grid-template-columns: repeat(3, minmax(74px, max-content));
  gap: clamp(8px, 3vw, 28px);
  align-items: start;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 10px 54px;
  background: linear-gradient(180deg, rgba(5, 8, 7, 0.92), rgba(5, 8, 7, 0.52) 64%, transparent);
}

.hud-box {
  min-width: 74px;
  border: 1px solid rgba(247, 239, 213, 0.28);
  border-radius: 8px;
  padding: 7px 10px 8px;
  background:
    linear-gradient(180deg, rgba(69, 87, 63, 0.74), rgba(13, 18, 16, 0.74)),
    rgba(0, 0, 0, 0.34);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  text-shadow: none;
}

.hud-box span {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hud-box strong {
  color: var(--cream);
  font-size: clamp(1.05rem, 3.5vw, 1.48rem);
  font-weight: 900;
}

.hud-box:nth-child(2) strong::before {
  content: none;
}

.board-frame {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 20%, transparent 78%, rgba(0, 0, 0, 0.36)),
    #07100e;
}

.quick-info-panel {
  position: absolute;
  left: clamp(10px, 3vw, 18px);
  right: clamp(10px, 3vw, 18px);
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 5;
  max-width: 520px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--cream);
  background:
    linear-gradient(90deg, rgba(81, 111, 64, 0.74), rgba(15, 20, 17, 0.9)),
    var(--panel-bg);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.panel-kicker {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-info-panel p {
  margin: 0;
}

.quick-info-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.quick-info-body {
  min-width: 0;
}

#selectedInfo {
  color: #ffffff;
  font-size: clamp(0.95rem, 2.8vw, 1.16rem);
  font-weight: 900;
  white-space: normal;
}

#cityInfo,
#unitInfo,
#resourceInfo {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.context-action-button {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 1px solid rgba(247, 239, 213, 0.38);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(95, 155, 82, 0.9), rgba(37, 66, 43, 0.94));
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
}

.context-action-button[hidden] {
  display: none;
}

.context-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.objective-ribbon {
  position: absolute;
  top: calc(86px + env(safe-area-inset-top));
  left: clamp(10px, 3vw, 18px);
  z-index: 4;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  gap: 9px;
  width: min(430px, calc(100vw - 20px));
  border: 1px solid rgba(238, 222, 166, 0.34);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--cream);
  background: rgba(10, 15, 14, 0.78);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(5px);
}

.objective-ribbon img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.objective-ribbon h2,
.overlay-panel h2,
.dialog-card h2 {
  margin: 0;
  color: var(--cream);
  font-size: 0.98rem;
  line-height: 1.1;
}

#objectiveText {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.panel-stack {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.overlay-panel {
  position: absolute;
  left: clamp(10px, 3vw, 18px);
  right: clamp(10px, 3vw, 18px);
  bottom: calc(78px + env(safe-area-inset-bottom));
  max-height: min(58vh, 430px);
  max-width: 560px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(49, 63, 48, 0.92), rgba(10, 13, 12, 0.96)),
    var(--panel-bg-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.overlay-panel[hidden] {
  display: none;
}

.panel-header {
  position: sticky;
  top: -12px;
  z-index: 2;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin: -12px -12px 10px;
  padding: 12px 12px 8px;
  background:
    linear-gradient(180deg, rgba(49, 63, 48, 0.98), rgba(31, 41, 32, 0.96)),
    var(--panel-bg-strong);
  border-bottom: 1px solid rgba(247, 239, 213, 0.12);
}

.panel-close {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(247, 239, 213, 0.32);
  border-radius: 50%;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.32);
  cursor: pointer;
  font-weight: 900;
}

.surface-close {
  align-self: start;
}

.objective-ribbon[hidden],
.quick-info-panel[hidden],
.help-coach[hidden] {
  display: none;
}

.overlay-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.25;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.command-choice,
.text-command,
.dialog-card button {
  min-height: 42px;
  border: 1px solid rgba(247, 239, 213, 0.38);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(95, 155, 82, 0.88), rgba(37, 66, 43, 0.92));
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
}

.command-choice:disabled,
.text-command:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.utility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.text-command {
  min-height: 36px;
  background: rgba(0, 0, 0, 0.28);
}

.research-status {
  margin-top: 0;
  color: var(--cream);
  font-size: 0.86rem;
}

#objectiveList {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

#objectiveList:empty::before {
  content: "The current objective is shown on the map ribbon.";
  color: var(--muted);
}

.needs-attention-list,
#messageLog {
  display: grid;
  gap: 7px;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  list-style: none;
}

#messageLog li,
.attention-empty {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
  white-space: normal;
}

#messageLog li + li {
  display: list-item;
}

.attention-item {
  min-height: 48px;
  border-color: rgba(247, 239, 213, 0.3);
  border-left-width: 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.bottom-command-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(5, 8, 7, 0.96), rgba(5, 8, 7, 0.74) 72%, transparent);
}

.round-command {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 58px;
  place-items: center;
  border: 1px solid rgba(247, 239, 213, 0.34);
  border-radius: 8px;
  padding: 5px 3px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(70, 88, 65, 0.92), rgba(17, 23, 20, 0.96));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.36);
  cursor: pointer;
  font-weight: 900;
}

.round-command span:first-child {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #172016;
  background: var(--cream);
  font-size: 0.86rem;
  line-height: 1;
}

.round-command span:last-child {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1;
  text-transform: uppercase;
}

.primary-command {
  border-color: rgba(255, 224, 107, 0.86);
  background:
    linear-gradient(180deg, rgba(191, 69, 55, 0.96), rgba(94, 23, 20, 0.98));
}

.primary-command span:first-child {
  color: #3a0805;
  background: var(--gold);
}

#endTurnButton,
#newGameButton,
#clearSaveButton {
  width: auto;
  height: auto;
  border-radius: 8px;
  text-transform: none;
}

#endTurnButton span,
#newGameButton span,
#clearSaveButton span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.round-command:hover,
.round-command:focus-visible,
.command-choice:not(:disabled):hover,
.command-choice:not(:disabled):focus-visible,
.text-command:not(:disabled):hover,
.text-command:not(:disabled):focus-visible,
.panel-close:hover,
.panel-close:focus-visible,
.dialog-card button:hover,
.dialog-card button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

#helpDialog,
#introDialog,
#profileDialog,
#resourceDialog {
  width: min(520px, calc(100vw - 26px));
  border-color: var(--panel-edge);
  border-radius: 8px;
  padding: 0;
  color: var(--cream);
  background: var(--panel-bg-strong);
}

#helpDialog::backdrop,
#introDialog::backdrop,
#profileDialog::backdrop,
#resourceDialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.dialog-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.dialog-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.32;
}

.intro-card {
  gap: 12px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.profile-save-list {
  display: grid;
  gap: 7px;
  max-height: min(32vh, 260px);
  overflow: auto;
}

.profile-save-list button {
  min-height: 42px;
  text-align: left;
}

.profile-save-list strong,
.profile-save-list span {
  display: block;
}

.profile-save-list span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-name-field,
.routine-select-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-name-field input,
.routine-select-field select {
  min-height: 42px;
  border: 1px solid rgba(247, 239, 213, 0.34);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.34);
  font: inherit;
}

.profile-status {
  min-height: 1.2em;
  color: var(--gold);
}

.outcome-card {
  width: min(92vw, 560px);
}

.outcome-kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.outcome-stats div {
  min-height: 74px;
  border: 1px solid rgba(247, 239, 213, 0.24);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.28);
}

.outcome-stats dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.outcome-stats dd {
  margin: 6px 0 0;
  color: var(--cream);
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1;
}

.help-coach-marker {
  position: absolute;
  z-index: 11;
  width: 96px;
  height: 54px;
  transform: translate(-50%, -100%);
  animation: help-marker-bounce 900ms ease-in-out infinite;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  filter:
    drop-shadow(0 0 7px rgba(255, 236, 136, 0.95))
    drop-shadow(0 8px 9px rgba(0, 0, 0, 0.7));
}

.help-coach-marker[hidden] {
  display: none;
}

.help-coach-marker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes help-marker-bounce {
  0%, 100% {
    transform: translate(-50%, -100%);
  }

  50% {
    transform: translate(-50%, calc(-100% - 8px));
  }
}

.help-coach {
  position: absolute;
  left: clamp(10px, 3vw, 18px);
  right: clamp(10px, 3vw, 18px);
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  max-width: 560px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 12px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(49, 63, 48, 0.92), rgba(10, 13, 12, 0.96)),
    var(--panel-bg-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.help-coach[hidden] {
  display: none;
}

.help-coach-icon {
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: 4px;
}

.help-coach-icon img {
  width: 52px;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 0 6px rgba(255, 236, 136, 0.82));
}

.help-coach h2 {
  margin: 0 0 5px;
  color: var(--cream);
  font-size: 1rem;
  line-height: 1.1;
}

.help-coach p {
  margin: 0;
  max-width: 440px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.25;
}

.help-coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.help-coach-actions button {
  min-height: 38px;
  border: 1px solid rgba(247, 239, 213, 0.38);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(95, 155, 82, 0.88), rgba(37, 66, 43, 0.92));
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
}

.help-coach-actions button:last-child {
  background: rgba(0, 0, 0, 0.28);
}

.city-status-panel {
  margin-top: 6px;
  font-size: 0.76rem;
}

@media (min-width: 760px) {
  .quick-info-panel {
    right: auto;
    bottom: calc(94px + env(safe-area-inset-bottom));
    width: 420px;
  }

  .overlay-panel {
    right: auto;
    bottom: calc(94px + env(safe-area-inset-bottom));
    width: 430px;
  }

  .objective-ribbon {
    top: calc(96px + env(safe-area-inset-top));
  }

  .bottom-command-bar {
    left: 50%;
    right: auto;
    width: min(720px, calc(100vw - 24px));
    transform: translateX(-50%);
    border: 1px solid rgba(247, 239, 213, 0.18);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    padding-inline: 10px;
  }

  .help-coach {
    left: auto;
    right: clamp(10px, 3vw, 18px);
    width: min(600px, calc(100vw - 470px));
    max-width: none;
    transform: none;
  }
}

@media (max-width: 520px) {
  .top-hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-inline: 8px;
  }

  .hud-box {
    min-width: 0;
    padding-inline: 6px;
  }

  .objective-ribbon {
    top: calc(72px + env(safe-area-inset-top));
  }

  .quick-info-panel {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .quick-info-panel #cityInfo,
  .quick-info-panel #unitInfo,
  .quick-info-panel #resourceInfo {
    display: none;
  }

  .bottom-command-bar {
    gap: 4px;
    padding-inline: 5px;
  }

  .round-command {
    min-height: 54px;
  }

  .round-command span:first-child {
    width: 22px;
    height: 22px;
  }

  .round-command span:last-child {
    font-size: 0.56rem;
  }

  .help-coach {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    padding: 14px;
  }

  .help-coach-icon img {
    width: 48px;
  }

  .help-coach-actions {
    gap: 7px;
    margin-top: 12px;
  }

  .help-coach-actions button {
    flex: 1 1 120px;
    min-height: 38px;
  }
}

.watch-shell .top-hud {
  grid-template-columns: repeat(4, minmax(70px, max-content));
}

.playable-shell .bottom-command-bar {
  grid-template-columns: repeat(7, minmax(58px, 1fr));
}

.playable-shell .more-command {
  display: none;
}

.playable-shell .bottom-command-bar #endTurnButton,
.playable-shell .bottom-command-bar #saveGameButton,
.playable-shell .bottom-command-bar #newGameButton,
.playable-shell .bottom-command-bar #clearSaveButton {
  display: grid;
  width: auto;
  height: auto;
  border: 1px solid rgba(247, 239, 213, 0.34);
  border-radius: 8px;
  padding: 5px 3px;
  background:
    linear-gradient(180deg, rgba(70, 88, 65, 0.92), rgba(17, 23, 20, 0.96));
}

.playable-shell .bottom-command-bar #endTurnButton {
  border-color: rgba(255, 224, 107, 0.86);
  background:
    linear-gradient(180deg, rgba(191, 69, 55, 0.96), rgba(94, 23, 20, 0.98));
}

@media (max-width: 760px) {
  .playable-shell .top-hud {
    top: calc(8px + env(safe-area-inset-top));
    grid-template-columns: repeat(3, max-content);
    gap: 20px;
    padding: 0 10px;
    background: none;
  }

  .playable-shell .hud-box {
    min-width: 0;
    padding: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.92);
  }

  .playable-shell .hud-box span {
    margin: 0;
    font-size: 0.7rem;
  }

  .playable-shell .hud-box strong {
    font-size: 1.35rem;
    font-weight: 700;
  }

  .playable-shell .objective-ribbon {
    display: none;
  }

  .playable-shell .quick-info-panel {
    left: 8px;
    right: 8px;
    bottom: calc(166px + env(safe-area-inset-bottom));
    max-width: none;
    border-color: rgba(247, 239, 213, 0.18);
    padding: 7px 9px;
    background: rgba(0, 0, 0, 0.62);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  }

  .playable-shell .quick-info-panel .panel-kicker,
  .playable-shell .quick-info-panel #cityInfo,
  .playable-shell .quick-info-panel #unitInfo,
  .playable-shell .quick-info-panel #resourceInfo,
  .playable-shell .quick-info-panel .city-status-panel {
    display: none;
  }

  .playable-shell:has(.overlay-panel:not([hidden])) .quick-info-panel,
  .playable-shell:has(.help-coach:not([hidden])) .quick-info-panel {
    display: none;
  }

  .playable-shell #selectedInfo {
    font-size: 0.82rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .playable-shell .context-action-button {
    min-height: 32px;
    margin-top: 6px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }

  .playable-shell .overlay-panel {
    left: 8px;
    right: 8px;
    bottom: calc(164px + env(safe-area-inset-bottom));
    max-width: none;
    max-height: min(38vh, 300px);
    padding: 10px;
    background: rgba(8, 12, 10, 0.9);
  }

  .playable-shell .overlay-panel h2 {
    font-size: 1rem;
  }

  .playable-shell .overlay-panel p,
  .playable-shell .research-status,
  .playable-shell #objectiveList,
  .playable-shell #messageLog li,
  .playable-shell .attention-empty {
    font-size: 0.78rem;
  }

  .playable-shell .action-grid {
    gap: 7px;
    margin-top: 9px;
  }

  .playable-shell .command-choice {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 0.78rem;
  }

  .playable-shell .bottom-command-bar {
    left: 50%;
    right: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: min(520px, calc(100vw - 28px));
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid rgba(247, 239, 213, 0.18);
    border-radius: 14px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.68);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
    transform: translateX(-50%);
  }

  .playable-shell .more-command {
    display: grid;
  }

  .playable-shell .bottom-command-bar #newGameButton,
  .playable-shell .bottom-command-bar #saveGameButton,
  .playable-shell .bottom-command-bar #clearSaveButton,
  .playable-shell .bottom-command-bar #helpButton {
    display: none;
  }

  .playable-shell .bottom-command-bar.is-more-open #newGameButton,
  .playable-shell .bottom-command-bar.is-more-open #saveGameButton,
  .playable-shell .bottom-command-bar.is-more-open #clearSaveButton,
  .playable-shell .bottom-command-bar.is-more-open #helpButton {
    display: grid;
  }

  .playable-shell .round-command,
  .playable-shell .bottom-command-bar #endTurnButton {
    min-height: 58px;
    border: 0;
    border-radius: 0;
    padding: 3px 2px;
    background: transparent;
    box-shadow: none;
  }

  .playable-shell .round-command span:first-child {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    color: #ffffff;
    background: rgba(8, 8, 8, 0.72);
    font-size: 1rem;
  }

  .playable-shell .round-command span:last-child {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.58rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  }

  .playable-shell .primary-command span:first-child {
    color: #ffffff;
    background: #0d82d8;
  }

  .playable-shell .help-coach {
    left: 8px;
    right: 8px;
    bottom: calc(164px + env(safe-area-inset-bottom));
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    width: auto;
    max-width: none;
    padding: 13px;
    transform: none;
  }

  .playable-shell:has(.overlay-panel:not([hidden])) .help-coach {
    display: none;
  }

  .playable-shell .help-coach-icon img {
    width: 44px;
  }

  .playable-shell .help-coach h2 {
    margin-bottom: 5px;
    font-size: 1.25rem;
  }

  .playable-shell .help-coach p {
    font-size: 0.92rem;
  }

  .playable-shell .help-coach-actions {
    gap: 7px;
    margin-top: 10px;
  }

  .playable-shell .help-coach-actions button {
    flex: 1 1 110px;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 0.82rem;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .playable-shell .top-hud {
    top: calc(6px + env(safe-area-inset-top));
    grid-template-columns: repeat(3, max-content);
    gap: 22px;
    padding: 0 10px;
    background: none;
  }

  .playable-shell .hud-box {
    min-width: 0;
    padding: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
  }

  .playable-shell .hud-box span {
    margin: 0;
    font-size: 0.64rem;
  }

  .playable-shell .hud-box strong {
    font-size: 1.18rem;
    font-weight: 800;
  }

  .playable-shell .objective-ribbon {
    display: none;
  }

  .playable-shell .quick-info-panel {
    left: 8px;
    right: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: min(360px, 44vw);
    border-color: rgba(247, 239, 213, 0.16);
    padding: 7px 9px;
    background: rgba(0, 0, 0, 0.58);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  }

  .playable-shell:has(.overlay-panel:not([hidden])) .quick-info-panel,
  .playable-shell:has(.help-coach:not([hidden])) .quick-info-panel {
    display: none;
  }

  .playable-shell .quick-info-panel .panel-kicker,
  .playable-shell .quick-info-panel #cityInfo,
  .playable-shell .quick-info-panel #unitInfo,
  .playable-shell .quick-info-panel #resourceInfo,
  .playable-shell .quick-info-panel .city-status-panel {
    display: none;
  }

  .playable-shell #selectedInfo {
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .playable-shell .overlay-panel {
    left: 8px;
    right: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: min(520px, 52vw);
    max-height: 44vh;
    padding: 10px;
    background: rgba(8, 12, 10, 0.9);
  }

  .playable-shell .overlay-panel h2 {
    font-size: 1rem;
  }

  .playable-shell .overlay-panel p,
  .playable-shell .research-status,
  .playable-shell #objectiveList,
  .playable-shell .attention-empty {
    font-size: 0.76rem;
  }

  .playable-shell .command-choice {
    min-height: 36px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .playable-shell .bottom-command-bar {
    left: 50%;
    right: auto;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: min(520px, 72vw);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    border: 1px solid rgba(247, 239, 213, 0.18);
    border-radius: 14px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.68);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
    transform: translateX(-50%);
  }

  .playable-shell .more-command {
    display: grid;
  }

  .playable-shell .bottom-command-bar #newGameButton,
  .playable-shell .bottom-command-bar #saveGameButton,
  .playable-shell .bottom-command-bar #clearSaveButton,
  .playable-shell .bottom-command-bar #helpButton {
    display: none;
  }

  .playable-shell .bottom-command-bar.is-more-open #newGameButton,
  .playable-shell .bottom-command-bar.is-more-open #saveGameButton,
  .playable-shell .bottom-command-bar.is-more-open #clearSaveButton,
  .playable-shell .bottom-command-bar.is-more-open #helpButton {
    display: grid;
  }

  .playable-shell .round-command,
  .playable-shell .bottom-command-bar #endTurnButton {
    min-height: 54px;
    border: 0;
    border-radius: 0;
    padding: 3px 2px;
    background: transparent;
    box-shadow: none;
  }

  .playable-shell .round-command span:first-child {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    color: #ffffff;
    background: rgba(8, 8, 8, 0.72);
    font-size: 0.95rem;
  }

  .playable-shell .round-command span:last-child {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.54rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  }

  .playable-shell .primary-command span:first-child {
    color: #ffffff;
    background: #0d82d8;
  }

  .playable-shell .help-coach {
    left: auto;
    right: 8px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px;
    width: min(430px, 42vw);
    max-width: none;
    padding: 12px;
    transform: none;
  }

  .playable-shell:has(.overlay-panel:not([hidden])) .help-coach {
    display: none;
  }

  .playable-shell .help-coach-icon img {
    width: 40px;
  }

  .playable-shell .help-coach h2 {
    margin-bottom: 5px;
    font-size: 1.15rem;
  }

  .playable-shell .help-coach p {
    font-size: 0.84rem;
  }

  .playable-shell .help-coach-actions {
    gap: 7px;
    margin-top: 9px;
  }

  .playable-shell .help-coach-actions button {
    flex: 1 1 100px;
    min-height: 34px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }
}

.help-coach-marker {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.help-coach-marker:focus-visible {
  outline: 3px solid rgba(244, 197, 79, 0.86);
  outline-offset: 4px;
}

.playable-shell .help-coach {
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  bottom: auto;
  top: 50%;
  z-index: 12;
  position: absolute;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 18px;
  width: min(800px, calc(100vw - 48px));
  max-width: none;
  margin: 0 auto;
  border: 0;
  border-radius: 24px;
  padding: 24px 28px 22px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.95);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.66);
  transform: translateY(-50%);
}

.playable-shell .help-coach > .surface-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.playable-shell .help-coach[hidden] {
  display: none;
}

.playable-shell .help-coach-icon {
  align-content: start;
  padding-top: 42px;
}

.playable-shell .help-coach-icon img {
  width: 70px;
  filter: drop-shadow(0 0 8px rgba(78, 148, 218, 0.72));
}

.playable-shell .help-coach h2 {
  margin: 0 0 14px;
  color: #ffffff;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1;
}

.playable-shell .help-coach p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 400;
  line-height: 1.08;
}

.playable-shell .help-coach-actions {
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.playable-shell .help-coach-actions button {
  flex: 0 0 auto;
  min-width: 96px;
  min-height: 60px;
  border: 0;
  border-radius: 14px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.92);
  background: #2f87d7;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 300;
}

.playable-shell .help-coach-actions #helpCoachHideButton {
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .playable-shell .help-coach {
    right: 12px;
    left: 12px;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 12px;
    width: auto;
    border-radius: 20px;
    padding: 18px 18px 16px;
  }

  .playable-shell .help-coach-icon {
    padding-top: 38px;
  }

  .playable-shell .help-coach-icon img {
    width: 48px;
  }

  .playable-shell .help-coach-actions {
    margin-top: 18px;
  }

  .playable-shell .help-coach-actions button {
    min-height: 50px;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .playable-shell .help-coach {
    right: 10px;
    left: 10px;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    width: auto;
    border-radius: 18px;
    padding: 14px 16px;
  }

  .playable-shell .help-coach-icon {
    padding-top: 30px;
  }

  .playable-shell .help-coach-icon img {
    width: 42px;
  }

  .playable-shell .help-coach h2 {
    margin-bottom: 8px;
  }

  .playable-shell .help-coach-actions {
    margin-top: 12px;
  }

  .playable-shell .help-coach-actions button {
    min-height: 42px;
  }
}

.watch-shell .score-box {
  min-width: 92px;
}

.watch-shell .score-leading {
  border-color: rgba(244, 197, 79, 0.78);
  box-shadow:
    0 0 0 1px rgba(244, 197, 79, 0.24) inset,
    0 8px 22px rgba(244, 197, 79, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.watch-shell .score-leading strong {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(244, 197, 79, 0.72);
}

.watch-ribbon h1 {
  margin: 0;
  color: var(--cream);
  font-size: 0.98rem;
  line-height: 1.1;
}

.watch-log {
  position: absolute;
  left: clamp(10px, 3vw, 18px);
  right: clamp(10px, 3vw, 18px);
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 6;
  max-width: min(620px, calc(100vw - 20px));
  max-height: min(32vh, 260px);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--cream);
  background:
    linear-gradient(180deg, rgba(49, 63, 48, 0.9), rgba(10, 13, 12, 0.95)),
    var(--panel-bg-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.watch-log-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.watch-log-header .panel-kicker {
  margin: 0;
}

.watch-log-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#pauseWatchButton,
#downloadLogButton {
  border: 1px solid rgba(247, 239, 213, 0.34);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--cream);
  background: rgba(5, 8, 7, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

#pauseWatchButton[aria-pressed="true"] {
  border-color: rgba(244, 197, 79, 0.78);
  color: #ffffff;
  background: rgba(70, 47, 12, 0.82);
}

#pauseWatchButton:disabled {
  opacity: 0.58;
  cursor: default;
}

#pauseWatchButton:hover:not(:disabled),
#downloadLogButton:hover {
  border-color: rgba(244, 197, 79, 0.78);
  color: #ffffff;
}

.watch-log #messageLog {
  display: grid;
  gap: 5px;
  max-height: calc(min(32vh, 260px) - 44px);
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.watch-log #messageLog li {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: normal;
}

.watch-log #messageLog li:first-child {
  color: #ffffff;
  font-weight: 900;
}

@media (min-width: 760px) {
  .watch-log {
    width: 520px;
    right: auto;
  }
}

@media (max-width: 560px) {
  .watch-shell .top-hud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .watch-shell .hud-box {
    min-width: 0;
  }
}
