@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #e8e4d7;
  --muted: #969c94;
  --canvas: #101411;
  --panel: #181d19;
  --panel-2: #202620;
  --line: #313a32;
  --brass: #c5a15a;
  --brass-dark: #806a39;
  --moss: #66785b;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(97, 118, 80, .18), transparent 35rem),
    linear-gradient(180deg, #111612, #0c100d);
  font-family: Inter, system-ui, sans-serif;
  font-size: .9rem;
}

button, a { -webkit-tap-highlight-color: transparent; }

.game-header {
  background: rgba(18, 23, 19, .94);
  border-color: var(--line) !important;
  backdrop-filter: blur(12px);
}

.brand img { object-fit: contain; filter: drop-shadow(0 3px 5px #000); }
.brand-title, h1, h2 { font-family: Cinzel, Georgia, serif; }
.brand-title { color: var(--ink); font-size: 1.1rem; letter-spacing: .035em; }
.eyebrow { color: var(--brass); font-size: .65rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.game-status { align-items: center; gap: .45rem; color: var(--muted); font-size: .75rem; }
.status-dot { width: .45rem; height: .45rem; border-radius: 50%; background: #8ba67a; box-shadow: 0 0 0 3px rgba(139,166,122,.12); }
.btn-brass { color: #18130a; background: var(--brass); border-color: var(--brass); font-weight: 700; }
.btn-brass:hover { color: #18130a; background: #d3b16d; border-color: #d3b16d; }
.editor-link { display: inline-flex; align-items: center; width: auto; padding: 0 .65rem; text-decoration: none; font-size: .68rem; }

.stat-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; background: var(--panel); }
.stat-card { min-width: 0; padding: .75rem 1rem; border-right: 1px solid var(--line); }
.stat-card:last-child { border: 0; }
.stat-card-wide { grid-column: span 1; }
.stat-label { display: block; margin-bottom: .15rem; color: var(--muted); font-size: .62rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.stat-card strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; font-size: .85rem; }
.stat-muted { color: var(--muted); font-weight: 500; }
.reference-code, kbd { color: var(--brass); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.game-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 260px; gap: .8rem; align-items: stretch; }
.card-shell { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: .65rem; background: linear-gradient(155deg, var(--panel-2), var(--panel)); box-shadow: 0 16px 45px rgba(0, 0, 0, .24); }
.side-panel, .action-panel { display: flex; flex-direction: column; }
.panel-heading, .map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.panel-heading h2, .map-toolbar h1 { margin: .12rem 0 0; font-size: 1rem; }
.level-badge { padding: .2rem .45rem; color: var(--brass); border: 1px solid var(--brass-dark); border-radius: 999px; font-size: .6rem; font-weight: 700; text-transform: uppercase; }
.character-block { padding: 1rem; text-align: center; }
.character-block > img { width: 72px; height: 86px; margin-bottom: .8rem; object-fit: contain; filter: drop-shadow(0 6px 8px #000); }
.attribute-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: .45rem; background: var(--line); text-align: left; }
.attribute-grid div { display: flex; justify-content: space-between; align-items: center; padding: .55rem .6rem; background: #1b211c; }
.attribute-grid span { color: var(--muted); font-size: .65rem; }
.attribute-grid strong { color: var(--brass); }
.panel-section { padding: 1rem; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.section-title h3 { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.section-title > span { color: var(--muted); font-size: .62rem; }
.empty-copy { margin: 0; color: var(--muted); font-size: .75rem; font-style: italic; }
.icon-button { width: 1.5rem; height: 1.5rem; color: var(--brass); border: 1px solid var(--line); border-radius: 50%; background: transparent; line-height: 1; }
.token-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.token-list span { padding: .25rem .45rem; border: 1px solid var(--line); border-radius: .25rem; color: #c5c9c1; background: #141815; font-size: .65rem; }

.map-card { display: flex; min-height: 695px; flex-direction: column; }
.map-toolbar { min-height: 67px; padding: .75rem 1rem; }
.map-actions { display: flex; align-items: center; }
.map-button, .zoom-level { height: 2rem; border: 1px solid var(--line); background: #151a16; }
.map-button { min-width: 2rem; color: var(--ink); font-weight: 700; }
.map-button:hover { color: var(--brass); background: #20271f; }
.map-button:first-child { border-radius: .35rem 0 0 .35rem; }
.zoom-level { min-width: 3.5rem; margin-left: -1px; padding: .42rem .5rem; color: var(--muted); text-align: center; font-size: .68rem; }
.map-button + .map-button, .zoom-level + .map-button { margin-left: -1px; }
.reset-button { width: auto; margin-left: .5rem !important; padding: 0 .7rem; border-radius: .35rem !important; font-size: .68rem; }
.map-viewport { position: relative; flex: 1; min-height: 620px; overflow: hidden; background: #0b0e0b; cursor: grab; touch-action: none; user-select: none; }
.map-viewport.dragging { cursor: grabbing; }
.map-stage { position: absolute; top: 0; left: 0; width: 1572px; height: 1897px; transform-origin: 0 0; will-change: transform; }
.map-stage img { display: block; width: 100%; height: 100%; pointer-events: none; }
.game-hex-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-hex-cell { fill: transparent; stroke: transparent; stroke-width: 2; vector-effect: non-scaling-stroke; }
.game-hex-cell.current { fill: rgba(197,161,90,.35); stroke: #ffe6a3; }
.game-hex-cell.neighbor { fill: rgba(106,150,92,.2); stroke: rgba(220,239,203,.9); cursor: pointer; }
.game-hex-cell.neighbor:hover { fill: rgba(197,161,90,.42); stroke: #fff; }
.game-hex-label { fill: #fffbdc; stroke: #111; stroke-width: 2px; paint-order: stroke; font: 700 13px ui-monospace, monospace; text-anchor: middle; pointer-events: none; }
.player-map-piece { pointer-events: none; }
.player-map-halo { fill: rgba(255,224,138,.25); stroke: #ffe08a; stroke-width: 2; vector-effect: non-scaling-stroke; }
.map-stage .player-map-token { position: absolute; z-index: 3; width: 78px; height: 80px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.9)); pointer-events: none; }
.map-stage .player-map-token[hidden] { display: none; }
.map-hint { position: absolute; bottom: .8rem; left: 50%; transform: translateX(-50%); padding: .4rem .75rem; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; color: #d1d4cd; background: rgba(10,13,10,.78); backdrop-filter: blur(8px); font-size: .65rem; pointer-events: none; }
.map-hint span { margin: 0 .35rem; color: var(--brass); }

.action-list { display: grid; gap: .45rem; padding: 1rem; }
.action-list button { display: grid; grid-template-columns: 1.8rem 1fr auto; align-items: center; gap: .55rem; width: 100%; padding: .6rem; color: var(--ink); border: 1px solid var(--line); border-radius: .4rem; background: #171c18; text-align: left; }
.action-list button:hover { border-color: var(--brass-dark); background: #1d241d; }
.action-list button:disabled { cursor: not-allowed; opacity: .42; }
.action-icon { display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border-radius: .3rem; color: var(--brass); background: rgba(197,161,90,.1); }
.action-list strong, .action-list small { display: block; }
.action-list strong { font-size: .72rem; }
.action-list small { margin-top: .1rem; color: var(--muted); font-size: .6rem; }
.action-list kbd { padding: 0; background: transparent; font-size: .62rem; font-weight: 400; }
.journal-section { flex: 1; }
.journal-entry { display: grid; grid-template-columns: .6rem 1fr; gap: .45rem; }
.journal-marker { width: .45rem; height: .45rem; margin-top: .2rem; border: 1px solid var(--brass); border-radius: 50%; box-shadow: 0 0 0 3px rgba(197,161,90,.1); }
.journal-entry time { color: var(--muted); font-size: .6rem; text-transform: uppercase; }
.journal-entry p { margin: .3rem 0; color: #c2c5bd; font-size: .7rem; line-height: 1.5; }
.journal-entry button, .rule-note a { padding: 0; color: var(--brass); border: 0; background: none; font-size: .65rem; text-decoration: none; }
.journal-list { display: block; }
.journal-log-item { padding: .55rem 0; border-top: 1px solid var(--line); }
.journal-log-item:first-child { padding-top: 0; border-top: 0; }
.journal-log-item time { color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.journal-log-item p { margin: .2rem 0 0; color: #c2c5bd; font-size: .67rem; line-height: 1.45; }
.rule-note { margin: .8rem; padding: .8rem; border: 1px solid var(--brass-dark); border-radius: .45rem; background: rgba(197,161,90,.06); }
.rule-note > span { color: var(--brass); font-size: .58rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.rule-note p { margin: .35rem 0 .45rem; color: #bbbdb7; font-size: .67rem; line-height: 1.45; }

.decision-options { display: grid; gap: .4rem; }
.decision-options button { padding: .55rem .65rem; color: #18130a; border: 0; border-radius: .35rem; background: var(--brass); font-size: .68rem; font-weight: 700; }

.game-dialog { width: min(92vw, 430px); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: .65rem; background: var(--panel); box-shadow: 0 25px 80px #000; }
.game-dialog::backdrop { background: rgba(5, 8, 6, .76); backdrop-filter: blur(3px); }
.game-dialog form { display: grid; gap: .8rem; padding: 1rem; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: .15rem 0 0; font-size: 1rem; }
.dialog-close { color: var(--muted); border: 0; background: none; font-size: 1.4rem; line-height: 1; }
.game-dialog label { display: grid; gap: .3rem; color: var(--muted); font-size: .65rem; font-weight: 600; text-transform: uppercase; }
.game-dialog input, .game-dialog select { width: 100%; padding: .6rem; color: var(--ink); border: 1px solid var(--line); border-radius: .35rem; background: #111612; font: .75rem Inter, sans-serif; text-transform: none; }
.game-dialog .check-label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .55rem; }
.game-dialog .check-label input { width: auto; }
.dialog-note { margin: 0; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.resolution-dialog { width: min(92vw, 620px); }
.resolution-content { display: grid; gap: .9rem; padding: 1rem; }
.resolution-summary { display: grid; gap: .45rem; }
.resolution-summary p { margin: 0; padding: .55rem .65rem; color: #d3d6ce; border-left: 3px solid var(--brass-dark); background: rgba(255,255,255,.025); font-size: .72rem; line-height: 1.5; }
.resolution-summary .resolution-wait { color: var(--muted); border-left-color: var(--muted); }
.resolution-event-text { max-height: 300px; margin: 0; padding: .8rem; overflow: auto; color: #cfd2ca; border: 1px solid var(--line); border-radius: .4rem; background: #101411; white-space: pre-wrap; font: .7rem/1.6 Inter, sans-serif; }

@media (max-width: 1199.98px) {
  .game-grid { grid-template-columns: 1fr 1fr; }
  .map-card { grid-column: 1 / -1; min-height: 620px; }
  .map-viewport { min-height: 545px; }
}

@media (max-width: 767.98px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-card { border-bottom: 1px solid var(--line); }
  .stat-card:nth-child(2n) { border-right: 0; }
  .stat-card:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .game-grid { grid-template-columns: 1fr; }
  .map-card, .side-panel, .action-panel { grid-column: auto; }
  .map-card { min-height: 555px; }
  .map-viewport { min-height: 480px; }
  .map-hint { white-space: nowrap; }
}
