:root { --gold: #e8bd5a; --gold2: #b98a2c; --red: #b0261c; --ink: #f4eee2; --mute: #b9b2a4; --glass: rgba(16, 14, 12, 0.46); --glass2: rgba(26, 22, 18, 0.62); --edge: rgba(255, 235, 200, 0.14); --line: rgba(232, 189, 90, 0.35);
  --ui: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif; --title: 'Trajan Pro', 'Cinzel', 'Times New Roman', Georgia, serif; font-size: 15px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--ink); font-family: var(--ui); user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.glass { background: var(--glass); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); border: 1px solid var(--edge); box-shadow: 0 8px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06); border-radius: 14px; }
kbd { display: inline-block; min-width: 1.5em; padding: 1px .35em; margin-right: .35em; border-radius: 6px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: var(--gold); font: 600 11px var(--ui); text-align: center; box-shadow: 0 1px 0 rgba(0,0,0,.4); }
button { font-family: inherit; cursor: pointer; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #army .sq, #buildbar button { pointer-events: auto; }
/* top */
#topbar { position: absolute; top: 14px; left: 16px; display: flex; gap: 2px; padding: 5px 6px; }
.res { padding: 4px 10px; font-size: 14px; white-space: nowrap; display: flex; align-items: center; gap: 6px; border-radius: 9px; }
.res + .res { border-left: 1px solid rgba(255,255,255,.07); }
.res b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ic { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.ic.silver { background: radial-gradient(circle at 35% 35%, #fff, #9aa3ad 60%, #59616b); } .ic.gold { background: radial-gradient(circle at 35% 35%, #fff6c8, #e8bd5a 55%, #8a6418); }
.ic.wood { border-radius: 3px; background: linear-gradient(90deg, #6b4a2a, #a2774a 50%, #6b4a2a); } .ic.men { border-radius: 3px; background: linear-gradient(#c33, #7a1410); clip-path: polygon(50% 0, 100% 25%, 85% 100%, 15% 100%, 0 25%); }
.ic.fire { background: radial-gradient(circle at 50% 70%, #ffd36a, #e2531d 60%, #7a1a08); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; } .ic.eagle { background: linear-gradient(135deg, #e8bd5a, #8a6418); clip-path: polygon(50% 0, 65% 35%, 100% 30%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 30%, 35% 35%); }
#compass { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 440px; height: 30px; overflow: hidden; border-radius: 16px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
#compass-strip { position: absolute; top: 6px; left: 0; height: 20px; white-space: nowrap; font: 600 12px var(--ui); }
#compass-strip span { position: absolute; transform: translateX(-50%); color: rgba(255,255,255,.55); }
#compass-strip span.c { color: var(--gold); font-size: 14px; }
#compass-mark { position: absolute; left: 50%; top: 0; width: 2px; height: 30px; background: linear-gradient(var(--gold), transparent); }
#clock { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); padding: 3px 12px; font-size: 12px; color: var(--mute); display: flex; gap: 10px; border-radius: 10px; }
#bossbar { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: 520px; text-align: center; }
#bossbar .bn { font: 600 15px var(--title); letter-spacing: .14em; color: #ffd9c0; text-shadow: 0 2px 10px #000; margin-bottom: 4px; }
.bar.boss { height: 10px; border-radius: 6px; } .bar.boss i { background: linear-gradient(90deg, #7a0d0a, #e0321e); }
#mapwrap { position: absolute; top: 14px; right: 16px; width: 232px; height: 232px; padding: 6px; border-radius: 22px; }
#minimap { width: 220px; height: 220px; border-radius: 16px; display: block; }
#mm-n { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); font: 700 11px var(--ui); color: var(--gold); text-shadow: 0 0 4px #000; }
#objective { position: absolute; top: 256px; right: 16px; width: 300px; padding: 11px 14px; font-size: 13px; line-height: 1.45; border-left: 3px solid var(--gold); }
#objective:empty { display: none; }
#objective h4 { margin: 0 0 4px; color: var(--gold); font: 600 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; transform: translate(-50%, -50%); } #crosshair i { display: block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
#prompt { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); padding: 8px 16px; font-size: 14px; border-radius: 12px; }
#prompt:empty { display: none; }
#gatebar { position: absolute; left: 50%; top: 120px; transform: translateX(-50%); width: 340px; text-align: center; font-size: 12px; padding: 7px 12px; }
#gatebar .bar { height: 7px; margin-top: 4px; }
.bar { background: rgba(0,0,0,.45); border-radius: 6px; overflow: hidden; height: 8px; }
.bar i { display: block; height: 100%; width: 50%; transition: width .15s; border-radius: 6px; }
.bar.hp i { background: linear-gradient(90deg, #8c1a14, #e0402c); } .bar.st i { background: linear-gradient(90deg, #a9822a, #f2cf6a); }
#gatebar .bar i { background: linear-gradient(90deg, #6b4a2a, #c08a4a); }
/* bottom-left */
#vitals { position: absolute; left: 16px; bottom: 16px; width: 300px; padding: 11px 13px; }
#vitals .who { display: flex; justify-content: space-between; align-items: center; font: 600 13px var(--title); letter-spacing: .1em; color: var(--gold); margin-bottom: 7px; }
.vit { margin-bottom: 6px; } .vit .bar { height: 9px; }
.vrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: var(--mute); } .chip b { color: var(--ink); }
.chip.buff { color: #bff0a8; border-color: rgba(140,230,120,.35); } .chip.debuff { color: #ffb0a0; border-color: rgba(255,120,100,.35); } .chip.ready { color: #1a1208; background: var(--gold); }
#army { position: absolute; left: 16px; bottom: 128px; width: 300px; max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; scrollbar-width: none; }
#army .sq { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--edge); border-radius: 11px; padding: 6px 10px; font-size: 12.5px; display: grid; grid-template-columns: 36px 1fr auto; gap: 2px 6px; align-items: center; cursor: pointer; transition: border-color .15s, background .15s; }
#army .sq:hover { border-color: rgba(232,189,90,.5); }
#army .sq.sel { border-color: var(--gold); background: rgba(80, 56, 18, .55); }
#army .sq .num { font: 700 15px var(--title); color: var(--gold); grid-row: span 2; text-align: center; }
#army .sq .meta { color: var(--mute); font-size: 11px; grid-column: 2 / 4; }
#army .sq .hpb { height: 3px; grid-column: 2 / 4; background: rgba(0,0,0,.4); border-radius: 2px; overflow: hidden; } #army .sq .hpb i { display: block; height: 100%; background: linear-gradient(90deg, #5fae3a, #a6e06a); }
#army .sq.ally .num { color: #8cf; }
#commands { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 14px; }
#commands button { background: transparent; color: var(--ink); border: 0; border-radius: 10px; padding: 7px 11px; font-size: 12.5px; }
#commands button:hover { background: rgba(255,255,255,.08); }
#toasts { position: absolute; top: 64px; left: 16px; width: 430px; display: flex; flex-direction: column; gap: 6px; }
.toast { background: var(--glass2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--edge); border-left: 3px solid #aaa; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; animation: fade 8s forwards; }
.toast.good { border-left-color: #7cd05a; } .toast.bad { border-left-color: #ff4a3a; } .toast.warn { border-left-color: var(--gold); }
@keyframes fade { 0% { opacity: 0; transform: translateX(-12px); } 4% { opacity: 1; transform: none; } 88% { opacity: 1; } 100% { opacity: 0; } }
#labels .lbl { position: absolute; transform: translate(-50%, -100%); font: 600 13px var(--title); letter-spacing: .06em; text-shadow: 0 1px 3px #000, 0 0 8px #000; white-space: nowrap; text-align: center; }
#labels .lbl small { display: block; font: 500 11px var(--ui); letter-spacing: 0; opacity: .85; }
#labels .sqlbl { position: absolute; transform: translate(-50%, -100%); font: 700 11px var(--ui); color: var(--gold); background: rgba(0,0,0,.45); padding: 1px 6px; border-radius: 6px; }
#labels .sqlbl.sel { background: var(--red); color: #fff; }
#labels .npc { position: absolute; transform: translate(-50%, -100%); font: 500 11px var(--ui); color: #f6dcc8; text-shadow: 0 1px 3px #000; }
#hint-bar { position: absolute; right: 16px; bottom: 16px; font-size: 11.5px; color: var(--mute); padding: 6px 10px; border-radius: 12px; }
/* command wheel */
#wheel { position: absolute; left: 50%; top: 50%; width: 420px; height: 420px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(10,8,6,.15) 0 22%, rgba(16,14,12,.55) 23% 100%); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--edge); }
#wheel .seg { position: absolute; width: 104px; height: 64px; margin: -32px 0 0 -52px; text-align: center; font-size: 12px; color: var(--ink); border-radius: 12px; padding-top: 6px; transition: background .1s, transform .1s; }
#wheel .seg .g { display: block; font-size: 20px; margin-bottom: 2px; }
#wheel .seg.on { background: rgba(232,189,90,.9); color: #1a1208; transform: scale(1.08); }
#wheel .mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 600 12px var(--title); color: var(--gold); letter-spacing: .12em; text-align: center; }
/* build */
#buildbar { position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; align-items: center; }
#buildbar button { background: rgba(255,255,255,.05); color: var(--ink); border: 1px solid transparent; border-radius: 10px; padding: 6px 10px; font-size: 12px; min-width: 86px; }
#buildbar button.on { border-color: var(--gold); background: rgba(232,189,90,.18); }
#buildbar .bt { font: 600 12px var(--title); color: var(--gold); letter-spacing: .1em; padding: 0 10px; }
#buildhint { position: absolute; left: 50%; top: 56%; transform: translateX(-50%); padding: 6px 12px; border-radius: 10px; font-size: 13px; background: var(--glass2); border: 1px solid var(--edge); }
#buildhint.ok { border-color: rgba(100,230,120,.6); } #buildhint.bad { border-color: rgba(255,80,60,.7); color: #ffc0b0; }
/* perf */
#perf { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); font: 11px/1.4 ui-monospace, Consolas, monospace; background: rgba(0,0,0,.6); color: #9f9; padding: 6px 10px; border-radius: 8px; z-index: 15; white-space: pre; pointer-events: none; }
/* panels */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 10; }
#panel { width: min(920px, 94vw); max-height: 88vh; overflow-y: auto; padding: 22px 26px; background: rgba(18, 15, 12, 0.72); border-radius: 20px; scrollbar-width: thin; }
#panel h2 { margin: 0 0 6px; font: 600 24px var(--title); color: var(--gold); letter-spacing: .08em; } #panel h3 { color: var(--gold); margin: 18px 0 8px; font: 600 13px var(--ui); letter-spacing: .14em; text-transform: uppercase; }
#panel p { line-height: 1.5; }
#panel .row { display: flex; gap: 10px; flex-wrap: wrap; }
#panel .card { flex: 1 1 250px; background: rgba(255,255,255,.04); border: 1px solid var(--edge); border-radius: 14px; padding: 12px 14px; }
#panel .card h4 { margin: 0 0 4px; font-size: 14px; } #panel .card .d { color: var(--mute); font-size: 12.5px; margin-bottom: 8px; line-height: 1.45; }
.btn { background: linear-gradient(180deg, #c0342a, #86190f); color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 8px 14px; font-size: 13px; margin: 3px 4px 3px 0; transition: filter .12s, transform .12s; }
.btn:hover { filter: brightness(1.15); } .btn:active { transform: translateY(1px); } .btn:disabled { filter: grayscale(1) brightness(.55); cursor: not-allowed; }
.btn.alt { background: rgba(255,255,255,.07); } .btn.gold { background: linear-gradient(180deg, #f0c766, #b58a2a); color: #1a1208; }
.btn.choice { display: block; width: 100%; text-align: left; padding: 11px 14px; margin: 6px 0; background: rgba(255,255,255,.06); }
.btn.choice:hover { background: rgba(232,189,90,.16); } .btn.choice small { color: var(--mute); }
.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; } .tabs .btn.on { background: rgba(232,189,90,.22); border-color: var(--gold); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; } table.t td, table.t th { padding: 7px 6px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; }
.chk { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--edge); border-radius: 12px; margin: 6px 0; cursor: pointer; background: rgba(255,255,255,.03); }
.chk input { transform: scale(1.3); }
.stance { padding: 2px 9px; border-radius: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; } .stance.war { background: #7a1010; } .stance.truce { background: #6a5a10; } .stance.alliance { background: #1a6a3a; } .stance.tributary { background: #1a4a7a; } .stance.subjugated { background: #555; }
.league { font-size: 11px; color: var(--gold); border: 1px solid var(--line); border-radius: 8px; padding: 1px 7px; margin-left: 6px; }
.kid { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.stat { display: inline-block; min-width: 76px; font-size: 12px; color: var(--mute); } .stat b { color: var(--ink); }
.pbar { height: 6px; background: rgba(0,0,0,.4); border-radius: 4px; overflow: hidden; margin: 6px 0; } .pbar i { display: block; height: 100%; background: linear-gradient(90deg, #b58a2a, #f0c766); }
/* fade-to-black events */
#fade { position: fixed; inset: 0; z-index: 25; background: #000; display: flex; align-items: center; justify-content: center; animation: fadein .9s ease; }
#fade .fade-card { max-width: 640px; text-align: center; padding: 20px; animation: rise 1.4s ease; }
#fade h2 { font: 600 28px var(--title); color: var(--gold); letter-spacing: .1em; margin: 0 0 16px; }
#fade #fade-text { font: 16px/1.65 Georgia, serif; color: #e8e0d0; margin-bottom: 22px; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } } @keyframes rise { from { opacity: 0; transform: translateY(10px); } 40% { opacity: 0; } to { opacity: 1; transform: none; } }
/* menu */
#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-start; padding-left: 8vw; background: radial-gradient(circle at 70% 50%, transparent 0, rgba(0,0,0,.2) 40%, rgba(0,0,0,.82) 100%); z-index: 20; }
.crest { font: 700 13px var(--title); letter-spacing: .6em; color: var(--gold); opacity: .8; }
.menu-inner h1 { font: 600 72px var(--title); margin: 6px 0 0; letter-spacing: .14em; color: var(--gold); text-shadow: 0 6px 30px #000; line-height: 1; }
.menu-inner h1 span { display: block; font-size: 28px; letter-spacing: .62em; color: var(--ink); margin-top: 10px; }
.menu-inner .tag { color: #ddd; text-shadow: 0 2px 8px #000; font-size: 15px; }
#menu-buttons { display: flex; flex-direction: column; gap: 8px; width: 320px; margin-top: 24px; }
#menu-buttons .btn { font-size: 16px; padding: 13px 16px; text-align: left; backdrop-filter: blur(10px); }
#menu-buttons .btn.alt { background: rgba(20,16,12,.5); border-color: var(--edge); }
.foot { color: #999; font-size: 12px; margin-top: 30px; }
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: radial-gradient(circle, #1a140e, #000); z-index: 30; font: 18px var(--title); letter-spacing: .08em; }
#loading .bar { width: 340px; height: 4px; } #loading .bar i { background: linear-gradient(90deg, var(--gold2), var(--gold)); width: 0; }
#mapcanvas { width: 100%; max-height: 68vh; object-fit: contain; border-radius: 14px; border: 1px solid var(--edge); cursor: crosshair; }
.legend { font-size: 12px; color: var(--mute); }
input[type=range] { width: 220px; accent-color: var(--gold); } select { background: #222; color: var(--ink); border: 1px solid var(--edge); border-radius: 8px; padding: 4px 8px; }
