:root {
  color-scheme: light;
  --bg: #eef2ef;
  --ink: #1d2325;
  --muted: #617074;
  --line: #b7c5c0;
  --panel: #fbfcf8;
  --water: #8fb9c5;
  --accent: #b53d2e;
  --accent-ink: #ffffff;
}

html {
  height: 100%;
  touch-action: manipulation;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #83948f;
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: #4f625d;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 18px;
  touch-action: manipulation;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0;
  margin-bottom: 10px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
}

.user-badge {
  color: var(--muted);
  font-size: 13px;
  margin-right: 4px;
}

.auth-screen,
.start-screen,
.welcome-screen {
  display: grid;
  min-height: 520px;
  place-items: center;
}

.auth-panel,
.start-actions,
.welcome-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  width: min(100%, 380px);
}

.welcome-panel {
  display: grid;
  gap: 14px;
  width: min(100%, 560px);
}

.welcome-panel h2,
.welcome-panel p {
  margin: 0;
}

.welcome-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-options {
  display: grid;
  gap: 10px;
}

.welcome-options button {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px 12px;
  text-align: left;
}

.welcome-options button span {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.82;
}

.auth-actions,
.start-actions {
  display: grid;
  gap: 10px;
}

.auth-actions {
  grid-template-columns: 1fr 1fr;
}

.message {
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
}

.bot-field {
  display: none !important;
  left: -10000px;
  position: absolute;
  top: auto;
}

.link-button {
  border: 0;
  color: var(--muted);
  min-height: 28px;
  padding: 0;
  text-align: left;
}

.link-button:hover {
  color: var(--ink);
}

.install-app-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-weight: 700;
  min-height: 32px;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome-options .install-primary {
  background: #1d5f73;
  border-color: #1d5f73;
  color: #ffffff;
}

.welcome-options .install-primary:hover {
  background: #174f60;
  border-color: #174f60;
}

.guide-link {
  color: var(--accent);
  font-weight: 700;
  line-height: 32px;
  text-underline-offset: 3px;
}

.build-version {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 0;
  text-align: center;
}

.install-dialog {
  align-items: center;
  background: rgba(16, 25, 28, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  position: fixed;
  z-index: 70;
}

.install-dialog-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 46px rgba(16, 25, 28, 0.32);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 20px;
  width: 100%;
}

.install-dialog-card h2 {
  margin: 0;
}

.install-dialog-card p {
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
}

.icon-button {
  font-size: 22px;
  min-width: 42px;
  padding: 0;
}

.game-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(29, 35, 37, 0.16);
  display: grid;
  gap: 6px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: 46px;
  width: 180px;
  z-index: 10;
}

.game-menu button {
  text-align: left;
}

.shortcut-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  max-width: 220px;
  padding: 6px 4px 0;
}

.shortcut-hint kbd {
  background: #eef1ed;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  padding: 1px 4px;
}

.game-result {
  align-items: center;
  background: rgba(16, 25, 28, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 50;
}

.game-result-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(16, 25, 28, 0.3);
  max-width: 420px;
  padding: 20px;
  width: 100%;
}

.game-result-dialog h2 {
  margin: 0 0 8px;
}

.game-result-dialog p {
  color: var(--muted);
  margin: 0 0 16px;
}

.profile-manager {
  align-items: center;
  background: rgba(16, 25, 28, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 60;
}

.profile-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 46px rgba(16, 25, 28, 0.32);
  max-height: calc(100dvh - 32px);
  max-width: 680px;
  overflow-y: auto;
  padding: 16px;
  width: 100%;
}

.profile-heading,
.profile-slot-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.profile-heading h2 {
  margin-bottom: 2px;
}

.profile-save-slots {
  display: grid;
  gap: 10px;
  margin: 14px 0 8px;
}

.profile-save-slot {
  background: #f4f7f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.profile-save-slot label {
  margin: 0;
}

.profile-slot-meta {
  color: var(--muted);
  font-size: 12px;
}

.profile-slot-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.game-result-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 440px) {
  .game-result-actions {
    grid-template-columns: 1fr;
  }
}

.game-hud {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.game-hud span {
  color: var(--muted);
  margin-left: 6px;
}

.game-hud,
.order-panel {
  touch-action: manipulation;
}

.selection-forces {
  font-size: 12px;
}

.game-layout {
  display: block;
}

.map-wrap {
  aspect-ratio: 2 / 1;
  background: #173f5f;
  border: 1px solid #6d98a4;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

#worldMap {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

.map-ocean {
  fill: #173f5f;
  pointer-events: none;
}

.map-controls {
  display: flex;
  gap: 6px;
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 5;
}

.map-controls button {
  align-items: center;
  background: rgba(251, 252, 248, 0.92);
  border-color: rgba(29, 35, 37, 0.32);
  border-radius: 999px;
  display: inline-flex;
  font-size: 20px;
  font-weight: 700;
  height: 36px;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  width: 36px;
}

.territory {
  fill-opacity: 0.9;
  pointer-events: all;
  stroke: rgba(8, 12, 14, 0.82);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill-opacity 120ms ease, filter 120ms ease, stroke-width 120ms ease;
}

@media (max-height: 520px) and (orientation: landscape) {
  body {
    overflow: hidden;
  }

  body:has(#gameScreen:not([hidden])) .topbar {
    padding: 0;
    position: fixed;
    right: max(8px, env(safe-area-inset-right));
    top: max(4px, env(safe-area-inset-top));
    z-index: 30;
  }

  body:has(#gameScreen:not([hidden])) .topbar > div:first-child,
  body:has(#gameScreen:not([hidden])) .topbar .user-badge,
  body:has(#gameScreen:not([hidden])) #logoutButton {
    display: none;
  }

  body:has(#gameScreen:not([hidden])) .topbar-actions {
    margin-top: 0;
    width: auto;
  }

  .app-shell {
    max-width: none;
    padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .topbar {
    gap: 8px;
    padding: 0 0 4px;
  }

  .topbar h1,
  #phaseSummary {
    display: none;
  }

  .topbar-actions {
    justify-content: flex-end;
    margin-top: 0;
    width: 100%;
  }

  .user-badge {
    font-size: 12px;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .icon-button,
  #logoutButton,
  .game-hud #endPhaseButton {
    min-height: 30px;
  }

  .game-hud {
    align-items: center;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    margin-bottom: 4px;
    padding: 5px 52px 5px 8px;
  }

  .game-hud #endPhaseButton {
    grid-column: auto;
    justify-self: auto;
  }

  .map-controls button {
    height: 32px;
    min-height: 32px;
    width: 32px;
  }
}

.guide-shell {
  margin: 0 auto;
  max-width: 820px;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.guide-back {
  color: var(--accent);
  display: inline-block;
  font-weight: 700;
  margin-bottom: 24px;
}

.guide-hero {
  margin-bottom: 24px;
}

.guide-hero h1 {
  font-size: clamp(32px, 7vw, 54px);
  margin: 4px 0 8px;
}

.guide-hero > p:last-child,
.guide-card p,
.guide-card li {
  color: var(--muted);
  line-height: 1.55;
}

.guide-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 14px;
  padding: 18px;
}

.guide-card h2 {
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 8px;
}

.guide-card ol,
.guide-card ul {
  margin: 0;
  padding-left: 22px;
}

.guide-card li + li {
  margin-top: 6px;
}

.territory:hover {
  fill-opacity: 1;
  filter: brightness(1.06);
}

.territory.owned {
  fill-opacity: 0.76;
  stroke: rgba(20, 24, 26, 0.72);
  stroke-width: 1.25;
}

.territory.owned:hover {
  fill-opacity: 0.9;
}

.territory.selected {
  fill-opacity: 0.94;
  stroke: #fff5ca;
  stroke-width: 3;
}

.territory-label {
  pointer-events: none;
  font-size: 52px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(18, 28, 32, 0.82);
  stroke-width: 9px;
}

.unit-label {
  pointer-events: none;
  font-size: 92px;
  font-weight: 700;
  fill: #fff5ca;
  paint-order: stroke;
  stroke: rgba(18, 28, 32, 0.9);
  stroke-width: 16px;
}

.map-detail-label {
  display: none;
}

#worldMap.map-detail .map-detail-label {
  display: block;
}

.owner-label,
.queued-label {
  pointer-events: none;
  font-size: 68px;
  font-weight: 800;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(18, 28, 32, 0.95);
  stroke-width: 14px;
}

.queued-label {
  fill: #fff5ca;
  font-size: 14px;
}

.capital-mark {
  pointer-events: none;
  fill: #fff5ca;
  stroke: #1c2426;
  stroke-width: 5;
}

.capital-tap-target {
  cursor: pointer;
  fill: transparent;
  pointer-events: all;
  stroke: none;
}

body:has(#gameScreen:not([hidden])) {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

.app-shell:has(#gameScreen:not([hidden])) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: none;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  padding-left: max(6px, env(safe-area-inset-left));
  padding-right: max(6px, env(safe-area-inset-right));
  padding-top: max(6px, env(safe-area-inset-top));
}

#gameScreen:not([hidden]),
#gameScreen:not([hidden]) .game-layout,
#gameScreen:not([hidden]) .map-wrap {
  min-height: 0;
}

#gameScreen:not([hidden]) {
  display: flex;
  flex: 1;
  flex-direction: column;
}

#gameScreen:not([hidden]) .game-layout,
#gameScreen:not([hidden]) .map-wrap {
  flex: 1;
}

#gameScreen:not([hidden]) .game-layout {
  display: flex;
}

#gameScreen:not([hidden]) .map-wrap {
  aspect-ratio: auto;
}

.order-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

input,
select {
  min-height: 36px;
  border: 1px solid #aebdb8;
  border-radius: 6px;
  padding: 0 9px;
  background: #ffffff;
  color: var(--ink);
}

.order-panel {
  align-items: end;
  bottom: 18px;
  box-shadow: 0 12px 28px rgba(29, 35, 37, 0.18);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  left: 50%;
  max-width: calc(100% - 36px);
  padding: 14px;
  position: fixed;
  transform: translateX(-50%);
  width: 760px;
  z-index: 20;
}

.order-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: 112px 112px auto;
  align-items: end;
}

.number-stepper {
  align-items: center;
  display: grid;
  grid-template-columns: 30px 44px 30px;
  gap: 4px;
}

.unit-picker {
  display: grid;
  gap: 2px;
}

.unit-slider {
  accent-color: var(--accent);
  height: 18px;
  margin: 0;
  min-height: 18px;
  padding: 0;
  width: 104px;
}

.number-stepper button {
  font-size: 18px;
  font-weight: 700;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

.number-stepper input {
  min-height: 30px;
  padding: 0 4px;
  text-align: center;
  width: 44px;
}

.number-stepper input::-webkit-inner-spin-button,
.number-stepper input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.queued-controls {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) 110px;
}

.queued-order-list {
  display: grid;
  gap: 5px;
}

.queued-order-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  font-size: 12px;
}

.queued-order-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queued-order-row button,
.queued-controls > button {
  min-height: 30px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8ece7;
  color: #293336;
  font-size: 12px;
  margin-right: 5px;
  margin-top: 5px;
}

@media (max-width: 900px) {
  .topbar,
  .game-hud {
    display: block;
  }

  .app-shell {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .topbar {
    padding: 4px 0 6px;
  }

  h1 {
    font-size: 24px;
  }

  #phaseSummary {
    font-size: 14px;
  }

  .topbar-actions {
    justify-content: flex-start;
    margin-top: 6px;
  }

  .game-hud {
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 6px;
    padding: 6px 8px;
  }

  .game-hud #endPhaseButton {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 30px;
  }

  .game-hud span {
    margin-left: 4px;
  }

  .order-panel {
    bottom: 0;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr);
    left: 0;
    max-height: 44vh;
    max-width: none;
    overflow-y: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0));
    transform: none;
    top: auto !important;
    width: 100%;
  }

  .order-panel h2 {
    font-size: 12px;
    margin-bottom: 2px;
  }

  .order-panel .message {
    font-size: 11px;
    line-height: 1.2;
    min-height: 0;
  }

  .order-controls {
    align-items: end;
    gap: 6px;
    grid-template-columns: 112px 112px 112px;
    justify-content: start;
  }

  .order-controls label {
    font-size: 11px;
    gap: 2px;
    margin-bottom: 0;
  }

  .order-controls input {
    font-size: 16px;
    min-height: 30px;
    width: 100%;
  }

  .order-panel button {
    min-height: 30px;
  }

  .order-controls > button {
    width: 112px;
  }

  .queued-controls {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .queued-order-list {
    max-height: 76px;
    overflow-y: auto;
  }

  #cancelOrderButton {
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .profile-manager {
    padding: 8px;
  }

  .profile-dialog {
    max-height: calc(100dvh - 16px);
    padding: 12px;
  }

  .profile-slot-actions button {
    flex: 1 1 40%;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .game-hud {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 5px 78px 5px 8px;
  }

  .game-hud > div:nth-child(2) {
    white-space: nowrap;
  }

  .game-hud #endPhaseButton {
    grid-column: auto;
  }

  .order-panel {
    align-items: end;
    bottom: 0;
    border-radius: 8px 8px 0 0;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(190px, 280px) auto auto;
    left: max(8px, env(safe-area-inset-left));
    max-height: none;
    max-width: none;
    height: calc(84px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
    overflow: visible;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: auto !important;
    transform: none;
    width: auto;
  }

  .order-panel h2 {
    font-size: 11px;
    margin-bottom: 0;
    white-space: nowrap;
  }

  .order-panel .message {
    display: none;
  }

  .order-controls {
    gap: 4px;
    grid-template-columns: 108px 108px 92px;
    justify-content: start;
  }

  .order-controls label {
    font-size: 10px;
    gap: 2px;
    width: 108px;
  }

  .order-controls input,
  .order-panel button {
    min-height: 26px;
  }

  .order-controls .unit-slider {
    min-height: 18px;
  }

  .order-controls input {
    font-size: 16px;
    padding: 0 6px;
    width: 100%;
  }

  .order-controls > button {
    width: 92px;
  }

  .queued-controls {
    gap: 6px;
    grid-template-columns: minmax(150px, 1fr) 82px;
  }

  .queued-order-list {
    max-height: 34px;
    overflow-y: auto;
  }

  .queued-order-row {
    gap: 4px;
    font-size: 11px;
  }

  .queued-order-row button,
  .queued-controls > button {
    min-height: 26px;
  }

  .queued-controls > button {
    width: 82px;
  }

#cancelOrderButton {
    justify-self: end;
    min-width: 72px;
  }
}

.mobile-end-phase {
  display: none;
}

body:has(#gameScreen:not([hidden])) .topbar {
  display: none;
}

.hud-money {
  margin-top: 4px;
}

.hud-money span {
  margin-left: 2px;
}

.combat-result {
  font-size: 13px;
  font-weight: 800;
  margin: 5px 0 0;
}

.combat-result.victory {
  color: #24723b;
}

.combat-result.defeat {
  color: #a52f25;
}

.map-menu-button {
  background: rgba(251, 252, 248, 0.92);
  left: 8px;
  position: absolute;
  top: 8px;
  z-index: 6;
}

.map-game-menu {
  left: 8px;
  right: auto;
  top: 54px;
  z-index: 7;
}

.order-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 900px) {
  .game-hud {
    grid-template-columns: minmax(0, 1fr);
  }

  .selection-forces {
    white-space: nowrap;
  }

  .game-hud #endPhaseButton {
    display: none;
  }

  .mobile-end-phase {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: block;
    min-height: 48px;
    position: fixed;
    right: 10px;
    z-index: 15;
  }

  .mobile-end-phase[hidden] {
    display: none;
  }

  .order-panel .target-message {
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
  }

  .order-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
  }

  .order-controls label,
  .unit-picker,
  .unit-slider {
    width: 100%;
  }

  .order-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .order-actions button {
    min-height: 44px;
    width: 100%;
  }

  #cancelOrderButton {
    justify-self: stretch;
  }
}

.hint-trigger {
  align-items: center;
  background: #fff8d8;
  border: 1px solid #9a7a20;
  border-radius: 999px;
  color: #5f4808;
  display: none;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  line-height: 1;
  min-height: 24px;
  padding: 0;
  width: 24px;
  z-index: 8;
}

.hint-mode .hint-trigger {
  display: inline-flex;
}

.control-label {
  align-items: center;
  display: flex;
  gap: 5px;
}

.hinted-control {
  display: block;
  position: relative;
}

.hinted-control > button:not(.hint-trigger) {
  width: 100%;
}

.hinted-control > .hint-trigger {
  position: absolute;
  right: -5px;
  top: -9px;
  width: 24px !important;
}

.map-help-hint {
  bottom: 8px;
  left: 8px;
  position: absolute;
}

.map-controls .hint-trigger {
  align-self: center;
  font-size: 13px;
  height: 24px;
  min-height: 24px;
  width: 24px;
}

.hint-mode .mobile-phase-hint {
  display: none;
}

.hint-dialog,
.hint-choice-dialog,
.battle-report-dialog,
.phase-dialog,
.update-dialog {
  align-items: center;
  background: rgba(16, 25, 28, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  position: fixed;
  z-index: 80;
}

.battle-report-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.battle-report-heading button {
  min-height: 30px;
  min-width: 54px;
  padding: 3px 10px;
}

.battle-report-heading button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.battle-report-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(16, 25, 28, 0.32);
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 32px);
  max-width: 480px;
  overflow-y: auto;
  padding: 20px;
  width: 100%;
}

.battle-report-card h2,
.battle-report-card p {
  margin: 0;
}

.battle-report-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battle-report-list {
  display: grid;
  gap: 8px;
}

.battle-report-list p {
  background: #f1f3ee;
  border-left: 4px solid var(--line);
  border-radius: 5px;
  line-height: 1.4;
  padding: 9px 10px;
}

.battle-report-list p.captured {
  border-left-color: #24723b;
}

.battle-report-list p.defended {
  border-left-color: #a77b18;
}

.attack-history-card {
  max-width: 620px;
}

.attack-history-list {
  max-height: 58dvh;
  overflow-y: auto;
}

.hint-choice-label {
  color: #7a5c08;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: -6px !important;
  text-transform: uppercase;
}

.hint-choice-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.hint-dialog-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(16, 25, 28, 0.32);
  display: grid;
  gap: 12px;
  max-width: 400px;
  padding: 20px;
  width: 100%;
}

.hint-dialog-card h2,
.hint-dialog-card p {
  margin: 0;
}

.hint-dialog-card > p:not(.hint-dialog-kicker) {
  color: var(--muted);
  line-height: 1.5;
}

.hint-dialog-kicker {
  color: #7a5c08;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .desktop-phase-hint {
    display: none !important;
  }

  .hint-mode .mobile-phase-hint {
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    display: inline-flex;
    position: fixed;
    right: 126px;
    z-index: 16;
  }

  body:has(#orderPanel:not([hidden])) .mobile-phase-hint {
    display: none !important;
  }

  .control-label .hint-trigger {
    height: 22px;
    min-height: 22px;
    width: 22px;
  }
}

[hidden] {
  display: none !important;
}
