/* Final visual pass for the live game shell. Keeps the current components and game rules. */
:root {
  --td-forest-950: #1f3026;
  --td-forest-800: #304b37;
  --td-forest-700: #426346;
  --td-brass: #c49a53;
  --td-paper: #fbf7eb;
  --td-paper-shadow: #eee5d0;
  --td-ink: #302d24;
  --td-muted: #706957;
  --td-border: #c9bb98;
}

.play-shell {
  color: var(--td-ink);
  background: #a6b08b;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.play-topbar {
  flex: 0 0 auto;
  min-height: 58px;
  height: auto;
  background: linear-gradient(180deg, #493a27, #30271d);
  border-bottom: 1px solid #8d7041;
  box-shadow: 0 3px 12px #1d241b55;
}

.game-brand-mark {
  border: 1px solid #d3b36d;
  background: linear-gradient(145deg, #b68a43, #75562c);
  box-shadow: inset 0 1px #f4dda0, 0 2px 5px #17150f66;
}

.player-context { color: #e0d2b1; font-size: 12px; }
.player-context b { color: #fff7e4; font-size: 13px; }

.global-village-switcher { position: relative; z-index: 60; flex: 0 1 auto; min-width: 170px; max-width: 340px; }
.global-village-switcher > summary { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; min-height: 35px; padding: 4px 9px; border: 1px solid #b8a477; border-radius: 6px; background: linear-gradient(#fffdf6,#eee3ca); color: #625638; list-style: none; cursor: pointer; }
.global-village-switcher > summary::-webkit-details-marker { display: none; }
.global-village-switcher > summary > span { color: #70634a; font-size: 10px; }
.global-village-switcher > summary > b { overflow: hidden; color: #302d24; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.global-village-switcher > summary > i { color: #526c43; font-size: 15px; font-style: normal; }
.global-village-switcher[open] > summary { border-color: #6f8053; box-shadow: 0 0 0 2px #6f805322; }
.global-village-menu { position: absolute; z-index: 70; top: calc(100% + 8px); left: 0; width: min(340px, calc(100vw - 24px)); max-height: min(60vh, 520px); overflow: auto; padding: 10px; border: 1px solid #a99462; border-radius: 8px; background: #f8f1df; box-shadow: 0 12px 30px #1d261c55; }
.global-village-menu > label { display: block; margin: 0 0 5px; color: #655b44; font-size: 12px; }
.global-village-menu > input { box-sizing: border-box; width: 100%; min-height: 36px; margin-bottom: 7px; padding: 6px 9px; border: 1px solid #c5b58d; border-radius: 5px; background: #fffdf7; color: #302d24; font: inherit; }
.global-village-menu .village-switcher-options { display: grid; gap: 3px; max-height: 42vh; overflow: auto; }
.global-village-menu .village-switcher-options button { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; padding: 6px 9px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #302d24; text-align: left; cursor: pointer; }
.global-village-menu .village-switcher-options button:hover,.global-village-menu .village-switcher-options button.active { border-color: #b8a477; background: #e8e6cf; }
.global-village-menu .village-switcher-options button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-village-menu .village-switcher-options button > small { flex: none; color: #706957; font-size: 11px; }
.topbar-button { min-height: 36px; border-radius: 6px; font-size: 12px; }
.topbar-button:hover { border-color: #d1b16e; background: #7a5c34; }

.resource-bar {
  gap: 8px;
  padding: 8px clamp(10px, 1.4vw, 20px);
  background: linear-gradient(180deg, #e8dcc0, #d8c9a6);
  border-bottom: 1px solid #a79062;
  box-shadow: 0 3px 8px #37311f24;
}

.resource-item {
  min-height: 52px;
  padding: 6px 10px;
  border: 1px solid #c8b78e;
  border-radius: 8px;
  background: linear-gradient(145deg, #fffdf5, #f1e8d5);
  box-shadow: inset 0 1px #fff;
}

.resource-item img { width: 34px; height: 34px; }
.resource-copy span { color: #685d47; font-size: 12px; }
.resource-copy strong { color: #2e3528; font-size: 17px; }
.resource-rate { color: #547044; font-size: 11px; }
.unit-roster { min-height: 52px; }

.play-container {
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  background: radial-gradient(ellipse at 50% 35%, #d8dfbd 0%, #b5c29a 58%, #8d9d75 100%);
}

.play-main-area {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}
.workspace-village-toolbar {
  position: relative;
  z-index: 30;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid #8e986e;
  border-radius: 9px;
  background: linear-gradient(110deg, #eff1df, #e1e6cf);
  box-shadow: inset 0 1px #ffffffb5, 0 2px 6px #36432b1a;
}
.workspace-village-caption {
  flex: none;
  color: #5c6e4d;
  font: 750 10px/1.2 system-ui, sans-serif;
  letter-spacing: .08em;
}
.workspace-village-toolbar .village-switcher { margin: 0; min-width: 0; }
.workspace-village-toolbar .village-switcher > summary {
  display: flex;
  max-width: min(520px, 65vw);
  justify-content: space-between;
  gap: 14px;
  min-height: 32px;
  border-color: #b4a477;
  background: linear-gradient(#fffdf6, #f1e8d5);
}
.workspace-village-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-village-toolbar .village-switcher > summary > b {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: #536a42;
  font-size: 11px;
}
.workspace-village-toolbar .village-switcher > summary > b > span {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 12px;
  background: #526c43;
  color: white;
  font-size: 11px;
}
.game-view { height: auto; }
.game-view.active { flex: 1 1 auto; min-height: 0; }
.game-view-content { flex: 1 1 auto; min-height: 0; }

.world-view-content { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }
.world-map-panel {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.world-map-panel > .pc.map-panel-content { flex: 1 1 auto; width: 100%; height: auto; min-width: 0; min-height: 0; overflow: hidden; }
.world-map-frame { position: relative; display: flex; flex: 1 1 auto; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.world-map-viewport { position: relative; flex: 1 1 auto; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.world-map-viewport canvas { width: 100%; height: 100%; }
.world-view-content.has-tile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); }
.world-view-content.has-tile > .world-map-panel { min-width: 0; min-height: 0; }
.world-view-content.has-tile > .tile-context-panel { min-width: 0; min-height: 0; overflow: auto; }

.game-side-nav {
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid #4d583b;
  border-radius: 10px;
  background: linear-gradient(180deg, #40563b, #273c30);
  box-shadow: 0 5px 14px #29332240, inset 0 1px #ffffff20;
}

.game-side-nav-label { color: #d8c89d; font-size: 10px; }
.game-side-nav > button {
  min-height: 54px;
  border-radius: 7px;
  color: #f5eedc;
  font: 600 12px/1.2 system-ui, sans-serif;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.game-side-nav > button i { color: #e4c77f; font-size: 23px; }
.game-side-nav > button:hover { transform: translateY(-1px); background: #ffffff12; }
.game-side-nav > button.active {
  border-color: #e1c57c99;
  background: linear-gradient(145deg, #78633a, #5c4c30);
  box-shadow: inset 3px 0 #edcf83, 0 2px 5px #17261d55;
  color: #fff9e9;
}

.game-view-heading {
  min-height: 54px;
  padding: 3px 7px 10px;
  border-bottom: 1px solid #62764b66;
}
.game-view-heading small {
  color: #4b6343;
  font: 700 11px/1.25 system-ui, sans-serif;
  letter-spacing: .1em;
  text-shadow: none;
}
.game-view-heading h1 {
  color: #29392b;
  font: 600 25px/1.15 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px #ffffff80;
}
.game-view-heading > span {
  padding: 6px 10px;
  border: 1px solid #a99a72;
  border-radius: 7px;
  background: #f8f2e4;
  color: #4c4432;
  font: 650 12px system-ui, sans-serif;
}

.game-view .panel,
.hex-board-panel,
.building-detail-panel,
.alliance-view-content {
  border: 1px solid var(--td-border);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--td-paper), var(--td-paper-shadow));
  box-shadow: 0 4px 14px #34412d24, inset 0 1px #ffffffb0;
}
.game-view .panel .ph {
  min-height: 42px;
  padding: 8px 13px;
  border-bottom: 1px solid #d6c9aa;
  color: #3b4936;
  font-size: 13px;
}
.game-view .panel .pc { color: var(--td-ink); }

.village-switcher > summary,
.map-legend > summary,
.context-rail-toggle {
  min-height: 38px;
  border-color: #a38d5d;
  border-radius: 7px;
  background: linear-gradient(#fffaf0, #e9ddc2);
  box-shadow: 0 2px 6px #3b35231c;
  color: #3d432e;
  font-size: 13px;
}
.village-switcher > summary:hover,
.map-legend > summary:hover,
.context-rail-toggle:hover { border-color: #687b4e; background: #fffdf4; }

.hex-board-panel { padding: 14px; }
.hex-board-panel { background: radial-gradient(ellipse at center, #fbf8e9 0%, #eee8d5 76%, #e6dec8 100%); }
.hex-slot { transition: filter .14s ease, transform .14s ease; }
.hex-slot:hover { filter: brightness(1.07) drop-shadow(0 3px 4px #34412d55); }
.hex-slot.selected { filter: drop-shadow(0 0 5px #b68c3f) drop-shadow(0 2px 3px #34412d55); }
.building-detail-panel { gap: 12px; padding: 15px; }
.building-detail-heading { border-color: #d7c9a8; }
.building-detail-heading h3 { color: #334332; }
.quote-resources .resource-cost { border-radius: 7px; }
.building-action,
.unit-train-button,
.server-save-button {
  border-radius: 7px;
  background: linear-gradient(180deg, #668451, #45623f);
  box-shadow: 0 2px 5px #293b2c33, inset 0 1px #ffffff33;
  color: #fff9e9;
  font-weight: 700;
}
.building-action:hover,
.unit-train-button:hover,
.server-save-button:hover { filter: brightness(1.08); }

.unit-type-option,
.unit-queue-slot,
.unit-stat-card {
  border-color: #d0c19c;
  border-radius: 9px;
  background: linear-gradient(145deg, #fffdf5, #f0e7d4);
  box-shadow: 0 2px 7px #4b43251a;
}
.unit-type-option { min-height: 76px; }
.unit-type-option.selected {
  border-color: #627e4e;
  background: linear-gradient(145deg, #f5f7e9, #dce7cf);
  box-shadow: inset 0 0 0 1px #718b58, 0 3px 9px #344c2a30;
}
.unit-card-name { font-size: 14px; }
.unit-card-state { font-size: 12px; }
.unit-stat-card > small { font-size: 11px; }
.unit-stat-card > b { font-size: 14px; }
.unit-queue-slot { min-height: 86px; }

.global-event-strip .village-event {
  min-height: 30px;
  border-radius: 7px;
  box-shadow: 0 2px 5px #574a2c16;
}
.attack-event { border-color: #c88674; background: #f8e6dc; color: #772e27; }
.game-context-rail[open] {
  border-color: #9b875d;
  border-radius: 10px;
  background: #f5edda;
  box-shadow: 0 12px 28px #20281d55;
}
.context-block { border-radius: 8px; }

@media (max-width: 1250px) and (min-width: 901px) {
  .game-side-nav > button { min-height: 46px; }
  .game-side-nav > button span { display: block; font-size: 11px; }
}
@media (max-width: 900px) {
  .play-container { gap: 9px; padding: 9px; }
  .game-side-nav { background: linear-gradient(180deg, #40563b, #273c30); }
  .game-view-heading h1 { font-size: 22px; }
}
@media (max-width: 680px) {
  .play-topbar { gap: 7px; padding: 7px; }
  .resource-item { min-height: 46px; }
  .game-view-heading { min-height: 48px; }
  .game-view-heading h1 { font-size: 20px; }
  .global-village-switcher { min-width: 0; max-width: min(58vw, 340px); flex: 1 1 0; }
  .global-village-switcher > summary { max-width: 100%; }
  .world-view-content.has-tile { display: flex; flex-direction: column; }
  .world-view-content.has-tile > .world-map-panel { flex: 1 1 auto; min-height: 52dvh; }
  .world-view-content.has-tile > .tile-context-panel { flex: 0 0 auto; max-height: 42dvh; }
}

/* Game workspace palette and hierarchy. */
.play-shell { background: #dce8d0; }
.play-topbar { background: linear-gradient(100deg,#604329,#84603a 58%,#69492f); border-color:#b9955b; }
.resource-bar { background: linear-gradient(180deg,#f8f1df,#e9dec3); }
.resource-item { position:relative; border-color:#e2d2ae; box-shadow:0 2px 7px #6d56371c,inset 0 1px #fff; }
.resource-wood { background:linear-gradient(115deg,#f3faea,#fffaf0); border-left:4px solid #74a35c; }
.resource-clay { background:linear-gradient(115deg,#fff2dd,#fffaf0); border-left:4px solid #c68d4e; }
.resource-iron { background:linear-gradient(115deg,#edf3fa,#fffaf0); border-left:4px solid #7892a6; }
.resource-crop { background:linear-gradient(115deg,#fff7d7,#fffaf0); border-left:4px solid #d2af49; }
.play-container { background:radial-gradient(ellipse at 45% 35%,#eef3df,#d6e5c8 60%,#b7d0ab); }
.game-side-nav { background:linear-gradient(180deg,#f7f1dd,#e7dfc8); border-color:#d0c19b; box-shadow:0 4px 14px #52643c24; }
.game-side-nav-label { color:#75633d; }
.game-side-nav > button,.game-nav-dialog .leaderboard-trigger { color:#455740; }
.game-side-nav > button i { color:#668a50; }
.game-side-nav > button:hover,.game-nav-dialog .leaderboard-trigger:hover { background:#dce9d0; color:#304b37; }
.game-side-nav > button.active { color:#fff; background:linear-gradient(145deg,#6d985f,#497b55); border-color:#729761; box-shadow:inset 3px 0 #f3d489,0 2px 6px #496a3d44; }
.game-side-nav > button.active i { color:#fff0be; }
.game-view-heading { border-color:#a8c19b; }
.game-view-heading h1 { color:#304e39; }
.game-view .panel,.hex-board-panel,.building-detail-panel,.alliance-view-content { border-color:#d7c8a7; background:linear-gradient(145deg,#fffdf6,#f4ecd8); box-shadow:0 4px 16px #53694720; }
.hex-board-panel { background:radial-gradient(ellipse at center,#f9f9e8,#e5efd7 75%,#d4e4c8); }
.building-action,.unit-train-button,.server-save-button { background:linear-gradient(#79a862,#4f8651); }
.unit-type-option:hover { border-color:#85a773; background:#f0f7e9; }
.unit-type-option.selected { background:linear-gradient(145deg,#f4fbea,#d7edcf); border-color:#78a36b; }
.play-shell :focus-visible { outline:3px solid #d49a36; outline-offset:2px; }
@media (max-width: 900px) { .game-side-nav { background:linear-gradient(180deg,#f7f1dd,#e7dfc8); } }
