/* IMPERIUM DOMINI · Material Design 3 (the house doctrine, training/DESIGN-DOCTRINE.md) in the Octavium colour scheme:
   wine, rose, gold, cream on a dark ground; Accanthis the brand face for titles, EB Garamond the body. 1 dp = 1 css px here.
   Type: only the M3 scale. Grid: 4 / 8. Two panes at most: a fixed 412 pane and the flexible map. One filled button per view. */
@font-face { font-family: "Accanthis"; src: url(/accanthis.otf) format("opentype"); font-display: swap; }
:root {
  --bg: #0f0b09; --s1: #18110e; --s2: #211813; --s3: #2b201a; --line: rgba(240, 210, 190, .14); --line2: rgba(240, 210, 190, .26);
  --gold: #e0be6f; --gold2: #f0d9a0; --on-gold: #2a1d07; --cream: #f4e6d6; --rose: #e9cfc4; --dim: #c3a69c; --faint: #8f7a70;
  --wine: #6b1f1c; --wine2: #84322e; --red: #c4493a; --green: #6fae5f;
  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-xl: 28px;
  --title: "Accanthis", "EB Garamond", Georgia, serif; --body: "EB Garamond", Georgia, "Times New Roman", serif;
  --e1: 0 1px 2px rgba(0,0,0,.5), 0 1px 3px 1px rgba(0,0,0,.3); --e2: 0 1px 2px rgba(0,0,0,.5), 0 2px 6px 2px rgba(0,0,0,.3); --e3: 0 4px 8px 3px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--cream); font: 400 16px/24px var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* type scale */
.d-s { font: 400 36px/44px var(--title); letter-spacing: .02em; }
.h-m { font: 400 28px/36px var(--title); letter-spacing: .02em; }
.h-s { font: 400 24px/32px var(--title); letter-spacing: .02em; }
.t-l { font: 400 22px/28px var(--title); letter-spacing: .02em; }
.t-m { font: 600 16px/24px var(--body); letter-spacing: .01em; }
.b-l { font: 400 16px/24px var(--body); }
.b-m { font: 400 14px/20px var(--body); }
.l-l { font: 600 14px/20px var(--body); letter-spacing: .08em; text-transform: uppercase; }
.l-m { font: 600 12px/16px var(--body); letter-spacing: .1em; text-transform: uppercase; }
.dim { color: var(--dim); } .faint { color: var(--faint); }

/* top app bar */
.bar { position: fixed; z-index: 20; inset: 0 0 auto 0; height: 64px; display: flex; align-items: center; gap: 8px; padding: 0 24px;
  background: linear-gradient(180deg, rgba(15,11,9,.92), rgba(15,11,9,.72)); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; margin-right: 16px; color: var(--cream); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 32px; height: 32px; }
.brand .name { font: 400 22px/28px var(--title); letter-spacing: .14em; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { height: 48px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 24px; color: var(--rose); font: 600 14px/20px var(--body); letter-spacing: .08em; text-transform: uppercase; }
.nav a:hover { background: rgba(240,210,190,.08); text-decoration: none; }

/* buttons (M3: filled, tonal, outlined, text) · min target 48 */
.btn { min-height: 40px; padding: 0 24px; border-radius: 20px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font: 600 14px/20px var(--body); letter-spacing: .08em; text-transform: uppercase; position: relative; text-decoration: none !important; white-space: nowrap; }
.btn::after { content: ""; position: absolute; inset: -4px 0; }
.btn.fill { background: var(--gold); color: var(--on-gold); box-shadow: var(--e1); }
.btn.fill:hover { background: var(--gold2); box-shadow: var(--e2); }
.btn.tonal { background: rgba(224,190,111,.16); color: var(--gold2); }
.btn.tonal:hover { background: rgba(224,190,111,.24); }
.btn.out { background: transparent; color: var(--rose); border: 1px solid var(--line2); }
.btn.out:hover { background: rgba(240,210,190,.06); }
.btn.text { background: transparent; color: var(--gold2); padding: 0 12px; }
.btn.text:hover { background: rgba(224,190,111,.1); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid rgba(196,73,58,.5); }
.btn[disabled] { opacity: .38; cursor: default; pointer-events: none; }

/* the front page: the map is the page, the pane lies over it */
.home { position: fixed; inset: 64px 0 0 0; }
.home .mapwrap { position: absolute; inset: 0; }
.pane { position: absolute; z-index: 5; top: 24px; left: 24px; bottom: 24px; width: 412px; display: flex; flex-direction: column;
  background: rgba(24,17,14,.94); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--e3); overflow: hidden; }
.pane-scroll { overflow-y: auto; padding: 24px; scrollbar-width: thin; scrollbar-color: var(--s3) transparent; }
.pane h1 { margin: 0; }
.kicker { color: var(--gold); margin: 0 0 8px; }
.lede { margin: 8px 0 0; color: var(--rose); }
.notice { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--r-m); background: rgba(107,31,28,.45); border: 1px solid rgba(196,73,58,.35); color: var(--cream); }
.sec { margin-top: 24px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; height: 48px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.sec-h h2 { margin: 0; color: var(--gold); }
.empty { padding: 16px 0; text-align: center; color: var(--dim); }
.empty .btn { margin-top: 12px; }
.li { display: flex; gap: 16px; align-items: center; min-height: 72px; padding: 8px 12px; margin: 0 -12px; border-radius: var(--r-m); cursor: pointer; color: inherit; }
.li:hover { background: rgba(240,210,190,.06); text-decoration: none; }
.li.static { cursor: default; } .li.static:hover { background: transparent; }
.li .av { flex: none; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; background: var(--s3); color: var(--gold2); font: 400 18px/1 var(--title); }
.li .av.sw { border: 2px solid rgba(255,255,255,.25); }
.li .tx { flex: 1; min-width: 0; }
.li .tx b { display: block; font: 600 16px/24px var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .tx span { display: block; color: var(--dim); font: 400 14px/20px var(--body); }
.li .end { flex: none; text-align: right; color: var(--dim); font: 400 14px/20px var(--body); }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line2); color: var(--rose); font: 600 12px/16px var(--body); letter-spacing: .08em; text-transform: uppercase; }
.chip.live { border-color: rgba(111,174,95,.5); color: #b7e0a8; }
.chip.live::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--green); margin-right: 8px; animation: blink 1.6s ease-in-out infinite; }
.chip.warn { border-color: rgba(196,73,58,.5); color: #f0b3a8; }
@keyframes blink { 50% { opacity: .35; } }
.pane-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.pane-foot .btn.fill { flex: 1; }

/* detail sheet over the map (a nation, an event, a contest) */
.sheet { position: absolute; z-index: 6; right: 24px; top: 24px; width: 380px; max-height: calc(100% - 48px); overflow-y: auto; padding: 24px;
  background: rgba(24,17,14,.96); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--e3); }
.sheet .x { position: absolute; top: 12px; right: 12px; width: 48px; height: 48px; border-radius: 24px; border: 0; background: transparent; color: var(--rose); font-size: 24px; cursor: pointer; }
.sheet .x:hover { background: rgba(240,210,190,.08); }
.sheet h3 { margin: 0 48px 4px 0; }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 4px 16px; margin: 16px 0; }
.kv dt { color: var(--dim); font: 600 12px/20px var(--body); letter-spacing: .1em; text-transform: uppercase; }
.kv dd { margin: 0; }
.prose { color: var(--rose); white-space: pre-wrap; }

/* the map */
.mapwrap { background: #141b22; overflow: hidden; touch-action: none; user-select: none; }
.dmap { width: 100%; height: 100%; display: block; cursor: grab; }
.dmap:active { cursor: grabbing; }
.dm-grat line { stroke: rgba(226,214,184,.07); stroke-width: calc(1.2px * var(--k, 1) * 1.4); vector-effect: non-scaling-stroke; }
.dm-land { fill: #46423a; }
.dm-lake { fill: #1d262f; stroke: rgba(226,214,184,.18); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dm-river { fill: none; stroke: #34424e; stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .9; }
.dm-border { fill: none; stroke: rgba(226,214,184,.22); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.dm-shore { fill: none; stroke: rgba(226,214,184,.42); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.dm-reg { fill: transparent; stroke: rgba(226,214,184,.12); stroke-width: .6; vector-effect: non-scaling-stroke; transition: fill .15s; }
.dm-reg:hover { fill: rgba(240,217,160,.16); }
.dm-reg.held { fill: color-mix(in srgb, var(--c) 64%, #46423a); stroke: color-mix(in srgb, var(--c) 64%, #46423a); stroke-width: .8; }
.dm-reg.held:hover { fill: color-mix(in srgb, var(--c) 82%, #46423a); stroke: color-mix(in srgb, var(--c) 82%, #46423a); }
.dm-reg.hl { fill: color-mix(in srgb, var(--c) 86%, #46423a); stroke: color-mix(in srgb, var(--c) 86%, #46423a); }
.dm-reg.dim { fill: color-mix(in srgb, var(--c) 28%, #46423a); stroke: color-mix(in srgb, var(--c) 28%, #46423a); }
.dm-reg.sel { fill: #f0d9a0; fill-opacity: .55; stroke: #f0d9a0; stroke-opacity: .9; stroke-width: 1.4; }
.dm-hatch { fill: url(#dm-hatch); }
.dm-nline { fill: none; stroke: color-mix(in srgb, var(--c) 70%, #f4e6d6); stroke-width: 4; vector-effect: non-scaling-stroke; pointer-events: none; stroke-linejoin: round; }
.dm-route { fill: none; stroke: #e0be6f; stroke-width: 1.6; stroke-dasharray: 8 7; vector-effect: non-scaling-stroke; opacity: .7; animation: dash 2.4s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -30; } }
.dm-plane { fill: #f0d9a0; filter: url(#dm-glow); }
.sc { transform: scale(calc(var(--k, 1) * .62)); }
.dm-exp .dm-dot { fill: #e0be6f; stroke: #2a1d07; stroke-width: 3; cursor: pointer; filter: url(#dm-glow); }
.dm-exp .dm-pulse { fill: none; stroke: #e0be6f; stroke-width: 2; vector-effect: non-scaling-stroke; transform-origin: 0 0; animation: pulse 2.8s ease-out infinite; pointer-events: none; }
.dm-exp .dm-pulse.d2 { animation-delay: 1.4s; }
@keyframes pulse { from { transform: scale(.5); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
.dm-exp-t { font: 400 30px/1 var(--title); fill: #f4e6d6; paint-order: stroke; stroke: rgba(15,11,9,.85); stroke-width: 7px; letter-spacing: .06em; pointer-events: none; }
.dm-exp-s { font: 600 17px/1 var(--body); fill: #e0be6f; paint-order: stroke; stroke: rgba(15,11,9,.85); stroke-width: 6px; letter-spacing: .14em; text-transform: uppercase; pointer-events: none; }
.dm-cap .dm-star { fill: var(--c); stroke: #f4e6d6; stroke-width: 2; cursor: pointer; filter: brightness(1.3); }
.dm-cap-t { font: 400 24px/1 var(--title); fill: #f4e6d6; paint-order: stroke; stroke: rgba(15,11,9,.85); stroke-width: 6px; pointer-events: none; }
.dm-tip { position: absolute; z-index: 9; left: 0; top: 0; pointer-events: none; max-width: 260px; padding: 8px 12px; border-radius: var(--r-s);
  background: rgba(33,24,19,.97); border: 1px solid var(--line2); box-shadow: var(--e2); font: 400 14px/20px var(--body); }
.dm-tip b { display: block; font: 600 14px/20px var(--body); color: var(--cream); }
.dm-tip span { display: block; color: var(--dim); }
.dm-tip i { display: block; font-style: normal; color: var(--cream); }
.dm-tip i::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 8px; }
.dm-zoom { position: absolute; z-index: 4; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.dm-zoom button { width: 48px; height: 48px; border-radius: var(--r-l); border: 1px solid var(--line2); background: rgba(33,24,19,.92); color: var(--cream); font-size: 22px; cursor: pointer; box-shadow: var(--e2); }
.dm-zoom button:hover { background: var(--s3); }
.legend { position: absolute; z-index: 4; left: 460px; bottom: 24px; display: flex; gap: 16px; padding: 8px 16px; border-radius: var(--r-l); background: rgba(24,17,14,.88); border: 1px solid var(--line); color: var(--dim); font: 400 14px/20px var(--body); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 6px; display: inline-block; }

/* the portal */
.portal { display: flex; min-height: 100vh; padding-top: 64px; }
.rail { position: fixed; top: 64px; bottom: 0; left: 0; width: 96px; padding: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; border-right: 1px solid var(--line); background: var(--s1); overflow-y: auto; }
.rail button { width: 80px; min-height: 56px; border: 0; background: transparent; color: var(--rose); border-radius: var(--r-l); cursor: pointer; font: 600 12px/16px var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 8px 4px; }
.rail button:hover { background: rgba(240,210,190,.06); }
.rail button.on { background: rgba(224,190,111,.18); color: var(--gold2); }
.work { margin-left: 96px; flex: 1; display: flex; gap: 24px; padding: 24px; min-width: 0; }
.fixed { width: 412px; flex: none; }
.flex { flex: 1; min-width: 0; }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-l); padding: 24px; }
.card + .card { margin-top: 24px; }
.portal .mapwrap { position: sticky; top: 88px; height: calc(100vh - 112px); border-radius: var(--r-l); border: 1px solid var(--line); }
.field { margin-top: 16px; }
.field label { display: block; margin-bottom: 8px; color: var(--dim); font: 600 12px/16px var(--body); letter-spacing: .1em; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; min-height: 56px; padding: 16px; border-radius: var(--r-s); border: 1px solid var(--line2); background: var(--s2); color: var(--cream); font: 400 16px/24px var(--body); }
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border: 2px solid var(--gold); padding: 15px; }
.field .help { margin-top: 4px; color: var(--faint); font: 400 14px/20px var(--body); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; gap: 8px; margin-top: 24px; align-items: center; flex-wrap: wrap; }
.msg { margin-top: 16px; padding: 12px 16px; border-radius: var(--r-m); font: 400 14px/20px var(--body); }
.msg.ok { background: rgba(111,174,95,.14); color: #cfe9c6; }
.msg.bad { background: rgba(196,73,58,.16); color: #f4c4ba; }
.who { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.who img { width: 32px; height: 32px; border-radius: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table td, .table th { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font: 400 14px/20px var(--body); }
.table th { color: var(--dim); font: 600 12px/16px var(--body); letter-spacing: .1em; text-transform: uppercase; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 40px; height: 40px; border-radius: 20px; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--cream); }
.toggle { display: flex; gap: 0; border: 1px solid var(--line2); border-radius: 20px; overflow: hidden; }
.toggle button { flex: 1; height: 40px; border: 0; background: transparent; color: var(--rose); cursor: pointer; font: 600 14px/20px var(--body); letter-spacing: .06em; text-transform: uppercase; }
.toggle button + button { border-left: 1px solid var(--line2); }
.toggle button.on { background: rgba(224,190,111,.2); color: var(--gold2); }

/* the doors */
.door { min-height: 100vh; display: grid; place-items: center; padding: 88px 24px 24px; }
.door .card { max-width: 560px; }

/* compact and medium windows (M3: below 840 one pane) */
@media (max-width: 1100px) { .legend { display: none; } .sheet { width: 340px; } }
@media (max-width: 840px) {
  .bar { padding: 0 16px; } .nav { display: none; } .brand .name { font-size: 18px; letter-spacing: .1em; }
  .home { position: static; padding-top: 64px; }
  .home .mapwrap { position: relative; height: 62vh; }
  .pane { position: relative; inset: auto; width: auto; margin: 16px; border-radius: var(--r-l); }
  .sheet { position: fixed; inset: auto 0 0 0; width: auto; max-height: 70vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .dm-zoom { right: 16px; bottom: 16px; }
  .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 72px; flex-direction: row; padding: 0 8px; border-right: 0; border-top: 1px solid var(--line); z-index: 15; overflow-x: auto; }
  .rail button { min-width: 72px; }
  .work { margin-left: 0; flex-direction: column; padding: 16px 16px 96px; }
  .fixed { width: auto; }
  .portal .mapwrap { position: relative; top: 0; height: 60vh; }
  .row2 { grid-template-columns: 1fr; }
}
