/* ===== GUERRA DO CASTELO — mesma skin do MU Idle Temporada (texturas em /static/img/ui) ===== */
@font-face { font-family:'Roboto'; font-weight:400; font-display:swap; src:url('/static/fonts/Roboto-Regular.woff2') format('woff2'); }
@font-face { font-family:'Roboto'; font-weight:700; font-display:swap; src:url('/static/fonts/Roboto-Bold.woff2') format('woff2'); }
* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --bg:#060606; --panel:#0c0c0c; --border:#3b301d;
  --gold:#b08d4f; --gold2:#ffcf8c; --red:#c62828; --text:#e8e0d0; --muted:#9e9689; --green:#7bd88f; --bad:#ff7a6b;
}
html { -webkit-text-size-adjust:100%; }
body {
  background:var(--bg); color:var(--text); min-height:100vh; overflow-x:hidden;
  font-family:'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size:14px; line-height:1.4;
}
body::before {
  content:''; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:linear-gradient(180deg, #000000b0 0%, #00000080 35%, #000000d8 100%), url('/static/img/ui/bg.jpg') center top / cover no-repeat;
}
.hidden { display:none !important; }
.muted { color:var(--muted); }
.center { text-align:center; }
.tiny-text { font-size:11.5px; line-height:1.4; }
.good { color:var(--green); } .bad { color:var(--bad); } .gold { color:var(--gold2); }
a { color:var(--gold2); }
button { font-family:inherit; cursor:pointer; color:inherit; }
button:disabled { cursor:default; opacity:.45; }
b { font-weight:700; }

.logo { font-family:Georgia, serif; font-size:34px; letter-spacing:3px; color:#efe6d2; text-align:center; filter:drop-shadow(0 2px 0 #000) drop-shadow(0 0 10px #b08d4f44); }
.logo span { background:linear-gradient(180deg, #fff0c2, #ffcf8c 45%, #b08d4f 75%, #6a4a1c); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.logo.small { font-size:17px; letter-spacing:1.5px; line-height:1; text-align:left; }
.boot { position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:16px; }
.boot-sub { letter-spacing:8px; color:var(--gold); font-weight:700; font-size:12px; text-align:center; }
.boot-spin { margin-top:22px; width:34px; height:34px; border:3px solid #3b301d; border-top-color:var(--gold2); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ---- botões / campos ---- */
.btn {
  background:none; border:1px solid transparent; border-image:url('/static/img/ui/btn.png') 12 fill / 10px stretch;
  color:#e3d9c4; font-weight:700; font-size:13px; padding:10px 14px; text-align:center;
}
.btn:hover:not(:disabled) { border-image-source:url('/static/img/ui/btn_h.png'); color:#fff0c2; }
.btn:active:not(:disabled) { border-image-source:url('/static/img/ui/btn_p.png'); }
.btn.gold { border-image:url('/static/img/ui/cta.png') 12 fill / 10px stretch; color:#ffe9b8; }
.btn.gold:hover:not(:disabled) { border-image-source:url('/static/img/ui/cta_h.png'); color:#fff; }
.btn.wide { width:100%; }
.btn.sm { padding:7px 10px; font-size:12px; }
.btn.link { border-image:none; border:0; color:var(--muted); text-decoration:underline; font-weight:400; padding:6px; }
input, select {
  width:100%; background:none; color:var(--text); font:inherit; padding:11px 12px; margin:6px 0;
  border:1px solid transparent; border-image:url('/static/img/ui/input.png') 8 fill / 8px stretch; outline:none;
}
select option { background:#111; }
.row { display:flex; gap:8px; align-items:center; }
.row > * { flex:1; min-width:0; }
.row > .fit { flex:0 0 auto; }

/* ---- painéis ---- */
.panel {
  position:relative; background:var(--panel) url('/static/img/ui/leather.jpg'); border:5px solid transparent;
  border-image:url('/static/img/ui/frame.png') 56 / 30px / 4px stretch; box-shadow:0 10px 30px #000c; padding:20px 16px 16px; margin:14px 0;
}
.panel h3 { font-size:12px; letter-spacing:2.5px; text-transform:uppercase; color:var(--gold2); margin:2px 0 8px; }
.panel h3 small { letter-spacing:0; text-transform:none; color:var(--muted); font-weight:400; font-size:11.5px; margin-left:6px; }
.panel p + p { margin-top:6px; }
.line { display:flex; justify-content:space-between; gap:10px; align-items:center; padding:8px 0; border-bottom:1px solid #2a2216; }
.line:last-child { border-bottom:0; }
.line .sub { font-size:11.5px; color:var(--muted); }
.line > div:first-child { min-width:0; }
.pill { display:inline-block; font-size:10.5px; font-weight:700; letter-spacing:.5px; padding:2px 7px; border:1px solid var(--border); border-radius:10px; color:var(--muted); vertical-align:1px; }
.pill.gold { color:var(--gold2); border-color:var(--gold); }
.dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:6px; vertical-align:0; box-shadow:0 0 0 1px #000; }
.gname.gold { color:var(--gold2); text-shadow:0 0 8px #b08d4f88; }
.note { border-left:3px solid var(--gold); background:#00000066; padding:9px 11px; font-size:12.5px; margin:10px 0; }
.note.red { border-left-color:var(--red); }

/* ---- entrada ---- */
.enter { max-width:420px; margin:0 auto; padding:34px 16px 60px; }
.pitch { text-align:center; margin:16px 6px 0; color:#d8cfbd; }
.or { text-align:center; color:var(--muted); font-size:11px; letter-spacing:3px; text-transform:uppercase; margin:14px 0 10px; }
.sso-nick { text-align:center; font-size:22px; font-weight:700; color:var(--gold2); margin:2px 0; }

/* ---- topo ---- */
#topbar {
  display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; padding:9px 12px; position:sticky; top:0; z-index:5;
  background:#0b0b0b url('/static/img/ui/leather.jpg'); border-bottom:1px solid var(--gold); box-shadow:0 1px 0 #000, 0 2px 0 #6a4a1c, 0 8px 20px #000a;
}
.brand { display:flex; flex-direction:column; gap:3px; }
.season-tag { font-size:10.5px; letter-spacing:1px; color:var(--gold); font-weight:700; max-width:52vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.clock {
  margin-left:auto; padding:6px 11px; color:var(--gold2); font-weight:700; font-size:12px; background:none; font-variant-numeric:tabular-nums;
  border:1px solid transparent; border-image:url('/static/img/ui/money.png') 10 fill / 8px stretch;
}
.clock.siege { color:#ff9a8a; }
.topstats { display:flex; gap:6px; flex-basis:100%; }
.topstat {
  flex:1; display:flex; gap:5px; align-items:center; justify-content:center; font-weight:700; font-size:12.5px; padding:5px 4px; min-width:0;
  border:1px solid transparent; border-image:url('/static/img/ui/money.png') 10 fill / 8px stretch; font-variant-numeric:tabular-nums;
}
.topstat img { height:15px; width:auto; }
.topstat i { font-style:normal; color:var(--muted); font-weight:400; font-size:10.5px; }
.devbar { display:flex; gap:6px; align-items:center; padding:5px 12px; background:#1a1206; border-bottom:1px dashed #6a4a1c; font-size:11px; overflow-x:auto; }
.devbar span { color:var(--gold); font-weight:700; letter-spacing:2px; text-transform:uppercase; }
.devbar button { background:#2a1e0c; border:1px solid #6a4a1c; color:var(--gold2); padding:4px 8px; font-size:11px; white-space:nowrap; }

#view { max-width:620px; margin:0 auto; padding:2px 12px 96px; }
#tabs {
  position:fixed; left:0; right:0; bottom:0; z-index:6; display:flex; background:#0b0b0b url('/static/img/ui/leather.jpg');
  border-top:1px solid var(--gold); padding:6px 6px calc(6px + env(safe-area-inset-bottom)); gap:4px; box-shadow:0 -8px 20px #000a;
}
#tabs button {
  flex:1; background:none; border:1px solid transparent; border-image:url('/static/img/ui/btn.png') 12 fill / 7px stretch;
  color:var(--muted); font-weight:700; padding:10px 2px; font-size:12px; position:relative;
}
#tabs button.on { border-image-source:url('/static/img/ui/btn_h.png'); color:var(--gold2); }
#tabs button .badge { position:absolute; top:4px; right:8px; width:8px; height:8px; border-radius:50%; background:var(--red); }

/* ---- mapa ---- */
.mapwrap { margin:12px -4px 0; }
svg.map { width:100%; height:auto; display:block; touch-action:manipulation; }
.map .edge { stroke:#6a4a1c; stroke-width:2; stroke-dasharray:3 5; opacity:.8; }
.map .edge.castle { stroke:#3b301d; stroke-dasharray:1 6; }
.map .node { cursor:pointer; }
.map .node circle.body { stroke-width:2.5; }
.map .node:hover circle.body { filter:brightness(1.35); }
.map .node text { fill:#efe6d2; font-size:10.5px; font-weight:700; text-anchor:middle; paint-order:stroke; stroke:#000; stroke-width:3px; }
.map .node text.own { fill:#cfc6b4; font-size:8.5px; font-weight:400; }
.map .node text.glyph { font-size:15px; stroke-width:2px; }
.map .node.mine circle.body { stroke-dasharray:none; }
.map .node .ring { fill:none; stroke:var(--gold2); stroke-width:2; stroke-dasharray:4 4; animation:march 1.2s linear infinite; }
.map .node .ring.def { stroke:var(--green); }
.map .node .can { fill:none; stroke:#ff7a6b; stroke-width:1.5; opacity:.7; }
@keyframes march { to { stroke-dashoffset:-16; } }
.legend { display:flex; flex-wrap:wrap; gap:4px 12px; font-size:11px; color:var(--muted); justify-content:center; margin-top:4px; }
.order-card { display:flex; gap:10px; align-items:center; justify-content:space-between; }
.order-card b { color:var(--gold2); }

/* ---- barras de batalha ---- */
.vs { margin:10px 0 4px; }
.vs .lbl { display:flex; justify-content:space-between; font-size:12px; margin-bottom:3px; }
.bar { height:14px; background:#000; border:1px solid #3b301d; overflow:hidden; }
.bar > i { display:block; height:100%; width:0; transition:width .9s ease-out; }
.phases { display:flex; gap:6px; flex-wrap:wrap; margin:8px 0 2px; }
.phase { font-size:11.5px; padding:3px 8px; border:1px solid var(--border); opacity:0; transform:translateY(4px); transition:all .35s; }
.phase.show { opacity:1; transform:none; }
.phase.ok { color:var(--green); border-color:#3d6b47; }
.phase.no { color:var(--bad); border-color:#7a2e26; }
.result { font-weight:700; margin-top:6px; opacity:0; transition:opacity .4s; }
.result.show { opacity:1; }
.battle + .battle { border-top:1px solid #2a2216; margin-top:12px; padding-top:10px; }

/* ---- exército ---- */
.unit { display:grid; grid-template-columns:1fr auto; gap:4px 10px; padding:10px 0; border-bottom:1px solid #2a2216; align-items:center; }
.unit:last-of-type { border-bottom:0; }
.unit .n { font-size:18px; font-weight:700; color:var(--gold2); font-variant-numeric:tabular-nums; }
.unit .acts { display:flex; gap:6px; }
.big { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; text-align:center; margin:8px 0; }
.big div { border:1px solid transparent; border-image:url('/static/img/ui/money.png') 10 fill / 8px stretch; padding:8px 2px; }
.big b { display:block; font-size:18px; color:var(--gold2); font-variant-numeric:tabular-nums; }
.big span { font-size:10.5px; color:var(--muted); letter-spacing:1px; text-transform:uppercase; }
.capbar { height:8px; background:#000; border:1px solid #3b301d; margin:6px 0 2px; }
.capbar i { display:block; height:100%; background:linear-gradient(90deg, #6a4a1c, #ffcf8c); }

/* ---- loja ---- */
.prod { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; padding:12px 0; border-bottom:1px solid #2a2216; }
.prod:last-child { border-bottom:0; }
.prod .price { font-size:12px; color:var(--muted); }

/* ---- folha / aviso ---- */
.overlay { position:fixed; inset:0; z-index:20; background:#000c; display:flex; align-items:flex-end; justify-content:center; }
.overlay-box {
  width:100%; max-width:560px; max-height:88vh; overflow-y:auto; background:#0c0c0c url('/static/img/ui/leather.jpg');
  border:5px solid transparent; border-image:url('/static/img/ui/frame.png') 56 / 30px / 4px stretch; padding:24px 18px calc(18px + env(safe-area-inset-bottom));
}
.overlay-box h2 { font-family:Georgia, serif; font-size:21px; letter-spacing:1.5px; color:var(--gold2); text-align:center; }
.overlay-box h2::after { content:''; display:block; height:10px; max-width:260px; margin:8px auto 10px; background:url('/static/img/ui/divider.png') center / 100% 100% no-repeat; }
.overlay-box .acts { display:flex; flex-direction:column; gap:8px; margin-top:14px; }
.toast {
  position:fixed; left:50%; bottom:84px; transform:translateX(-50%); z-index:30; max-width:92vw; background:#150d06; border:1px solid var(--gold);
  color:#ffe9b8; padding:10px 14px; font-size:13px; box-shadow:0 8px 24px #000; text-align:center;
}
.toast.err { border-color:var(--red); color:#ffc9c2; }

.pix-qr { width:210px; height:210px; background:#fff; padding:8px; border:1px solid var(--gold); margin:10px auto; display:block; }
.copy-row { display:flex; gap:6px; align-items:center; }
.copy-row input { margin:0; font-size:12px; }
.btn.fit { flex:0 0 auto; }
#pp-buttons { min-height:100px; margin-top:10px; background:#fff; padding:12px 12px 2px; }
#pp-buttons.loading { background:#ffffff18; }
a.btn.hidden { display:none !important; }
.foot { text-align:center; font-size:11px; color:var(--muted); padding:0 12px 28px; }

@media (min-width:700px) {
  .overlay { align-items:center; }
  .logo { font-size:44px; }
  .topstats { flex-basis:auto; }
  .topstat { padding:5px 12px; }
  .clock { margin-left:auto; }
}
