:root {
  --bg: #120e0b;
  --bg2: #1b1510;
  --panel: #221a13;
  --panel2: #2a2018;
  --line: #3b2e22;
  --line2: #4c3b2b;
  --text: #ece3d4;
  --muted: #a8977f;
  --gold: #e9b949;
  --gold2: #ffd27a;
  --ember: #ff8a3d;
  --red: #e0533f;
  --green: #79c25a;
  --blue: #8cc4ff;
  --grain: #e7c55a;
  --timber: #c58b52;
  --stone: #b8b2a7;
  --ore: #8fb6d6;
  --r: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #2b1d12 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: Cinzel, Georgia, serif; font-weight: 700; letter-spacing: .02em; margin: 0 0 .5em; }
h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h3 { font-size: 15px; }
h4 { font-size: 13px; margin-top: 1em; color: var(--muted); }
h2 small, h3 small { font: 400 12px Inter, sans-serif; letter-spacing: 0; }
p { margin: 0 0 .6em; }
a { color: var(--gold2); }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; margin-top: 8px; }
.bad { color: var(--red); }
.good { color: var(--green); }
.warn { color: var(--ember); }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
input, select, button { font: inherit; color: inherit; }
input {
  background: #120d09; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input:focus { outline: 2px solid rgba(233, 185, 73, .5); outline-offset: 0; }
input[type=range] { padding: 0; accent-color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover:not(:disabled) { background: #36291e; border-color: #6a5238; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#e9b949, #c98e2a); color: #20150a; border-color: #f2cd72; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(#f4c75a, #d69a31); }
.btn.danger { background: linear-gradient(#d6513a, #a5321f); border-color: #ef7a62; color: #fff; }
.btn.ember { border-color: #8a4b22; color: var(--ember); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.glow { box-shadow: 0 0 0 0 rgba(233, 185, 73, .6); animation: glow 1.8s infinite; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(233, 185, 73, .55); } 70% { box-shadow: 0 0 0 12px rgba(233, 185, 73, 0); } 100% { box-shadow: 0 0 0 0 rgba(233, 185, 73, 0); } }
.link { background: none; border: 0; color: var(--muted); font: 400 12px Inter, sans-serif; text-decoration: underline; cursor: pointer; padding: 0 4px; }
.iconbtn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line2);
  background: var(--panel2); cursor: pointer; font-size: 18px; font-weight: 700;
}
.iconbtn:hover { border-color: #6a5238; }

/* ------------------------------------------------ auth */
body.auth { overflow-y: auto; }
.splash { max-width: 1120px; margin: 0 auto; padding: 48px 20px; display: grid; grid-template-columns: 1fr 360px; gap: 36px; align-items: start; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #e9b949, #a8621f); color: #1d1208; box-shadow: 0 4px 16px rgba(233, 140, 40, .35); }
.brand-mark .ic { width: 24px; height: 24px; }
.brand b { font-family: Cinzel, serif; font-size: 16px; display: block; line-height: 1.1; letter-spacing: .06em; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.brand.big .brand-mark { width: 64px; height: 64px; border-radius: 16px; }
.brand.big .brand-mark .ic { width: 40px; height: 40px; }
.brand.big h1 { font-size: 44px; margin: 0; line-height: 1; letter-spacing: .06em; background: linear-gradient(#ffe2a0, #e9a23b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand.big p { margin: 4px 0 0; color: var(--muted); letter-spacing: .3em; text-transform: uppercase; font-size: 13px; }
.lede { font-size: 17px; color: #d8ccb8; max-width: 620px; margin: 22px 0 28px; }
.horde-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.horde-card { background: linear-gradient(180deg, color-mix(in srgb, var(--fc) 14%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, var(--fc) 40%, var(--line)); border-radius: var(--r); padding: 16px; }
.horde-card h3 { color: var(--fc); margin-top: 8px; }
.horde-card p { color: var(--muted); font-size: 13px; margin: 0; }
.horde-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--fc) 22%, transparent); color: var(--fc); }
.horde-ic .ic { width: 26px; height: 26px; }
.auth-box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; position: sticky; top: 24px; }
.auth-box label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.auth-box input { font-size: 15px; padding: 10px 12px; color: var(--text); }
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; background: #140f0b; border-radius: 10px; padding: 4px; }
.tabs2 button { border: 0; background: none; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs2 button.on { background: var(--panel2); color: var(--gold2); }
.err { background: rgba(224, 83, 63, .12); border: 1px solid rgba(224, 83, 63, .4); color: #ffb3a6; padding: 8px 10px; border-radius: 8px; }

/* ------------------------------------------------ shell */
body.game { height: 100vh; height: 100dvh; overflow: hidden; }
body.game #app { display: grid; height: 100%; grid-template-columns: 200px 1fr 300px; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top top top" "alerts alerts alerts" "nav view chat"; }
.top { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: linear-gradient(#1f1710, #18120d); border-bottom: 1px solid var(--line); }
.resbar { display: flex; gap: 8px; flex: 1; justify-content: center; flex-wrap: wrap; }
.res { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #140f0b; border: 1px solid var(--line); }
.res b { font-variant-numeric: tabular-nums; min-width: 42px; }
.res small { color: var(--muted); font-size: 11px; }
.res.grain .ic { color: var(--grain); } .res.timber .ic { color: var(--timber); } .res.stone .ic { color: var(--stone); } .res.ore .ic { color: var(--ore); }
.res.full { border-color: #7a5a1e; }
.res.full b { color: var(--gold2); }
.top-right { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: #140f0b; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pill.ember .ic { color: var(--ember); }
.pill.shield { color: var(--blue); border-color: #2f4a66; }
#alerts { grid-area: alerts; }
.alert { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: linear-gradient(90deg, color-mix(in srgb, var(--fc) 35%, #2a0f0a), #1c120d); border-bottom: 1px solid color-mix(in srgb, var(--fc) 60%, transparent); animation: pulse 2s infinite; }
.alert .ic { color: var(--fc); }
.alert > span:first-of-type { flex: 1; }
.alert-t b { font-variant-numeric: tabular-nums; color: #fff; }
@keyframes pulse { 50% { background-color: rgba(224, 83, 63, .12); } }
.nav { grid-area: nav; display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; border-right: 1px solid var(--line); background: #17110c; }
.nav button { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); font-weight: 600; text-align: left; }
.nav button:hover { color: var(--text); background: #20180f; }
.nav button.on { color: var(--gold2); background: var(--panel2); border-color: var(--line2); }
.nav .badge { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: var(--red); color: #fff; font-style: normal; font-size: 11px; border-radius: 999px; padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
.only-mobile { display: none !important; }
#view { grid-area: view; overflow-y: auto; padding: 18px; min-width: 0; min-height: 0; }
#view[data-view=map] { padding: 0; overflow: hidden; position: relative; }
.chat { grid-area: chat; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #17110c; padding: 12px; min-height: 0; }
.chat h3 { display: flex; gap: 8px; align-items: center; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; min-height: 0; }
.msg { font-size: 13px; word-wrap: break-word; }
.msg small { color: #7d6d58; font-size: 11px; }
.msg b { color: var(--gold2); }
.msg.sys { background: rgba(255, 138, 61, .08); border-left: 2px solid var(--ember); padding: 4px 8px; border-radius: 4px; }
.msg.sys b { color: var(--ember); }
.chat form { display: flex; gap: 6px; margin-top: 8px; }
.chat input { flex: 1; }

/* ------------------------------------------------ cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.grid { display: grid; gap: 12px; }
.buildings { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.tip { margin-top: 16px; }

.hero-card { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: linear-gradient(135deg, #2c2016, #1d1610); border: 1px solid var(--line2); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.hero-main { display: flex; gap: 14px; align-items: center; }
.hero-main h2 { margin-bottom: 4px; font-size: 22px; }
.crest { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #4a3520, #1e150d); border: 1px solid #6a5238; color: var(--gold); }
.crest .ic { width: 32px; height: 32px; }
.hero-stats { display: flex; gap: 22px; align-items: center; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.hero-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.zone { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.zone.haven { background: rgba(121, 194, 90, .15); color: var(--green); }
.zone.frontier { background: rgba(224, 83, 63, .15); color: #ff9b85; }

.queue .q-row, .q-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.queue .q-row > span:first-child { flex: 1; }
.queue.idle { color: var(--muted); border-style: dashed; }
.cd { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold2); }
.bar { height: 6px; background: #120d09; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c98e2a, #ffd27a); transition: width .4s linear; }

.bcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bcard header { display: flex; gap: 10px; align-items: center; }
.bcard h3 { margin: 0; }
.bcard .lvl { color: var(--gold); font-size: 12px; font-weight: 700; }
.bcard.unbuilt { border-style: dashed; }
.bcard.unbuilt .lvl { color: var(--muted); }
.bcard.busy { border-color: #8a6a2a; box-shadow: inset 0 0 0 1px rgba(233, 185, 73, .2); }
.b-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #160f0a; border: 1px solid var(--line2); color: var(--gold); }
.b-ic .ic { width: 22px; height: 22px; }
.blurb { color: var(--muted); font-size: 12.5px; margin: 0; }
.eff { display: flex; flex-direction: column; font-size: 12.5px; margin: 0; }
.eff .next { color: var(--green); }
.cost { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cost span { display: inline-flex; align-items: center; gap: 3px; }
.cost .ic { width: 15px; height: 15px; }
.cost .short { color: var(--red); }
.bcard .btn { margin-top: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.uchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; background: #160f0a; border: 1px solid var(--line2); font-size: 12.5px; white-space: nowrap; }
.uchip i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 10px; background: #4a3520; color: var(--gold2); }
.uchip.back i { background: #23394d; color: #b9dcff; }
.uchip b { color: var(--gold2); }
.units h2 { margin-bottom: 12px; }
.ucard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.ucard header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ucard.locked { opacity: .6; }
.tag { font-size: 11px; color: var(--muted); }
.stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.stats b { color: var(--text); font-size: 13px; }
.strong { font-size: 12px; color: var(--green); margin: 0; }
form.train { display: flex; gap: 8px; }
form.train input { width: 90px; }
form.train .btn.primary { flex: 1; }
.march-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; background: #1d160f; }
.march-row.back { opacity: .85; }
.march-row.incoming { border-color: #7a2a1e; background: #2a130d; }
.loot { display: inline-flex; gap: 6px; margin-left: 6px; color: var(--muted); }
.loot .ic { width: 14px; height: 14px; }

/* ------------------------------------------------ quests */
.chronicle .chap { color: var(--ember); font-size: 11px; text-transform: uppercase; letter-spacing: .16em; font-weight: 700; margin-bottom: 6px; }
.chronicle h2 { font-size: 22px; }
.story { font-family: Georgia, serif; font-size: 15px; color: #dccfb9; font-style: italic; border-left: 3px solid #6a5238; padding-left: 12px; }
.objs { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.objs li { display: flex; flex-direction: column; gap: 4px; }
.objs li.ok > span::before { content: '✓ '; color: var(--green); }
.pbar { position: relative; height: 18px; background: #120d09; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.pbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #8a5d1d, #d69a31); }
.pbar.done i { background: linear-gradient(90deg, #3f7a2c, #79c25a); }
.pbar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.pbar.heat { height: 8px; margin-top: 4px; }
.pbar.heat i { background: linear-gradient(90deg, #6a3b1e, var(--fc)); }
.reward { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.reward > span { display: inline-flex; align-items: center; gap: 4px; }
.reward .ember { color: var(--ember); }
.bounty { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.bounty.claimed { opacity: .5; }
.bounty .b-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bounty .btn { align-self: flex-end; }
.standing { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.standing > div { flex: 1; }
.standing small { display: block; color: var(--muted); }
.f-ic { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--fc) 22%, transparent); color: var(--fc); }

/* ------------------------------------------------ reports */
.reports { grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); }
#replist { display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow-y: auto; }
.rep { display: flex; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--muted); }
.rep:hover { background: #20180f; }
.rep.on { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.rep.unseen b { color: var(--text); }
.rep.unseen::before { content: ''; width: 7px; height: 7px; background: var(--ember); border-radius: 50%; margin-top: 6px; flex: none; }
.rep small { white-space: nowrap; }
.rep b { flex: 1; font-weight: 600; }
.rep-head { border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.rep-head.win { background: linear-gradient(90deg, rgba(121, 194, 90, .18), transparent); border-left: 3px solid var(--green); }
.rep-head.loss { background: linear-gradient(90deg, rgba(224, 83, 63, .18), transparent); border-left: 3px solid var(--red); }
.rep-head > span { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.rep-head.win > span { color: var(--green); } .rep-head.loss > span { color: var(--red); }
.rep-head h3 { margin: 4px 0; font-size: 18px; }
.loot-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.loot-line span { display: inline-flex; gap: 4px; align-items: center; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 6px; border-bottom: 1px solid #2a2018; }
.tbl tr.me td { background: rgba(233, 185, 73, .08); color: var(--gold2); }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); }

/* ------------------------------------------------ map */
.map-wrap { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); }
.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }
.map-tools { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.legend { pointer-events: none; position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; flex-wrap: wrap; background: rgba(18, 14, 11, .85); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted); max-width: calc(100% - 360px); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-block; width: 11px; height: 11px; }
.lg.hold { background: var(--gold); border-radius: 3px 3px 6px 6px; }
.lg.camp { background: #1a120c; border: 2px solid var(--fc); transform: rotate(45deg); width: 9px; height: 9px; }
.lg.front { border: 2px dashed rgba(230, 120, 60, .8); }
.map-panel { border-left: 1px solid var(--line); background: var(--panel); padding: 14px; overflow-y: auto; }
.tile-head { margin-bottom: 12px; }
.camp-card .ch { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.camp-card h3 { color: var(--fc); margin: 0; }
.hold-card.mine h3 { color: var(--gold2); }
.inc-mini { margin-top: 14px; padding: 8px 10px; border-radius: 8px; background: #2a130d; border: 1px solid #7a2a1e; font-size: 12.5px; }
.inc-mini .ic { color: var(--red); }

/* ------------------------------------------------ modal + toasts */
.modal-wrap { position: fixed; inset: 0; background: rgba(5, 3, 2, .7); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(3px); }
.modal { position: relative; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.modal-x { position: absolute; right: 10px; top: 8px; background: none; border: 0; font-size: 24px; color: var(--muted); cursor: pointer; }
.march-units { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.mu { display: grid; grid-template-columns: 150px 1fr 70px auto; gap: 8px; align-items: center; }
.mu small { color: var(--muted); }
.forecast { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.fc-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.fc-row span { display: inline-flex; gap: 4px; align-items: center; }
.fc-verdict { padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.fc-verdict.good { background: rgba(121, 194, 90, .12); color: #bfe8a8; }
.fc-verdict.warn { background: rgba(255, 138, 61, .12); color: #ffc79e; }
.fc-verdict.bad { background: rgba(224, 83, 63, .14); color: #ffb3a6; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast.bad { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--ember); }
.toast.out { opacity: 0; transform: translateX(20px); }

/* ------------------------------------------------ responsive */
@media (max-width: 1200px) {
  body.game #app { grid-template-columns: 180px 1fr; grid-template-areas: "top top" "alerts alerts" "nav view"; }
  .chat { position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 90vw); z-index: 40; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.chat-open .chat { transform: none; }
  .only-mobile { display: flex !important; }
}
@media (max-width: 900px) {
  .splash { grid-template-columns: 1fr; padding: 28px 16px; }
  .horde-row { grid-template-columns: 1fr; }
  .auth-box { position: static; }
  .brand.big h1 { font-size: 32px; }
  body.game #app { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "top" "alerts" "view" "nav"; }
  .top { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .top .brand small { display: none; }
  .resbar { order: 3; flex: 1 1 100%; width: 100%; justify-content: space-between; gap: 4px; flex-wrap: nowrap; }
  .res { padding: 3px 7px; font-size: 12px; }
  .res small { display: none; }
  .top-right { margin-left: auto; }
  .nav { flex-direction: row; overflow-x: auto; padding: 4px; border-right: 0; border-top: 1px solid var(--line); gap: 2px; }
  .nav button { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 11px; flex: 1; min-width: 56px; align-items: center; }
  .nav .badge { top: 2px; right: 4px; transform: none; }
  #view { padding: 12px; }
  .cols, .reports, .sides { grid-template-columns: 1fr; }
  .hero-stats { gap: 14px; }
  .map-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .map-panel { border-left: 0; border-top: 1px solid var(--line); max-height: 45vh; }
  .legend { max-width: calc(100% - 24px); bottom: auto; top: 12px; left: 56px; }
  .mu { grid-template-columns: 1fr 70px auto; }
  .mu input[type=range] { grid-column: 1 / -1; grid-row: 2; }
  .alert { flex-wrap: wrap; padding: 8px 12px; }
}

/* ------------------------------------------------ heroes */
.nav button[hidden] { display: none !important; }
select { background: #120d09; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; width: 100%; }
.fl { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; margin: 10px 0; }
.heroes { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 12px; }
.hcard { --hc: var(--gold); background: linear-gradient(180deg, color-mix(in srgb, var(--hc) 10%, var(--panel)), var(--panel) 40%); border: 1px solid color-mix(in srgb, var(--hc) 35%, var(--line)); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.hcard.vanguard, .hbadge.vanguard, .classopt.vanguard { --hc: #e9b949; }
.hcard.marksman, .hbadge.marksman, .classopt.marksman { --hc: #8cc4ff; }
.hcard.bulwark, .hbadge.bulwark, .classopt.bulwark { --hc: #b8b2a7; }
.hcard.reaver, .hbadge.reaver, .classopt.reaver { --hc: #e2643c; }
.hcard header { display: flex; gap: 12px; align-items: center; }
.hport { position: relative; width: 60px; height: 60px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--hc); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--hc) 35%, #2a1d12), #140e09); border: 2px solid var(--hc); box-shadow: 0 0 18px color-mix(in srgb, var(--hc) 30%, transparent); }
.hport .ic { width: 30px; height: 30px; }
.hport span { position: absolute; right: -4px; bottom: -4px; background: var(--hc); color: #1a110a; font-weight: 800; font-size: 12px; border-radius: 999px; min-width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid var(--panel); }
.hname h3 { margin: 0; }
.hname small { display: block; color: var(--muted); }
.hstatus { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.hstatus.ready { background: rgba(121, 194, 90, .15); color: var(--green); }
.hstatus.field { background: rgba(233, 185, 73, .15); color: var(--gold2); }
.hstatus.hurt { background: rgba(224, 83, 63, .15); color: #ff9b85; }
.perk { color: var(--hc); font-size: 12.5px; margin: 0; }
.hstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hstat { background: #160f0a; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.hstat b { font-size: 16px; color: var(--text); }
.iconbtn.sm { width: 26px; height: 22px; font-size: 14px; }
.iconbtn:disabled { opacity: .35; cursor: not-allowed; }
.hbonus { list-style: none; padding: 0; margin: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.hbonus li { display: flex; justify-content: space-between; border-bottom: 1px dashed #2f2419; padding: 2px 0; }
.hbonus b { color: var(--green); font-variant-numeric: tabular-nums; }
.hactions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tagpill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(140, 196, 255, .14); color: var(--blue); }
.hbadge { display: inline-flex; align-items: center; gap: 6px; color: var(--hc); }
.hbadge small { color: var(--muted); }
.classpick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.classopt { --hc: var(--gold); display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--hc) 40%, var(--line)); background: color-mix(in srgb, var(--hc) 8%, var(--panel)); cursor: pointer; }
.classopt:hover { border-color: var(--hc); }
.classopt .ic { color: var(--hc); width: 26px; height: 26px; }
.classopt b { color: var(--hc); font-family: Cinzel, serif; }
.classopt small { color: var(--muted); }
.classopt em { font-style: normal; font-size: 12px; }
.champ { color: #ffcf8a; background: rgba(255, 138, 61, .08); border-left: 3px solid var(--ember); padding: 6px 10px; border-radius: 4px; font-size: 13px; }
.heroline { color: var(--gold2); font-size: 13px; }
.adm-stats { flex-wrap: wrap; margin-bottom: 12px; }
@media (max-width: 900px) { .classpick { grid-template-columns: 1fr; } .heroes { grid-template-columns: 1fr; } }

/* ------------------------------------------------ alliance, mail, gear, guide */
.atag { color: var(--green); font-family: Inter, sans-serif; font-weight: 800; font-size: .8em; letter-spacing: .04em; }
.about { color: #d8ccb8; font-style: italic; margin: 6px 0 0; }
.row-actions { white-space: nowrap; }
.alliance-lords .row-actions { white-space: normal; }
.row-actions .btn { margin: 1px; }
.btn.bad, .link.bad { color: #ff9b85; }
textarea { background: #120d09; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; width: 100%; font: inherit; color: inherit; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.achat { display: flex; flex-direction: column; height: min(70vh, 640px); }
.achat .msgs { flex: 1; }
.achat form.row { display: flex; gap: 6px; margin-top: 8px; }
.achat form.row input { flex: 1; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.subtabs > button:not(.btn) { display: inline-flex; gap: 6px; align-items: center; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; color: var(--muted); cursor: pointer; font-weight: 600; }
.subtabs > button.on { background: var(--panel2); color: var(--gold2); border-color: var(--line2); }
.subtabs .btn { margin-left: auto; }
.subtabs .badge { font-style: normal; background: var(--red); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.rep-head.scout { background: linear-gradient(90deg, rgba(140, 196, 255, .14), transparent); border-left: 3px solid var(--blue); }
.rep-head.scout > span { color: var(--blue); }
.letter { white-space: normal; line-height: 1.6; padding: 12px; background: #1a130d; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; font-family: Georgia, serif; font-size: 15px; }
.drop { color: var(--rc); background: color-mix(in srgb, var(--rc) 10%, transparent); border-left: 3px solid var(--rc); padding: 6px 10px; border-radius: 4px; }
.drop small { color: var(--muted); }
.hgear { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gslot { --rc: var(--line2); border: 1px dashed var(--line2); border-radius: 8px; padding: 5px 7px; font-size: 11.5px; min-height: 42px; }
.gslot.full { border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 8%, transparent); }
.gslot small { display: block; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .06em; }
.gslot b { color: var(--rc); font-weight: 600; }
.hstat em { font-style: normal; color: var(--green); font-size: 12px; margin-left: 2px; }
.armoury { margin-top: 16px; }
.armoury select { min-width: 140px; }
.card.daily { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-color: #7a5a1e; background: linear-gradient(90deg, rgba(233, 185, 73, .14), var(--panel)); }
.card.daily .ic { color: var(--ember); }
.lg.ally { background: var(--green); border-radius: 3px 3px 6px 6px; }
.guide details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.guide summary { color: var(--text); font-weight: 700; display: flex; gap: 8px; align-items: center; }
.guide p { margin: 8px 0 0; color: #d8ccb8; }
.lede-s { color: #d8ccb8; margin: 12px 0; }

/* ------------------------------------------------ castle art */
.castle-pic { position: relative; width: 132px; height: 112px; flex: none; border: 0; padding: 0; background: radial-gradient(circle at 50% 70%, rgba(255,210,120,.18), transparent 70%); cursor: pointer; }
.castle-pic img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); transition: transform .2s; }
.castle-pic:hover img { transform: scale(1.05); }
.castle-pic span { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); font-size: 10px; background: rgba(12,8,5,.85); border: 1px solid var(--line2); border-radius: 999px; padding: 1px 8px; color: var(--muted); white-space: nowrap; }
.stylepick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.styleopt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; text-align: center; }
.styleopt img { width: 100%; height: 130px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.styleopt b { font-family: Cinzel, serif; color: var(--gold2); }
.styleopt small { color: var(--muted); font-size: 12px; }
.styleopt.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(233,185,73,.35); }
.painting { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(13,10,7,.7); color: var(--gold2); font-family: Cinzel, serif; pointer-events: none; }
.painting[hidden] { display: none; }
.painting span { display: inline-flex; gap: 8px; align-items: center; padding: 10px 18px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); }
@media (max-width: 900px) { .stylepick { grid-template-columns: 1fr 1fr; } .castle-pic { width: 96px; height: 84px; } }

/* ------------------------------------------------ castle interior */
.hero-card.slim { padding: 12px 18px; }
.city { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.city.has-panel { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); }
.city-main { background: radial-gradient(ellipse at 50% 40%, #2c2216, #120d09 75%); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.city-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); background: rgba(12, 8, 5, .5); font-size: 13px; }
.city-bar .btn { margin-left: auto; }
.court { position: relative; width: 100%; aspect-ratio: 356 / 250; max-height: 78vh; margin: 0 auto; user-select: none; overflow: hidden; background: radial-gradient(ellipse at 50% 46%, #2c2216, #0c0906 72%); }
.plot { position: absolute; transform: translate(-50%, -100%); background: none; border: 0; padding: 0; cursor: pointer; }
.plot img { width: 100%; display: block; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); transition: transform .15s, filter .15s; transform-origin: 50% 90%; }
.plot:hover img, .plot.on img { transform: scale(1.06); filter: drop-shadow(0 0 10px rgba(255, 210, 120, .55)) drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); }
.plot.empty img { opacity: .55; filter: grayscale(.85) brightness(.75) sepia(.2); }
.plot.empty:hover img { opacity: .65; }
.plot-tag { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; font-size: 11px; font-weight: 600; background: rgba(12, 8, 5, .82); border: 1px solid var(--line2); border-radius: 999px; padding: 1px 4px 1px 9px; color: var(--text); opacity: .0; transition: opacity .15s; }
.plot-tag b { background: var(--gold); color: #1a110a; border-radius: 999px; min-width: 20px; padding: 0 5px; text-align: center; }
.plot-tag i { color: var(--gold2); display: inline-flex; }
.plot-tag i .ic { width: 13px; height: 13px; }
.court:hover .plot-tag, .plot.on .plot-tag { opacity: 1; }
@media (hover: none) { .plot-tag { opacity: 1; } }
.plot.empty .plot-tag b { background: var(--panel2); color: var(--muted); }
.city-panel { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; }
.bpanel { position: relative; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bp-head { display: flex; gap: 12px; align-items: flex-start; }
.bp-head img { width: 110px; flex: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.bp-head h2 { margin: 0; }
.up-box { border: 1px solid var(--line2); border-radius: 10px; padding: 10px; background: #1d150e; display: flex; flex-direction: column; gap: 8px; }
.up-box.busy { border-color: #8a6a2a; }
.up-box h4 { margin: 0; color: var(--gold2); }
.reqs { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.reqs .ok { color: var(--green); } .reqs .no { color: #ff9b85; }
.unit-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.unit-row.locked { opacity: .6; }
.ur-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.unit-row form.train input { width: 70px; }
h4.branch { margin-top: 14px; color: var(--gold2); font-size: 14px; }
h4.branch small { display: block; font: 400 11.5px Inter, sans-serif; }
.techs { display: grid; grid-template-columns: 1fr; gap: 8px; }
.tech { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #1b140d; display: flex; flex-direction: column; gap: 4px; }
.tech.locked { opacity: .55; }
.tech.maxed { border-color: #3f7a2c; }
.tech.studying { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(233, 185, 73, .3); }
.t-head { display: flex; justify-content: space-between; align-items: center; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 9px; height: 9px; border-radius: 2px; background: #2f241a; border: 1px solid var(--line2); transform: rotate(45deg); }
.pips i.on { background: var(--gold); border-color: var(--gold2); }
.t-per { margin: 0; font-size: 12.5px; color: var(--green); }
.t-unl { margin: 0; font-size: 12px; color: var(--ember); }
.tech .btn { align-self: flex-start; }
.blist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; padding: 12px; }
.brow { display: flex; gap: 10px; align-items: center; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.brow.on { border-color: var(--gold); }
.brow img { width: 54px; }
.brow span { flex: 1; display: flex; flex-direction: column; }
.brow small { color: var(--muted); }
@media (max-width: 1100px) {
  .city.has-panel { grid-template-columns: 1fr; }
  .city-panel { position: fixed; left: 0; right: 0; bottom: 0; max-height: 72vh; z-index: 45; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .6); }
}
@media (max-width: 900px) { .city-panel { bottom: 58px; } .bp-head img { width: 80px; } }

.court-ground { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.court-light { position: absolute; inset: 0; pointer-events: none; z-index: 900; background: linear-gradient(135deg, rgba(255,226,160,.14), transparent 45%, rgba(26,16,48,.18)), radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,.55)); }
.wallpiece { position: absolute; transform: translate(-50%, -100%); background: none; border: 0; padding: 0; cursor: pointer; }
.wallpiece img { width: 100%; display: block; filter: drop-shadow(0 4px 5px rgba(0,0,0,.4)); }
.wallpiece.flip img { transform: scaleX(-1); }
.wallpiece:hover img, .wallpiece.on img { filter: drop-shadow(0 0 8px rgba(255,210,120,.5)) drop-shadow(0 4px 5px rgba(0,0,0,.4)); }
.plot.site svg { width: 100%; display: block; overflow: visible; }
.site-pad { fill: rgba(70, 48, 24, .45); }
.site-rope { fill: none; stroke: #e9c46a; stroke-width: 1.4; stroke-dasharray: 4 3; }
.site-stake { stroke: #6a4a2a; stroke-width: 2.4; stroke-linecap: round; }
.site-sign rect { fill: #8a6238; stroke: #3a2614; stroke-width: 1; }
.site-sign path { stroke: #ffd27a; stroke-width: 1.6; }
.plot.site:hover .site-rope, .plot.site.on .site-rope { stroke: #fff1b8; stroke-width: 2; }
.plot.site .plot-tag { bottom: 30%; }
.site-plus { position: absolute; left: 50%; bottom: 34%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(#ffd27a, #c98e2a); color: #1a110a; font: 800 16px/22px Inter, sans-serif; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.5), 0 0 0 2px rgba(255,240,200,.35); animation: glow 2.4s infinite; }
.plot.site:hover .site-plus, .plot.site.on .site-plus { opacity: 0; }

.skills { color: var(--gold2); font-size: 13px; }
.hcard .skill { margin: 0; font-size: 12.5px; color: #e6dccb; }
.hcard .skill b { color: var(--gold2); }

.world-nav{position:absolute;top:13px;left:66px;right:14px;display:flex;align-items:center;gap:7px;flex-wrap:wrap;z-index:3;pointer-events:none}.world-nav>*{pointer-events:auto}.world-nav button{background:#21352be8;border:1px solid #9eaa7477;color:#e7dfbd;border-radius:6px;padding:7px 10px;font:600 10px Inter,sans-serif;cursor:pointer;backdrop-filter:blur(8px)}.world-nav>span{font:600 9px Inter,sans-serif;color:#d7d6b5;background:#13251ce8;padding:8px;border-radius:5px}.world-nav form{margin-left:auto;display:flex;gap:4px}.world-nav input{width:63px;background:#172d24e8;color:#f0e4bb;border:1px solid #a2aa7755;padding:6px;border-radius:5px;font-size:11px}.world-nav input::placeholder{color:#c2c4a0}.world-nav button:hover{border-color:#e1c888}@media(max-width:700px){.world-nav{left:53px;right:7px;gap:4px;top:9px}.world-nav button{font-size:8px;padding:6px}.world-nav>span{display:none}.world-nav form{margin-left:0}.world-nav input{width:43px;font-size:9px}}

/* horde invasion banner */
.alert.invasion .inv-bar { display: inline-block; width: 90px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.12); vertical-align: middle; margin: 0 4px; overflow: hidden; }
.alert.invasion .inv-bar i { display: block; height: 100%; background: var(--fc); }

/* battle replay */
.modal:has(.replay) { width: min(680px, 100%); }
.replay .rp-empty { opacity: .6; font-size: 12px; }
.rp-head { display: flex; align-items: center; gap: 12px; margin: 0 28px 10px 0; }
.rp-tug { flex: 1; height: 10px; border-radius: 5px; background: #8a2f26; overflow: hidden; }
.rp-tug i { display: block; height: 100%; width: 50%; background: #c9862a; transition: width .6s ease; }
.rp-field { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.rp-vs { align-self: center; font-family: Cinzel, serif; opacity: .6; }
.rp-side h4 { margin: 0 0 6px; font-size: 13px; }
.rp-row { position: relative; display: grid; grid-template-columns: 7.5em 1fr 3.5em; gap: 6px; align-items: center; font-size: 12px; margin: 4px 0; transition: opacity .4s; }
.rp-row.gone { opacity: .35; }
.rp-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.rp-side.you .rp-bar i { background: #c9862a; }
.rp-side.foe .rp-bar i { background: #b8483b; }
.rp-bar i { display: block; height: 100%; width: 100%; transition: width .6s ease; }
.rp-n { text-align: right; }
.rp-hit { position: absolute; right: -2px; top: -12px; color: #ff6b57; font-style: normal; font-weight: 700; opacity: 0; }
.rp-hit.pop { animation: rp-pop .9s ease-out; }
@keyframes rp-pop { 0% { opacity: 1; transform: translateY(4px); } 100% { opacity: 0; transform: translateY(-10px); } }
.rp-end { text-align: center; margin: 10px 0; }
@media (max-width: 560px) { .rp-field { grid-template-columns: 1fr; } .rp-vs { display: none; } }

/* market */
.mk-amt { display: inline-flex; align-items: center; gap: 4px; }
.mk-amt .ic { width: 15px; height: 15px; }
#mkpost .fl .row, #mktrader .fl .row { display: flex; gap: 8px; align-items: center; }
#mkpost .fl .row > *, #mktrader .fl .row > * { flex: 1; min-width: 0; margin: 0; }

/* chat report flag */
.msg .msg-flag { margin-left: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; opacity: 0; font-size: 11px; padding: 0 2px; }
.msg:hover .msg-flag, .msg .msg-flag:focus { opacity: .8; }
@media (hover: none) { .msg .msg-flag { opacity: .5; } }

#adm > .btn.danger { margin-top: 16px; }

/* hero talents */
.talents h4 { margin: 10px 0 4px; }
.trow { display: grid; grid-template-columns: 3.2em 1fr 1fr; gap: 6px; align-items: stretch; margin: 4px 0; }
.trow small { align-self: center; color: var(--muted); }
.trow.locked { opacity: .45; }
.tal { border: 1px solid var(--line2); background: var(--panel2); color: var(--text); border-radius: 7px; padding: 5px 7px; font-size: 12px; text-align: left; cursor: pointer; }
.tal em { display: block; font-style: normal; color: var(--muted); font-size: 11px; }
.tal:disabled { cursor: default; }
.tal.on { border-color: var(--gold2); color: var(--gold2); font-weight: 700; }
.tal.off { opacity: .4; }

.danger-zone { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.danger-zone summary { cursor: pointer; color: var(--red, #d24a3a); }

/* lord profile */
.link.lord { color: inherit; font-weight: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; padding: 0; }
.lord-card .lc-head { display: flex; gap: 14px; align-items: center; }
.lord-card .lc-head h3 { margin: 0; }
.lord-card .lc-head p { margin: 2px 0; }
.lord-card .lc-stats { margin: 12px 0; }
.lc-record { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.deeds { display: flex; flex-wrap: wrap; gap: 6px; }
.deed { border: 1px solid var(--line2); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: help; }
.deed.bronze { color: #d9a066; border-color: #d9a06666; }
.deed.silver { color: #d5dbe3; border-color: #d5dbe366; }
.deed.gold { color: #ffcf5a; border-color: #ffcf5a88; background: #ffcf5a12; }

/* events calendar */
.events .evs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.ev { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.ev > div b { display: block; }
.ev > div small { color: var(--muted); font-size: 12px; }
.ev > span { font-size: 12px; white-space: nowrap; }
.ev .btn { grid-column: 1 / -1; justify-self: start; }
.ev.on { border-color: var(--fc); box-shadow: inset 3px 0 var(--fc); }

/* alliance research */
.atechs { display: grid; gap: 6px; margin: 10px 0; }
.atech { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.donate { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px; }
.donate label { display: flex; align-items: center; gap: 6px; }
.donate input { width: 100%; min-width: 0; }
.donate .btn { grid-column: 1 / -1; }

/* phones: wide tables scroll inside their card instead of running off the screen */
@media (max-width: 560px) {
  .card .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl.ranks th:nth-child(3), .tbl.ranks td:nth-child(3) { display: none; }
  .tbl th, .tbl td { padding-left: 6px; padding-right: 6px; }
}
.card h4 { margin-top: 14px; }
.objs .go, .bounty .go { margin: 4px 6px 4px 0; }
@media (max-width: 560px) {
  #view[data-view="quests"] { display: flex; flex-direction: column; }
  #view[data-view="quests"] > .events { order: 2; margin-top: 14px; }
}
.away { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.away li { display: flex; gap: 8px; align-items: center; }
.msg.mention { background: #d8b5731a; border-left: 3px solid var(--gold2); padding-left: 6px; }
.msg .watch { color: var(--gold2); margin-left: 4px; }
.card h3 { margin-top: 16px; }
.card > h2 + .chips + h3, .card h2 + h3 { margin-top: 8px; }
.chat-quiet { float: right; font-size: 11px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.chat.quiet .msg.sys { display: none; }
#rankby, #mkf { width: auto; display: inline-block; margin-left: 6px; }
.rep-filter { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.rep-filter .chip { border: 1px solid var(--line2); background: none; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.rep-filter .chip.on { color: var(--gold2); border-color: var(--gold2); }
.tips { border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--panel2); }
.tips ul { margin: 6px 0 8px 18px; padding: 0; }
.tips li { margin: 3px 0; }
.rcode { font: 700 20px/1.4 ui-monospace, Consolas, monospace; letter-spacing: 1px; text-align: center; padding: 14px 8px; border: 1px dashed var(--gold2); border-radius: 10px; color: var(--gold2); user-select: all; word-break: break-all; }
#rcform input { flex: 1; min-width: 0; }
/* phone pass: bigger tap targets, and wide tables scroll inside their card */
@media (max-width: 700px) {
  .rep-filter .chip { padding: 7px 13px; font-size: 13px; }
  .heroes .iconbtn.sm, .iconbtn.sm { min-width: 34px; min-height: 34px; }
  button.link { padding: 6px 2px; }
  input[type="checkbox"] { width: 18px; height: 18px; }
  [data-view="admin"] .card { overflow-x: auto; }
  [data-view="admin"] .tbl { min-width: max-content; }
}
.horde-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.horde-card { border: 1px solid var(--line2); border-top: 3px solid var(--fc); border-radius: 10px; padding: 12px 14px; }
.hc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--fc); }
.hc-head .f-ic svg { width: 20px; height: 20px; }
.horde-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.horde-card dt { color: var(--muted); }
.horde-card dd { margin: 0; text-align: right; }
.horde-card dd small { display: block; color: var(--muted); font-size: 12px; }
.fb { border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.fb.done { opacity: .55; }
.fb .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.fb .row small { flex: 1; }
.fb p { margin: 6px 0 2px; white-space: pre-wrap; }
#fbform textarea { width: 100%; font: inherit; color: var(--text); background: #0d0a08; border: 1px solid var(--line2); border-radius: 8px; padding: 10px; resize: vertical; }
