/* ============================================================
   AGES OF VALOR  --  stylesheet
   A dark high-fantasy menu UI. Pixel-art friendly.
   ============================================================ */

:root {
  --stone-950: #0f0b15;
  --stone-900: #15101d;
  --stone-850: #1b1526;
  --stone-800: #221a30;
  --stone-700: #2d2340;
  --stone-600: #3a2e52;
  --panel: #211a2e;
  --panel-raise: #2a2039;

  --gold: #e8c34a;
  --gold-bright: #ffe08a;
  --gold-dark: #a9801f;

  --parchment: #ece0c4;
  --text: #ddd3ea;
  --text-dim: #9a90ae;

  --player: #54c08a;
  --player-dk: #1f5e42;
  --enemy: #d05a46;
  --enemy-dk: #6e2a20;
  --neutral: #9a93ab;
  --neutral-dk: #4a4458;

  --hp: #e0493a;
  --xp: #e8c34a;
  --mana: #5a8fd6;

  --radius: 10px;
  --shadow: 0 6px 18px rgba(0,0,0,.45);
  --font-head: 'Press Start 2P', monospace;
  --font-body: 'VT323', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 700px at 50% -10%, #241a33 0%, transparent 60%),
    linear-gradient(180deg, var(--stone-900), var(--stone-950));
  color: var(--text);
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.25;
  -webkit-font-smoothing: none;
}

img { image-rendering: pixelated; image-rendering: crisp-edges; }

button { font-family: var(--font-body); cursor: pointer; }
h1,h2,h3 { font-family: var(--font-head); font-weight: normal; letter-spacing: .5px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--stone-900); }
::-webkit-scrollbar-thumb { background: var(--stone-600); border-radius: 6px; }

/* ---------- App shell ---------- */
#app { max-width: 1180px; margin: 0 auto; padding: 14px 16px 60px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--stone-800), var(--stone-850));
  border: 2px solid var(--stone-600);
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: var(--shadow);
  position: relative;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 46px; height: 46px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.brand .title { font-family: var(--font-head); font-size: 15px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.brand .sub { font-size: 16px; color: var(--text-dim); margin-top: 2px; }

.clock {
  display: flex; align-items: center; gap: 10px;
  background: var(--stone-900); border: 2px solid var(--stone-600);
  border-radius: 8px; padding: 6px 14px;
}
.clock .season-emoji { font-size: 24px; }
.clock .yr { font-family: var(--font-head); font-size: 12px; color: var(--gold-bright); }
.clock .se { font-size: 18px; color: var(--text-dim); }

.resources { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.res-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--stone-900); border: 2px solid var(--stone-600);
  border-radius: 8px; padding: 5px 12px; min-width: 96px;
}
.res-chip img { width: 26px; height: 26px; }
.res-chip .val { font-size: 24px; color: var(--parchment); }
.res-chip .delta { font-size: 16px; }
.delta.plus { color: var(--player); }
.delta.minus { color: var(--enemy); }

/* ---------- Primary action bar ---------- */
.actionbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 12px 0;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  background: var(--stone-800); color: var(--text-dim);
  border: 2px solid var(--stone-600); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 10px 18px 12px;
  font-size: 20px; transition: .12s;
}
.tab:hover { color: var(--parchment); background: var(--stone-700); }
.tab.active { color: var(--gold-bright); background: var(--panel); border-color: var(--gold-dark); box-shadow: inset 0 -3px 0 var(--gold); }
.tab .pip { color: var(--enemy); font-size: 16px; }

.end-turn {
  margin-left: auto;
  background: linear-gradient(180deg, #3a7d58, #245c3c);
  color: #eafff2; border: 2px solid #6fe0a3;
  border-radius: 8px; padding: 10px 22px;
  font-size: 22px; text-shadow: 1px 1px 0 #0d2a1a;
  box-shadow: 0 4px 0 #123, 0 6px 14px rgba(0,0,0,.4);
  transition: .1s;
}
.end-turn:hover { filter: brightness(1.12); }
.end-turn:active { transform: translateY(3px); box-shadow: 0 1px 0 #123; }

.topmenu-btn {
  background: var(--stone-800); color: var(--text-dim);
  border: 2px solid var(--stone-600); border-radius: 8px;
  padding: 10px 14px; font-size: 18px;
}
.topmenu-btn:hover { color: var(--parchment); }

/* ---------- View panel ---------- */
.view {
  background: linear-gradient(180deg, var(--panel), var(--stone-850));
  border: 2px solid var(--stone-600);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 18px; min-height: 420px;
  box-shadow: var(--shadow);
}
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.view-head h2 { font-size: 16px; color: var(--gold); text-shadow: 2px 2px 0 #000; margin: 0; }
.view-head .hint { color: var(--text-dim); font-size: 18px; }

/* ---------- Territory grid ---------- */
.grid { display: grid; gap: 14px; }
.grid.realm { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }

.terr-card {
  position: relative; overflow: hidden;
  background: var(--stone-850);
  border: 2px solid var(--stone-600);
  border-radius: 10px; padding: 0;
  transition: .12s; cursor: pointer;
}
.terr-card:hover { transform: translateY(-3px); border-color: var(--gold-dark); box-shadow: 0 8px 18px rgba(0,0,0,.5); }
.terr-card .art { position: relative; height: 118px; background: #0c0912; display: flex; align-items: center; justify-content: center; }
.terr-card .art img { width: 118px; height: 118px; }
.terr-card .owner-flag {
  position: absolute; top: 8px; left: 8px;
  font-size: 15px; padding: 2px 9px; border-radius: 20px;
  border: 2px solid; text-shadow: 1px 1px 0 #000;
}
.flag-player { background: var(--player-dk); color: #c8ffe0; border-color: var(--player); }
.flag-enemy  { background: var(--enemy-dk);  color: #ffd6cf; border-color: var(--enemy); }
.flag-neutral{ background: var(--neutral-dk);color: #e4e0ee; border-color: var(--neutral); }

.terr-card .threat-badge {
  position: absolute; top: 8px; right: 8px; font-size: 16px;
  background: rgba(20,10,10,.8); border: 2px solid var(--enemy);
  color: #ffd0c8; border-radius: 6px; padding: 1px 7px;
}
.terr-card .body { padding: 9px 12px 12px; }
.terr-card .tname { font-size: 23px; color: var(--parchment); line-height: 1; }
.terr-card .ttype { font-size: 16px; color: var(--text-dim); margin-top: 1px; }
.terr-card .meta { display: flex; gap: 12px; margin-top: 8px; font-size: 18px; flex-wrap: wrap; }
.terr-card .meta .mi { display: flex; align-items: center; gap: 4px; }
.terr-card .meta img { width: 18px; height: 18px; }
.terr-card .garrison-row {
  margin-top: 9px; display: flex; align-items: center; gap: 8px;
  border-top: 1px dashed var(--stone-600); padding-top: 8px;
}
.terr-card .garrison-row .av { width: 34px; height: 34px; border-radius: 6px; border: 2px solid var(--stone-600); background: #0c0912; }
.terr-card .garrison-row .g-txt { font-size: 17px; }
.terr-card .garrison-row .g-txt .nm { color: var(--parchment); }
.terr-card .garrison-row .g-txt .lv { color: var(--gold); }
.garrison-empty { color: var(--text-dim); font-style: italic; }

.terr-card.is-capital { border-color: var(--gold-dark); box-shadow: 0 0 0 1px var(--gold-dark) inset; }
.terr-card.raided .art::after {
  content: "RAIDED"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(120,20,10,.45); color: #ffdad2; font-family: var(--font-head); font-size: 13px; letter-spacing: 1px;
}

/* ---------- Hero cards ---------- */
.grid.heroes { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hero-card {
  display: flex; gap: 12px; padding: 12px;
  background: var(--stone-850); border: 2px solid var(--stone-600);
  border-radius: 10px; transition: .12s; cursor: pointer;
}
.hero-card:hover { transform: translateY(-3px); border-color: var(--gold-dark); box-shadow: 0 8px 18px rgba(0,0,0,.5); }
.hero-card .portrait {
  width: 84px; height: 84px; flex: none; border-radius: 8px;
  background: radial-gradient(circle at 50% 30%, #35294a, #140f1f);
  border: 2px solid var(--stone-600); display: flex; align-items: flex-end; justify-content: center; overflow: hidden;
}
.hero-card .portrait img { width: 84px; height: 84px; }
.hero-card .info { flex: 1; min-width: 0; }
.hero-card .hname { font-size: 23px; color: var(--parchment); line-height: 1; }
.hero-card .hclass { font-size: 16px; color: var(--gold); }
.hero-card .hloc { font-size: 15px; color: var(--text-dim); margin-top: 2px; }
.lvl-badge {
  display: inline-block; font-family: var(--font-head); font-size: 10px;
  background: var(--gold-dark); color: #1a1205; border-radius: 5px; padding: 3px 6px; margin-left: 4px;
}
.statline { display: flex; gap: 10px; margin-top: 6px; font-size: 17px; flex-wrap: wrap; }
.statline .s { display: flex; align-items: center; gap: 3px; }
.statline img { width: 16px; height: 16px; }

/* bars */
.bar { height: 9px; background: #0c0912; border: 1px solid var(--stone-600); border-radius: 6px; overflow: hidden; margin-top: 5px; }
.bar > span { display: block; height: 100%; }
.bar.hp > span { background: linear-gradient(180deg, #ff6a57, var(--hp)); }
.bar.xp > span { background: linear-gradient(180deg, var(--gold-bright), var(--gold-dark)); }
.bar-label { font-size: 14px; color: var(--text-dim); display: flex; justify-content: space-between; margin-top: 4px; }

.wounded { opacity: .6; filter: grayscale(.4); }
.tag-wounded { color: var(--enemy); font-size: 15px; }

/* ---------- Recruit list ---------- */
.grid.recruit { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.recruit-card { padding: 12px; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; }
.recruit-card .top { display: flex; gap: 12px; }
.recruit-card .portrait { width: 76px; height: 76px; flex: none; border-radius: 8px; overflow: hidden; background: radial-gradient(circle at 50% 30%, #35294a, #140f1f); border: 2px solid var(--stone-600); }
.recruit-card .portrait img { width: 76px; height: 76px; }
.recruit-card .desc { font-size: 17px; color: var(--text-dim); margin: 8px 0; min-height: 44px; }
.locked { opacity: .55; }

/* ---------- Buttons ---------- */
.btn {
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  color: var(--parchment); border: 2px solid var(--stone-600);
  border-radius: 7px; padding: 8px 14px; font-size: 18px; transition: .1s;
}
.btn:hover:not(:disabled) { border-color: var(--gold-dark); color: var(--gold-bright); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, #e8c34a, #b8862a); color: #241a05; border-color: var(--gold-bright); font-weight: bold; }
.btn.gold:hover:not(:disabled) { filter: brightness(1.1); color: #241a05; }
.btn.red { background: linear-gradient(180deg, #c7513e, #8e3022); color: #ffe9e4; border-color: #ef7c68; }
.btn.red:hover:not(:disabled) { filter: brightness(1.1); color: #fff; }
.btn.green { background: linear-gradient(180deg, #3a7d58, #245c3c); color: #eafff2; border-color: #6fe0a3; }
.btn.small { padding: 5px 10px; font-size: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cost { color: var(--gold); white-space: nowrap; }
.cost.cant { color: var(--enemy); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6,4,10,.78);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: linear-gradient(180deg, var(--panel-raise), var(--stone-850));
  border: 2px solid var(--gold-dark); border-radius: 12px;
  max-width: 620px; width: 100%; max-height: 88vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.modal .m-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 2px solid var(--stone-600); }
.modal .m-head h3 { font-size: 15px; color: var(--gold); margin: 0; text-shadow: 2px 2px 0 #000; }
.modal .m-head .m-x { margin-left: auto; background: none; border: none; color: var(--text-dim); font-size: 30px; line-height: 1; }
.modal .m-head .m-x:hover { color: var(--enemy); }
.modal .m-body { padding: 18px; }
.modal .m-portrait { width: 128px; height: 128px; float: right; margin: 0 0 10px 14px; border-radius: 10px; border: 2px solid var(--stone-600); background: radial-gradient(circle at 50% 30%, #35294a, #140f1f); }
.modal .m-art { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; border: 2px solid var(--stone-600); margin-bottom: 12px; image-rendering: pixelated; }
.modal p { font-size: 19px; margin: 8px 0; }
.modal .label { color: var(--gold); }

/* detail stat table */
.stat-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.stat-table td { padding: 5px 8px; font-size: 19px; border-bottom: 1px solid var(--stone-700); }
.stat-table td:first-child { color: var(--text-dim); width: 42%; }
.stat-table td img { width: 16px; height: 16px; vertical-align: -2px; margin-right: 5px; }
.up { color: var(--player); }

/* choose list (assign hero / pick attacker) */
.choose-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.choose-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px; transition: .1s;
}
.choose-item:hover { border-color: var(--gold-dark); }
.choose-item img { width: 44px; height: 44px; border-radius: 6px; background: #140f1f; border: 1px solid var(--stone-600); }
.choose-item .ci-info { flex: 1; }
.choose-item .ci-name { font-size: 20px; color: var(--parchment); }
.choose-item .ci-sub { font-size: 15px; color: var(--text-dim); }

/* battle log */
.battle-log { background: #0c0912; border: 2px solid var(--stone-600); border-radius: 8px; padding: 10px 12px; font-size: 18px; margin: 10px 0; max-height: 240px; overflow: auto; }
.battle-log .ln { margin: 3px 0; }
.battle-log .ln.good { color: var(--player); }
.battle-log .ln.bad { color: var(--enemy); }
.battle-log .ln.crit { color: var(--gold-bright); }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0 12px; }
.vs-row .combatant { text-align: center; }
.vs-row .combatant img { width: 92px; height: 92px; border-radius: 10px; border: 2px solid var(--stone-600); background: radial-gradient(circle at 50% 30%, #35294a, #140f1f); }
.vs-row .combatant .cn { font-size: 18px; margin-top: 4px; }
.vs-row .combatant .cp { font-size: 16px; color: var(--gold); }
.vs-row .vs { font-family: var(--font-head); font-size: 20px; color: var(--enemy); }

/* ---------- Chronicle / log ---------- */
.chronicle { display: flex; flex-direction: column; gap: 4px; }
.log-entry { font-size: 19px; padding: 7px 12px; border-left: 3px solid var(--stone-600); background: var(--stone-850); border-radius: 0 6px 6px 0; }
.log-entry .ts { color: var(--gold-dark); font-size: 15px; margin-right: 8px; }
.log-entry.good { border-left-color: var(--player); }
.log-entry.bad { border-left-color: var(--enemy); }
.log-entry.epic { border-left-color: var(--gold); background: #2a2210; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--stone-800); border: 2px solid var(--gold-dark); color: var(--parchment);
  padding: 10px 18px; border-radius: 8px; font-size: 19px; box-shadow: var(--shadow);
  animation: toastIn .2s ease;
}
.toast.good { border-color: var(--player); }
.toast.bad { border-color: var(--enemy); }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- Title / main menu ---------- */
.title-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
  background-size: cover; background-position: center;
  position: relative;
}
.title-screen::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,6,16,.35), rgba(10,6,16,.85)); }
.title-inner { position: relative; z-index: 2; max-width: 560px; }
.title-inner img.crest { width: 120px; height: 120px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.7)); margin-bottom: 8px; }
.title-inner h1 { font-size: 34px; color: var(--gold-bright); text-shadow: 3px 3px 0 #000, 0 0 18px rgba(232,195,74,.4); margin: 6px 0; }
.title-inner .tagline { font-size: 22px; color: var(--parchment); margin-bottom: 26px; }
.title-menu { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.title-menu .btn { min-width: 260px; font-size: 22px; padding: 12px 20px; }
.title-foot { position: relative; z-index: 2; margin-top: 30px; color: var(--text-dim); font-size: 16px; }

.help-cols { columns: 2; column-gap: 24px; }
.help-cols p { font-size: 18px; margin: 0 0 10px; break-inside: avoid; }
@media (max-width: 680px) { .help-cols { columns: 1; } .resources { margin-left: 0; width: 100%; } }

.empty-state { text-align: center; color: var(--text-dim); font-size: 20px; padding: 40px 10px; }
.flash-gold { animation: flashGold .6s ease; }
@keyframes flashGold { 0%,100% { } 40% { color: var(--gold-bright); text-shadow: 0 0 12px var(--gold); } }

.pill { display: inline-block; font-size: 15px; padding: 1px 8px; border-radius: 20px; border: 1px solid var(--stone-600); color: var(--text-dim); }
.divider { height: 2px; background: var(--stone-700); margin: 14px 0; border-radius: 2px; }
.muted { color: var(--text-dim); }
.good-text { color: var(--player); }
.bad-text { color: var(--enemy); }
.gold-text { color: var(--gold); }

/* ---------- Tab count pip ---------- */
.tab .pip.count {
  color: #1a1205; background: var(--gold); border-radius: 10px;
  padding: 0 7px; font-size: 16px; margin-left: 2px;
}

/* ---------- Buildings ---------- */
.bld-strip { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 3px; }
.terr-card .art .bld-strip img {
  width: 28px; height: 28px; background: rgba(12,9,18,.8);
  border: 1px solid var(--stone-600); border-radius: 5px;
}
.choose-item img.bld { width: 52px; height: 52px; background: #140f1f; }
.fx-note { font-size: 18px; color: var(--player); }

/* ---------- Items / Armory ---------- */
.grid.armory { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.btn.on { border-color: var(--gold-dark); color: var(--gold-bright); }
.item-card {
  display: flex; gap: 12px; padding: 12px;
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px;
}
.item-card .it-info { flex: 1; min-width: 0; }
.item-icon {
  --rar: var(--stone-600);
  width: 60px; height: 60px; flex: none; border-radius: 8px;
  border: 2px solid var(--rar);
  background: radial-gradient(circle at 50% 35%, #35294a, #140f1f);
  box-shadow: inset 0 0 12px -3px var(--rar);
  display: flex; align-items: center; justify-content: center;
}
.item-icon img, .choose-item .item-icon img {
  width: 46px; height: 46px; border: none; background: none; border-radius: 0;
}
.item-icon.sm { width: 32px; height: 32px; border-radius: 6px; }
.item-icon.sm img { width: 24px; height: 24px; }
.item-name { font-size: 21px; line-height: 1.05; }
.item-sub { font-size: 15px; color: var(--text-dim); }
.item-stats { font-size: 17px; color: var(--player); }
.gear-strip { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.hero-card .gear-strip .item-icon.sm { width: 26px; height: 26px; border-width: 1px; }
.hero-card .gear-strip .item-icon.sm img { width: 20px; height: 20px; }

/* equipment grid in the hero sheet (9 slots) */
.equip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; clear: both; }
@media (max-width: 560px) { .equip-grid { grid-template-columns: repeat(2, 1fr); } }
.equip-tile {
  display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0;
  padding: 7px 8px; color: var(--text);
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px; transition: .1s;
}
.equip-tile:hover { border-color: var(--gold-dark); }
.equip-tile.empty .item-icon { border-style: dashed; box-shadow: none; opacity: .6; }
.et-info { display: flex; flex-direction: column; min-width: 0; }
.et-name, .et-stats { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.et-name { font-size: 17px; line-height: 1.1; }
.et-stats { font-size: 14px; color: var(--player); }

/* attribute points */
.attr-list { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 12px; clear: both; }
.attr-row {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px;
  background: var(--stone-850); border: 1px solid var(--stone-600); border-radius: 8px;
}
.attr-name { width: 76px; font-size: 19px; color: var(--parchment); }
.attr-val { width: 30px; text-align: center; font-family: var(--font-head); font-size: 11px; color: var(--gold-bright); }
.attr-desc { flex: 1; font-size: 16px; color: var(--text-dim); }
.attr-row .btn { min-width: 34px; }

/* ---------- Research ---------- */
.tech-tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.tech-tree .tech-col { margin-bottom: 10px; }
@media (max-width: 1100px) { .tech-tree { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .tech-tree { grid-template-columns: 1fr; } }
.tech-col { display: flex; flex-direction: column; align-items: stretch; }
.tech-branch { font-size: 13px; color: var(--gold); text-align: center; margin: 0 0 10px; }
.tech { display: flex; gap: 10px; padding: 9px 10px; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; }
.tech img { width: 48px; height: 48px; flex: none; image-rendering: pixelated; }
.tech-name { font-size: 20px; color: var(--parchment); line-height: 1.05; }
.tech-name small { font-size: 13px; color: var(--text-dim); }
.tech-desc { font-size: 16px; color: var(--text-dim); margin: 2px 0 6px; }
.tech-status { font-size: 16px; }
.tech.done { border-color: var(--player); background: #16301f; }
.tech.open { border-color: var(--gold-dark); }
.tech.locked { opacity: .55; }
.tech-arrow { text-align: center; color: var(--stone-600); font-size: 18px; line-height: 1.2; }

/* ---------- Animated battle stage ---------- */
.battle-stage {
  position: relative; height: 220px; margin-bottom: 10px; overflow: hidden;
  border: 2px solid var(--stone-600); border-radius: 10px; background: #140f1f;
}
.battle-stage::before {
  content: ""; position: absolute; inset: -20px; background-image: var(--bg); background-size: cover; background-position: center;
  image-rendering: pixelated; filter: blur(2px) brightness(.55) saturate(1.1);
}
.battle-stage .bs-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.55)); }
.battle-stage.broken { display: none; }
.bs-sprite {
  position: absolute; bottom: 14px; width: 192px; height: 192px; image-rendering: pixelated;
  transition: transform .18s ease-out, filter .4s; filter: drop-shadow(0 6px 4px rgba(0,0,0,.55));
}
.bs-hero { left: 14%; }
.bs-foe { right: 14%; }
.bs-hero.acting-attack { transform: translateX(60px); }
.bs-foe.acting-attack { transform: translateX(-60px); }
.bs-hero.acting-hurt { filter: drop-shadow(0 6px 4px rgba(0,0,0,.55)) brightness(1.6) sepia(.6) hue-rotate(-30deg); }
.bs-foe.acting-hurt { filter: drop-shadow(0 6px 4px rgba(0,0,0,.55)) brightness(1.6) sepia(.6) hue-rotate(-30deg); }
.bs-sprite.fallen { filter: grayscale(.8) brightness(.6); }
@media (max-width: 560px) { .bs-sprite { width: 128px; height: 128px; } .battle-stage { height: 160px; } }

/* ---------- Named quests ---------- */
.quest-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-top: 6px; }
.quest-card {
  display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px 8px; color: var(--text);
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px; transition: .1s;
}
.quest-card:hover:not(:disabled) { border-color: var(--gold); background: #2a2210; }
.quest-card img { width: 56px; height: 56px; border-radius: 6px; flex: none; border: 1px solid var(--stone-600); }
.quest-card .qc-txt { display: flex; flex-direction: column; min-width: 0; }
.quest-card .qc-name { font-size: 19px; color: var(--parchment); line-height: 1.05; }
.quest-card .qc-sub { font-size: 15px; color: var(--text-dim); }
.quest-card .qc-chain { font-size: 13px; color: #3fe0d0; text-transform: uppercase; letter-spacing: 1px; }
.quest-card.chain { border-color: #2a8f86; }
.quest-card.on { border-color: var(--player); background: #16301f; }
.quest-card.locked { opacity: .45; cursor: not-allowed; }
.battle-log .ln.has-img { display: flex; gap: 10px; align-items: flex-start; }
.battle-log .ln-img { width: 48px; height: 48px; border-radius: 6px; flex: none; border: 1px solid var(--stone-600); }
.chain-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.chain-row { padding: 8px 12px; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; font-size: 19px; }
.chain-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chain-step { display: flex; align-items: center; gap: 6px; font-size: 16px; color: var(--text-dim); padding: 3px 8px 3px 3px; border: 1px solid var(--stone-600); border-radius: 8px; opacity: .6; }
.chain-step img { width: 30px; height: 30px; border-radius: 5px; }
.chain-step small { color: var(--text-dim); }
.chain-step.done { color: var(--player); border-color: var(--player); opacity: 1; }
.chain-step.next { color: #3fe0d0; border-color: #3fe0d0; opacity: 1; }

/* ---------- Stronghold bosses ---------- */
.siege-foe.boss { width: 110px; height: 110px; border-color: var(--gold); box-shadow: 0 0 18px rgba(208,90,70,.6); }
.boss-name { font-family: var(--font-head); font-size: 13px; color: var(--enemy); margin-bottom: 4px; }
.boss-name span { color: var(--text-dim); font-family: var(--font-body); font-size: 17px; }
.boss-quote { font-size: 19px; font-style: italic; color: #ffd6cf; margin-bottom: 6px; }
.boss-mech { margin-top: 10px; padding: 7px 12px; font-size: 18px; border-left: 3px solid var(--enemy); background: #2a1414; border-radius: 0 8px 8px 0; }
.boss-mech b { color: #ffb1a4; }
.battle-log .ln.boss { color: #ffb1a4; font-style: italic; }
.boss-mini { float: left; width: 52px; height: 52px; margin: 0 8px 4px 0; border-radius: 8px; border: 2px solid var(--enemy); background: #140f1f; }
.wm-node .wm-foe.boss { width: 34px; height: 34px; border-color: var(--gold); box-shadow: 0 0 6px var(--enemy); }

/* ---------- World map ---------- */
.realm-toggle { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.worldmap {
  position: relative; width: 100%; max-width: 1000px; aspect-ratio: 4 / 3; margin: 0 auto;
  border: 3px solid var(--gold-dark); border-radius: 12px; overflow: hidden; background: #3a6fb0;
  box-shadow: inset 0 0 40px rgba(0,0,0,.35), var(--shadow);
}
.worldmap .wm-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; transition: filter .6s; }
/* the seasons tint the one map */
.worldmap.s-spring .wm-bg { filter: saturate(1.25) brightness(1.06) hue-rotate(6deg); }
.worldmap.s-autumn .wm-bg { filter: sepia(.45) saturate(1.6) hue-rotate(-22deg) brightness(.98); }
.worldmap.s-winter .wm-bg { filter: saturate(.3) brightness(1.22) contrast(.92) hue-rotate(-8deg); }
.worldmap.s-winter::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.18), rgba(210,230,255,.28)); }
.wm-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.wm-lines .ml { stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.wm-lines .ml.own { stroke: #ffe08a; stroke-width: 3.5; filter: drop-shadow(0 0 2px #000); }
.wm-lines .ml.front { stroke: #ff6a57; stroke-width: 3; stroke-dasharray: 7 5; }
.wm-lines .ml.reach { stroke: rgba(255,255,255,.75); stroke-width: 2.2; stroke-dasharray: 3 5; }
.wm-lines .ml.far { stroke: rgba(20,12,30,.35); stroke-width: 1.5; stroke-dasharray: 2 6; }
.wm-node {
  position: absolute; z-index: 2; transform: translate(-50%, -50%); width: 54px; height: 54px;
  cursor: pointer; transition: transform .12s;
}
.wm-node:hover { transform: translate(-50%, -50%) scale(1.15); z-index: 5; }
.wm-node .wm-tile {
  width: 54px; height: 54px; border-radius: 50%; object-fit: cover; image-rendering: pixelated;
  border: 3px solid var(--neutral); background: #140f1f; box-shadow: 0 3px 6px rgba(0,0,0,.6);
}
.wm-node.mine .wm-tile { border-color: var(--player); }
.wm-node.hostile .wm-tile { border-color: var(--enemy); }
.wm-node.sale .wm-tile { border-color: #e4e0ee; }
.wm-node.far { opacity: .62; filter: grayscale(.55); }
.wm-node.far:hover { opacity: 1; filter: none; }
.wm-node.frontier .wm-tile { box-shadow: 0 0 0 3px rgba(255,106,87,.55), 0 3px 6px rgba(0,0,0,.6); }
.wm-node.raided .wm-tile { filter: sepia(.6) brightness(.7); }
.wm-node .wm-crown { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); font-size: 20px; color: var(--gold-bright); text-shadow: 1px 1px 0 #000, 0 0 6px #000; }
.wm-node .wm-hero, .wm-node .wm-foe {
  position: absolute; right: -10px; bottom: -4px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--player); background: #140f1f; image-rendering: pixelated;
}
.wm-node .wm-foe { border-color: var(--enemy); }
.wm-node .wm-raid {
  position: absolute; top: -12px; right: -18px; font-size: 14px; padding: 0 6px; border-radius: 8px;
  background: var(--enemy); color: #fff; border: 1px solid #ffb1a4; animation: pulse 1.2s ease-in-out infinite; white-space: nowrap;
}
.wm-node .wm-label {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%); white-space: nowrap; text-align: center;
  font-size: 15px; line-height: 1; color: #fff; padding: 2px 6px; border-radius: 6px; background: rgba(12,9,18,.78);
  pointer-events: none;
}
.wm-node .wm-label small { display: block; font-size: 13px; color: var(--text-dim); margin-top: 1px; }
.wm-node.mine .wm-label small { color: #9fe8bf; }
.wm-node.hostile .wm-label small { color: #ffb1a4; }
.wm-legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 8px; font-size: 16px; color: var(--text-dim); }
.wm-legend .lg { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 3px solid; margin-right: 5px; vertical-align: -1px; }
.lg.mine { border-color: var(--player); } .lg.sale { border-color: #e4e0ee; } .lg.hostile { border-color: var(--enemy); }
.lg.frontier { border-color: var(--player); box-shadow: 0 0 0 3px rgba(255,106,87,.55); } .lg.far { border-color: var(--neutral); opacity: .5; }
@media (max-width: 760px) { .wm-node { width: 36px; height: 36px; } .wm-node .wm-tile { width: 36px; height: 36px; } .wm-node .wm-label { top: 38px; font-size: 12px; } .wm-node .wm-hero, .wm-node .wm-foe { width: 18px; height: 18px; } }
.terr-card.far { opacity: .6; }
.borders { font-size: 18px; }
.locked-note { color: var(--text-dim); font-size: 18px; border: 1px dashed var(--stone-600); border-radius: 8px; padding: 8px 12px; }

/* ---------- Deeds: achievements, uniques, sets, traits ---------- */
.grid.ach-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ach { padding: 10px 12px; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; opacity: .8; }
.ach.got { border-color: var(--gold-dark); background: #2a2210; opacity: 1; }
.ach-name { font-size: 21px; color: var(--parchment); }
.ach.got .ach-name { color: var(--gold-bright); }
.ach-desc { font-size: 17px; color: var(--text-dim); min-height: 40px; }
.ach-foot { font-size: 15px; color: var(--text-dim); margin-top: 4px; }
.grid.uniq-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.uniq { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; }
.uniq.got { border-color: #3fe0d0; }
.uniq .uq { font-family: var(--font-head); font-size: 18px; color: var(--stone-600); }
.set-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.trait-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 12px; clear: both; }
.trait { font-size: 17px; padding: 4px 10px; border: 1px solid var(--stone-600); border-radius: 8px; color: var(--text-dim); background: var(--stone-850); }
.trait b { color: var(--parchment); margin-right: 6px; }
.trait.got { border-color: var(--gold-dark); background: #2a2210; color: var(--player); }
.trait.got b { color: var(--gold-bright); }
.pill.trait-pill { color: var(--gold-bright); border-color: var(--gold-dark); }

/* ---------- Sieges ---------- */
.siege-top { display: flex; gap: 14px; align-items: center; }
.siege-foe { width: 84px; height: 84px; border-radius: 10px; border: 2px solid var(--enemy); background: radial-gradient(circle at 50% 30%, #35294a, #140f1f); flex: none; }
.siege-pips { font-size: 24px; letter-spacing: 3px; }
.siege-pips .muted { font-size: 17px; letter-spacing: 0; }
.pip-win { color: var(--player); } .pip-loss { color: var(--enemy); } .pip-none { color: var(--stone-600); }
.siege-party { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.siege-hero { width: 66px; text-align: center; }
.siege-hero img { width: 62px; height: 62px; border-radius: 8px; border: 2px solid var(--stone-600); background: radial-gradient(circle at 50% 30%, #35294a, #140f1f); }
.siege-hero.down img { filter: grayscale(1) brightness(.5); border-color: var(--enemy-dk); }
.siege-hero .sh-n { font-size: 14px; color: var(--text-dim); }

/* ---------- Sound controls ---------- */
.audio-ctl { display: flex; gap: 6px; }
.audio-ctl .topmenu-btn { padding: 6px 11px; font-size: 20px; line-height: 1; }
.audio-ctl .topmenu-btn.off { opacity: .4; text-decoration: line-through; }
.title-menu .audio-ctl { margin-top: 4px; }

/* ---------- Motion ---------- */
/* battle: the two sides lunge at each other, then the loser reels */
@keyframes lungeR { 0% { transform: translateX(0); } 35% { transform: translateX(34px) scale(1.08); } 55% { transform: translateX(26px); } 100% { transform: translateX(0); } }
@keyframes lungeL { 0% { transform: translateX(0); } 35% { transform: translateX(-34px) scale(1.08); } 55% { transform: translateX(-26px); } 100% { transform: translateX(0); } }
@keyframes reel { 0%, 100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-6px) rotate(-4deg); } 40% { transform: translateX(6px) rotate(4deg); } 60% { transform: translateX(-4px) rotate(-2deg); } 80% { transform: translateX(4px) rotate(2deg); } }
@keyframes fallen { to { filter: grayscale(1) brightness(.55); } }
@keyframes triumph { 0% { box-shadow: 0 0 0 rgba(232,195,74,0); } 50% { box-shadow: 0 0 26px rgba(232,195,74,.9); } 100% { box-shadow: 0 0 12px rgba(232,195,74,.55); } }
@keyframes vsFlash { 0%, 100% { transform: scale(1); color: var(--enemy); } 35% { transform: scale(1.9); color: #fff; text-shadow: 0 0 18px #fff; } }
.vs-row.clash .combatant:first-child > img { animation: lungeR .55s ease-out; }
.vs-row.clash .combatant:last-child > img { animation: lungeL .55s ease-out; }
.vs-row.clash .vs { animation: vsFlash .55s ease-out; }
.vs-row.won .combatant:first-child > img { animation: lungeR .55s ease-out, triumph .9s ease-out .55s forwards; border-color: var(--gold); }
.vs-row.won .combatant:last-child > img { animation: lungeL .55s ease-out, reel .5s ease-in-out .55s, fallen .4s ease-in 1.05s forwards; }
.vs-row.lost .combatant:last-child > img { animation: lungeL .55s ease-out, triumph .9s ease-out .55s forwards; border-color: var(--enemy); }
.vs-row.lost .combatant:first-child > img { animation: lungeR .55s ease-out, reel .5s ease-in-out .55s, fallen .4s ease-in 1.05s forwards; }
/* report lines arrive one after another */
@keyframes lineIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.battle-log.reveal .ln { opacity: 0; animation: lineIn .28s ease-out forwards; animation-delay: calc(var(--i, 0) * 0.11s); }
.battle-log.reveal.late .ln { animation-delay: calc(0.75s + var(--i, 0) * 0.14s); }
@keyframes shimmer { 0%, 100% { text-shadow: none; } 50% { text-shadow: 0 0 10px rgba(255,224,138,.9); } }
.battle-log .ln.crit { animation: lineIn .28s ease-out forwards, shimmer 1.6s ease-in-out 1.5s 2; }
/* resource counters pop when they change */
@keyframes bumpUp { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: var(--player); } 100% { transform: scale(1); } }
@keyframes bumpDown { 0% { transform: scale(1); } 40% { transform: scale(1.25); color: var(--enemy); } 100% { transform: scale(1); } }
.res-chip .val { display: inline-block; }
.res-chip .val.bump-up { animation: bumpUp .5s ease-out; }
.res-chip .val.bump-down { animation: bumpDown .5s ease-out; }
/* title screen */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes glow { 0%, 100% { text-shadow: 3px 3px 0 #000, 0 0 14px rgba(232,195,74,.35); } 50% { text-shadow: 3px 3px 0 #000, 0 0 30px rgba(232,195,74,.8); } }
.title-inner img.crest { animation: float 4s ease-in-out infinite; }
.title-inner h1 { animation: glow 3.5s ease-in-out infinite; }
/* cards ease in when a view is drawn */
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.event-art { animation: cardIn .35s ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* dilemmas: events with choices */
.decision-bar {
  margin-bottom: 12px; padding: 9px 14px; cursor: pointer; font-size: 19px;
  background: #2a2210; border: 2px solid var(--gold); border-radius: 8px; color: var(--parchment);
  animation: pulse 1.6s ease-in-out infinite;
}
.event-art { display: block; width: 192px; height: 192px; margin: 0 auto 12px; border-radius: 10px; border: 2px solid var(--gold-dark); }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice {
  display: flex; flex-direction: column; text-align: left; gap: 2px; padding: 9px 12px;
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px; color: var(--text); transition: .1s;
}
.choice:hover:not(:disabled) { border-color: var(--gold); background: #2a2210; }
.choice.off { opacity: .45; cursor: not-allowed; }
.ch-label { font-size: 21px; color: var(--gold-bright); }
.ch-hint { font-size: 17px; color: var(--text-dim); }

/* class abilities in war parties */
.ab-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.ab-chip { font-size: 15px; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--stone-600); color: var(--text-dim); opacity: .7; cursor: help; }
.ab-chip.on { color: #cfe6ff; border-color: var(--mana); background: #16243a; opacity: 1; }
.ability-on { color: #9fc8ff; }
.battle-log .ln.ability { color: #9fc8ff; font-size: 16px; }
.recruit-card .desc.ability-on { min-height: 0; margin-top: -2px; }

/* scouted raids */
.scout-box { border: 2px solid var(--enemy); border-radius: 10px; background: #2a1414; margin-bottom: 14px; overflow: hidden; }
.scout-head { padding: 7px 12px; background: var(--enemy-dk); color: #ffd6cf; font-size: 19px; }
.scout-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; border-top: 1px solid #4a2020; }
.scout-row:hover { background: #3a1a1a; }
.scout-row img { width: 40px; height: 40px; border-radius: 6px; background: #140f1f; border: 1px solid var(--enemy); }
.scout-row .sr-txt { flex: 1; font-size: 18px; }
.scout-row .sr-go { color: var(--gold); white-space: nowrap; font-size: 17px; }
.terr-card .threat-badge.incoming { background: var(--enemy); color: #fff; border-color: #ffb1a4; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.threat-box { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--enemy); background: #2a1414; border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 18px; clear: both; }
.threat-box img { width: 56px; height: 56px; border-radius: 8px; background: #140f1f; border: 1px solid var(--enemy); flex: none; }
.battle-log .ln.warn, .log-entry.warn { color: #ffcf7a; }
.log-entry.warn { border-left-color: var(--gold); }

/* item level badge on item icons */
.item-icon { position: relative; }
.item-icon .ilvl {
  position: absolute; right: -5px; bottom: -5px; min-width: 20px; padding: 0 4px;
  font-size: 15px; line-height: 17px; text-align: center;
  color: var(--parchment); background: #0c0912;
  border: 1px solid var(--rar); border-radius: 8px;
}
.item-icon.sm .ilvl { right: -4px; bottom: -4px; min-width: 14px; padding: 0 2px; font-size: 12px; line-height: 13px; border-radius: 6px; }
.et-lvl { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* war party builder */
.party-bar {
  background: #0c0912; border: 2px solid var(--gold-dark); border-radius: 8px;
  padding: 9px 12px; font-size: 19px; color: var(--parchment);
}
.choose-item.picked { border-color: var(--gold); background: #2a2210; }
.party-faces { display: flex; justify-content: center; gap: 3px; margin-top: 5px; flex-wrap: wrap; max-width: 130px; }
.vs-row .combatant .party-faces img { width: 28px; height: 28px; border-radius: 5px; border-width: 1px; }

/* portrait column on hero cards: portrait + "next portrait" button */
.pcol { display: flex; flex-direction: column; gap: 5px; flex: none; width: 84px; }
.pbtn { width: 100%; padding: 2px 0; font-size: 15px; }

.pill.auto { color: #bfe0ff; border-color: var(--mana); }
.pill.pts { color: var(--gold-bright); border-color: var(--gold-dark); }

/* equipment slots in the hero sheet */
.equip-slots { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; clear: both; }
.equip-slot {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px;
}
.equip-slot.empty .item-icon { border-style: dashed; box-shadow: none; opacity: .6; }
.equip-slot .es-info { flex: 1; min-width: 0; }
.slot-label { font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Portrait picker (Recruit) ---------- */
.look-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.look-row .slot-label { margin-right: 4px; }
.look {
  width: 56px; height: 56px; padding: 0; overflow: hidden; border-radius: 8px;
  border: 2px solid var(--stone-600); opacity: .55; transition: .1s;
  background: radial-gradient(circle at 50% 30%, #35294a, #140f1f);
}
.look img { width: 52px; height: 52px; display: block; }
.look:hover { opacity: .9; }
.look.sel { opacity: 1; border-color: var(--gold); box-shadow: 0 0 8px rgba(232,195,74,.5); }

/* ---------- Generated pixel font and interface frame ---------- */
/* "Valor Pixel" was drawn by PixelLab at 16px; it has no space glyph, so spaces fall back to the next font. */
@font-face { font-family: 'Valor Pixel'; src: url('assets/fonts/valor.ttf') format('truetype'); font-display: swap; }
:root { --font-title: 'Valor Pixel', 'Press Start 2P', monospace; }
h1, h2, h3, .brand .title, .boss-name, .tech-branch, .clock .yr { font-family: var(--font-title); letter-spacing: 1px; }
.brand .title { font-size: 24px; }
.clock .yr { font-size: 18px; }
.view-head h2 { font-size: 26px; }
.modal .m-head h3 { font-size: 24px; }
.title-inner h1 { font-size: 64px; }
.tech-branch { font-size: 22px; }
.boss-name { font-size: 20px; }
/* tiny labels stay in the blockier fallback, which reads better at 10-12px */
.lvl-badge, .attr-val, .vs-row .vs, .terr-card.raided .art::after { font-family: 'Press Start 2P', monospace; }

/* stone-and-gold frame around dialogs and the title menu (9-slice of assets/ui/frame.png) */
.modal {
  border: 22px solid transparent;
  border-image: url('assets/ui/frame.png') 46 fill / 22px / 0 stretch;
  background-clip: padding-box;
  image-rendering: pixelated;
}
.modal .m-head { border-bottom-color: rgba(232,195,74,.35); }
.title-menu {
  padding: 26px 34px; border: 22px solid transparent;
  border-image: url('assets/ui/frame.png') 46 fill / 22px / 0 stretch;
}

/* ---------- Worlds and the voyage ---------- */
.voyage-bar { background: #10222e; border-color: #6fb7e0; }
.modal .m-art.voy-art { max-height: 210px; object-fit: cover; }
.voy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 12px 0; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.voy-hero {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; text-align: left; cursor: pointer;
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px; color: var(--text); transition: .1s;
}
.voy-hero:hover { border-color: var(--gold-dark); }
.voy-hero.on { border-color: var(--player); background: #16301f; }
.voy-hero img { width: 44px; height: 44px; border-radius: 6px; image-rendering: pixelated; flex: none; }
.voy-hero .vh-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 18px; line-height: 1.1; }
.voy-hero .vh-txt small { font-size: 15px; color: var(--text-dim); }
.voy-hero .vh-check { width: 24px; font-size: 22px; color: var(--player); text-align: center; }

/* ---------- Professions ---------- */
.btn.tiny { padding: 2px 7px; font-size: 14px; }
.mat-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mat-chip {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px;
  background: var(--stone-850); border: 2px solid var(--stone-600);
}
.mat-chip img { width: 32px; height: 32px; image-rendering: pixelated; }
.mat-chip .mat-n { font-size: 22px; color: var(--gold-bright); min-width: 22px; }
.mat-chip .mat-name { font-size: 15px; color: var(--text-dim); }
.prof-choose { margin-bottom: 16px; }
.prof-choose h4 { margin: 12px 0 6px; color: var(--gold); font-size: 15px; }
.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.prof-card, .prof-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--stone-850); border: 2px solid var(--stone-600);
}
.prof-card img, .prof-head > img { width: 48px; height: 48px; image-rendering: pixelated; flex: none; }
.prof-card .pc-txt { display: flex; flex-direction: column; flex: 1; font-size: 16px; line-height: 1.15; }
.prof-card .pc-txt b { font-size: 20px; color: var(--parchment); }
.prof-card .pc-txt span { color: var(--text-dim); }
.prof-panel { margin-bottom: 16px; padding: 8px; border-radius: 12px; background: var(--stone-900); border: 2px solid var(--gold-dark); }
.prof-head { border-color: transparent; background: transparent; }
.prof-head .ph-txt { flex: 1; }
.prof-head h3 { margin: 0 0 4px; font-size: 22px; }
.prof-head h3 small { font-size: 15px; color: var(--gold); margin-left: 6px; }
.skill-bar { position: relative; height: 16px; border-radius: 8px; background: var(--stone-950); border: 1px solid var(--stone-600); overflow: hidden; max-width: 420px; margin-bottom: 4px; }
.skill-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright)); }
.skill-bar span { position: relative; display: block; text-align: center; font-size: 13px; line-height: 16px; color: #fff; text-shadow: 1px 1px 0 #000; }
.gather-note { padding: 4px 12px; font-size: 17px; }
.gather-note p { margin: 4px 0; }
.recipes { display: flex; flex-direction: column; gap: 10px; }
.rec-group .rg-head, .reforge-box .rg-head { font-size: 17px; color: var(--gold); margin: 6px 4px 4px; border-bottom: 1px solid var(--stone-700); }
.rec-group .rg-head small, .reforge-box .rg-head small { color: var(--text-dim); font-size: 14px; margin-left: 6px; }
.rec-group.locked { opacity: .55; }
.rec-row {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 8px; align-items: center;
  padding: 4px 6px; border-radius: 8px; background: var(--stone-850); margin-bottom: 4px;
}
.rec-row .rc-icon { width: 40px; height: 40px; image-rendering: pixelated; }
.rec-row .rc-txt { display: flex; flex-direction: column; font-size: 15px; line-height: 1.15; min-width: 0; }
.rec-row .rc-txt b { font-size: 18px; }
.rec-row .rc-txt span { color: var(--text-dim); }
.rec-row .rc-cost { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; font-size: 16px; }
.rc-mat { display: inline-flex; align-items: center; gap: 2px; }
.rc-mat img { width: 20px; height: 20px; image-rendering: pixelated; }
.rc-mat.short { color: var(--enemy); }
.rc-gold { color: var(--gold-bright); }
.rec-row .rc-btns { display: flex; gap: 4px; }
/* how much skill a craft would teach, as in other games: orange, yellow, green, grey */
.skill-3 { color: #ff9a3c; } .skill-2 { color: #f2d14b; } .skill-1 { color: #5fd27a; } .skill-0 { color: #9a96a8; }
.reforge-box { margin: 0 0 16px; padding: 6px; border-radius: 12px; background: var(--stone-900); border: 2px solid var(--stone-600); }
.supply-row, .enh-row {
  display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; background: var(--stone-850); margin: 4px 0;
}
.supply-row img, .enh-row img { width: 36px; height: 36px; image-rendering: pixelated; flex: none; }
.supply-row .sp-txt { display: flex; flex-direction: column; flex: 1; font-size: 16px; line-height: 1.15; }
.supply-row .sp-txt small { color: var(--text-dim); font-size: 14px; }
.supply-row.off { opacity: .6; }
.enh-row span { flex: 1; font-size: 16px; }
@media (max-width: 700px) { .rec-row { grid-template-columns: 40px 1fr; } .rec-row .rc-cost, .rec-row .rc-btns { grid-column: 2; justify-content: flex-start; } }

/* ---------- Professions sub-tabs and profession buildings ---------- */
.ptabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; border-bottom: 2px solid var(--gold-dark); padding-bottom: 6px; }
.ptab {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 17px; cursor: pointer;
  background: var(--stone-850); color: var(--text); border: 2px solid var(--stone-600); border-radius: 8px 8px 0 0;
}
.ptab img { width: 24px; height: 24px; image-rendering: pixelated; }
.ptab small { color: var(--text-dim); font-size: 13px; }
.ptab:hover { border-color: var(--gold-dark); }
.ptab.on { background: #2a2210; border-color: var(--gold); color: var(--gold-bright); }
.prof-sums { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-bottom: 16px; }
.prof-sum {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left; cursor: pointer;
  background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; color: var(--text);
}
.prof-sum:hover { border-color: var(--gold); }
.prof-sum img { width: 44px; height: 44px; image-rendering: pixelated; flex: none; }
.prof-sum .ps-txt { display: flex; flex-direction: column; flex: 1; gap: 3px; font-size: 17px; }
.prof-sum .ps-txt b { font-size: 19px; color: var(--parchment); }
.choose-item.locked { opacity: .55; }
.bld-group { margin: 12px 0 6px; color: var(--gold); font-size: 15px; }

/* ---------- Zoomable map ---------- */
.worldmap .wm-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.worldmap .wm-viewport:active { cursor: grabbing; }
.worldmap .wm-inner { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; --nz: 1; }
.worldmap .wm-inner .wm-node { transform: translate(-50%, -50%) scale(var(--nz)); }
.worldmap .wm-inner .wm-node:hover { transform: translate(-50%, -50%) scale(calc(var(--nz) * 1.15)); }
/* names only where there is room for them; key lands always keep theirs */
.worldmap:not(.lod-all) .wm-node:not(.wm-key) .wm-label { display: none; }
.worldmap:not(.lod-all) .wm-node:not(.wm-key):hover .wm-label { display: block; }
.wm-ctrls { position: absolute; top: 8px; right: 8px; z-index: 10; display: flex; flex-direction: column; gap: 5px; }
.wm-ctrls button {
  width: 40px; height: 40px; font-size: 21px; line-height: 1; border-radius: 9px; cursor: pointer;
  background: rgba(12,9,18,.84); color: var(--parchment); border: 2px solid var(--gold-dark); box-shadow: 0 2px 5px rgba(0,0,0,.5);
}
.wm-ctrls button:hover { border-color: var(--gold-bright); }
.wm-ctrls button.hot { border-color: var(--enemy); color: #ffb1a4; animation: pulse 1.2s ease-in-out infinite; }
.wm-hint { text-align: center; font-size: 15px; margin: 6px 0 0; }

/* ---------- Phone layout ---------- */
.tab .tab-ic { display: none; }
.tab-more { display: none; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-tab { min-height: 56px; font-size: 20px; }
@media (max-width: 700px) {
  body { padding-bottom: 86px; }
  /* compact top bar: crest, clock and one scrolling row of resources */
  .topbar { gap: 8px; padding: 6px 8px; }
  .brand .title, .brand .sub { display: none; }
  .brand img { width: 34px; height: 34px; }
  .clock { padding: 3px 8px; gap: 6px; }
  .clock .season-emoji { font-size: 18px; }
  .resources { flex-wrap: nowrap; overflow-x: auto; width: 100%; margin-left: 0; gap: 6px; scrollbar-width: none; }
  .resources::-webkit-scrollbar { display: none; }
  .res-chip { min-width: 0; padding: 3px 8px; flex: none; }
  /* bottom tab bar with icons; the rest live under "More" */
  .actionbar { margin: 0; }
  .actionbar .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 0; flex-wrap: nowrap;
    background: var(--stone-900); border-top: 2px solid var(--gold-dark); padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .actionbar .tab {
    flex: 1 1 0; min-width: 0; border: none; border-radius: 8px; padding: 4px 2px; background: transparent;
    display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 13px; position: relative;
  }
  .actionbar .tab.active { background: var(--stone-800); color: var(--gold-bright); }
  .actionbar .tab .tab-ic { display: block; font-size: 22px; line-height: 1.1; }
  .actionbar .tab .tab-lb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .actionbar .tab .pip { position: absolute; top: 0; right: 4px; font-size: 11px; }
  .actionbar .tab-extra { display: none; }
  .actionbar .tab-more { display: flex; }
  /* End Season floats above the tab bar */
  .end-turn { position: fixed; right: 10px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 41; padding: 9px 16px; font-size: 19px; box-shadow: 0 4px 12px rgba(0,0,0,.6); }
  .decision-bar { font-size: 16px; }
  .view-head h2 { font-size: 20px; }
  .view-head .hint { font-size: 15px; }
  .grid.realm { grid-template-columns: 1fr 1fr; gap: 8px; }
  /* pop-ups become bottom sheets */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; border-bottom: none; animation: sheetUp .2s ease; }
  .modal .m-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* comfortable finger targets */
  .btn { min-height: 42px; }
  .btn.small { min-height: 38px; }
  .btn.tiny { min-height: 32px; }
  .m-x { min-width: 42px; min-height: 42px; }
  .toast { font-size: 16px; }
}
@media (max-width: 420px) { .grid.realm { grid-template-columns: 1fr; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Siege tactics ---------- */
.tactics { margin: 10px 0 6px; }
.tactics .tell { padding: 8px 10px; border-radius: 8px; background: #1d1830; border: 1px solid var(--stone-600); font-size: 17px; margin-bottom: 8px; }
.tactic-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn.tactic { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 3px; padding: 8px 10px; white-space: normal; }
.btn.tactic b { font-size: 19px; }
.btn.tactic small { font-size: 14px; line-height: 1.15; }
@media (max-width: 700px) { .tactic-row { grid-template-columns: 1fr; } }

/* ---------- The Forge ---------- */
.forge-top { display: flex; gap: 12px; align-items: center; }
.forge-top img { width: 64px; height: 64px; image-rendering: pixelated; flex: none; }
.forge-bar {
  position: relative; height: 44px; margin: 14px 0; border-radius: 10px; overflow: hidden;
  background: linear-gradient(90deg, #3a0d06, #b53a12 30%, #ffb347 50%, #b53a12 70%, #3a0d06);
  border: 3px solid var(--stone-600); box-shadow: inset 0 0 14px rgba(0,0,0,.7);
}
.forge-bar .fz { position: absolute; top: 0; bottom: 0; }
.forge-bar .fz.good { left: 32%; right: 32%; background: rgba(95,210,122,.35); border-left: 2px solid #5fd27a; border-right: 2px solid #5fd27a; }
.forge-bar .fz.perfect { left: 44%; right: 44%; background: rgba(255,214,102,.55); border-left: 2px solid #ffd666; border-right: 2px solid #ffd666; }
.forge-mark {
  position: absolute; top: -2px; bottom: -2px; left: 0; width: 6px; margin-left: -3px; border-radius: 3px;
  background: #fff; box-shadow: 0 0 8px #fff, 0 0 2px #000; animation: forgeSweep 1s linear infinite alternate;
}
@keyframes forgeSweep { from { left: 0%; } to { left: 100%; } }
.btn.forge-strike { font-size: 22px; min-width: 150px; }
.forge-switch { margin: -6px 0 14px; }
@media (prefers-reduced-motion: reduce) { .forge-mark { animation-duration: 2400ms !important; animation-iteration-count: infinite !important; } }

/* ---------- Prospecting ---------- */
.vein { margin-top: 10px; padding: 8px 10px; border-top: 1px solid var(--stone-700); }
.vein h4 { margin: 0 0 8px; color: var(--gold); font-size: 18px; }
.vein h4 small { font-size: 14px; }
.vein-wrap { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.vein-grid { display: grid; grid-template-columns: repeat(5, 48px); grid-template-rows: repeat(5, 48px); gap: 4px; }
.vein-cell {
  position: relative; display: flex; align-items: center; justify-content: center; font-size: 22px; border-radius: 6px;
  background: linear-gradient(180deg, #6d6470, #4a424e); border: 2px solid #2a2430; cursor: pointer; padding: 0;
}
.vein-cell:hover:not(:disabled) { border-color: var(--gold); }
.vein-cell:disabled { cursor: default; opacity: .7; }
.vein-cell.open { background: #2a2230; cursor: default; }
.vein-cell.open.shown { opacity: .55; }
.vein-cell.open.cave { background: #4a1a14; }
.vein-cell small { position: absolute; right: 3px; bottom: 1px; font-size: 13px; color: #ffcf6e; text-shadow: 1px 1px 0 #000; }
.vein-side { flex: 1; min-width: 200px; font-size: 16px; }
@media (max-width: 420px) { .vein-grid { grid-template-columns: repeat(5, 1fr); grid-template-rows: none; width: 100%; } .vein-cell { aspect-ratio: 1; } }

/* ---------- Rival houses ---------- */
.wm-node.rival .wm-tile { border-color: var(--rc, #b45ce0); box-shadow: 0 0 0 2px rgba(0,0,0,.5), 0 0 10px var(--rc, #b45ce0); }
.wm-node.rival .wm-foe { border-color: var(--rc, #b45ce0); }
.wm-legend .lg.rival { border-color: var(--rc); }

/* ---------- Arena and treasure maps ---------- */
.arena-bar { background: #2a1f10; }
.map-bar { background: #1f2410; border-color: #b8a25a; animation: none; }
.champ { display: flex; gap: 12px; align-items: center; padding: 8px; margin: 8px 0; border-radius: 10px; background: #2a1414; border: 2px solid var(--enemy); }
.champ img { width: 64px; height: 64px; border-radius: 8px; image-rendering: pixelated; flex: none; }
.arena-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.arena-hero { display: flex; align-items: center; gap: 10px; padding: 6px 10px; text-align: left; cursor: pointer; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 8px; color: var(--text); }
.arena-hero:hover { border-color: var(--gold); }
.arena-hero img { width: 44px; height: 44px; border-radius: 6px; image-rendering: pixelated; }
.arena-hero .ah-txt { display: flex; flex-direction: column; flex: 1; font-size: 17px; line-height: 1.15; }
.arena-hero .ah-txt small { color: var(--text-dim); font-size: 14px; }
.arena-hero .ah-odds { font-size: 22px; color: var(--gold-bright); min-width: 52px; text-align: right; }
.riddle { font-size: 22px; font-style: italic; color: var(--parchment); text-align: center; padding: 8px; border-radius: 8px; background: #2a2210; }
.map-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.map-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; cursor: pointer; background: var(--stone-850); border: 2px solid var(--stone-600); border-radius: 10px; color: var(--text); }
.map-opt:hover { border-color: var(--gold); }
.map-opt img { width: 72px; height: 72px; border-radius: 8px; image-rendering: pixelated; }
.map-opt small { color: var(--text-dim); }
@media (max-width: 480px) { .map-opts { grid-template-columns: 1fr; } .map-opt { flex-direction: row; } .map-opt img { width: 48px; height: 48px; } }
.wm-wrap { position: relative; max-width: 1000px; margin: 0 auto; }
.wm-wrap > .wm-ctrls { top: 11px; right: 11px; }
@media (max-width: 700px) {
  #app { padding-left: 6px; padding-right: 6px; }
  .view { padding: 10px 8px; }
  .wm-wrap > .wm-ctrls { position: static; flex-direction: row; justify-content: center; margin-top: 8px; gap: 8px; }
  .wm-ctrls button { width: 46px; height: 42px; }
  .worldmap { border-width: 2px; border-radius: 10px; }
  .wm-legend { font-size: 13px; }
}
@media (max-width: 420px) { .wm-node { width: 30px; height: 30px; } .wm-node .wm-tile { width: 30px; height: 30px; border-width: 2px; } .wm-node .wm-label { top: 31px; font-size: 11px; } .wm-node .wm-hero, .wm-node .wm-foe { width: 15px; height: 15px; right: -6px; } .wm-node .wm-crown { font-size: 14px; top: -10px; } }
.btn.tactic.gold small, .btn.tactic.gold small.good-text { color: #3a2608; }

/* ---- Multiplayer: Realms tab, sign-in, market ---- */
.title-account { margin-top: 14px; font-size: 17px; color: var(--parchment); text-shadow: 0 1px 2px #000; }
.linkish { background: none; border: none; padding: 0; color: var(--gold); font: inherit; text-decoration: underline; cursor: pointer; }
.mp-field { display: block; margin: 8px 0; font-size: 18px; color: var(--parchment); }
.mp-input { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 7px 9px; font: inherit; font-size: 19px;
  color: var(--parchment); background: #0c0912; border: 2px solid var(--stone-600); border-radius: 6px; }
.mp-input:focus { outline: none; border-color: var(--gold); }
.mp-h { margin: 18px 0 6px; font-size: 20px; color: var(--gold); }
.mp-table { width: 100%; border-collapse: collapse; font-size: 18px; margin: 4px 0 8px; }
.mp-table th, .mp-table td { padding: 5px 8px; text-align: left; border-bottom: 1px solid #2b2238; vertical-align: middle; }
.mp-table th { color: var(--text-dim); font-weight: normal; }
.mp-table tr.me td { color: var(--gold); }
.mp-table .mk-what { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mk-mat { width: 24px; height: 24px; image-rendering: pixelated; vertical-align: middle; }
.mp-list { margin: 4px 0 8px 18px; font-size: 18px; }
@media (max-width: 640px) { .mp-table { font-size: 16px; } .mp-table th, .mp-table td { padding: 4px 4px; } }
/* Realms: search boxes and market filters */
.hall-body { min-height: 120px; }
.mp-search, .mp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px; }
.mp-search .mp-input, .mp-filters .mp-input { display: inline-block; width: auto; margin: 0; padding: 5px 8px; font-size: 17px; }
.mp-search #hall-pq { flex: 1 1 220px; }
.mp-filters .mf-q { flex: 1 1 220px; }
.mp-sel { cursor: pointer; }
.mf-num { display: inline-flex; align-items: center; gap: 5px; font-size: 17px; color: var(--text-dim); }
.mf-num .mp-input { width: 76px; }
/* scout reports: the auto-resolve button sits at the right of the header */
.scout-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scout-head .scout-auto { margin-left: auto; }
/* market pages */
.mk-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 6px 0; }
.mk-pager .btn.small { min-width: 34px; }
.mk-pager .mf-num { margin-left: auto; }

/* research queue */
.tech.queued { border-color: var(--gold-dark); box-shadow: inset 0 0 10px -4px var(--gold); }
.rq-panel { background: #0c0912; border: 2px solid var(--gold-dark); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; }
.rq-head { font-size: 18px; color: var(--parchment); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rq-head .btn { margin-left: auto; }
.rq-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rq-item { display: flex; align-items: center; gap: 5px; background: var(--stone-850); border: 1px solid var(--stone-600); border-radius: 8px; padding: 3px 6px; font-size: 16px; }
.rq-item img { width: 24px; height: 24px; image-rendering: pixelated; }

/* online comforts: your rank, friend stars */
.mp-me { margin: 6px 0 4px; font-size: 18px; color: var(--parchment); }
.star { background: none; border: none; padding: 0 2px; font-size: 20px; line-height: 1; color: var(--text-dim); cursor: pointer; }
.star.on { color: var(--gold); }
.star:hover { color: var(--gold); }
/* the Endless Ladder banner */
.ladder-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 12px; background: linear-gradient(90deg, #2a1c3d, #160f22); border: 2px solid var(--gold-dark); border-radius: 10px; font-size: 18px; color: var(--parchment); }
.ladder-bar img { width: 44px; height: 44px; image-rendering: pixelated; }
.ladder-bar .btn { margin-left: auto; }
/* the Arena */
.ar-face { width: 22px; height: 22px; image-rendering: pixelated; vertical-align: middle; border-radius: 4px; }
.ar-champs { font-size: 16px; line-height: 1.5; }
.ar-bout { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; padding: 6px 8px; background: #0c0912; border: 1px solid var(--stone-600); border-radius: 8px; }
.ar-bout .ar-side { flex: 1 1 260px; font-size: 18px; }
.ar-bout .mp-input { width: auto; flex: 1 1 260px; margin: 0; }

/* phones: the four resources always fit (Renown used to scroll off the right edge, out of sight) */
@media (max-width: 700px) {
  .resources { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; gap: 4px; width: 100%; }
  .res-chip { min-width: 0; padding: 3px 4px; gap: 0 4px; flex-wrap: wrap; justify-content: center; align-content: center; }
  .res-chip img { width: 20px; height: 20px; }
  .res-chip .val { font-size: 19px; line-height: 1.1; }
  .res-chip .delta { flex-basis: 100%; text-align: center; font-size: 13px; line-height: 1; }
}
