/* The game surface is intentionally quieter than the printed map. Stone,
   bronze and charcoal frame the table; nation colour is reserved for meaning. */
:root {
  color: #eee6d5;
  --bg: #171814;
  --panel: #27271f;
  --panel-soft: #1f211c;
  --border: #625b49;
  --muted: #b8ae99;
  --subtle: #8f8777;
  --accent: #c4934d;
  --accent-strong: #deb66e;
  --accent-ink: #241b10;
  --cyan: #8fb5ad;
  --danger: #cf776d;
  --success: #8cad79;
  --shadow: 0 1rem 2.6rem rgb(0 0 0 / 32%);
}

body {
  background:
    radial-gradient(circle at 52% -20%, rgb(104 88 56 / 24%), transparent 38rem),
    repeating-linear-gradient(115deg, rgb(255 255 255 / 1.2%) 0 1px, transparent 1px 7px),
    #171814;
  color: #eee6d5;
}

button, input, textarea, select {
  border-color: #625b49;
  border-radius: .28rem;
  background: linear-gradient(#343329, #282920);
  color: #eee6d5;
}

button {
  box-shadow: inset 0 1px rgb(255 255 255 / 5%), 0 1px 2px rgb(0 0 0 / 28%);
}

button:hover { border-color: #a58d61; background: linear-gradient(#403d30, #2c2c23); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline-color: color-mix(in srgb, var(--nation-color, #c4934d) 70%, white); }

h1, h2, h3, .panel-label, .section-kicker {
  font-family: Georgia, "Times New Roman", serif;
}

.panel, .lobby-card {
  border-radius: .36rem;
  border-color: #625b49;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 2.5%), transparent 22%),
    repeating-linear-gradient(27deg, transparent 0 9px, rgb(255 255 255 / 1%) 9px 10px),
    linear-gradient(150deg, rgb(47 46 36 / 97%), rgb(29 31 26 / 97%));
  box-shadow: inset 0 0 0 1px rgb(218 188 128 / 7%), var(--shadow);
}

.primary-button {
  border-color: #e0b568;
  background: linear-gradient(#dab169, #b77f39);
  color: #241b10;
  text-shadow: 0 1px rgb(255 255 255 / 22%);
}

.primary-button:hover { background: linear-gradient(#e8c985, #c38b43); }
.secondary-button { background: linear-gradient(#39372c, #292a22); }

.status-pill, .revision-pill, .meta-chip, .resource-chip {
  border-radius: .24rem;
  border-color: rgb(173 151 108 / 35%);
  background: rgb(33 34 29 / 84%);
}

.resource-chip {
  border-left: 2px solid var(--nation-color, #c4934d);
  color: #bfb49e;
}

.resource-chip strong { color: #e3c382; }

body:has(.game-shell:not([hidden])) .hud-ribbon {
  border-bottom: 1px solid #70664e;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--nation-color, #7d7058) 12%, transparent), transparent 35%),
    repeating-linear-gradient(112deg, rgb(255 255 255 / 1%) 0 1px, transparent 1px 8px),
    linear-gradient(#24251f, #1b1d19);
  box-shadow: 0 .45rem 1.2rem rgb(0 0 0 / 32%);
}

body:has(.game-shell:not([hidden])) .hud-ribbon h2 { color: #f2e9d5; letter-spacing: .025em; }
body:has(.game-shell:not([hidden])) .hud-ribbon > div:first-child { border-left: 3px solid var(--nation-color, #c4934d); padding-left: .65rem; }

body:has(.game-shell:not([hidden])) .map-panel { background: #171814; }
body:has(.game-shell:not([hidden])) .task-window .action-panel,
body:has(.game-shell:not([hidden])) .dashboard-grid > section,
body:has(.game-shell:not([hidden])) .task-window .decision-panel,
body:has(.game-shell:not([hidden])) .task-window .hand-panel {
  border-color: rgb(174 151 107 / 48%);
  border-top: 2px solid color-mix(in srgb, var(--nation-color, #c4934d) 65%, #c4934d);
  background:
    repeating-linear-gradient(24deg, transparent 0 8px, rgb(255 255 255 / 1%) 8px 9px),
    linear-gradient(145deg, rgb(44 44 35 / 96%), rgb(27 29 24 / 95%));
}

body:has(.game-shell:not([hidden])) .map-board .map-summary,
body:has(.game-shell:not([hidden])) .map-board .map-toolbar {
  border-color: rgb(174 151 107 / 44%);
  border-radius: .3rem;
  background: rgb(29 30 25 / 86%);
}

.map-toolbar { align-items: stretch; }
.map-social-tools { display: flex; gap: .2rem; padding-right: .3rem; border-right: 1px solid rgb(174 151 107 / 30%); }
.map-social-tool[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--nation-color, #c4934d) 72%, #d9c59e);
  background: color-mix(in srgb, var(--nation-color, #c4934d) 26%, #272820);
  box-shadow: inset 0 -2px var(--nation-color, #c4934d);
  color: #fff8e8;
}
.map-social-clear { color: #cfc3aa; }
.map-scroll[data-map-tool="draw"] { cursor: crosshair; }
.map-scroll[data-map-tool="erase"] { cursor: cell; }
.map-scroll[data-map-tool="ping"] { cursor: pointer; }

.pregame-host-guide {
  display: grid;
  gap: .45rem;
  margin: .8rem 0;
  padding: .75rem;
  border: 1px solid rgb(240 179 91 / 48%);
  border-radius: .45rem;
  background: rgb(240 179 91 / 7%);
}

.pregame-host-guide > strong { color: #f3d08b; }
.pregame-host-guide p { margin: 0; line-height: 1.45; }
.pregame-invite-note { color: #e8d4ad; }
.pregame-copy-row { display: grid; gap: .25rem; }
.pregame-copy-row > label { color: var(--subtle); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.pregame-copy-controls { display: flex; gap: .4rem; align-items: stretch; }
.pregame-copy-controls input { min-width: 0; flex: 1; font-family: ui-monospace, monospace; font-size: .76rem; }
.pregame-copy-controls button { flex: 0 0 auto; min-height: 2.25rem; padding: .35rem .6rem; font-size: .74rem; }

.pregame-tabs {
  display: flex;
  gap: .35rem;
  margin: 1rem 0 0;
  border-bottom: 1px solid rgb(174 151 107 / 32%);
}

.lobby-card:has([data-pregame-setup]) {
  width: min(100%, 58rem);
  max-width: 58rem;
}

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

.pregame-tab {
  min-height: 2.6rem;
  padding: .55rem .85rem;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: .45rem .45rem 0 0;
  background: transparent;
  color: #cfc3aa;
  font-weight: 800;
}

.pregame-tab:hover { background: rgb(240 179 91 / 9%); color: #fff8e8; }
.pregame-tab.is-active { border-bottom-color: var(--accent-strong); background: rgb(240 179 91 / 13%); color: #fff8e8; }
.pregame-grid { margin-top: 1rem; }
.pregame-state { margin-top: 1rem; padding: clamp(1rem, 2.5vw, 1.5rem); }
.pregame-state > strong { display: block; font-size: 1.25rem; }
.pregame-seat-card {
  display: grid;
  gap: .7rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgb(95 211 213 / 58%);
  border-radius: .65rem;
  background: linear-gradient(145deg, rgb(20 57 62 / 44%), rgb(10 30 37 / 48%));
  box-shadow: inset 0 0 0 1px rgb(95 211 213 / 8%);
}
.pregame-seat-card h3 { margin: 0; color: #efffff; font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; }
.pregame-seat-card p { margin: 0; }
.pregame-seat-card form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; align-items: end; }
.pregame-seat-card form button { grid-column: 1 / -1; }

@media (max-width: 52rem) {
  .pregame-seat-card form { grid-template-columns: 1fr; }
}

.map-player-drawing {
  fill: none;
  stroke: var(--drawing-color, #c4934d);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .9;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 70%));
  pointer-events: none;
}

.map-player-drawing.is-preview { opacity: .62; stroke-dasharray: 3 2; }
svg[data-map-tool="erase"] .map-player-drawing.is-own { pointer-events: stroke; }

.map-player-ping circle {
  fill: none;
  stroke: var(--ping-color, #c4934d);
  stroke-width: 10;
  transform-origin: center;
  animation: map-ping 1.8s ease-out forwards;
  pointer-events: none;
}
.map-player-ping circle + circle { animation-delay: .2s; }

@keyframes map-ping {
  0% { opacity: 0; transform: scale(.45); stroke-width: 14; }
  18% { opacity: 1; }
  100% { opacity: 0; transform: scale(2.6); stroke-width: 3; }
}

.hand-list {
  display: flex;
  align-items: flex-end;
  gap: 0;
  min-height: 8.5rem;
  overflow-x: auto;
  padding: .7rem .75rem 1rem;
}

.hand-list li {
  display: grid;
  flex: 0 0 6.3rem;
  align-content: space-between;
  min-height: 8rem;
  margin-left: -1.1rem;
  padding: .65rem .55rem;
  border: 1px solid #a28757;
  border-radius: .42rem;
  background:
    linear-gradient(155deg, rgb(255 255 255 / 16%), transparent 24%),
    repeating-linear-gradient(35deg, transparent 0 7px, rgb(87 63 31 / 5%) 7px 8px),
    #ddd0ad;
  box-shadow: 0 .35rem .8rem rgb(0 0 0 / 35%);
  color: #2b2419;
  transform: rotate(-1deg);
  transition: transform .14s ease, margin .14s ease, box-shadow .14s ease;
}

.hand-list li:first-child { margin-left: 0; }
.hand-list li:nth-child(even) { transform: rotate(1deg); }
.hand-list li:hover { z-index: 2; margin-right: .35rem; transform: translateY(-.35rem) rotate(0); box-shadow: 0 .65rem 1.2rem rgb(0 0 0 / 42%); }
.hand-list strong { color: #2b2419; font-family: Georgia, "Times New Roman", serif; font-size: .82rem; }
.hand-list span { color: #65543a; font-size: .65rem; text-align: left; }

.trade-card-list { grid-template-columns: repeat(auto-fill, minmax(7.3rem, 1fr)); gap: .65rem; align-items: start; }
.trade-card {
  min-height: 10.4rem;
  aspect-ratio: 5 / 7;
  border-color: #9d8355;
  border-radius: .45rem;
  background:
    linear-gradient(155deg, rgb(255 255 255 / 14%), transparent 25%),
    repeating-linear-gradient(31deg, transparent 0 8px, rgb(87 63 31 / 5%) 8px 9px),
    #d7c8a2;
  color: #2b2419;
  box-shadow: 0 .35rem .8rem rgb(0 0 0 / 32%);
  transition: transform .14s ease, box-shadow .14s ease;
}
.trade-card strong { color: #2b2419; font-family: Georgia, "Times New Roman", serif; font-size: .9rem; }
.trade-card span { color: #65543a; }
.trade-card:hover { transform: translateY(-.2rem); }
.trade-card.is-offered { border-color: var(--nation-color, #b77f39); background: #e4d5ad; box-shadow: 0 .75rem 1.3rem rgb(0 0 0 / 42%), inset 0 0 0 3px color-mix(in srgb, var(--nation-color, #b77f39) 70%, transparent); transform: translateY(-.35rem); }

.notification-card, .area-inspector, .map-action-popover, .urgent-alert, .conflict-summary, .trade-session-panel {
  border-radius: .35rem;
  border-color: rgb(174 151 107 / 58%);
  background:
    repeating-linear-gradient(28deg, transparent 0 9px, rgb(255 255 255 / 1%) 9px 10px),
    linear-gradient(145deg, rgb(47 46 36 / 97%), rgb(25 28 23 / 97%));
}

.conflict-summary:not([hidden]), .urgent-alert:not([hidden]) { animation: tablet-arrive .18s ease-out both; }
@keyframes tablet-arrive { from { opacity: 0; transform: translate(-50%, calc(-50% + .5rem)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 52rem) {
  .map-social-tools { max-width: 58vw; overflow-x: auto; }
  .map-social-tool { flex: 0 0 auto; }
  .hand-list li { flex-basis: 5.8rem; }
}
