:root {
  color-scheme: dark;
  --bg: #0c1310;
  --panel: #17221c;
  --line: #34473b;
  --green: #d0dfad;
  --muted: #b3bdae;
  --amber: #eab578;
  --paper: #f3eddb;
}

body {
  min-width: 0;
  min-height: 100vh;
  background: #0f1914;
  color: var(--paper);
  font-size: 1rem;
}

body > header {
  position: relative;
  min-height: 62px;
  height: auto;
  padding: 13px max(4vw, 18px);
  background: #0e1713;
  border-color: #77917c30;
  gap: 18px;
  flex-wrap: wrap;
}

.brand { gap: 13px; letter-spacing: .14em; font-size: 1.05rem; }
.brand small { color: var(--amber); font-size: .7rem; letter-spacing: .16em; }
.brand .crest {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border: 1px solid #eab57877;
  border-radius: 13px;
  background: linear-gradient(145deg, #483728, #28231c);
  color: var(--amber);
  box-shadow: inset 0 0 0 3px #eab57813;
  font: 700 1.65rem/1 serif;
}

body > header .nav { color: var(--muted); gap: 11px; font-size: .75rem; letter-spacing: .08em; }
body > header #clock { color: var(--paper); font-variant-numeric: tabular-nums; }
body > header .quiet { border-radius: 8px; font-size: .86rem; }

body > main {
  width: 100%;
  max-width: 1640px;
  margin-inline: auto;
  padding: 14px clamp(12px, 2vw, 28px) 24px;
}

.account-stories {
  margin: 0;
  max-width: none;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #18261e;
  color: var(--paper);
}
.account-stories summary {
  padding: 12px 16px;
  color: var(--paper);
  cursor: pointer;
  font-size: .85rem;
}
.account-stories .stories-intro, .account-stories .stories-slots, .account-stories .stories-status {
  margin-inline: 16px;
}
.account-stories .stories-slots { grid-template-columns: 1fr; margin-bottom: 12px; }
.account-stories .stories-status:empty { display: none; }
.account-stories .eyebrow, .account-stories p { color: #bacbbd; }
.account-stories p { font-size: .9rem; line-height: 1.45; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.header-actions .google { width: auto; font-size: .86rem; border-radius: 8px; }
.header-actions [hidden] { display: none; }
body > header #accountStatus:not(.error) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
body > header #accountStatus.error {
  flex-basis: 100%;
  color: #ffc1ac;
  margin: 0;
}
.appearance-only .wizard-top { justify-content: flex-end; }
.appearance-only :is(#wizardSteps, .name-label, #characterName, #clanSelect, #clanBenefits, #clanPreview, #ninkenEdit, #sidebarSummary, .era-tag) {
  display: none;
}
.story-slot { background: #213329; border-color: #4a6453; color: var(--paper); }
.story-slot span, .story-slot small { color: #bacbbd; }

.story-slot.selected { border-color: var(--amber); box-shadow: inset 0 0 0 1px #eab57844; background: #293d2d; }

.layout { grid-template-columns: minmax(0, 1fr) minmax(310px, 365px); gap: 14px; align-items: start; }
.map-panel, .game-sidebar {
  min-width: 0;
  border: 1px solid #476151;
  border-radius: 16px;
  box-shadow: 0 4px 12px #233c291a;
  background: var(--panel);
}

.map-top, .map-bottom, .map-mode, .map-places { background: #1c2b22; }
.map-top, .map-bottom { padding: 12px 17px; gap: 10px; }
.map-top #mapScope { font-size: .78rem; letter-spacing: .025em; color: var(--paper); font-weight: 700; }
.map-top #weather, .map-bottom { font-size: .77rem; color: var(--muted); }
.map-top #expandMap, .map-actions button, .map-navigation button { font-size: .78rem; }
.map-top #expandMap { white-space: nowrap; }
.map-mode { padding: 6px 14px 11px; gap: 8px; }
.map-mode button { padding: 9px 13px; border-radius: 8px; font-size: .84rem; }
.map-mode button.active, .sidebar-tabs button[aria-pressed=true] { color: #161d13; background: var(--green); }
.map-mode small, .map-places summary, .map-places summary span { font-size: .78rem; }
.map-places summary { color: var(--paper); }
.map-places summary span { color: var(--amber); }
.map-panel .world { width: 100%; border-block: 1px solid #476151; }
.map-tag { border-radius: 8px; background: #0e1915e8; }
.map-tag span, .location { font-size: .74rem; }
.location { max-width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; }
.map-controls button, .map-actions button { border-radius: 8px; }
.map-actions { gap: 6px; }

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 7px;
  background: #111e17;
  border-color: #476151;
}

.sidebar-tabs button { color: #e0ebdc; font-size: .77rem; min-height: 40px; padding: 8px 2px; }
.game-sidebar > .card { padding: 21px; }
.game-sidebar h2 { color: var(--paper); font-size: 1.35rem; }
.game-sidebar .character > .eyebrow { color: var(--amber); font-size: .73rem; }
.game-sidebar p, .game-sidebar .empty { color: var(--muted); font-size: .9rem; }
.game-sidebar .empty-sprite { color: var(--amber); font-size: 2.55rem; }
.game-sidebar .primary { border-radius: 9px; background: var(--amber); color: #21190f; }
.game-sidebar #journal .entry { border-color: #eab57870; }
.game-sidebar #journal .entry::before { background: var(--amber); }
.game-help { color: #bacbbd; font-size: .85rem; }
.game-help > summary { padding: 8px 0; }

button:not(:disabled):hover { filter: brightness(1.12); }
button:focus-visible, a:focus-visible, summary:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(250px, 290px); gap: 12px; }
  .sidebar-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-sidebar > .card { padding: 17px; }
}

@media (max-width: 760px) {
  body > main { padding-top: 15px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .map-top, .map-bottom, .map-mode { padding-inline: 10px; }
  .map-actions { margin-left: 0; }
  .map-actions button { min-height: 34px; }
}

@media (max-width: 480px) {
  body > header { min-height: 65px; gap: 10px; padding-inline: 14px; }
  body > header .nav { display: none; }
  body > header .quiet { padding: 8px 9px; }
  .brand { letter-spacing: .08em; gap: 8px; font-size: .9rem; white-space: nowrap; }
  .brand .crest { flex-basis: 35px; width: 35px; height: 35px; font-size: 1.25rem; }
  .brand small { font-size: .63rem; }
  body > header { flex-wrap: wrap; }
  .header-actions { flex-wrap: wrap; }
  .header-actions .google, .header-actions #switchAccount { padding: 8px 9px; font-size: .8rem; }
  .map-tag { display: none; }
  .map-top #mapScope { font-size: .7rem; }
  .map-mode button { padding-inline: 10px; font-size: .77rem; }
}
