:root { --ink: #f1e6cf; --dim: #b9ab90; --gold: #e8b24a; --red: #c8402e; --panel: rgba(22,18,24,0.92); --edge: rgba(232,178,74,0.35); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0a0c14; overflow: hidden; color: var(--ink); font-family: Alegreya, Georgia, serif; touch-action: none; user-select: none; -webkit-user-select: none; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hide { display: none !important; }
button { font-family: inherit; color: inherit; }
.btn { display: block; width: 100%; padding: 13px 16px; margin: 8px 0 0; font-size: 17px; font-weight: 800; background: rgba(60,48,40,0.9); border: 1px solid var(--edge); border-radius: 6px; cursor: pointer; letter-spacing: 0.02em; }
.btn.gold { background: linear-gradient(#c8902e, #9a6418); border-color: #f0c870; color: #1e1408; text-shadow: 0 1px 0 rgba(255,230,170,0.5); }
.btn:active { transform: translateY(1px); filter: brightness(1.15); }
.btn:disabled { opacity: 0.4; }
.small { font-size: 13px; color: var(--dim); }
.kicker { font-family: Cinzel, Georgia, serif; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
h2 { font-family: Cinzel, Georgia, serif; font-size: 22px; margin: 4px 0 8px; line-height: 1.15; }
p { margin: 8px 0; line-height: 1.38; font-size: 16px; }

/* title */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.title-art, .intro-art { position: absolute; inset: 0; background: url(art/siege.webp) center 30% / cover no-repeat; filter: saturate(1.05); }
.intro-art { background-image: url(art/yard.webp); background-position: center 40%; filter: brightness(0.6); }
.title { align-items: flex-end; }
.title::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(10,10,20,0.05) 30%, rgba(10,8,14,0.92) 78%); }
.title-box { position: relative; z-index: 1; width: min(420px, 92vw); padding: 0 0 max(28px, env(safe-area-inset-bottom)); text-align: center; }
.logo { font-family: Cinzel, Georgia, serif; font-weight: 900; font-size: clamp(46px, 14vw, 76px); letter-spacing: 0.06em; color: #f6dfa6; text-shadow: 0 3px 0 #5a2a10, 0 0 30px rgba(255,150,60,0.45); line-height: 1; }
.tag { margin: 10px 0 14px; font-size: 18px; color: var(--ink); text-shadow: 0 1px 4px #000; }
.col { display: flex; flex-direction: column; }
.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.intro-box { position: relative; width: min(440px, 92vw); max-height: 92vh; overflow: auto; }
.how { margin: 10px 0; display: grid; gap: 6px; font-size: 15px; color: var(--dim); }
.how b { color: var(--ink); }
.dim { background: rgba(6,6,10,0.6); }
.menu { width: min(380px, 90vw); text-align: center; max-height: 92vh; overflow: auto; }
.fadein { animation: fadein 0.8s ease both; }
@keyframes fadein { from { opacity: 0; } }

/* night HUD */
.hud { position: fixed; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.top > * { pointer-events: auto; }
.tl { flex: 0 0 auto; }
.nlbl { font-family: Cinzel, Georgia, serif; font-weight: 900; font-size: 16px; text-shadow: 0 1px 3px #000; }
.nlbl span { font-size: 11px; color: var(--dim); }
.bar { position: relative; height: 8px; border-radius: 4px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.15); overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; transition: width 0.2s; }
.bar.dawn { width: 96px; margin-top: 4px; }
.bar.dawn i { background: linear-gradient(90deg, #3a4a8a, #e89a6a); }
.tbars { flex: 1; display: flex; flex-direction: column; gap: 5px; max-width: 220px; margin-left: auto; }
.tbars .bar { height: 14px; }
.tbars .bar b { position: absolute; left: 6px; top: -1px; z-index: 1; font-size: 11px; line-height: 14px; text-shadow: 0 1px 2px #000; letter-spacing: 0.05em; }
.bar.gate i { background: linear-gradient(#a8743a, #6a4420); }
.bar.keep i { background: linear-gradient(#c84a3a, #7a2016); }
.bar.hot { box-shadow: 0 0 10px 2px rgba(255,90,40,0.8); }
.bar.broken { border-color: var(--red); }
.bar.broken b::after { content: ' broken'; color: #ff9a8a; }
.pausebtn { flex: 0 0 auto; width: 38px; height: 34px; border-radius: 6px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); font-size: 13px; }
.crew { position: absolute; left: 0; right: 0; bottom: max(6px, env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 3px; padding: 0 4px; }
.chip { position: relative; width: min(42px, 8.6vw); aspect-ratio: 1 / 1.15; padding: 0; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.25); background: #1e1a22; }
.chip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chip .hp, .chip .nv { position: absolute; bottom: 0; width: 3px; background: #7ad070; }
.chip .hp { left: 0; } .chip .nv { right: 0; background: #7ab0f0; }
.chip em { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 0 4px #000; }
.chip.down { border-color: #ff5a4a; animation: pulse 0.6s infinite alternate; }
.chip.down img { filter: saturate(0.4) brightness(0.7); }
.chip.flee { border-color: #fff; } .chip.flee img { filter: brightness(1.4) saturate(0.3); }
.chip.shaken { border-color: #7ab0f0; }
.chip.dead img { filter: grayscale(1) brightness(0.35); }
.chip.sel { outline: 2px solid #78dcff; }
@keyframes pulse { to { box-shadow: 0 0 12px 3px rgba(255,80,60,0.9); } }
.act { position: absolute; right: 12px; bottom: calc(max(6px, env(safe-area-inset-bottom)) + 62px); min-width: 150px; padding: 16px 18px; font-size: 18px; font-weight: 800; border-radius: 40px; background: linear-gradient(#d89a36, #a0641c); color: #1e1408; border: 2px solid #ffd88a; box-shadow: 0 4px 18px rgba(0,0,0,0.5), 0 0 22px rgba(255,170,60,0.5); animation: actin 0.18s ease both; }
.act.cauldron { background: linear-gradient(#f0a030, #b05a10); }
.act.ally { background: linear-gradient(#7ac870, #3a7a30); border-color: #c0f0b0; }
.act.bridge { background: linear-gradient(#e86a4a, #a02a18); border-color: #ffb8a0; color: #fff; }
@keyframes actin { from { transform: scale(0.6); opacity: 0; } }
.rally { position: absolute; left: 12px; bottom: calc(max(6px, env(safe-area-inset-bottom)) + 62px); width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: rgba(40,30,30,0.75); border: 2px solid rgba(255,220,140,0.4); font-family: Cinzel, Georgia, serif; font-weight: 900; font-size: 12px; }
.rally span { position: relative; z-index: 1; }
.rally i { position: absolute; left: 0; right: 0; top: 0; background: rgba(0,0,0,0.6); }
.rally.ready { border-color: #ffd88a; box-shadow: 0 0 16px rgba(255,200,100,0.6); background: rgba(120,40,30,0.85); }
.mebar { position: absolute; left: 12px; bottom: calc(max(6px, env(safe-area-inset-bottom)) + 132px); width: 64px; height: 7px; border-radius: 4px; background: rgba(0,0,0,0.6); overflow: hidden; border: 1px solid rgba(255,255,255,0.2); }
.mebar i { position: absolute; left: 0; top: 0; bottom: 0; background: #f0c050; }
.mebar.down i { background: #c8402e; }
.hint, .toast { position: absolute; left: 50%; transform: translateX(-50%); width: max-content; max-width: 86vw; padding: 9px 14px; border-radius: 8px; font-size: 15px; text-align: center; pointer-events: none; }
.hint { bottom: calc(max(6px, env(safe-area-inset-bottom)) + 142px); background: rgba(20,16,10,0.88); border: 1px solid var(--edge); color: #ffe6b0; }
.toast { top: 96px; background: rgba(40,10,10,0.85); border: 1px solid rgba(255,120,100,0.4); }
.banner { position: absolute; left: 0; right: 0; top: 26%; text-align: center; pointer-events: none; animation: banner 2.6s ease both; }
.banner b { display: block; font-family: Cinzel, Georgia, serif; font-weight: 900; font-size: clamp(30px, 9vw, 52px); color: #f6dfa6; text-shadow: 0 3px 0 #3a1a08, 0 0 24px rgba(255,140,60,0.6); }
.banner span { display: block; margin-top: 4px; font-size: 18px; color: var(--ink); text-shadow: 0 1px 4px #000; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* the day */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 60vh; overflow: auto; padding: 14px 16px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(24,20,24,0.9), rgba(16,12,16,0.97)); border-top: 1px solid var(--edge); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.5); }
@media (min-width: 700px) { .sheet { left: 50%; transform: translateX(-50%); width: 560px; } }
.sheet.rise { animation: rise 0.35s ease both; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 700px) { @keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); } } }
.sheet .row.dead { color: #ffb0a0; }
.sheet .row.hurt { color: #ffd8a0; }
.sheet .row.good { color: #b8f0b0; }
.sheet .row.say { font-style: italic; color: var(--dim); }
.sheet .row.say b { font-style: normal; color: var(--gold); }
.sheet .row.intel { color: #ffe0b0; }
.faces { display: flex; gap: 6px; margin: 6px 0; }
.faces img { width: 46px; height: 46px; border-radius: 6px; border: 1px solid var(--edge); }
.faces img.dead { filter: grayscale(0.8) brightness(0.7); }
.btns { display: flex; flex-direction: column; margin-top: 6px; }
.jobs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.job { text-align: left; padding: 10px; border-radius: 8px; background: rgba(50,40,36,0.85); border: 1px solid rgba(255,255,255,0.12); cursor: pointer; }
.job b { display: block; font-size: 15px; }
.job span { display: block; font-size: 13px; color: var(--dim); margin: 3px 0; line-height: 1.25; }
.job em { font-size: 11px; color: var(--gold); font-style: normal; letter-spacing: 0.04em; }
.job.on { background: rgba(120,80,30,0.9); border-color: #f0c870; box-shadow: inset 0 0 0 1px #f0c870; }
.job.on span { color: var(--ink); }
.posts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 8px 0; }
.post { min-height: 70px; border-radius: 7px; padding: 4px; background: rgba(60,60,72,0.55); border: 1px solid rgba(255,255,255,0.1); cursor: pointer; }
.post.p-gate, .post.p-yard { background: rgba(70,52,40,0.55); }
.post.p-yard { grid-column: span 2; }
.pname { font-size: 11px; color: var(--dim); line-height: 1.15; min-height: 26px; }
.pfaces { display: flex; flex-wrap: wrap; gap: 3px; }
.pfaces img { width: 32px; height: 32px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.25); cursor: pointer; }
.pfaces img.picked { outline: 2px solid #78dcff; transform: scale(1.1); }
.who { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; pointer-events: none; }
.who img { width: 44px; height: 44px; border-radius: 6px; }
.who b { display: block; } .who span { font-size: 13px; color: var(--dim); }
.who .hpb, .who .nvb { display: block; width: 110px; height: 5px; margin-top: 4px; background: rgba(0,0,0,0.6); border-radius: 3px; overflow: hidden; }
.who .hpb i, .who .nvb i { display: block; height: 100%; background: #7ad070; }
.who .nvb i { background: #7ab0f0; }
.roll { display: grid; gap: 6px; margin: 10px 0; text-align: left; }
.rollrow { display: flex; gap: 10px; align-items: center; }
.rollrow img { width: 40px; height: 40px; border-radius: 6px; }
.rollrow b { display: block; } .rollrow span { font-size: 12px; color: var(--dim); } .rollrow em { display: block; font-size: 13px; color: #cfe8c0; font-style: normal; }
.rollrow.gone em { color: #e0a090; } .rollrow.gone img { filter: grayscale(1) brightness(0.6); }
