:root {
  --font: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --font-title: "Press Start 2P", "Courier New", monospace;
  --hud-bg: rgba(14, 10, 22, 0.66);
  --gold: #ffe27a;
  --panel-bg: #c6c6c6;
  --panel-text: #3f3f3f;
  --slot-bg: #8b8b8b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #000; color: #fff; font-family: var(--font);
  user-select: none; -webkit-user-select: none;
}

#game { position: fixed; inset: 0; display: block; touch-action: none; image-rendering: pixelated; }
#game.dragging { cursor: grabbing !important; }

button { font-family: var(--font); }

/* ---------- Minecraft-style buttons ---------- */
.mc, .speed button, .p-close {
  font-family: var(--font); font-size: 14px; color: #fff; text-shadow: 2px 2px 0 #3a3a3a;
  background: #747474; border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #aaaaaa, inset -2px -3px 0 #4c4c4c;
  padding: 6px 12px; cursor: pointer; line-height: 1.1;
}
.mc:hover, .speed button:hover, .p-close:hover { background: #7f8fc8; box-shadow: inset 2px 2px 0 #b8c4f0, inset -2px -3px 0 #4d5a8c; }
.mc:active, .speed button:active { transform: translateY(1px); }
.mc.on, .speed button.on { background: #5b8b3b; box-shadow: inset 2px 2px 0 #8cc060, inset -2px -3px 0 #3a5a22; }
.mc.red { background: #9a3a32; box-shadow: inset 2px 2px 0 #c8665c, inset -2px -3px 0 #5c1e18; }
.mc.red:hover { background: #b84a40; }
.mc.big { font-size: 18px; padding: 12px 22px; min-width: min(320px, 80vw); }
.mc.small { font-size: 13px; padding: 4px 9px; }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 10; }
#hud-tl { top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.year-box { background: var(--hud-bg); border: 2px solid rgba(255, 255, 255, 0.16); padding: 10px 14px 8px; }
#year { font-family: var(--font-title); font-size: 20px; color: var(--gold); text-shadow: 3px 3px 0 #4a3000; letter-spacing: 1px; white-space: nowrap; }
#era { font-size: 13px; color: #9fe8ff; margin-top: 4px; text-shadow: 1px 1px 0 #000; letter-spacing: 0.5px; }
.weather { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-size: 15px; color: #e8e8e8; text-shadow: 1px 1px 0 #000; }
.weather img { width: 24px; height: 24px; image-rendering: pixelated; }
.speed { display: flex; gap: 4px; }
.speed button { font-size: 14px; padding: 5px 10px; min-width: 40px; }
#paused-badge { display: none; font-family: var(--font-title); font-size: 10px; color: #fff; background: #b03030; padding: 6px 9px; border: 2px solid #000; }
#paused-badge.show { display: block; animation: blink 1.2s steps(2) infinite; }

#hud-tr { top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#minimap { width: 300px; height: 56px; border: 2px solid #000; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22); image-rendering: pixelated; cursor: pointer; background: #000; touch-action: none; }
.hud-row { background: var(--hud-bg); padding: 3px 9px; font-size: 14px; text-shadow: 1px 1px 0 #000; }
.hud-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

#hint {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 11;
  background: rgba(20, 14, 30, 0.85); border: 2px solid var(--gold); color: var(--gold);
  padding: 8px 14px; font-size: 15px; display: none; text-shadow: 1px 1px 0 #000;
  max-width: min(560px, calc(100vw - 700px)); min-width: 220px; text-align: center; pointer-events: none;
}
#hint.show { display: block; }
#hint.warn { border-color: #ff7a6a; color: #ffb0a0; }

#toast {
  position: fixed; top: 64px; left: 50%; transform: translate(-50%, -8px); opacity: 0;
  transition: opacity 0.25s, transform 0.25s; z-index: 12; background: rgba(0, 0, 0, 0.8);
  padding: 8px 14px; font-size: 15px; pointer-events: none; border-left: 4px solid #7cfc5a;
  max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- city / nation labels ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.tlabel {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 6px; padding: 3px 7px 3px 4px;
  background: rgba(12, 8, 20, 0.74); border: 2px solid var(--tc, #fff); color: #fff;
  font-size: 12px; white-space: nowrap; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  text-shadow: 1px 1px 0 #000;
}
.tlabel:hover { background: rgba(48, 36, 72, 0.92); }
.tlabel.capital { font-size: 14px; font-weight: 600; padding: 4px 8px 4px 4px; }
.tlabel .lflag { width: 24px; height: 15px; image-rendering: pixelated; border: 1px solid rgba(0, 0, 0, 0.7); }
.tlabel:not(.capital) .lflag { width: 16px; height: 10px; }
.tlabel .lpop { background: rgba(255, 255, 255, 0.16); padding: 0 5px; font-size: 11px; color: #ddd; }
.tlabel.war .lname::before { content: "\2694  "; color: #ff6b5a; }
.tlabel.revolt { border-style: dashed; animation: revolt 0.8s steps(2) infinite; }
.tlabel.picked { outline: 3px solid var(--gold); animation: pulse 0.9s ease-in-out infinite; }
.tlabel.selected { outline: 2px solid #fff; }

/* ---------- event log ---------- */
#log { position: fixed; left: 12px; bottom: 100px; z-index: 9; width: min(460px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.logline {
  pointer-events: auto; background: rgba(0, 0, 0, 0.58); padding: 4px 8px; font-size: 14px; line-height: 1.3;
  text-shadow: 1px 1px 0 #000; transition: opacity 2s; animation: slidein 0.3s ease-out;
}
.logline.fade { opacity: 0; }
.ev { display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: 0; background: #aaa; border: 1px solid #000; }
.ev-war { background: #e04a3a; } .ev-ally { background: #5ad06a; } .ev-peace { background: #fff; }
.ev-election { background: #ffd23a; } .ev-found { background: #5aa8ff; } .ev-grow { background: #b07cff; }
.ev-death { background: #6a6a6a; } .ev-fall { background: #2a2a2a; border-color: #888; } .ev-weapon { background: #ff9a3a; }
.ev-weather { background: #7fd6ff; } .ev-build { background: #c8a060; } .ev-family { background: #ff8ac0; } .ev-info { background: #bbb; }
.ev-tech { background: #6bcbff; } .ev-law { background: #e8d8a0; } .ev-revolt { background: #ff4a6a; } .ev-crisis { background: #a0522d; }
.ev-plague { background: #7fd34a; } .ev-trade { background: #d4a017; } .ev-spy { background: #4a4a6a; } .ev-holiday { background: #ff9af0; }
.ev-discovery { background: #3ae0c0; } .ev-econ { background: #e8c547; } .ev-god { background: #fff6c8; }
.ey { color: var(--gold); font-size: 12px; }
a.tl, a.hl { cursor: pointer; text-decoration: none; color: inherit; }
a.tl { font-weight: 600; }
a.tl:hover, a.hl:hover { text-decoration: underline; }
.logline a.hl { color: #d8e8ff; }
.chip { display: inline-block; width: 9px; height: 9px; margin: 0 4px 0 1px; border: 1px solid rgba(0, 0, 0, 0.75); vertical-align: 0; }

/* ---------- toolbox (hotbar) ---------- */
#toolbar-wrap {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 10;
  display: flex; flex-direction: column; align-items: center; max-width: calc(100vw - 16px);
}
#tool-name { margin-bottom: 8px; text-align: center; opacity: 0; transition: opacity 0.25s; pointer-events: none; text-shadow: 2px 2px 0 #000; max-width: min(640px, 92vw); }
#tool-name.show { opacity: 1; }
#tool-name b { display: block; font-size: 17px; color: #fff; }
#tool-name span { font-size: 13px; color: #d4d4d4; }
#tool-cats { display: flex; gap: 3px; margin-bottom: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.cat {
  display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 5px; cursor: pointer; font-size: 13px; color: #ddd;
  background: rgba(0, 0, 0, 0.6); border: 2px solid #141414; box-shadow: inset 0 0 0 1px #6b6b6b; text-shadow: 1px 1px 0 #000; white-space: nowrap;
}
.cat img { width: 16px; height: 16px; image-rendering: pixelated; }
.cat:hover { color: #fff; background: rgba(60, 60, 60, 0.8); }
.cat.on { color: var(--gold); background: rgba(40, 32, 10, 0.88); box-shadow: inset 0 0 0 1px var(--gold); }
#toolbar {
  display: flex; align-items: center; padding: 3px; max-width: 100%; overflow-x: auto;
  background: rgba(0, 0, 0, 0.6); border: 3px solid #141414; box-shadow: inset 0 0 0 2px #8b8b8b;
  scrollbar-width: thin;
}
.slot {
  position: relative; width: 48px; height: 48px; flex: 0 0 48px; margin: 0; padding: 0;
  background: rgba(139, 139, 139, 0.32); border: 2px solid #3a3a3a; cursor: pointer;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.45), inset -2px -2px 0 rgba(255, 255, 255, 0.12);
  display: grid; place-items: center;
}
.slot img { width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.slot:hover { background: rgba(210, 210, 210, 0.35); }
.slot.active { border-color: #fff; box-shadow: 0 0 0 2px #fff, inset 0 0 0 2px #000; z-index: 2; background: rgba(255, 255, 255, 0.2); }
.slot .key { position: absolute; right: 3px; bottom: 2px; font-family: var(--font-title); font-size: 7px; color: #fff; text-shadow: 1px 1px 0 #000; }
.slot.instant { background: rgba(110, 150, 200, 0.28); }
.slot.flash { animation: flash 0.4s; }
.sep { width: 8px; flex: 0 0 8px; }

/* ---------- side panel (Minecraft inventory style) ---------- */
#panel {
  position: fixed; top: 140px; right: 12px; bottom: 86px; width: min(400px, calc(100vw - 24px)); z-index: 20;
  background: var(--panel-bg); color: var(--panel-text); border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555, 0 6px 0 rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column;
}
#panel.hidden { display: none; }
#panel-body { overflow-y: auto; padding: 14px 16px 26px; flex: 1; user-select: text; scrollbar-width: thin; }
.p-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.flag-big { width: 96px; height: 60px; image-rendering: pixelated; border: 2px solid #000; flex: none; background: #888; }
.portrait { width: 80px; height: 90px; image-rendering: pixelated; background: var(--slot-bg); border: 2px solid #000; box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #fff; flex: none; }
.p-titles { flex: 1; min-width: 0; }
.p-title { font-size: 20px; font-weight: 700; color: #262626; line-height: 1.15; overflow-wrap: anywhere; }
.p-sub { margin-top: 5px; font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.p-close { align-self: flex-start; padding: 2px 8px; font-size: 14px; }
.p-sec { background: var(--slot-bg); color: #fff; padding: 8px 10px; border: 2px solid #373737; box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #b5b5b5; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14px; border-bottom: 1px solid rgba(0, 0, 0, 0.14); }
.row:last-child { border-bottom: 0; }
.row > span { color: #eee; opacity: 0.85; white-space: nowrap; }
.row > b { font-weight: 600; text-align: right; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }
.p-sec .muted { color: #e0e0e0; opacity: 0.8; }
.p-sec a.tl, .p-sec a.hl { color: #fff; }
#panel h4 { margin: 16px 0 6px; font-size: 14px; color: #2a2a2a; text-transform: uppercase; letter-spacing: 1px; }
#panel h3 { margin: 6px 0 4px; font-size: 18px; color: #2a2a2a; }
.p-list { font-size: 14px; }
.p-list p { margin: 4px 0; }
.badge { background: #3f3f3f; color: var(--gold); padding: 1px 7px; font-size: 12px; }
.tag { display: inline-block; padding: 0 6px; font-size: 12px; background: #6a6a6a; color: #fff; margin-right: 3px; }
.tag.war { background: #b03030; } .tag.ally { background: #3a8a3a; } .tag.neutral { background: #7a7a7a; }
.muted { color: #5e5e5e; font-size: 13px; }
.bar { display: inline-block; height: 9px; flex: 1; background: #373737; border: 1px solid #000; min-width: 50px; }
.bar i { display: block; height: 100%; background: #6fd34a; }
.bar.hp { width: 110px; flex: none; vertical-align: middle; }
.bar.hp i { background: #e04a3a; }
.wrow, .rrow, .vrow, .frow, .cit { display: flex; align-items: center; gap: 8px; padding: 3px 2px; }
.wrow img { width: 20px; height: 20px; image-rendering: pixelated; }
.wn { width: 72px; }
.rrow a.tl { flex: 1; }
.op { width: 34px; text-align: right; }
.vrow a.hl { width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow > span:first-child { width: 70px; flex: none; color: #5e5e5e; }
.frow .flow { flex: 1; min-width: 0; line-height: 1.35; }
.flag-xs { width: 20px; height: 12px; image-rendering: pixelated; border: 1px solid #000; }
.flag-sm { width: 40px; height: 25px; image-rendering: pixelated; border: 1px solid #000; flex: none; }
.citizens { max-height: 260px; overflow-y: auto; background: rgba(0, 0, 0, 0.06); border: 1px solid rgba(0, 0, 0, 0.2); }
.cit { cursor: pointer; padding: 2px 6px; }
.cit:hover { background: rgba(255, 255, 255, 0.45); }
.cit .dot { width: 8px; height: 8px; border: 1px solid #000; flex: none; }
.cn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crown { color: #a87800; }
.nation { display: flex; gap: 10px; align-items: center; padding: 7px 6px; cursor: pointer; border-bottom: 1px solid rgba(0, 0, 0, 0.15); }
.nation:hover { background: rgba(255, 255, 255, 0.45); }
.ninfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nation.fallen { opacity: 0.6; }
.history .hrow { padding: 4px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.1); font-size: 13px; line-height: 1.35; }
.history .ey { color: #7a5a00; }
.history a.hl { color: #23407a; }

.settings { margin-top: 20px; padding-top: 8px; border-top: 3px solid #8b8b8b; }
.set { margin: 10px 0; }
.set > label { display: block; font-size: 14px; margin-bottom: 4px; color: #2a2a2a; font-weight: 600; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline.wrap { flex-wrap: wrap; }
#panel input:not([type]), #panel input[type="text"], #panel select {
  font-family: var(--font); font-size: 14px; background: #000; color: #fff;
  border: 2px solid #a0a0a0; padding: 5px 7px; flex: 1; min-width: 0; outline: none;
}
#panel input:focus, #panel select:focus { border-color: #fff; }
#panel input[type="range"] { width: 100%; accent-color: #5b8b3b; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.sw { height: 24px; border: 2px solid #000; cursor: pointer; padding: 0; }
.sw.on { outline: 3px solid #fff; outline-offset: -6px; }
.wbtn { font-size: 13px; padding: 5px 8px; }
.wbtn img { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: -3px; margin-right: 4px; }

/* ---------- decade summary card ---------- */
#decade {
  position: fixed; left: 12px; top: 150px; z-index: 9; width: min(360px, calc(100vw - 24px));
  max-height: max(140px, calc(100vh - 540px)); display: flex; flex-direction: column;
  background: rgba(24, 18, 8, 0.86); border: 2px solid #8a6a2a; box-shadow: inset 0 0 0 2px rgba(255, 226, 122, 0.12), 0 4px 0 rgba(0, 0, 0, 0.4);
  text-shadow: 1px 1px 0 #000;
}
#decade.hidden { display: none; }
#decade.pop { animation: slidein 0.35s ease-out; }
.d-head { display: flex; align-items: center; gap: 8px; padding: 7px 8px 6px 10px; border-bottom: 1px solid rgba(255, 226, 122, 0.25); }
.d-head b { font-family: var(--font-title); font-size: 10px; color: var(--gold); white-space: nowrap; }
.d-head span { flex: 1; font-size: 13px; color: #d8c89a; }
.d-head .p-close { padding: 0 6px; font-size: 12px; }
#decade-body { overflow-y: auto; padding: 6px 10px; font-size: 13px; line-height: 1.35; scrollbar-width: thin; user-select: text; }
.dline { padding: 2px 0; }
.dline a.hl { color: #d8e8ff; }
.d-more { background: none; border: 0; color: #d8c89a; font-size: 12px; text-align: right; padding: 3px 10px 6px; cursor: pointer; }
.d-more:hover { color: var(--gold); text-decoration: underline; }
#btn-decade.new:not(.on) { animation: newpulse 1s ease-in-out infinite; }

/* ---------- panel extras ---------- */
.p-nav {
  position: sticky; top: -14px; z-index: 2; display: flex; flex-wrap: wrap; gap: 3px; margin: 0 -16px 10px; padding: 6px 16px;
  background: var(--panel-bg); border-bottom: 2px solid #8b8b8b;
}
.p-nav button { font-family: var(--font); font-size: 12px; padding: 2px 7px; background: #8b8b8b; color: #fff; border: 1px solid #373737; cursor: pointer; text-shadow: 1px 1px 0 #373737; }
.p-nav button:hover { background: #7f8fc8; }
#panel h5 { margin: 12px 0 4px; font-size: 13px; color: #3a3a3a; }
section { scroll-margin-top: 40px; }
.tag.plague { background: #5a9a2a; } .tag.crisis { background: #8a5a2a; } .tag.bless { background: #c8a030; }
.tag.law { background: #5a6a8a; } .tag.trade { background: #a07a10; } .tag.trait { background: #6a4a8a; }
.party { display: inline-block; padding: 0 6px; font-size: 12px; color: #fff; background: var(--pc); border: 1px solid rgba(0, 0, 0, 0.5); text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6); margin-right: 3px; white-space: nowrap; }
.alert { margin: 6px 0; padding: 5px 8px; font-size: 13px; color: #fff; background: #8a3a3a; border: 2px solid #4a1a1a; }
.alert.crisis { background: #7a5a2a; border-color: #3a2a10; } .alert.plague { background: #4a7a2a; border-color: #2a4a10; }
.alert a.hl { color: #fff; text-decoration: underline; }
.ledger .lrow { display: flex; justify-content: space-between; padding: 2px 4px; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.pos { color: #2a6a1a; } .neg { color: #9a2a2a; }
.stores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stores span { background: var(--slot-bg); color: #eee; padding: 3px 6px; font-size: 12px; border: 1px solid #373737; }
.stores b { display: block; font-size: 15px; color: #fff; }
.classbar { display: flex; height: 12px; border: 1px solid #000; background: #373737; }
.classbar i { display: block; height: 100%; }
.jobs { display: flex; flex-wrap: wrap; gap: 4px; }
.jobs p { width: 100%; }
.job { background: #8b8b8b; color: #fff; padding: 1px 6px; font-size: 12px; border: 1px solid #373737; }
.job b { color: var(--gold); } .job i { color: #ddd; font-style: normal; }
.job.bad { background: #8a3a3a; }
.techs { display: flex; flex-wrap: wrap; gap: 3px; }
.tech { background: #3a5a7a; color: #fff; padding: 1px 6px; font-size: 12px; border: 1px solid #1a2a3a; cursor: help; }
.why { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.why span { font-size: 12px; padding: 0 5px; background: rgba(0, 0, 0, 0.08); border: 1px solid rgba(0, 0, 0, 0.15); }
.cand { align-items: flex-start; }
.cname { width: 170px; flex: none; display: flex; flex-direction: column; gap: 1px; }
.cname a.hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promise { font-size: 12px; color: #5a4a2a; }
.rebel { color: #b03030; }
.rk { width: 18px; color: #5e5e5e; }
.laws { display: flex; flex-direction: column; gap: 4px; }
.law { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; padding: 3px 4px; background: rgba(0, 0, 0, 0.05); }
.law input { margin-top: 3px; accent-color: #5b8b3b; }
.law span { display: flex; flex-direction: column; }
.law i { font-style: normal; color: #5e5e5e; font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chipbtn { font-family: var(--font); font-size: 12px; padding: 2px 8px; background: #8b8b8b; color: #fff; border: 1px solid #373737; cursor: pointer; }
.chipbtn.on { background: #5b8b3b; }
canvas.chart { display: block; width: 100%; border: 2px solid #373737; image-rendering: pixelated; }
.ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.rank h5 { margin: 6px 0 2px !important; }
.rank .rrow { font-size: 12px; padding: 1px 0; gap: 4px; }
.rank .rrow a.tl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eras { display: flex; flex-wrap: wrap; gap: 3px; }
.era { padding: 2px 7px; font-size: 12px; background: #9a9a9a; color: #e8e8e8; border: 1px solid #6a6a6a; }
.era.on { background: #3a6a8a; color: #fff; border-color: #1a3a5a; }
details.legend { border-bottom: 1px solid rgba(0, 0, 0, 0.12); padding: 4px 0; font-size: 13px; }
details.legend summary { cursor: pointer; }
details.legend .hrow { padding: 2px 0 2px 14px; }
details.legend a.hl { display: inline-block; margin: 2px 0 0 14px; color: #23407a; text-decoration: underline; }
.trow4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.trow2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.tcard {
  display: flex; flex-direction: column; gap: 1px; padding: 4px 6px; font-size: 12px; cursor: pointer; min-width: 0;
  background: #e4e4e4; border: 2px solid #555; border-left: 5px solid var(--pc, #888);
}
.tcard:hover { background: #fff; }
.tcard b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #262626; }
.tcard i { color: #7a5a00; font-style: normal; }
.tcard span { color: #5e5e5e; font-size: 11px; }
.tcard .ttl { color: #3a5a8a; }
.tcard.me { background: #fff8d8; border-color: #a87800; }
.tcard.empty { cursor: default; color: #8a8a8a; background: #d4d4d4; border-style: dashed; border-left-width: 2px; }
#h-snap { margin-top: 6px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.62)); padding: 16px; }
.overlay.hidden { display: none; }
.start-box {
  text-align: center; padding: 28px 34px; max-width: min(640px, 100%); max-height: 100%; overflow-y: auto;
  background: rgba(10, 8, 16, 0.76); border: 3px solid #000; box-shadow: inset 0 0 0 2px #6b6b6b;
}
h1 { font-family: var(--font-title); font-size: clamp(28px, 6vw, 54px); line-height: 1.25; margin: 0 0 16px; color: var(--gold); text-shadow: 4px 4px 0 #6a3a00, 8px 8px 0 rgba(0, 0, 0, 0.4); letter-spacing: 2px; }
.help-box h2 { font-family: var(--font-title); font-size: 18px; color: var(--gold); margin: 0 0 16px; }
.tagline { font-size: 17px; color: #e8e8e8; margin: 0 0 12px; }
.world-info { font-size: 14px; color: #9fd8f5; margin-bottom: 18px; }
.start-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.howto { text-align: left; margin: 20px auto 0; padding: 0 0 0 18px; font-size: 14px; color: #cfcfcf; line-height: 1.6; max-width: 480px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; text-align: left; margin-bottom: 18px; }
.help-grid div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.help-grid b { color: var(--gold); }
.help-grid span { color: #d8d8d8; line-height: 1.35; }

/* ---------- animations ---------- */
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes pulse { 50% { outline-color: rgba(255, 226, 122, 0.35); } }
@keyframes flash { 0% { background: rgba(255, 255, 255, 0.85); } 100% { background: rgba(110, 150, 200, 0.28); } }
@keyframes revolt { 50% { border-color: #ff4a6a; } }
@keyframes newpulse { 50% { background: #a08a2a; box-shadow: inset 2px 2px 0 #d8c060, inset -2px -3px 0 #5a4a10; } }
@keyframes slidein { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  #hint { max-width: calc(100vw - 24px); min-width: 0; top: 122px; font-size: 13px; padding: 6px 10px; }
  #toast { top: 170px; }
  #tool-name span { display: none; }
  #minimap { width: 200px; height: 38px; }
  #panel { top: 12px; bottom: 120px; }
  #decade { top: 170px; max-height: calc(100vh - 330px); }
  .help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #year { font-size: 14px; }
  .year-box { padding: 7px 10px 6px; }
  #log { display: none; }
  .cat span { display: none; }
  .trow4 { grid-template-columns: repeat(2, 1fr); }
  .ranks { grid-template-columns: 1fr; }
  .slot { width: 42px; height: 42px; flex-basis: 42px; }
  .slot img { width: 28px; height: 28px; }
  .hud-btns .mc.small { font-size: 12px; padding: 3px 6px; }
}
