:root {
  --panel-bg: rgba(22, 26, 32, 0.92);
  --panel-border: #6b5631;
  --text: #f3ead2;
  --muted: #a99f88;
  --gold: #ffe28a;
  --bad: #ff7a6b;
  --good: #8fe07f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1d4e6e;
  color: var(--text);
  font-family: system-ui, "Segoe UI", sans-serif;
  user-select: none;
}

#world { display: block; position: fixed; inset: 0; touch-action: none; cursor: grab; }

#hud {
  position: fixed;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.hud-btn {
  text-align: left;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 14px;
  background: #5a3e1e;
  border: 2px solid var(--panel-border);
  border-radius: 10px;
}
/* The Shop: a gold square right of the resource bar, so players see it */
.hud-top { position: relative; }   /* (the shop sits outside it, so the buttons below keep the bar's width) */
#shop-btn { position: absolute; left: calc(100% + 8px); top: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  width: 72px; height: 72px; flex: none; font-size: 26px; padding: 0; background: linear-gradient(#c9952e, #8a5a14); color: #fff6dc; }
#shop-btn span, #settings-btn span { font-size: 13px; }
/* Settings: a square right under the Shop */
#settings-btn { position: absolute; left: calc(100% + 8px); top: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-align: center; width: 72px; height: 72px; padding: 0; font-size: 24px; background: #3a3f48; }
#settings-btn:hover { background: #4d535e !important; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 6px 0; white-space: nowrap; }
.setrow .toggle { min-width: 90px; flex: none; }
.setrow .toggle.on { background: #3f7a2a; }
.box.settings { min-width: 260px; }
.box.voyage { width: min(420px, 92vw); max-height: 84vh; overflow: auto; }
.box.voyage .voyn { width: 100%; box-sizing: border-box; margin: 6px 0; padding: 7px 9px; font-size: 14px; }
.box.shop { max-height: 84vh; overflow: auto; }   /* the Shop: its list scrolls, Close stays reachable */
/* The Shop's sliding rows (user, 2026-11-20): Medals 3 cards side by side, the skin rows 1 big card each. */
#modal .box.shop { width: min(760px, calc(100% - 24px)); max-height: 88vh; }
.srow { position: relative; }
.carousel { position: relative; }
.cartrack { position: relative; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 0 6px; }
.cartrack::-webkit-scrollbar { display: none; }
.carousel[data-per="3"] .scard { flex: 0 0 calc((100% - 20px) / 3); }
.carousel[data-per="1"] .scard { flex: 0 0 100%; }
.scard {
  scroll-snap-align: start; min-width: 0; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 10px 8px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 226, 138, 0.09), rgba(0, 0, 0, 0.28)); border: 1px solid #5a4a30;
}
.scard:hover { border-color: #b8944a; }
.scard.pack { border-color: #c8962a; background: linear-gradient(180deg, rgba(255, 196, 64, 0.2), rgba(0, 0, 0, 0.3)); cursor: default; }
.scard .mico .medalico { width: 58px; height: 58px; vertical-align: middle; }
.scard .packico { display: flex; justify-content: center; }
.scard .packico .medalico { width: 42px; height: 42px; margin: 0 -7px; }
.scard .packico { max-width: 100%; }
.scard .packico.many .medalico { width: 34px; height: 34px; margin: 0 -6px; }   /* packs of 4+ medals */
@media (max-width: 520px) { .scard .packico.many .medalico { width: 26px; height: 26px; margin: 0 -4px; } }
.scard .sname { font-size: 13px; line-height: 1.2; color: var(--gold); }
.scard .stype { display: block; font-size: 11px; color: var(--muted); }
.scard .sdesc { font-size: 12px; color: var(--muted); line-height: 1.35; }
.scard .sbuy { margin-top: auto; width: 100%; }
.scard .sseason { display: inline-block; margin-top: 2px; padding: 1px 6px; border-radius: 9px; font-size: 10.5px; background: #b8141c; color: #fff; }   /* a seasonal offer */
.scard.seasonal { border-color: #c83a3a; background: linear-gradient(180deg, rgba(200, 40, 40, 0.16), rgba(20, 90, 40, 0.18)); }
.scard.pack .sdesc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }   /* (full list in its tooltip) */
.scard.big { cursor: default; flex-direction: row; align-items: stretch; text-align: left; gap: 12px; padding: 10px; }   /* picture left, details right */
.scard.big .medalprev { flex: 0 0 52%; width: 52%; max-width: none; height: auto; margin: 0; align-self: center; }
.scard.big .bigside { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.scard.big .bigrow { display: flex; gap: 8px; align-items: center; }
.scard.big .bigrow .medalico { width: 44px; height: 44px; }
@media (max-width: 620px) { .scard.big { flex-direction: column; } .scard.big .medalprev { width: 100%; flex: none; } }
.scard.big .sname { font-size: 15px; }
.scard.empty { justify-content: center; align-items: center; min-height: 90px; }
.carnav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 30px; height: 46px; padding: 0; border-radius: 8px; font-size: 14px;
  background: rgba(15, 20, 25, 0.88); border: 1px solid #7a6440; color: var(--gold);
}
.carnav.prev { left: -8px; }
.carnav.next { right: -8px; }
.carnav:disabled { opacity: 0.2; }
.cardots { display: flex; justify-content: center; gap: 5px; min-height: 7px; }
.cardots span { width: 7px; height: 7px; border-radius: 50%; background: #5a4a30; }
.cardots span.on { background: var(--gold); }
.scard.flash { animation: sflash 1.2s; }
@keyframes sflash { 0%, 60% { box-shadow: 0 0 0 3px var(--gold) inset; } 100% { box-shadow: none; } }
@media (max-width: 520px) {
  .scard { padding: 8px 4px; }
  .scard .sname { font-size: 11px; }
  .scard .mico .medalico { width: 42px; height: 42px; }
  .scard.pack .sdesc { display: none; }
  .scard .sbuy { font-size: 12px; padding: 4px 2px; }
}
.box.alliance { width: min(440px, 92vw); max-height: 84vh; overflow: auto; }   /* the Alliance window */
.box.alliance .allyname { width: 100%; box-sizing: border-box; margin: 6px 0; padding: 7px 9px; font-size: 14px; }
#shop-btn:hover { background: linear-gradient(#e0ab3e, #a06a1c) !important; }
#map-btn { background: #1e4a66; }
#reports-btn { background: #4a2f2a; }
.hud-btn:hover { background: #74512a !important; }
.badge { background: #e8332a; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 12px; margin-left: 4px; }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* ---------- Sea map ---------- */
#map { position: fixed; inset: 0; z-index: 5; background: #163e58; }
#map.hidden, #reports.hidden, #war.hidden, #under.hidden { display: none; }
#map .mcanvas, #under .mcanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
/* Underground World: same layout as the Sea Map; a flooded cave (art in cave.js) */
#under { position: fixed; inset: 0; z-index: 5; background: #061c21; }
.ustore { display: flex; gap: 10px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.ustore span { color: var(--text); }
.ubuild { border: 1px solid #5a4630; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; }
.ubuild.empty { opacity: 0.85; border-style: dashed; }
.mtop {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: rgba(15, 20, 25, 0.85); border-bottom: 2px solid var(--panel-border);
}
.mtop b { color: var(--gold); font-size: 17px; white-space: nowrap; }
.msearch { display: flex; gap: 6px; }
.msearch input {
  width: 170px; padding: 6px 8px; font: inherit; background: #0f1317; color: var(--text);
  border: 1px solid #7a6440; border-radius: 6px; user-select: text;
}
.mcoord { display: flex; gap: 6px; }   /* X / Y search */
.mcoord input {
  width: 64px; padding: 6px 8px; font: inherit; background: #0f1317; color: var(--text);
  border: 1px solid #7a6440; border-radius: 6px; user-select: text;
}
.mclose { margin-left: auto; }
.mside {
  position: absolute; top: 64px; right: 12px; width: 320px; max-height: calc(100% - 80px); overflow-y: auto;
  background: var(--panel-bg); border: 2px solid var(--panel-border); border-radius: 10px; padding: 12px;
}
.mside h3, .rbox h3 { margin: 4px 0 8px; color: var(--gold); }
.mrow, .rrow {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; margin-bottom: 4px; text-align: left;
}
.mrow span, .rrow span { color: var(--muted); }

.mside .muted { color: var(--muted); font-size: 12px; }
.formation {
  position: relative; width: 100%; aspect-ratio: 8 / 10; margin: 6px 0;
  background-color: #17557f; border: 2px solid #0f3550; border-right: 3px solid rgba(255, 255, 255, 0.5);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 12.5% 10%;
}
.fu.model { border-color: transparent; }
.fu.model .sico, .fu.model .dico { width: 100%; height: 100%; margin: 0; }
.fu {
  position: absolute; box-sizing: border-box; border: 2px solid var(--gold); border-radius: 5px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.fu span { font-size: 15px; }
.fu i { position: absolute; top: 0; left: 2px; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; }

/* ---------- Battlefield ---------- */
#war { position: fixed; inset: 0; z-index: 7; background: #12161b; display: flex; flex-direction: column; }
.wtop {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: rgba(15, 20, 25, 0.95); border-bottom: 2px solid var(--panel-border);
}
.wtitle { color: var(--gold); font-size: 17px; }
.winfo { color: var(--muted); }
.wbody { flex: 1; display: flex; min-height: 0; }
.wcanvas { flex: 1; min-width: 0; height: 100%; }
.wside { width: 300px; overflow-y: auto; padding: 12px; background: var(--panel-bg); border-left: 2px solid var(--panel-border); }
.wpick { display: block; width: 100%; text-align: left; margin-bottom: 4px; }
.wpick span { display: block; font-size: 11px; color: var(--muted); }
.wpick.on { background: #85642a; border-color: var(--gold); }
/* Rarity sections in the attack / defence dragon lists (sticky while their section is in view). */
.wgroup + .wgroup { margin-top: 8px; }
.wsep {
  position: sticky; top: -12px; z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 6px 0 5px; margin-bottom: 4px; background: #161a1f;
  font-size: 11px; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; color: #c9c2b0;
}
.wsep::before, .wsep::after { content: ''; flex: 1; height: 2px; background: currentColor; opacity: 0.5; }
.wsep.r-rare { color: #7fb0ff; }
.wsep.r-apex { color: #ff7a6b; }
.wpick span.dot { display: inline-block; }
.wpick .st, .erow .st { color: #d9cfb5; font-size: 11px; }
.erow { padding: 5px 0; border-bottom: 1px solid #2a2620; font-size: 13px; }
.erow .muted { color: var(--muted); font-size: 11px; }
.cmp { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0; }
.cmp th { color: var(--muted); font-weight: 500; text-align: right; }
.cmp td { text-align: right; padding: 2px 0; }
.cmp td:first-child, .cmp th:first-child { text-align: left; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.wbtns { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; margin-top: 12px; position: sticky; bottom: 0; }
@media (max-width: 700px) {
  .wbody { flex-direction: column; }
  .wcanvas { height: 50%; flex: none; }
  .wside { width: auto; flex: 1; border-left: none; }
  .mside { width: auto; left: 12px; top: auto; bottom: 12px; max-height: 45%; }
  .mtop { flex-wrap: wrap; }
}

/* ---------- Market & gold ---------- */
.goldtxt { color: #ffd34d; }
.silvertxt { color: #d9e2ea; }
.camptabs { margin-bottom: 8px; }
.slothead { margin-top: 8px; border-bottom: 1px solid rgba(232,226,210,0.15); padding-bottom: 2px; }   /* Armory: stored equipment by slot */
.campgroup + .campgroup { margin-top: 2px; }
.camptabs button.locked { opacity: 0.55; filter: grayscale(0.7); cursor: not-allowed; }   /* events not running right now */
.campgroup > .hint { margin: 2px 0 8px; }
.rlistbox { max-height: 280px; overflow-y: auto; margin: 6px 0; padding-right: 4px; }
.sec.event { border-left: 3px solid #7d1414; padding-left: 8px; }
.sec.infected { border-left: 3px solid #4f9a2a; padding-left: 8px; }   /* Infected Islands */
.items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 6px 0; }
@media (max-width: 700px) { .items { grid-template-columns: 1fr; } }
.chests { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.chest { padding: 8px; border-radius: 8px; text-align: center; background: rgba(255, 255, 255, 0.04); border: 1px solid #5a4a2e; }
.chest.silver { border-color: #a8b0b8; }
.chest.gold { border-color: #e0b33a; box-shadow: inset 0 0 18px rgba(224, 179, 58, 0.15); }
.chest .cicon { font-size: 38px; line-height: 1; }
.chest .row { text-align: left; }
.chest .big { margin-top: 6px; }
.btns.m2 { grid-template-columns: 1fr 1fr; }
.buyhead { margin: 8px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.buyhead.r-rare { color: #7fb0ff; }
.buyhead.r-apex { color: #ff7a6b; }
.buyrow { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid #2a2620; font-size: 13px; }
.buyrow .muted { color: var(--muted); font-size: 11px; display: block; margin-left: 16px; }
.buybtns { display: flex; gap: 4px; flex-shrink: 0; }
.buybtns button { font-size: 12px; padding: 3px 8px; }
.lvsel { display: flex; align-items: center; gap: 8px; }
.lvsel button { padding: 2px 10px; }

#reveal {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(40, 30, 10, 0.85) 0%, rgba(0, 0, 0, 0.9) 70%); cursor: pointer;
}
#reveal.hidden { display: none; }
.rv { text-align: center; animation: rvpop 0.5s ease-out; padding: 20px; }
@keyframes rvpop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rvchest { color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.rvmedal {
  width: 160px; height: 160px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8 0%, var(--c) 45%, #000a 100%);
  border: 4px solid #c9a86a; display: flex; align-items: center; justify-content: center;
  animation: rvglow 1.6s ease-in-out infinite alternate;
}
.rvmedal span { font-size: 90px; }
.r-common .rvmedal { --glow: rgba(200, 200, 200, 0.5); }
.r-rare .rvmedal { --glow: rgba(90, 150, 255, 0.8); }
.r-apex .rvmedal { --glow: rgba(255, 70, 50, 0.9); }
@keyframes rvglow { from { box-shadow: 0 0 20px var(--glow, #fff6); } to { box-shadow: 0 0 60px var(--glow, #fff6); } }
.rvrarity { margin-top: 16px; font-family: Cinzel, Georgia, serif; letter-spacing: 4px; text-transform: uppercase; color: var(--muted); }
.r-rare .rvrarity { color: #7fb0ff; }
.r-apex .rvrarity { color: #ff7a6b; }
.rvname { font-family: Cinzel, Georgia, serif; font-size: 34px; color: var(--gold); margin-top: 4px; }
.rvsp { font-size: 17px; }
.rvpass { margin-top: 8px; color: #ffd34d; }
.rvnote { margin-top: 10px; font-size: 13px; color: var(--muted); max-width: 320px; }
.rvskip { margin-top: 22px; font-size: 12px; color: var(--muted); }

/* ---------- Armory ---------- */
#panel.wide { width: 440px; }
.crafts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 6px 0; }
.craft { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; border-color: var(--tc); }
.craft b { color: var(--tc); }
.craft span { font-size: 11px; color: var(--muted); }
.craft span.goldtxt { color: #ffd34d; font-size: 12px; }
.item { margin: 6px 0; padding: 7px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.04); border-left: 4px solid var(--tc); }
.ihead { display: flex; align-items: center; gap: 6px; }
.iicon { font-size: 18px; }
.ieff { font-size: 12px; color: #d9cfb5; }
.ibtns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ibtns button { font-size: 12px; padding: 3px 7px; }
.general { margin: 8px 0; padding: 8px; border-radius: 8px; background: rgba(255, 226, 138, 0.05); border: 1px solid #4a3f2c; }
.gname { font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.gslot { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid #2a2620; font-size: 13px; }
.gslot.empty .muted { color: var(--muted); font-size: 12px; }
.gslot:last-of-type { border-bottom: none; }
.away { font-size: 11px; font-weight: 400; color: #8fd0ff; }
@media (max-width: 700px) { #panel.wide { width: auto; left: 12px; } .crafts { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Armies ---------- */
#armies { position: fixed; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
#armies.hidden { display: none; }
#armies-btn { background: #24485a; }
.abox {
  width: min(560px, 100%); max-height: min(640px, 100%); display: flex; flex-direction: column;
  background: var(--panel-bg); border: 2px solid var(--panel-border); border-radius: 10px; padding: 12px;
}
.abox h3 { margin: 4px 0 8px; color: var(--gold); }
.alist { overflow-y: auto; }
.arow { padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); border-left: 4px solid #f0b84a; }
.arow.back { border-left-color: var(--good); }
.arow.back .bar div { background: var(--good); }
.arow .muted { color: var(--muted); }
.arow .bar { margin: 4px 0 6px; height: 6px; }

/* ---------- Reports ---------- */
#reports { position: fixed; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.rbox {
  width: min(860px, 100%); height: min(600px, 100%); display: flex; flex-direction: column;
  background: var(--panel-bg); border: 2px solid var(--panel-border); border-radius: 10px; padding: 12px;
}
.rhead { display: flex; align-items: center; }
.rbody { flex: 1; display: grid; grid-template-columns: 260px 1fr; gap: 12px; min-height: 0; }
.rlist, .rdetail { overflow-y: auto; }
.rrow { position: relative; display: block; }
.rrow.on { background: #85642a; border-color: var(--gold); }
.rrow { padding-right: 20px; }
.rrow .ricon { color: inherit; margin-right: 4px; }
.rrow .rago { display: block; font-size: 11px; }
.rhead .rall { margin-left: 12px; font-size: 12px; color: var(--muted); }
.dotnew { position: absolute; right: 8px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #e8332a; }
@media (max-width: 700px) { .rbody { grid-template-columns: 1fr; grid-template-rows: 35% 65%; } }
/* Messages from players (✉️ in Reports) and the alliance chat */
.rrow.rmsg { border-left: 4px solid #5aa0d8; }
.rrow .msgt { color: #9fd0f5; }
.msglog { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.alliance .msglog { max-height: 300px; }
.msg { align-self: flex-start; max-width: 80%; background: rgba(0, 0, 0, 0.25); border-radius: 8px; padding: 5px 9px; }
.msg.mine { align-self: flex-end; background: rgba(90, 160, 216, 0.25); }
.msgwho { font-size: 11px; color: var(--muted); }
.msgbody { white-space: pre-wrap; overflow-wrap: anywhere; }
.msgtext { width: 100%; box-sizing: border-box; min-height: 56px; resize: vertical; font: inherit; padding: 6px; border-radius: 6px; }
.msgbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; }
.altabs { display: flex; gap: 6px; margin-bottom: 8px; }
.altabs button.on { background: #85642a; border-color: var(--gold); }
#resource-bar {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 270px;
}
.res {
  display: grid;
  grid-template-columns: 26px 70px 1fr auto;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
}
.res .ico { font-size: 18px; }
.runeico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; display: inline-block; }
.coinico { width: 1.15em; height: 1.15em; vertical-align: -0.22em; display: inline-block; }   /* silver coins (config RESOURCE_ICONS.silver) */
.medalico { width: 1.3em; height: 1.3em; vertical-align: -0.3em; display: inline-block; }       /* medals (config MEDALS.*.icon) */
.medalrow { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; }
.medalrow .medalbig .medalico { width: 48px; height: 48px; }
.medalprev { display: block; width: 100%; max-width: 360px; aspect-ratio: 2 / 1; margin: 6px 0; border-radius: 8px; border: 1px solid var(--panel-border); }   /* the skin's picture (medalart.js) */
.medalrow .medalpack { display: flex; flex-direction: column; }   /* a pack: its medals stacked */
.medalrow .medalpack .medalico + .medalico { margin-top: -6px; }
.medalslot { margin-top: 6px; }
.medalchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.medalchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border: 1px solid rgba(201, 168, 106, 0.5); border-radius: 12px; font-size: 12px; }
.chestico { width: 1.2em; height: 1.2em; vertical-align: -0.25em; display: inline-block; }    /* chest icons (config CHESTS.*.icon) */   /* the rune icon (config RESOURCE_ICONS.runes) */
.res .amt { font-weight: 700; font-size: 16px; text-align: right; }
.res .amt.full { color: var(--gold); }
.res .cap { color: var(--muted); font-size: 12px; }
.res .rate { font-size: 12px; color: var(--good); }
.res .rate.neg { color: var(--bad); }
.tick { margin-top: 6px; font-size: 12px; color: var(--muted); border-top: 1px solid #3a342a; padding-top: 6px; }

#panel {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 360px;
  z-index: 2;
  max-height: calc(100% - 70px);
  overflow-y: auto;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
}
#panel.hidden { display: none; }
.evtime { color: var(--gold); white-space: nowrap; }   /* an event's time left, top right of its page */
img.emo { width: 1.2em; height: 1.2em; vertical-align: -0.25em; display: inline-block; }   /* a picture used like an emoji (Great Migration's wing) */
/* The open event's story (Exploration Camp): a parchment card left of the wide panel; on narrow screens inside it. */
.lore {
  background: radial-gradient(ellipse at center, #f1e4c3 60%, #e2cfa1 100%);
  color: #3b2a17; font-family: "IM Fell English", Georgia, serif; font-size: 15px; line-height: 1.45;
  border: 2px solid #8a6a3a; border-radius: 8px; padding: 12px 14px;
  box-shadow: inset 0 0 18px rgba(90, 60, 25, 0.25);
}
.lore .lore-h { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 15px; letter-spacing: 1px; color: #8b2e1f; margin-bottom: 6px; }
.lore p { margin: 0; }
#eventlore { position: fixed; top: 12px; right: 476px; width: 300px; z-index: 2; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45); }
#eventlore.hidden { display: none; }
.lore.lore-in { display: none; margin-top: 10px; }
@media (max-width: 1150px) { #eventlore { display: none; } .lore.lore-in { display: block; } }
.ph { display: flex; align-items: center; gap: 10px; }
.ph .pico { font-size: 34px; }
.ph h2 { margin: 0; font-size: 18px; color: var(--gold); }
.ph .sub { font-size: 12px; color: var(--muted); }
.ph .close { margin-left: auto; align-self: flex-start; }
.sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid #3a342a; }
.row { display: flex; justify-content: space-between; padding: 3px 0; }
.hint { font-size: 12px; color: var(--muted); padding: 2px 0 4px; }
.btns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 6px 0; }
.btns.d { grid-template-columns: repeat(4, 1fr); }
.btns.s { grid-template-columns: repeat(3, 1fr); }
.btns.q { grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr 2fr; align-items: center; }
.btns .qty { text-align: center; font-size: 15px; }
.cost.inl { margin: 0; gap: 8px; font-size: 13px; }
button.wide { width: 100%; margin: 2px 0 6px; }
.row.sm { font-size: 13px; padding: 2px 0; }
.row .muted { color: var(--muted); font-size: 11px; }
.hint.good { color: var(--good); }
.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
.dt th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding-bottom: 4px; }
.dt td { padding: 4px 4px 4px 0; vertical-align: top; }
.dt td .hint { padding: 0; font-size: 11px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
button.link { background: none; border: none; padding: 0; text-align: left; color: var(--text); }
button.link:hover { text-decoration: underline; background: none; }
button.icon { padding: 2px 5px; font-size: 12px; }
.dlist { max-height: 200px; overflow-y: auto; }
.wlist { max-height: 220px; overflow-y: auto; margin-top: 6px; border-top: 1px solid #3a342a; padding-top: 4px; }
.wlist .dt td { padding: 3px 4px 3px 0; vertical-align: middle; }
.wlist .num { text-align: right; white-space: nowrap; color: var(--good); font-weight: 600; }
.wlist .m { color: #7fb0f0; }
.wlist .f { color: #f07fb8; }
.wlist .muted { color: var(--muted); font-size: 12px; }
.dt td.m { color: #7fb0f0; }
.dt td.f { color: #f07fb8; }
.dt td.muted { color: var(--muted); }

/* ---------- Book of Dragons ---------- */
#book {
  --ink: #3b2a17;
  --ink-soft: #6e5636;
  --parch: #f1e4c3;
  --parch-dark: #e2cfa1;
  --accent: #8b2e1f;
  position: fixed; inset: 0; z-index: 9;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
#book.hidden { display: none; }
#book .book {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  width: min(960px, 100%);
  height: min(640px, 100%);
  background: #5a3a1c;
  border-radius: 12px;
  padding: 12px;
  gap: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: var(--ink);
  font-family: "IM Fell English", Georgia, serif;
}
#book .page {
  background: radial-gradient(ellipse at center, var(--parch) 60%, var(--parch-dark) 100%);
  padding: 22px 24px;
  overflow-y: auto;
  min-height: 0;
}
#book .page.left { border-radius: 6px 2px 2px 6px; box-shadow: inset -12px 0 18px -12px rgba(60, 35, 10, 0.5); display: flex; flex-direction: column; }
#book .page.right { border-radius: 2px 6px 6px 2px; box-shadow: inset 12px 0 18px -12px rgba(60, 35, 10, 0.5); }
#book h2 { font-family: Cinzel, Georgia, serif; color: var(--accent); margin: 0 0 8px; font-size: 24px; }
#book .page.right h2 { text-align: center; font-size: 26px; }
#book button { font-family: inherit; color: var(--ink); background: transparent; border: 1px solid transparent; }
#book .bclose {
  position: absolute; top: 2px; right: 2px; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  background: #5a3a1c; color: var(--parch); border: 2px solid #c9a86a; font-size: 14px;
}
#book .btabs { display: flex; gap: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--ink-soft); }
#book .btabs button { padding: 6px 10px; font-size: 15px; border-radius: 6px 6px 0 0; }
#book .btabs button.on { background: var(--parch-dark); border: 1px solid var(--ink-soft); border-bottom-color: var(--parch-dark); margin-bottom: -1px; font-weight: bold; }
#book .blist { overflow-y: auto; flex: 1; min-height: 0; }
#book .bitem {
  display: grid; grid-template-columns: 14px 1fr; column-gap: 8px; align-items: center;
  width: 100%; text-align: left; padding: 6px 8px; border-radius: 6px; font-size: 16px;
}
#book .bitem:hover { background: rgba(110, 86, 54, 0.12); }
#book .bitem.on { background: rgba(139, 46, 31, 0.14); border-color: rgba(139, 46, 31, 0.4); }
#book .bitem .dot { grid-row: span 2; width: 12px; height: 12px; margin: 0; border: 1px solid var(--ink-soft); }
/* Rarity headings in the species list: a ruled title that stays at the top while scrolling through its group. */
#book .bsep {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 6px 4px 4px; background: var(--parch);
  font-family: Cinzel, Georgia, serif; font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-soft);
}
#book .bgroup + .bgroup { margin-top: 6px; }
#book .bsep::before, #book .bsep::after { content: ''; flex: 1; height: 2px; background: currentColor; opacity: 0.45; }
#book .bsep.r-rare { color: #2c5a9e; }
#book .bsep.r-apex { color: var(--accent); }
#book .bname { font-weight: bold; }
#book .bmeta { font-size: 13px; color: var(--ink-soft); font-style: italic; }
#book .sx-m { color: #2c5a9e; }
#book .sx-f { color: #a3346c; }
#book .medal {
  width: 96px; height: 96px; margin: 0 auto 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8 0%, var(--c) 45%, #0006 100%);
  border: 3px solid #8a6a3b; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(60, 35, 10, 0.35);
}
#book .medal span { font-size: 54px; filter: drop-shadow(0 2px 2px #0005); }
#book .rarity { text-align: center; font-family: Cinzel, Georgia, serif; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
#book .rarity.r-rare { color: #2c5a9e; }
#book .rarity.r-apex { color: var(--accent); }
#book .lore { font-style: italic; text-align: center; font-size: 17px; margin: 8px 12px 14px; }
#book dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 16px; }
#book dt { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 13px; color: var(--accent); padding-top: 2px; }
#book dd { margin: 0; }
#book .bsub { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 13px; color: var(--accent); border-bottom: 1px solid var(--ink-soft); margin: 12px 0 6px; padding-bottom: 2px; }
#book .bgather { width: 100%; font-size: 16px; }
#book .bgather td { text-align: center; }
#book .bicon { font-size: 14px; padding: 2px 4px; border-radius: 4px; vertical-align: middle; }
#book .bicon:hover, #book .blink:hover { background: rgba(110, 86, 54, 0.15); }
#book .blink { padding: 0; text-decoration: underline; font-size: 16px; }
#book .muted { color: var(--ink-soft); font-style: italic; }
#book .passive {
  font-size: 16px; margin: 4px 0 14px; padding: 8px 12px; border-radius: 6px;
  background: rgba(139, 46, 31, 0.09); border: 1px solid rgba(139, 46, 31, 0.35); border-left: 4px solid var(--accent);
}
#book .passive .ptitle { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 14px; color: var(--accent); margin-bottom: 2px; }
#book .passive .muted { font-size: 13px; margin-top: 2px; }
#book .pdemo { display: block; width: 100%; aspect-ratio: 10 / 4; margin-top: 6px; border-radius: 6px; border: 2px solid #6e5636; }
#book .bempty { font-style: italic; color: var(--ink-soft); }
@media (max-width: 700px) {
  #book .book { grid-template-columns: 1fr; grid-template-rows: 40% 60%; height: 100%; }
  #book .page.left, #book .page.right { border-radius: 6px; box-shadow: none; }
}

#modal {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
}
#modal.hidden { display: none; }
#modal .box {
  width: min(320px, calc(100% - 32px));
  max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto;   /* taller than the screen: it scrolls */
  background: var(--panel-bg); border: 2px solid var(--panel-border); border-radius: 10px; padding: 14px;
}
#modal h3 { margin: 0 0 4px; color: var(--gold); }
#modal input {
  width: 100%; margin: 10px 0 4px; padding: 8px; font: inherit; font-size: 16px;
  background: #0f1317; color: var(--text); border: 1px solid #7a6440; border-radius: 6px; user-select: text;
}
#modal .err { color: var(--bad); min-height: 0; }
.mbtns { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; margin-top: 10px; }
.picker { background: rgba(255, 226, 138, 0.05); border-radius: 8px; padding: 10px 8px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; max-height: 180px; overflow-y: auto; margin: 6px 0 10px; }
.chip { font-size: 12px; padding: 4px 7px; }
.chip.m { border-color: #5b8fd6; }
.chip.f { border-color: #d65b9a; }
.chip.on.m { background: #2c4f80; }
.chip.on.f { background: #80305a; }
.cost { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; font-weight: 600; }
.cost .lack { color: var(--bad); }
.bar { height: 10px; background: #000a; border-radius: 5px; overflow: hidden; margin: 6px 0 10px; }
.bar div { height: 100%; background: #f0b84a; }

/* A link that looks like a button (Settings: email report, Discord) */
.btnlink { display: block; text-align: center; text-decoration: none; margin-top: 6px; background: #3b3326; color: var(--text); border: 1px solid #7a6440; border-radius: 6px; padding: 7px 6px; }
.btnlink:hover { border-color: var(--gold); }
.btns.m2 .btnlink { margin-top: 6px; }
.seltext { user-select: text; color: var(--gold); }
#modal .box.settings .wide { width: 100%; margin-top: 6px; }
#modal .box.settings button[disabled] { width: 100%; margin-top: 6px; }
button {
  background: #3b3326;
  color: var(--text);
  border: 1px solid #7a6440;
  border-radius: 6px;
  padding: 5px 6px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #54472f; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.big { width: 100%; padding: 9px; font-weight: 700; background: #6b4f1e; }
button.big:hover:not(:disabled) { background: #85642a; }
button.big.danger { background: #7d1414; }
button.big.danger:hover:not(:disabled) { background: #9c2020; }
button.on { background: #85642a; border-color: var(--gold); }

#log {
  position: fixed;
  left: 12px;
  bottom: 12px;
  max-width: 360px;
  font-size: 13px;
  pointer-events: none;
}
#log div {
  background: rgba(15, 20, 25, 0.7);
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 4px;
}
#log div.logout { animation: logout 1s ease forwards; }
@keyframes logout { to { opacity: 0; } }

#dev {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-bg);
  padding: 6px 8px;
  border-radius: 8px;
}
#dev span { margin-right: 4px; }
#dev.hidden { display: none; }

/* ---------- Story, tutorial guide (Ulfgar) & highlight ring ---------- */
.clanline { font-size: 12px; color: var(--muted); margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid #3a342a; }
.clanline b { color: var(--gold); font-family: Cinzel, Georgia, serif; letter-spacing: 1px; }
/* The honor bar (honor.js): the red mark is the danger line */
.honorbar { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0 0 6px; padding: 2px 4px; font-size: 12px; background: none; border: 0; color: var(--muted); cursor: pointer; }
.honorbar i { position: relative; flex: 1; height: 7px; border-radius: 4px; background: #2a2620; overflow: hidden; }
.honorbar i b { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #c8a24a, #e8d27a); }
.honorbar i em { position: absolute; top: 0; bottom: 0; width: 2px; background: #e0443a; }
.honorbar.low { color: #ff8a7a; }
.honorbar.low i b { background: #c0392b; }
.box.honorbox { width: min(440px, 92vw); max-height: 84vh; overflow: auto; }

#story {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 25%, #2b4256 0%, #121c26 55%, #07090c 100%);
  overflow-y: auto; user-select: text;
}
#story.hidden { display: none; }
.spage { max-width: 640px; width: 100%; text-align: center; color: #f3ead2; animation: sfade 0.6s ease; }
@keyframes sfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sart { font-size: 60px; letter-spacing: 10px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6)); animation: sfloat 4s ease-in-out infinite; }
@keyframes sfloat { 50% { transform: translateY(-6px); } }
.stitle { font-family: Cinzel, Georgia, serif; font-size: 32px; color: var(--gold); letter-spacing: 4px; margin: 12px 0 14px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.stext { font-family: 'IM Fell English', Georgia, serif; font-size: 20px; line-height: 1.55; }
.stext b { color: var(--gold); font-weight: normal; }
.sform { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 20px auto 0; max-width: 460px; text-align: left; }
.sform label { display: flex; flex-direction: column; gap: 4px; font-family: Cinzel, Georgia, serif; font-size: 13px; letter-spacing: 1px; color: var(--muted); }
.sform input {
  font: 18px 'IM Fell English', Georgia, serif; padding: 8px 10px; border-radius: 6px;
  border: 2px solid var(--panel-border); background: #0f141a; color: var(--gold); user-select: text;
}
.sform input:focus { outline: none; border-color: var(--gold); }
.sform .sdice { grid-column: 1 / -1; justify-self: center; font-size: 13px; }
.sform .serr { grid-column: 1 / -1; text-align: center; color: var(--bad); font-size: 13px; min-height: 16px; }
.sbtns { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.sbtns button.big { width: auto; min-width: 200px; font-size: 16px; }
.sdots { margin-top: 18px; display: flex; gap: 8px; justify-content: center; }
.sdots i { width: 8px; height: 8px; border-radius: 50%; background: #3a4552; }
.sdots i.on { background: var(--gold); }

#guide {
  position: fixed; left: 12px; bottom: 12px; z-index: 31; width: min(460px, calc(100vw - 24px));
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 34px 12px 12px;
  background: rgba(16, 20, 26, 0.97); border: 2px solid var(--gold); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65); color: var(--text); animation: sfade 0.3s ease;
}
#guide.hidden { display: none; }
#guide .gport {
  flex: 0 0 60px; width: 60px; height: 60px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 35%, #7b8794, #2a3139); border: 2px solid #c9a86a;
}
#guide .gport { overflow: hidden; }
#guide .gport .gface { width: 100%; height: 100%; display: block; }   /* the guide's portrait (tutorial.js portrait) */
.tutform .gface { width: 1.4em; height: 1.4em; vertical-align: middle; margin: -0.2em 0.2em -0.2em 0; }
#guide .gbody { flex: 1; min-width: 0; }
#guide .gname { font-family: Cinzel, Georgia, serif; font-weight: 700; color: var(--gold); font-size: 14px; letter-spacing: 1px; }
#guide .gtext { font-size: 14px; line-height: 1.45; margin: 4px 0 10px; }
#guide .gtext b { color: var(--gold); }
#guide .gbtns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#guide .gbtns button.big { width: auto; padding: 7px 14px; }
#guide .gbtns button.danger { background: #7d1414; }
#guide .gq { width: 100%; font-size: 13px; color: var(--gold); }
#guide .gskip { margin-left: auto; background: none; border: none; padding: 2px; font-size: 11px; color: var(--muted); text-decoration: underline; }
#guide .gmin { position: absolute; top: 6px; right: 6px; padding: 0 7px; font-size: 14px; line-height: 20px; }
#guide.min { width: auto; padding: 0; border-radius: 50%; border-width: 0; background: none; box-shadow: none; }
#guide.min .gport { cursor: pointer; box-shadow: 0 0 0 3px var(--gold), 0 4px 14px rgba(0, 0, 0, 0.6); animation: tutpulse 1.6s ease-in-out infinite; }
/* Over full-screen views the guide docks at the bottom and the view shrinks above it. */
body.guide-dock #guide { left: 0; right: 0; bottom: 0; width: auto; border-radius: 0; border-width: 2px 0 0; }
body.guide-dock :is(#war, #map, #under, #book, #reports, #armies) { bottom: var(--gh, 120px); }

#tut-ring {
  position: fixed; z-index: 30; pointer-events: none; border: 3px solid var(--gold); border-radius: 12px;
  box-shadow: 0 0 0 4px rgba(255, 226, 138, 0.25), 0 0 20px 6px rgba(255, 226, 138, 0.55);
  animation: tutpulse 1.2s ease-in-out infinite;
}
#tut-ring.hidden { display: none; }
#tut-ring.round { border-radius: 50%; }
#tut-ring::after {
  content: '👇'; position: absolute; left: 50%; top: -40px; transform: translateX(-50%);
  font-size: 28px; animation: tutbob 0.8s ease-in-out infinite alternate;
}
#tut-ring.below::after { content: '👆'; top: auto; bottom: -42px; }
@keyframes tutpulse { 50% { box-shadow: 0 0 0 8px rgba(255, 226, 138, 0.12), 0 0 28px 10px rgba(255, 226, 138, 0.35); } }
@keyframes tutbob { to { margin-top: -8px; } }
#tut-ring.below::after { animation-name: tutbobup; }
@keyframes tutbobup { to { margin-bottom: -8px; } }
button.tutform { margin-bottom: 8px; background: #2f5d2a; }
button.tutform:hover:not(:disabled) { background: #3d7535; }

#sandbox-badge {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 50; pointer-events: none;
  background: #7d1414; color: #fff; padding: 2px 12px; border-radius: 0 0 8px 8px; font-size: 11px; letter-spacing: 1px;
}
#sandbox-kit { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 50; background: #7d1414; color: #fff; font-size: 12px; padding: 3px 10px; }

@media (max-width: 600px) {
  .stitle { font-size: 24px; }
  .stext { font-size: 17px; }
  .sart { font-size: 44px; }
  .sform { grid-template-columns: 1fr; }
  #guide { left: 0; right: 0; bottom: 0; width: auto; border-radius: 12px 12px 0 0; border-width: 2px 0 0; }
  #guide .gport { flex-basis: 46px; width: 46px; height: 46px; }
  #guide .gport span { font-size: 28px; }
  #guide .gtext { font-size: 13px; }
  #guide.min { left: auto; right: 12px; bottom: 12px; }
}

/* Father's last gift: choose one Lv1 Apex dragon (reuses the story overlay). */
#story.pick { align-items: flex-start; }
.ppage { max-width: 860px; width: 100%; margin: 0 auto; text-align: center; color: #f3ead2; animation: sfade 0.5s ease; padding-bottom: 8px; }
.ppage .stitle { font-size: 26px; margin-top: 4px; }
.ppage .stext { font-size: 18px; }
.phint { font-size: 13px; color: var(--muted); margin: 6px 0 14px; }
.apgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; text-align: left; }
.apcard {
  display: grid; grid-template-columns: 44px 1fr; column-gap: 10px; row-gap: 2px; align-items: start; padding: 10px;
  background: rgba(20, 24, 30, 0.9); border: 2px solid #3a3326; border-radius: 10px; color: var(--text); font: inherit; text-align: left;
}
.apcard:hover { border-color: #8a7444; background: rgba(36, 40, 48, 0.95); }
.apcard.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 226, 138, 0.35), 0 0 16px rgba(255, 226, 138, 0.25); }
.apmedal { grid-row: span 3; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #c9a86a; display: flex; align-items: center; justify-content: center; }
.apmedal span { font-size: 24px; filter: drop-shadow(0 1px 2px #0008); }
.apname { font-family: Cinzel, Georgia, serif; font-weight: 700; color: var(--gold); font-size: 15px; }
.apstats { font-size: 12px; color: var(--muted); }
.appas { grid-column: 1 / -1; font-size: 12px; line-height: 1.4; color: #d9cfb5; margin-top: 4px; }
.appas b { color: var(--gold); }
.pbar { position: sticky; bottom: -16px; margin-top: 14px; padding: 12px 0 16px; background: linear-gradient(transparent, #0b1016 35%); }
.pbar button.big { width: auto; min-width: 240px; font-size: 16px; }

/* Repair Dock & Hospital panels (care.js) */
.carerow { padding: 6px 0 4px; border-top: 1px solid #3a342a; }
.carerow:first-of-type { border-top: none; }
.carerow .btns { margin-top: 2px; }

/* Equipment tiles (gear.js): framed in the tier colour; empty general slots show a faint outline. */
.gtile {
  --gs: 56px; width: var(--gs); height: var(--gs); flex: none; position: relative; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; border: 2px solid var(--tc, #4a443a);
  background: radial-gradient(circle at 50% 38%, #2e2a24 0%, #171512 62%, #0d0c0a 100%);
  box-shadow: inset 0 0 12px color-mix(in srgb, var(--tc, #000) 40%, transparent), 0 0 0 1px #000, 0 2px 4px rgba(0, 0, 0, 0.5);
}
.gtile svg { width: 88%; height: 88%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.65)); }
.gtile.t-legendary, .gtile.t-unique { box-shadow: inset 0 0 14px color-mix(in srgb, var(--tc) 50%, transparent), 0 0 0 1px #000, 0 0 9px color-mix(in srgb, var(--tc) 70%, transparent); }
.gtile.empty { border: 2px solid #3d372d; background: radial-gradient(circle at 50% 40%, #1d1a16 0%, #100f0d 100%); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85); }
.gtile.empty svg { filter: none; }
.item { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: start; border-left: none; border: 1px solid #3a342a; }
.item .ibody { min-width: 0; }
.gslots { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.gsl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gslname { font-size: 10px; color: var(--muted); letter-spacing: 0.5px; }
.gsx { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 11px; line-height: 18px; }
/* Ship pictures (ships.js) in place of the ⛵ / 🪤 icons; .big = the shipyard's preview */
.sico { display: inline-block; width: 1.7em; height: 1.7em; margin: -0.35em 0.1em -0.35em 0; vertical-align: middle; background: center / contain no-repeat; }
/* Dragon pictures (dragons.js): in lists instead of the colour dot; big ones in reveals */
.dico { display: inline-block; width: 2.4em; height: 1.5em; margin: -0.3em 0.35em -0.3em 0; vertical-align: middle; background: center / contain no-repeat; }
.dico.big { width: 150px; height: 94px; margin: 0; }
.apmedal .dico { width: 40px; height: 26px; margin: 0; }
#book .bitem .dico { grid-row: span 2; width: 36px; height: 23px; margin: 0; }
#book canvas.dpic { display: block; width: 100%; height: 150px; margin: 0 auto 6px; }
.sico.big { width: 84px; height: 84px; margin: 0; }
.sico.wide { width: 3.2em; }
.sico.big.wide { width: 160px; }
.sprev { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; }
.wpick .sico { display: inline-block; }
.wpick .wgear { display: flex; gap: 4px; margin: 4px 0 2px; }
.wpick .wgear .gtile { display: inline-flex; border-radius: 5px; }
.gworn { font-size: 12px; padding: 2px 0; }
.gworn .ieff { margin-left: 4px; }

/* Clan flag maker (Town Hall) */
.flagmaker h3 { margin: 0 0 6px; font-size: 15px; }
.flagmaker .fprev { display: flex; gap: 12px; align-items: center; margin: 6px 0; }
.flagmaker .fprev .pflag { flex: none; }
.flagmaker .flabel { font-size: 12px; font-weight: 600; margin: 8px 0 4px; opacity: 0.8; }
.flagmaker .fswatches, .flagmaker .fshapes { display: flex; flex-wrap: wrap; gap: 5px; }
.flagmaker .fswatch { width: 26px; height: 26px; padding: 0; border: 2px solid rgba(43,33,22,0.55); border-radius: 5px; cursor: pointer; }
.flagmaker .fswatch.on { outline: 3px solid #e2a92a; outline-offset: 1px; border-color: #2b2116; }
.flagmaker .fswatch:disabled { opacity: 0.25; cursor: not-allowed; }
.flagmaker .fshape { padding: 2px; line-height: 0; border: 2px solid transparent; border-radius: 5px; background: transparent; cursor: pointer; }
.flagmaker .fshape.on { border-color: #e2a92a; background: rgba(226,169,42,0.18); }
.flagmaker .big { margin-top: 10px; }
svg.pflag { vertical-align: middle; }

/* Leaderboards (Honor screen) */
.lb .lbtabs button.on { background: #e2a92a; color: #2b2116; }
.lb .lblist { max-height: 260px; overflow-y: auto; margin: 6px 0; border-radius: 6px; background: rgba(0,0,0,0.12); }
.lb .lbrow { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.lb .lbrow.you { background: rgba(226,169,42,0.25); font-weight: 600; }
.lb .lbrank { width: 34px; flex: none; text-align: right; }
.lb .lbname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .lbname small { opacity: 0.7; font-weight: 400; }
.lb .lbgap { text-align: center; opacity: 0.6; line-height: 1; }
#quests-btn { background: #3d4a22; }

/* Quests */
.box.questbox { width: min(480px, 94vw); max-height: 86vh; overflow: auto; }
.qcard { background: rgba(0,0,0,0.14); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 7px 9px; margin: 6px 0; }
.qcard.done { border-color: #e2a92a; background: rgba(226,169,42,0.14); }
.qcard.claimed { opacity: 0.55; }
.qcard .qtext { font-weight: 600; font-size: 13px; }
.qcard .qbar { position: relative; height: 14px; border-radius: 7px; background: rgba(0,0,0,0.3); margin: 5px 0; overflow: hidden; }
.qcard .qbar > div { height: 100%; background: linear-gradient(90deg, #6aa84f, #9fd36b); }
.qcard.done .qbar > div { background: linear-gradient(90deg, #d79a1e, #f3cf5a); }
.qcard .qbar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 14px; font-weight: 700; text-shadow: 0 1px 1px #000; }
.qcard .qfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.qcard .qrew { opacity: 0.9; }
.qcard .qfoot button { flex: none; }

/* In-game notification banners (notify.js) */
#toasts { position: fixed; top: 54px; right: 12px; z-index: 9000; display: flex; flex-direction: column; gap: 6px; max-width: min(320px, 86vw); pointer-events: none; }
#toasts .toast { pointer-events: auto; cursor: pointer; background: #2b2116; color: #f6ead0; border: 2px solid #e2a92a; border-radius: 10px; padding: 8px 11px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45); display: flex; flex-direction: column; gap: 2px; font-size: 13px; animation: toastIn 0.25s ease-out; transition: opacity 0.5s, transform 0.5s; }
#toasts .toast b { font-size: 14px; }
#toasts .toast.out { opacity: 0; transform: translateX(30px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* Account (Settings) */
#modal .box.settings .account .acbtn { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
#modal .box.settings .account .acbtn b { font-size: 16px; width: 18px; text-align: center; }
#modal .box.settings .account .acbtn.google b { color: #4285f4; }
#modal .box.settings .account .acor { text-align: center; font-size: 12px; opacity: 0.7; margin: 8px 0 2px; }
#modal .box.settings .account .acin { margin: 4px 0; }
#modal .box.settings .account .acin:disabled { opacity: 0.5; }
#modal .box.settings .account .acrow { display: flex; gap: 6px; margin-top: 4px; }
#modal .box.settings .account .acrow button { flex: 1; width: auto; margin-top: 0; }
#modal .box.settings .account .acforgot { display: block; margin: 6px auto 0; width: auto; }
/* Settings rows with long labels (notifications) wrap instead of widening the window */
#modal .box.settings .setrow { gap: 10px; }
#modal .box.settings .setrow > span { white-space: normal; min-width: 0; }
#modal .box.settings .setrow > span.good, #modal .box.settings .setrow > span.bad, #modal .box.settings .setrow > span.muted { text-align: right; font-size: 13px; }
#modal .box.settings .setrow .toggle { min-width: 64px; }

/* Opening screen (logo) */
#splash { position: fixed; inset: 0; z-index: 100000; background: #141d1e; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; transition: opacity 0.7s ease; }
#splash .splash-bg { position: absolute; inset: -40px; background: url("../img/splash.webp") center / cover no-repeat; filter: blur(18px) brightness(0.5); }
#splash .splash-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }   /* the whole dragon on tall phones */
@media (min-aspect-ratio: 4/3) { #splash .splash-logo { object-fit: cover; } }   /* wide screens: fill it */
#splash::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 100%), linear-gradient(to bottom, rgba(0,0,0,0) 55%, rgba(0,0,0,0.75) 100%); }
#splash .splash-in { position: relative; z-index: 2; text-align: center; padding: 0 16px 9vh; }
#splash h1 { margin: 0; font-family: 'Cinzel', serif; font-weight: 700; font-size: clamp(30px, 7vw, 72px); letter-spacing: 0.04em; color: #f6dc8c;
  text-shadow: 0 2px 2px #000, 0 0 24px rgba(0,0,0,0.85), 0 0 46px rgba(214,160,60,0.45); }
#splash .splash-load { margin-top: 10px; font-family: 'IM Fell English', serif; font-style: italic; font-size: clamp(15px, 2.4vw, 20px); color: #f3e6c6; opacity: 0.85; animation: splashPulse 1.6s ease-in-out infinite; }
#splash.gone { opacity: 0; pointer-events: none; }
@keyframes splashPulse { 50% { opacity: 0.4; } }
#modal .box.settings .legal { text-align: center; font-size: 13px; }
#modal .box.settings a { color: var(--gold); }
.qcard.final { border-color: rgba(226,169,42,0.5); background: rgba(226,169,42,0.08); }

/* Reports: the lists (All / Messages / Battles / Eggs hatched) */
.rtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.rtabs button { flex: 1 1 auto; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.rtabs button.on { background: #85642a; border-color: var(--gold); color: #fff3cf; }
.rtabs .badge { margin-left: 4px; }
