:root {
  --bg: #0b0e13; --panel: #131922; --panel2: #1b2330; --line: #283244; --text: #e6ebf2; --dim: #8b96a8;
  --blue: #3b82f6; --blue2: #1e3a6b; --red: #ef4444; --amber: #f0a530; --green: #3fbf6f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 12px; cursor: pointer; transition: border-color .12s, background .12s, transform .05s; }
button:hover:not(:disabled) { border-color: var(--blue); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: linear-gradient(180deg, #4b8ef7, #2f6fe4); border-color: #4b8ef7; color: #fff; font-weight: 650; }
button.danger { background: #5a1d1d; border-color: #8a2a2a; }
button.small { padding: 4px 9px; font-size: 12px; }
button.on { background: var(--blue2); border-color: var(--blue); }
button.iconbtn { font-size: 18px; padding: 4px 10px; line-height: 1; }
kbd { font: 11px ui-monospace, monospace; padding: 1px 5px; border-radius: 4px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.25); margin-left: 4px; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.neg { color: #ff7b7b; } .pos { color: #6fdc95; } .amber { color: var(--amber); }
small { font-size: 11px; }
img.ico { width: 26px; height: 26px; object-fit: contain; vertical-align: middle; }
img.ico.xs { width: 18px; height: 18px; }
img.ico.lg { width: 34px; height: 34px; margin-right: 4px; }
.grow { flex: 1; }

/* ---- full-screen app layout ---- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#top { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 7px 12px; background: linear-gradient(180deg, #121a2a, #0d121b); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand b { display: block; font-size: 17px; letter-spacing: .5px; }
.brand small { color: var(--dim); }
.badge { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: #0b0d12; border: 2px solid var(--blue); font-weight: 800; font-size: 12px; color: #fff; position: relative; overflow: hidden; }
.badge::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; background: var(--blue); opacity: .8; }
.stat { display: flex; align-items: center; gap: 7px; }
.stat small { display: block; color: var(--dim); font-size: 11px; }
.stat b { font-size: 15px; }
.stat.wide { min-width: 130px; }
.stat.wide .bar { width: 110px; }
@media (max-width: 1250px) { .brand small, .stat.treasury { display: none; } .brand b { font-size: 15px; } }
.pips { display: flex; gap: 4px; margin-top: 3px; }
.pips i { width: 14px; height: 8px; border-radius: 2px; background: #2a3342; }
.pips i.on { background: #ffd34d; box-shadow: 0 0 6px rgba(255,211,77,.6); }
button.next { padding: 9px 16px; }
.bar { display: inline-block; width: 140px; height: 8px; background: #222a36; border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar i { display: block; height: 100%; background: var(--blue); }
.bar.red i { background: var(--red); } .bar.amber i { background: var(--amber); } .bar.green i { background: var(--green); }
.kv .bar { width: 90px; margin-left: 6px; }

#tabs { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
#tabs button { background: transparent; border-color: transparent; }
#tabs button.on { background: var(--panel2); border-color: var(--line); }
#tabs .hint { font-size: 12px; margin-right: 8px; }

#view { flex: 1; min-height: 0; position: relative; }
#cityview { position: absolute; inset: 0; display: flex; }
#mapwrap { flex: 1; min-width: 0; position: relative; overflow: hidden; }
#mapwrap canvas, #tacleft canvas { position: absolute; inset: 0; display: block; cursor: grab; }
canvas.dragging { cursor: grabbing !important; }
#hpanel { flex: none; width: 380px; overflow-y: auto; border-left: 1px solid var(--line); border-radius: 0; }
#pageview { position: absolute; inset: 0; overflow-y: auto; }

.panel { background: var(--panel); padding: 14px; }
.panel h3 { margin: 0 0 2px; font-size: 18px; }
.panel h4, .page h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); }
.hhead { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.hhead img.bimg { width: 84px; height: 84px; object-fit: contain; border-radius: 8px; background: #1a2a1a; border: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #1d2531; }
.kv span { color: var(--dim); }
.people, ul.plain { list-style: none; margin: 0; padding: 0; }
li.person { display: flex; gap: 10px; align-items: center; padding: 5px 0; }
li.person.gone { opacity: .55; }
img.fam { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: #2a2018; flex: none; }
img.fam.sm { width: 30px; height: 30px; border-radius: 6px; vertical-align: middle; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; background: #2a3342; color: #cfd6e2; }
.tag.red { background: #5a1d1d; color: #ffb3b3; } .tag.amber { background: #5a3d10; color: #ffd38a; } .tag.green { background: #163d27; color: #9be7b8; }
.tag img.ico.xs { width: 13px; height: 13px; }
.ops { display: flex; flex-direction: column; gap: 6px; }
button.op { display: flex; align-items: center; gap: 10px; text-align: left; padding: 7px 10px; }
button.op span { display: flex; flex-direction: column; }
button.op small { color: var(--dim); }
button.op img.ico { width: 34px; height: 34px; }
button.op.raid:not(:disabled) { border-color: #b91c1c; background: linear-gradient(180deg, #3a1515, #2a1010); }

.page { padding: 16px 20px; max-width: 1300px; }
.page h2 { margin: 6px 0 4px; display: flex; align-items: center; }
.page h3 { margin: 18px 0 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; }
.card.sel { border-color: var(--blue); }
.card.officer { display: flex; gap: 11px; flex-wrap: wrap; }
.card.officer .obody { flex: 1; min-width: 150px; }
.card.officer > .row, .card.officer > .shopbtns { flex-basis: 100%; }
.card.vcard { display: flex; gap: 12px; align-items: center; }
img.vimg { width: 70px; height: 70px; object-fit: contain; transform: rotate(90deg); }
img.face { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: #0b1020; flex: none; }
img.face.sm { width: 30px; height: 30px; border-radius: 6px; vertical-align: middle; margin: 0 4px; }
.cardhead { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; color: var(--dim); }
.stats b { color: var(--text); }
.stats.big { gap: 8px 22px; margin: 12px 0; }
.stats.big span { display: flex; flex-direction: column; font-size: 12px; }
.stats.big b { font-size: 18px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.shopbtns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tbl { border-collapse: collapse; width: 100%; margin: 8px 0; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--dim); font-weight: 500; font-size: 12px; }
.tbl td.small { font-size: 12px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 4px 0; border-bottom: 1px solid #1b2129; }
.log li.bad { color: #ff9a9a; } .log li.good { color: #8fe0ad; } .log li.big { color: #9fc5ff; font-weight: 600; }

#modal { position: fixed; inset: 0; background: rgba(4, 6, 10, .78); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
#modalbox { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; width: min(760px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#modalbox h2 { margin-top: 0; display: flex; align-items: center; }
.squad label, label.opt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; margin: 5px 0; cursor: pointer; }
.booking { border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin: 8px 0; }
.bhead { display: flex; gap: 10px; align-items: center; }
.charges { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 3px 10px; margin-top: 8px; }
.charges label { font-size: 13px; cursor: pointer; }
.charges label.ok { color: #9be7b8; } .charges label.bad { color: #d9a0a0; } .charges label.soft { color: #d8c59a; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; max-width: min(460px, calc(100vw - 32px)); }
.toast { background: rgba(26,20,10,.96); border: 1px solid var(--amber); padding: 10px 14px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.5); transition: opacity .4s, transform .4s; }
.toast.day { background: rgba(12,20,36,.96); border-color: var(--blue); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---- raid view ---- */
#tac { position: fixed; inset: 0; display: flex; flex-direction: column; background: #05070a; }
#tacbar { flex: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; background: #10151f; border-bottom: 1px solid var(--line); }
#tacbar .hint { font-size: 12px; }
#tacwrap { flex: 1; min-height: 0; display: flex; }
#tacleft { flex: 1; min-width: 0; position: relative; overflow: hidden; }
#tachint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(20, 14, 6, .92); border: 1px solid var(--amber); padding: 6px 12px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 2; }
#tachint.show { opacity: 1; }
#tacside { flex: none; width: 340px; overflow-y: auto; padding: 12px; background: var(--panel); border-left: 1px solid var(--line); }
#tacside .card { margin-bottom: 10px; }
#tacside img.face { width: 56px; height: 56px; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.acts button { display: flex; justify-content: space-between; align-items: center; }
.acts.two { margin-top: 10px; }
.squadlist { list-style: none; padding: 0; margin: 0; }
.squadlist li { padding: 4px 6px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.squadlist li:hover { background: #18202c; }
.squadlist li.on { border-color: var(--blue); background: #142036; }
.squadlist li.down { opacity: .5; }
.tlog li { font-size: 12.5px; }

/* ---- title screen ---- */
#title { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(180deg, rgba(5,8,16,.55) 0%, rgba(5,8,16,.15) 45%, rgba(5,8,16,.85) 100%), url("../assets/title.jpg") center / cover no-repeat, #05080f; }
#title .tinner { text-align: center; max-width: 720px; margin-top: -8vh; }
#title h1 { margin: 6px 0 4px; font-size: clamp(40px, 8vw, 84px); letter-spacing: 6px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 #0b1a3a, 0 0 28px rgba(59,130,246,.65); }
#title h1::after { content: ""; display: block; height: 6px; margin: 10px auto 0; width: 70%; background: linear-gradient(90deg, transparent, #3b82f6, transparent); }
#title .tbadge { display: inline-block; padding: 4px 12px; border: 1px solid #3b82f6; border-radius: 4px; color: #9fc5ff; letter-spacing: 3px; font-size: 12px; background: rgba(10,20,40,.6); }
#title .tag { color: #d6dde8; font-size: 17px; text-shadow: 0 2px 6px #000; background: none; }
.tbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
button.big { padding: 12px 22px; font-size: 16px; background: rgba(20,28,40,.85); }
button.big.primary { background: var(--blue); }
button.big small { opacity: .75; margin-left: 6px; }

@media (max-width: 900px) {
  #cityview { flex-direction: column; }
  #hpanel { width: auto; height: 42%; border-left: 0; border-top: 1px solid var(--line); }
  #tacwrap { flex-direction: column; }
  #tacside { width: auto; height: 38%; border-left: 0; border-top: 1px solid var(--line); }
  #tabs .hint, #tacbar .hint { display: none; }
  .bar { width: 100px; }
}
