/* anything marked hidden stays hidden, whatever display a class gives it */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #18230f; color: #efe3c6;
  font: 15px/1.35 "Alegreya Sans", "Trebuchet MS", Verdana, sans-serif;
  user-select: none;
}
#game { position: fixed; inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); } /* clear a phone's notch and home bar */
#view { position: absolute; left: 0; top: 0; display: block; cursor: default; }
#view.target { cursor: crosshair; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 30px;
  display: flex; align-items: center; gap: 18px; padding: 0 12px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0 2px, transparent 2px 9px),
    linear-gradient(#4a3822, #2b1f12);
  border-bottom: 2px solid #b08d4a; box-shadow: 0 2px 0 #2a1d0e, 0 4px 12px rgba(0,0,0,0.45);
  z-index: 5;
}
.res { display: flex; align-items: center; gap: 6px; }
.res b { color: #ffe39a; min-width: 40px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 #000; }
i.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a8, #e2b52d 60%, #9a7414); display: inline-block; }
i.sup { width: 12px; height: 14px; background: #d8c7a3; clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%); display: inline-block; }
#topbar .spacer { flex: 1 1 auto; }
#topbar button { flex: 0 0 auto; }
.sm { display: none; }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: inline-block; } }
#btn-box.on, #btn-names.on { background: linear-gradient(#a8864a, #6d5634); color: #fff; }
#btn-sound.off { opacity: .6; }
#objectives {
  position: absolute; top: 40px; left: 10px; z-index: 4; width: 260px; max-width: calc(100vw - 20px);
  background: linear-gradient(rgba(52,38,20,0.9), rgba(28,20,10,0.9)); border: 2px solid #b08d4a; border-radius: 7px;
  padding: 6px 10px 8px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
#objectives .oh { display: flex; justify-content: space-between; align-items: center; font: 17px/1.2 "IM Fell English SC", Georgia, serif; color: #ffe08a; margin-bottom: 4px; }
#objectives .oh button { padding: 0 6px; font-size: 11px; }
#objectives .oi { display: flex; gap: 7px; align-items: flex-start; color: #cdbf9f; padding: 2px 0; }
#objectives .oi i { flex: 0 0 11px; height: 11px; margin-top: 3px; border: 1.5px solid #a8864a; border-radius: 2px; }
#objectives .oi.cur { color: #fff4d6; font-weight: 700; }
#objectives .oi.cur i { border-color: #ffe08a; box-shadow: 0 0 6px rgba(255,220,120,0.6); }
#objectives .oi.done { color: #8fbf7a; text-decoration: line-through; }
#objectives .oi.done i { background: #6fbf5a; border-color: #6fbf5a; }
.stats.rank { color: #ffd24a; font-weight: 800; }
#view, #minimap { touch-action: none; }
table.help td.hdr { color: #c8b68f; font-weight: bold; padding-top: 10px; }

button {
  font: inherit; font-weight: 700; color: #f6e9c8; cursor: pointer;
  background: linear-gradient(#6d5634, #3f301b); border: 1px solid #a8864a; border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255,235,180,0.25), inset 0 -2px 0 rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.5);
  padding: 3px 10px; text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}
button:hover { background: linear-gradient(#80673f, #4d3b22); }
button:focus-visible { outline: 2px solid #ffe08a; outline-offset: 1px; }
button.primary { border-color: #e8c46a; color: #fff4cf; background: linear-gradient(#8a6a32, #4f3a17); }

#notice {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  text-align: center; pointer-events: none; z-index: 4;
  text-shadow: 0 1px 2px #000, 0 0 4px #000; font-weight: bold;
}
#notice div { transition: opacity .5s; }

#panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 190px;
  display: flex; gap: 8px; padding: 5px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.07) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(0deg, rgba(255,220,160,0.03) 0 1px, transparent 1px 5px),
    linear-gradient(#4d3a22, #24190d);
  border-top: 3px solid #b08d4a; box-shadow: 0 -2px 0 #2a1d0e, 0 -6px 16px rgba(0,0,0,0.5);
  z-index: 5;
}
#minimap-wrap { flex: 0 0 auto; border: 3px solid #b08d4a; border-radius: 4px; background: #000; box-shadow: inset 0 0 0 1px #2a1d0e, 0 0 0 1px #2a1d0e; }
#minimap { display: block; cursor: pointer; width: 176px; height: 176px; }
#info {
  flex: 1 1 auto; min-width: 0; border: 2px solid #6b5634; border-radius: 4px;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,230,170,0.06), transparent 60%), rgba(12,8,4,.55);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.6);
  padding: 8px; overflow: hidden;
}
#commands {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, 56px); grid-auto-rows: 56px;
  gap: 4px; align-content: start; padding: 2px;
}
.cmd {
  position: relative; width: 56px; height: 56px; padding: 0; overflow: hidden;
  background: #2d2416; border: 2px solid #a8864a; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
}
.cmd img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; pointer-events: none; }
.cmd:hover:not(.disabled) { border-color: #ffe08a; box-shadow: 0 0 8px rgba(255,210,100,0.5); }
.cmd:active:not(.disabled) { transform: translateY(1px); }
.cmd .hk { position: absolute; top: 0; left: 0; font-size: 11px; font-weight: 800; color: #ffe39a; background: rgba(0,0,0,0.6); padding: 0 4px; border-bottom-right-radius: 4px; pointer-events: none; }
.cmd .nm { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9.5px; line-height: 12px; font-weight: 800; color: #fff4d6; background: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.8)); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; letter-spacing: .01em; }
.cmd .cost { position: absolute; top: 0; right: 0; border-radius: 0 0 0 4px !important; font-size: 10px; font-weight: 800; color: #ffe39a; background: rgba(0,0,0,0.6); padding: 0 3px; border-top-left-radius: 4px; pointer-events: none; font-variant-numeric: tabular-nums; }
.cmd.disabled { filter: grayscale(0.85) brightness(0.6); }
.cmd.active { outline: 2px solid #ffe39a; }
.cmd .glyph { font-size: 22px; margin-bottom: 10px; pointer-events: none; color: #f6e2a8; text-shadow: 0 2px 0 #000; }
.cmd:has(.glyph) { background: radial-gradient(circle at 50% 35%, #6d5634, #2d2416); }

#tooltip {
  position: absolute; display: none; max-width: 260px; z-index: 20;
  background: rgba(20,15,8,.95); border: 1px solid #8a7045; padding: 6px 8px; pointer-events: none;
  font-size: 13px;
}
#tooltip .t { color: #ffe39a; font-weight: bold; }

.single { display: flex; gap: 12px; }
.portrait { width: 72px; height: 72px; background: #1a140c; border: 2px solid #a8864a; border-radius: 5px; flex: 0 0 72px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.portrait img { width: 100%; height: 100%; display: block; }
.single h3 { margin: 0 0 4px; color: #ffe39a; font: 22px/1.1 "IM Fell English SC", Georgia, serif; letter-spacing: .02em; }
.stats { font-size: 13px; color: #d7cab0; }
.stats span { margin-right: 12px; white-space: nowrap; }
.hpbar { height: 8px; width: 180px; max-width: 100%; background: #2a0c08; border: 1px solid #000; border-radius: 4px; margin: 3px 0 6px; overflow: hidden; }
.hpbar div { height: 100%; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35); }
.queue { display: flex; gap: 4px; margin-top: 6px; align-items: flex-end; }
.qitem { width: 38px; height: 38px; border: 2px solid #8a7045; border-radius: 4px; overflow: hidden; background: #1a140c; position: relative; cursor: pointer; }
.qitem img { width: 100%; height: 100%; display: block; }
.qitem.first { width: 46px; height: 46px; }
.qitem.first img { width: 100%; height: 100%; }
.qprog { height: 5px; background: #222; width: 160px; margin-top: 4px; border: 1px solid #000; }
.qprog div { height: 100%; background: #e2b52d; }
.multi { display: flex; flex-wrap: wrap; gap: 3px; }
.mitem { width: 40px; height: 45px; border: 1px solid #8a7045; border-radius: 3px; overflow: hidden; background: #1a140c; cursor: pointer; }
.mitem img { width: 38px; height: 38px; display: block; }
.mitem .mhp { height: 3px; margin: 0 1px; }
.muted { color: #a69a80; }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); z-index: 50;
}
#menu { background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0.05), rgba(0,0,0,0.55) 75%); }
body.demo #topbar, body.demo #panel, body.demo #notice { display: none; }
.overlay.hidden { display: none; }
.box {
  max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto;
  background: linear-gradient(rgba(62,46,26,0.94), rgba(30,21,11,0.94)); border: 3px solid #b08d4a; border-radius: 10px;
  padding: 24px 32px; min-width: min(320px, calc(100vw - 32px)); width: 560px; text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.box h1 { margin: 0; font: 60px/1 "IM Fell English SC", Georgia, serif; color: #ffe08a; letter-spacing: .03em; text-shadow: 0 3px 0 #6b4a17, 0 6px 18px rgba(0,0,0,0.6); text-wrap: balance; }
.box h2 { margin: 0 0 14px; color: #ffe39a; font: 34px/1.1 "IM Fell English SC", Georgia, serif; }
.box .sub { margin: 6px 0 14px; color: #d9c393; font-size: 13px; font-weight: 800; letter-spacing: .32em; text-transform: uppercase; }
.box .row { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }
.box .row button { font-size: 18px; padding: 8px 20px; }
.box .col { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.box .col button { font-size: 16px; padding: 6px; }
.box h3.sec { margin: 16px 0 6px; font: 20px/1.1 "IM Fell English SC", Georgia, serif; color: #ffe08a; border-top: 1px solid rgba(176,141,74,0.4); padding-top: 12px; }
.box h3.sec:first-of-type { border-top: 0; padding-top: 0; }
.box .row { margin: 10px 0 !important; }
#mp { text-align: left; }
#mp-status { margin: 4px 0 8px; text-align: center; font-size: 13px; }
.mp-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.mp-row > button { flex: 1 1 140px; padding: 6px 8px; }
.mp-row label { color: #d9c393; font-weight: 700; min-width: 80px; }
#mp input { flex: 1 1 120px; min-width: 0; font: inherit; color: #fff4d6; background: #1a130a; border: 1px solid #8a7045; border-radius: 5px; padding: 5px 8px; }
#mp input:focus-visible { outline: 2px solid #ffe08a; }
#mp-code { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; text-align: center; max-width: 120px; }
.mp-sub { margin: 10px 0 4px; color: #d9c393; font-weight: 700; font-size: 13px; }
#mp-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow: auto; font-size: 13px; }
.mp-game { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(0,0,0,0.25); border: 1px solid #5a4630; border-radius: 5px; padding: 4px 4px 4px 10px; }
#mp-wait { text-align: center; }
.mp-label { color: #d9c393; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; font-weight: 800; }
.mp-code { font: 52px/1 "IM Fell English SC", Georgia, serif; color: #ffe08a; letter-spacing: .18em; margin: 4px 0; text-shadow: 0 3px 0 #6b4a17; user-select: text; }
details { text-align: left; margin-top: 8px; }
summary { cursor: pointer; color: #ffe39a; }
table.help { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
table.help td { padding: 2px 6px; border-bottom: 1px solid #3e3220; }
table.help td:first-child { color: #ffe39a; white-space: nowrap; }
#go-stats table { margin: 0 auto; border-collapse: collapse; }
#go-stats td, #go-stats th { padding: 3px 12px; }
#go-stats th { color: #ffe39a; }

/* ---------- Small screens / phones ---------- */
@media (max-width: 760px), (max-height: 520px) {
  #topbar { gap: 8px; padding: 0 6px; font-size: 13px; }
  #topbar button { padding: 3px 7px; }
  .res b { min-width: 0; }
  .lbl { display: none; }
  .sm { display: inline; }
  #panel { height: 144px; gap: 4px; padding: 3px; }
  #minimap-wrap { flex: 0 0 auto; }
  #minimap { width: 130px; height: 130px; }
  #info { padding: 4px; font-size: 12px; }
  .single { gap: 6px; }
  .portrait { width: 44px; height: 44px; flex-basis: 44px; }
  .single h3 { font-size: 15px; }
  .stats { font-size: 11px; }
  .stats span { margin-right: 6px; }
  .hpbar, .qprog { width: 100%; max-width: 120px; }
  .qitem, .qitem.first { width: 30px; height: 30px; }
  .qitem img, .qitem.first img { width: 28px; height: 28px; }
  .mitem { width: 28px; height: 32px; }
  .mitem img { width: 26px; height: 26px; }
  #commands { grid-template-columns: repeat(5, 45px); grid-auto-rows: 45px; gap: 2px; }
  .cmd { width: 45px; height: 45px; }
  .cmd .nm { font-size: 8px; line-height: 10px; }
  .cmd .hk { display: none; }
  .cmd .glyph { font-size: 18px; }
  .box { padding: 16px; }
  .box h1 { font-size: 40px; }
  .box .row button { font-size: 16px; padding: 8px 12px; }
}
@media (max-width: 760px), (max-height: 520px) {
  #objectives { width: 210px; font-size: 11px; top: 36px; left: 6px; padding: 4px 8px 6px; }
  #objectives .oi:not(.cur) { display: none; }
}
@media (max-width: 480px) {
  #topbar { gap: 4px; padding: 0 4px; font-size: 12px; }
  #topbar button { padding: 2px 5px; }
  .res { gap: 3px; }
  #clock { display: none; }
  #info { display: none; }
  #panel { justify-content: space-between; }
}

/* ---------- stage 7: resources, costs, placement, factions, guide ---------- */
img.ri { width: 18px; height: 18px; display: inline-block; vertical-align: middle; filter: drop-shadow(0 1px 0 #000); }
.res b { min-width: 32px; }
#clock.peace { color: #9fe6a0; }
#commands { max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
.cmd .cost { display: flex; flex-direction: column; align-items: flex-end; padding: 0 2px; line-height: 10px; font-size: 9px; background: rgba(0,0,0,0.62); }
.cmd .cost .rc { font-weight: 800; }
.rc::before, .rt img { content: ''; }
.rc::before { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 2px; vertical-align: 1px; }
.r-gold { color: #ffe07a; } .rc.r-gold::before { background: #f2c83e; }
.r-wood { color: #e8bd84; } .rc.r-wood::before { background: #a8703a; }
.r-food { color: #ffab9a; } .rc.r-food::before { background: #d8604a; }
.r-ore { color: #c6d6f0; } .rc.r-ore::before { background: #8d98a8; }
.rt { white-space: nowrap; font-weight: 800; margin-right: 6px; }
.rt img { width: 15px; height: 15px; vertical-align: -3px; margin-right: 1px; }
#tooltip .tc { margin: 2px 0 3px; }
#tooltip i { color: #ffd88a; }
.single .desc { font-size: 12.5px; color: #cfc2a4; margin: 1px 0 3px; line-height: 1.25; max-width: 460px; }
.single h3 .lvl { font: 800 12px/1 "Alegreya Sans", sans-serif; color: #1a1206; background: #ffd24a; border-radius: 3px; padding: 1px 4px; vertical-align: 3px; }
.qitem .ql { position: absolute; right: 1px; bottom: 0; font-size: 11px; font-weight: 800; color: #ffe07a; text-shadow: 0 1px 0 #000; }
.stats b { color: #f4e8c8; }
#info { overflow-y: auto; }

#place-bar {
  position: absolute; z-index: 8; transform: translateX(-50%); display: flex; gap: 6px; align-items: center;
  background: rgba(24,17,8,0.92); border: 2px solid #b08d4a; border-radius: 8px; padding: 4px 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
#place-bar[hidden] { display: none; }
#pb-name { color: #ffe39a; font-weight: 800; font-size: 13px; padding: 0 4px; white-space: nowrap; }
#pb-ok { background: linear-gradient(#4f8a32, #2a5418); border-color: #9fe07a; font-size: 15px; padding: 5px 12px; }
#pb-ok.bad { filter: grayscale(0.8) brightness(0.7); }
#pb-no { font-size: 15px; padding: 5px 10px; }

.fac-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.fac-pick .fac-side { grid-column: 1 / -1; font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #d8c89a; margin-top: 2px; }
.fac-pick .soon { position: absolute; top: 18px; left: 2px; right: 2px; font-size: 9.5px; font-weight: 800; color: #ffe08a; background: rgba(0,0,0,0.65); border-radius: 4px; padding: 1px 0; }
.fac-pick button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 6px; font-size: 12.5px; line-height: 1.1; position: relative; }
.fac-pick button img { width: 56px; height: 56px; border-radius: 5px; border: 1px solid #6b5634; }
.fac-pick button.sel { border-color: #ffe08a; box-shadow: 0 0 0 2px #ffe08a, 0 0 12px rgba(255,220,120,0.5); }
.fac-pick button.locked img { filter: grayscale(1) brightness(0.45); }
.fac-pick .lock { position: absolute; top: 20px; font-size: 18px; }
.fac-pick .prog { font-size: 10.5px; color: #c8b68f; font-weight: 700; }
.fac-blurb { font-size: 13px; margin: 6px 0 0; min-height: 34px; }
.small { font-size: 12px; margin: 0; }

.box.wide { width: 860px; text-align: left; }
.box.wide h2 { text-align: center; }
#guide-tabs { flex-wrap: wrap; justify-content: center; }
#guide-tabs button { font-size: 14px !important; padding: 4px 12px !important; }
#guide-tabs button.sel { border-color: #ffe08a; color: #fff4cf; background: linear-gradient(#8a6a32, #4f3a17); }
#guide-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.gcard { display: flex; gap: 8px; background: rgba(0,0,0,0.25); border: 1px solid #5a4630; border-radius: 6px; padding: 6px; }
.gcard img { width: 60px; height: 60px; flex: 0 0 60px; border-radius: 4px; border: 1px solid #6b5634; }
.gcard h4 { margin: 0 0 2px; color: #ffe39a; font: 17px/1.1 "IM Fell English SC", Georgia, serif; }
.gcard p { margin: 0 0 3px; font-size: 12.5px; color: #d7cab0; line-height: 1.25; }
.gcard .gs { font-size: 11.5px; color: #c8b68f; }
.gcard .gs b { color: #f4e8c8; }
@media (max-width: 760px), (max-height: 520px) {
  img.ri { width: 14px; height: 14px; }
  .res b { min-width: 0; }
  #topbar { gap: 6px; }
  .single .desc { font-size: 11px; }
  .fac-pick button img { width: 34px; height: 34px; }
  .fac-pick button { font-size: 10.5px; }
}
@media (max-width: 480px) {
  #topbar .res[title="Supply (used / cap)"] i { display: none; }
}
@media (max-width: 480px) {
  #btn-sound { display: none; }
  #topbar { gap: 3px; font-size: 11px; }
  #topbar .res { gap: 1px; }
  img.ri { width: 12px; height: 12px; }
  i.sup { width: 9px; height: 11px; }
  #topbar button { padding: 2px 4px; }
}

/* =====================================================================
   UI v2: ornate frames, crests, cards
   ===================================================================== */
:root {
  --gold: #d8b25a; --gold-hi: #ffe39a; --gold-lo: #8a6a2a;
  --wood-hi: #5a4428; --wood-lo: #221709; --ink: #1a1208;
}
.crest-sm { width: 22px; height: 22px; flex: 0 0 auto; filter: drop-shadow(0 1px 1px #000); }
.crest-md { width: 64px; height: 64px; display: block; margin: -8px auto 4px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.crest-lg { width: 84px; height: 84px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.6)); }
#go-crest { display: block; margin: -6px auto 2px; }

/* ornate framed box with gold corner studs */
.box {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,220,150,0.10), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,230,180,0.025) 0 1px, transparent 1px 4px),
    linear-gradient(rgba(64,47,27,0.97), rgba(28,19,9,0.97));
  border: 3px solid var(--gold);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px rgba(255,220,140,0.28), inset 0 0 40px rgba(0,0,0,0.55), 0 14px 50px rgba(0,0,0,.7);
}
.box::before, .box::after {
  content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none;
  background: radial-gradient(circle at 40% 35%, #fff3c0, #d8b25a 45%, #7a5a1e 80%);
  transform: rotate(45deg); border: 1px solid #3a2a10; box-shadow: 0 2px 4px rgba(0,0,0,.6);
}
.box::before { top: -10px; left: -10px; }
.box::after { top: -10px; right: -10px; }
.box.menu-box { width: 980px; max-width: calc(100vw - 24px); padding: 18px 26px 22px; }
.title-row { display: flex; align-items: center; justify-content: center; gap: 22px; }
.title-mid { min-width: 0; }
.box h1 {
  background: linear-gradient(#fff6cf, #ffd86a 45%, #c8902a 55%, #ffe8a0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 3px 0 #4a3010) drop-shadow(0 6px 14px rgba(0,0,0,.6));
}
.intro { margin: 4px auto 10px; max-width: 640px; color: #e6d6b0; }
.box h3.sec {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  border-top: 0 !important; padding-top: 0 !important; margin: 12px 0 8px;
}
.box h3.sec::before, .box h3.sec::after {
  content: ''; flex: 1 1 auto; height: 2px; max-width: 120px;
  background: linear-gradient(90deg, transparent, var(--gold) 70%, transparent);
}
.box h3.sec::after { background: linear-gradient(90deg, transparent, var(--gold) 30%, transparent); }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: center; }
.card {
  background: linear-gradient(rgba(0,0,0,0.28), rgba(0,0,0,0.18));
  border: 1px solid rgba(216,178,90,0.45); border-radius: 8px; padding: 6px 14px 12px;
  box-shadow: inset 0 1px 0 rgba(255,230,170,0.12), inset 0 0 24px rgba(0,0,0,0.35);
}
.card details { text-align: left; }
.diff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
button.diff { display: flex; flex-direction: column; align-items: center; padding: 8px 4px 7px; line-height: 1.1; }
button.diff b { font: 22px/1.1 "IM Fell English SC", Georgia, serif; color: #fff4cf; }
button.diff small { font-size: 11.5px; color: #d9c393; font-weight: 700; margin-top: 2px; }
button.diff:hover { box-shadow: 0 0 14px rgba(255,210,110,0.45), inset 0 1px 0 rgba(255,235,180,0.3); }

/* buttons: engraved bronze */
button {
  background: linear-gradient(#77603a, #4a3820 55%, #3a2b16);
  border: 1px solid #c49a50; border-bottom-color: #6a4e22;
  box-shadow: inset 0 1px 0 rgba(255,235,180,0.3), inset 0 -2px 0 rgba(0,0,0,0.35), 0 2px 3px rgba(0,0,0,0.55);
  transition: box-shadow .15s, filter .15s;
}
button:hover { filter: brightness(1.12); background: linear-gradient(#86703f, #54402a 55%, #40301a); }
button.primary { background: linear-gradient(#a8823a, #6a4c1a 55%, #4f3812); border-color: #ffe08a; }

/* faction picker with crests */
.fac-pick button { padding: 6px 2px 7px; background: linear-gradient(#5a4428, #2e2212); }
.fac-pick button img { width: 46px; height: 46px; border: 0; background: none; }
.fac-pick button.sel { background: linear-gradient(#8a6a32, #3e2c12); }
.fac-pick button .fn { font-weight: 800; }

/* top bar: resource pills + crest */
#topbar { gap: 10px; background: repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0 2px, transparent 2px 9px), linear-gradient(#5a4428, #2b1f12 70%, #1f160a); border-bottom: 2px solid var(--gold); }
#topbar .res {
  background: linear-gradient(#1c140a, #2a1e10); border: 1px solid #6b5634; border-radius: 12px;
  padding: 1px 9px 1px 5px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.7), 0 1px 0 rgba(255,220,150,0.12);
}
#clock { font-variant-numeric: tabular-nums; }
#topbar button { border-radius: 12px; padding: 2px 11px; }

/* bottom panel: gilded frame with corner studs */
#panel { border-top: 3px solid var(--gold); background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.08) 0 2px, transparent 2px 11px),
    linear-gradient(#5a4428, #2a1d0e 60%, #1c1308); }
#panel::before, #panel::after {
  content: ''; position: absolute; top: -8px; width: 13px; height: 13px; transform: rotate(45deg);
  background: radial-gradient(circle at 40% 35%, #fff3c0, #d8b25a 45%, #7a5a1e 80%); border: 1px solid #3a2a10;
}
#panel::before { left: 12px; } #panel::after { right: 12px; }
#minimap-wrap { border: 3px solid var(--gold); box-shadow: inset 0 0 0 1px #000, 0 0 0 2px var(--ink), 0 3px 8px rgba(0,0,0,.6); border-radius: 6px; }
#info {
  border: 1px solid #8a7045; border-radius: 6px;
  background: radial-gradient(ellipse at 20% 0%, rgba(255,230,170,0.08), transparent 60%), linear-gradient(rgba(10,7,3,.72), rgba(20,14,7,.62));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), inset 0 2px 10px rgba(0,0,0,0.7);
}
.cmd {
  border: 2px solid #b8924a; border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.7), 0 2px 3px rgba(0,0,0,0.6);
}
.cmd::after { content: ''; position: absolute; inset: 0; border-radius: 5px; pointer-events: none; background: linear-gradient(rgba(255,255,255,0.14), transparent 40%); }
.cmd:hover:not(.disabled) { border-color: var(--gold-hi); box-shadow: 0 0 10px rgba(255,210,100,0.6), inset 0 0 0 1px rgba(0,0,0,0.6); transform: translateY(-1px); }
.cmd.active { outline: 0; border-color: #9fe07a; box-shadow: 0 0 10px rgba(140,255,120,0.55); }
.portrait { border: 2px solid var(--gold); border-radius: 7px; box-shadow: 0 0 0 1px #000, 0 3px 8px rgba(0,0,0,.6); }
.single h3 { background: linear-gradient(#fff6cf, #ffd86a 60%, #d8a040); -webkit-background-clip: text; background-clip: text; color: transparent; }
#tooltip { border: 1px solid var(--gold); border-radius: 6px; background: linear-gradient(rgba(34,25,12,.97), rgba(18,12,6,.97)); box-shadow: 0 6px 18px rgba(0,0,0,.6); padding: 7px 10px; }
#objectives { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), 0 4px 14px rgba(0,0,0,0.45); }

@media (max-width: 860px) {
  .menu-grid { grid-template-columns: 1fr; }
  .crest-lg { width: 54px; height: 54px; }
  .title-row { gap: 8px; }
}
@media (max-width: 760px), (max-height: 520px) {
  #topbar { gap: 5px; }
  #topbar .res { padding: 0 5px 0 3px; border-radius: 9px; }
  #topbar button { padding: 2px 6px; }
  .box.menu-box { padding: 12px 12px 16px; }
  .crest-lg { width: 44px; height: 44px; }
  button.diff b { font-size: 18px; }
  button.diff small { font-size: 10px; }
}
@media (max-width: 480px) {
  #topbar { gap: 2px; }
  #topbar .res { padding: 0 3px; border: 0; background: none; box-shadow: none; }
  .crest-sm { width: 16px; height: 16px; }
  .crest-lg { width: 36px; height: 36px; }
  .intro { font-size: 13px; }
}
.box::before { top: 5px; left: 5px; } .box::after { top: 5px; right: 5px; }
.tips { text-align: left; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: #d7cab0; }
.tips li { padding: 3px 0 3px 18px; position: relative; }
.tips li::before { content: ''; position: absolute; left: 3px; top: 9px; width: 7px; height: 7px; transform: rotate(45deg); background: var(--gold); }
.tips b { color: var(--gold-hi); }
@media (max-width: 760px), (max-height: 520px) { .box.menu-box h1 { font-size: 34px; } .tips { font-size: 12px; } }
.cmd.cat { border-color: var(--gold-hi); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,220,140,0.35), 0 2px 3px rgba(0,0,0,0.6); }
.cmd.cat .nm { font-size: 10.5px; color: var(--gold-hi); background: linear-gradient(rgba(40,24,6,0.5), rgba(40,24,6,0.92)); }
.cmd.cat::before { content: '▸'; position: absolute; right: 3px; top: 1px; color: var(--gold-hi); font-size: 12px; text-shadow: 0 1px 0 #000; }
button.diff.sel { background: linear-gradient(#a8823a, #6a4c1a 55%, #4f3812); border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--gold-hi), 0 0 14px rgba(255,220,120,0.5); }
.start-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-top: 12px; padding: 8px 12px; border-width: 2px; }
.start-btn img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.start-btn b { display: block; font: 28px/1.05 "IM Fell English SC", Georgia, serif; color: #fff4cf; letter-spacing: .03em; }
.start-btn small { display: block; font-size: 12px; color: #f0dca8; font-weight: 700; }
.start-btn:hover { box-shadow: 0 0 18px rgba(255,210,110,0.6), inset 0 1px 0 rgba(255,235,180,0.3); }
@media (max-width: 760px), (max-height: 520px) { .start-btn b { font-size: 22px; } .start-btn img { width: 34px; height: 34px; } }
.cmd.upg { border-color: #ffd24a; background: radial-gradient(circle at 50% 35%, #8a6a2a, #2d2416); }
.cmd.upg .glyph { color: #ffe39a; font-size: 26px; }
.cmd.upg .nm { color: #ffe39a; }
.cmd.upg.disabled { filter: grayscale(0.5) brightness(0.75); }
.r-stone { color: #ece4d2; } .rc.r-stone::before { background: #cfc6b2; }
#descbar { display: none; }
@media (max-width: 480px) {
  #descbar:not([hidden]) {
    display: block; position: absolute; left: 0; right: 0; bottom: 144px; z-index: 6;
    padding: 4px 8px 5px; font-size: 11.5px; line-height: 1.3; color: #e8dcbc;
    background: linear-gradient(rgba(24,17,8,0.9), rgba(36,26,12,0.95)); border-top: 1px solid var(--gold);
    max-height: 48px; overflow: hidden;
  }
  #descbar b { color: var(--gold-hi); margin-right: 4px; }
  #descbar .ds, #descbar .dc { color: #c8b68f; font-weight: 700; white-space: nowrap; }
  #descbar .rc { margin-right: 4px; }
  body.demo #descbar { display: none !important; }
}
#clock { white-space: nowrap; }
#topbar .res b { min-width: 0; }
#topbar .res { white-space: nowrap; }
@media (max-width: 1100px) { #topbar .lbl { display: none; } #topbar .sm { display: inline; } }
@media (max-width: 480px) {
  #btn-names, #my-crest { display: none; }
  #topbar { font-size: 10.5px; padding: 0 3px; }
  #topbar .res { gap: 1px; padding: 0 2px; }
  img.ri { width: 11px; height: 11px; }
  #topbar button { padding: 1px 4px; font-size: 12px; }
  #descbar:not([hidden]) { bottom: 144px; }
}
.stats.drill { color: #9fe6a0; font-weight: 700; }
.r-water { color: #8fd8ff; } .rc.r-water::before { background: #4aa8e8; }
@media (max-width: 1400px) { #topbar .lbl { display: none; } #topbar .sm { display: inline; } #topbar { gap: 8px; } }
/* sky & season indicator */
#sky { width: 32px; height: 16px; border-radius: 5px; display: block; box-shadow: 0 0 0 1px #000, 0 0 0 2px #6b5634; }
#topbar .res.sky { cursor: help; }
#season-name { color: #e8f0ff; font-weight: 700; font-size: 0.92em; }
@media (max-width: 1250px) { #season-name { display: none; } }
@media (max-width: 480px) { #sky { width: 24px; height: 12px; } }
/* twilight boss bar and ward timer */
#bossbar { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); z-index: 7; width: min(420px, 70vw); cursor: pointer;
  padding: 4px 10px 7px; border: 1px solid #a070d0; border-radius: 9px; background: linear-gradient(rgba(34,14,44,0.92), rgba(18,8,24,0.92)); box-shadow: 0 0 16px rgba(170,90,255,0.35), inset 0 1px 0 rgba(255,220,255,0.12); }
#bossbar[hidden] { display: none; }
#bossbar .bn { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font: 16px/1.2 "IM Fell English SC", Georgia, serif; color: #f0d8ff; text-shadow: 0 1px 2px #000; }
#bossbar small { font: 700 11px "Alegreya Sans", sans-serif; color: #c8a8e0; }
#bossbar .bb { height: 8px; margin-top: 3px; border-radius: 5px; background: #1a0c20; box-shadow: inset 0 1px 2px #000; overflow: hidden; }
#boss-hp { height: 100%; border-radius: 5px; background: linear-gradient(#e070ff, #8a2ac0); transition: width .2s; }
#topbar .res.ward { border-color: #7ac8f0; background: linear-gradient(#0c2436, #143a52); }
#topbar .res.ward[hidden] { display: none; }
#ward-t { color: #bfe8ff; }
@media (max-width: 480px) { #bossbar { top: 30px; padding: 2px 7px 5px; } #bossbar .bn { font-size: 13px; } }
body.boss #notice { top: 90px; }
@media (max-width: 480px) { body.boss #notice { top: 70px; } }
/* battle setup: segmented pickers */
.opt-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.opt-l { flex: 0 0 64px; font-size: 12px; font-weight: 800; color: #cdb88c; text-transform: uppercase; letter-spacing: .05em; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { padding: 3px 9px; font-size: 13px; border-radius: 8px; }
.seg button.sel { background: linear-gradient(#a8823a, #6a4c1a 55%, #4f3812); border-color: var(--gold-hi); box-shadow: 0 0 0 1px var(--gold-hi), 0 0 8px rgba(255,220,120,0.4); color: #fff4cf; }
.go-t td:first-child { text-align: left; white-space: nowrap; }
.go-t tr.me td { color: #fff2b8; font-weight: 800; }
i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 0 1px #000; vertical-align: middle; }
/* kingdoms & diplomacy panel */
#players { position: absolute; top: 38px; right: 8px; z-index: 8; width: min(430px, calc(100vw - 16px)); max-height: calc(100vh - 260px); overflow: auto;
  padding: 6px 10px 8px; border: 1px solid var(--gold); border-radius: 9px; background: linear-gradient(rgba(34,25,12,.96), rgba(18,12,6,.96)); box-shadow: 0 6px 18px rgba(0,0,0,.6); }
#players[hidden] { display: none; }
#players .ph { display: flex; justify-content: space-between; align-items: center; font: 18px "IM Fell English SC", Georgia, serif; color: var(--gold-hi); margin-bottom: 4px; }
#players .ph button { padding: 0 7px; }
#players .pr { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid rgba(184,146,74,0.25); font-size: 13px; }
#players .pr.out { opacity: 0.5; }
#players .pc { width: 20px; height: 20px; }
#players .pn { flex: 1 1 auto; font-weight: 700; color: #f0e2c0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#players .ps { font-size: 11.5px; font-weight: 800; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.ps.me { background: #3a4a2a; color: #cfeaa8; } .ps.ally { background: #1e3a52; color: #a8d8ff; } .ps.war { background: #4a1a14; color: #ffb0a4; } .ps.peace { background: #2a4a2a; color: #b8f0a0; } .ps.out { background: #333; color: #aaa; }
#players select { font: inherit; font-size: 12px; background: #1c140a; color: #f0e2c0; border: 1px solid #6b5634; border-radius: 6px; padding: 1px 2px; }
#players .pr button { padding: 1px 7px; font-size: 12px; }
#players .pw { font-size: 11.5px; color: #ffe39a; }
.small { font-size: 11.5px; }
/* peace offers */
#offers { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); z-index: 9; display: flex; flex-direction: column; gap: 6px; width: min(460px, calc(100vw - 16px)); }
.offer { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #9fe07a; border-radius: 10px; background: linear-gradient(rgba(22,34,14,.96), rgba(12,20,8,.96)); box-shadow: 0 0 16px rgba(140,255,120,0.3); color: #e8f4d8; font-size: 13.5px; }
.offer img { width: 34px; height: 34px; }
.offer .ot { flex: 1 1 auto; }
.offer .obar { height: 3px; margin-top: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; overflow: hidden; }
.offer .obar i { display: block; height: 100%; background: #9fe07a; animation: offerbar 30s linear forwards; }
@keyframes offerbar { from { width: 100%; } to { width: 0; } }
.offer button { padding: 3px 9px; }
.offer .yes { border-color: #9fe07a; }
/* chat */
#chat { position: absolute; left: 8px; bottom: calc(var(--panel-h, 190px) + 10px); z-index: 6; width: min(380px, calc(100vw - 16px)); pointer-events: none; }
#chat[hidden] { display: none; }
#chat-log .cm { font-size: 13px; line-height: 1.35; color: #f4ecd6; text-shadow: 0 1px 2px #000, 0 0 3px #000; padding: 1px 6px; border-radius: 5px; background: rgba(10,7,3,0.45); margin-top: 2px; transition: opacity 1.5s; overflow-wrap: anywhere; }
#chat-log .cm.team { background: rgba(20,40,60,0.55); }
#chat-log .cm.old { opacity: 0; }
#chat.open #chat-log .cm.old { opacity: 0.85; }
#chat-bar { display: flex; gap: 4px; margin-top: 4px; pointer-events: auto; }
#chat-bar[hidden] { display: none; }
#chat-in { flex: 1 1 auto; font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--gold); background: rgba(20,14,7,0.95); color: #f4ecd6; }
#chat-ch { padding: 2px 8px; font-size: 12px; }
#chat-ch.team { border-color: #7ac8f0; color: #bfe8ff; }
/* lobby seats */
#mp-seats { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; text-align: left; }
#mp-seats .seat { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 7px; background: rgba(0,0,0,0.25); font-size: 13px; }
#mp-seats .seat.me { box-shadow: inset 0 0 0 1px var(--gold-hi); }
#mp-seats .sn { flex: 1 1 auto; font-weight: 700; }
#mp-seats .st { font-size: 11.5px; color: #cdb88c; }
#mp-seats .sc { width: 18px; height: 18px; }
#mp-seats button { padding: 1px 7px; font-size: 12px; }
#mp-info { margin-top: 4px; }
/* player profile: the bar on the title screen */
.pf-bar { display: flex; align-items: center; gap: 12px; margin: 8px auto 2px; max-width: 760px; padding: 6px 12px; text-align: left;
  border: 1px solid rgba(216,178,90,0.55); border-radius: 10px; background: linear-gradient(rgba(0,0,0,0.32), rgba(0,0,0,0.2)); box-shadow: inset 0 1px 0 rgba(255,230,170,0.12); }
.pf-bar[hidden] { display: none; }
.pf-av { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--gold); box-shadow: 0 2px 6px rgba(0,0,0,.6); flex: 0 0 auto; }
.pf-mid { flex: 1 1 auto; min-width: 0; }
.pf-nm { display: flex; align-items: baseline; gap: 8px; }
.pf-nm b { font: 22px/1.1 "IM Fell English SC", Georgia, serif; color: #fff2c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-kind { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 8px; background: #3a3020; color: #d9c393; white-space: nowrap; }
.pf-kind.acct { background: #2c3a52; color: #bcd6ff; }
.pf-lv { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #e6d6b0; font-weight: 700; }
.pf-lv small { color: #a69a80; font-weight: 700; white-space: nowrap; }
.xpbar { display: block; flex: 1 1 auto; min-width: 60px; max-width: 220px; height: 7px; border-radius: 4px; background: #1a120a; box-shadow: inset 0 1px 2px #000, 0 0 0 1px rgba(216,178,90,0.4); overflow: hidden; }
.xpbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(#ffe89a, #d8a030); box-shadow: 0 0 6px rgba(255,210,100,0.6); }
.xpbar.big { max-width: none; height: 10px; margin: 6px 0; }
.pf-rec { font-weight: 800; color: #ffe39a; white-space: nowrap; }
.pf-btns { display: flex; gap: 6px; }
.pf-btns button { padding: 4px 10px; }
@media (max-width: 640px) { .pf-bar { flex-wrap: wrap; gap: 8px; } .pf-av { width: 40px; height: 40px; } .pf-rec { order: 3; } .pf-btns { order: 4; margin-left: auto; } .pf-lv small { display: none; } }
/* sign in */
#login, #record { z-index: 60; }
.login-box { width: 720px; }
.lg-ruler { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 10px; }
.lg-rp { display: flex; gap: 10px; }
.lg-rb { display: flex; flex-direction: column; align-items: center; padding: 4px 10px 6px; min-width: 96px; }
.lg-rb img { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(216,178,90,0.6); }
.lg-rb span { font: 18px/1.1 "IM Fell English SC", Georgia, serif; margin-top: 3px; }
.lg-rb.sel { background: linear-gradient(#a8823a, #6a4c1a 55%, #4f3812); border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--gold-hi), 0 0 14px rgba(255,220,120,0.5); }
.lg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lg-grid .card { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.lg-grid .card button { padding: 7px 10px; font-size: 16px; }
.lg-grid input { font: inherit; font-size: 16px; color: #fff4d6; background: #1a130a; border: 1px solid #8a7045; border-radius: 6px; padding: 6px 10px; text-align: center; min-width: 0; }
.lg-grid input:focus-visible { outline: 2px solid #ffe08a; }
.lg-grid input.bad { border-color: #ff8a6a; box-shadow: 0 0 8px rgba(255,120,90,0.5); }
.lg-who { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 14px; }
.lg-who img { width: 28px; height: 28px; border-radius: 50%; }
.lg-sh { margin: 12px 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #cdb88c; }
.lg-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; margin-top: 3px; border-radius: 8px; background: rgba(0,0,0,0.25); text-align: left; }
.lg-row img { width: 30px; height: 30px; border-radius: 50%; }
.lg-rn { font-weight: 800; color: #fff2c8; }
.lg-row .small { flex: 1 1 auto; }
.lg-row button { padding: 2px 9px; }
@media (max-width: 640px) { .lg-grid { grid-template-columns: 1fr; } .lg-rb img { width: 48px; height: 48px; } }
/* the full record */
.rec-box { width: 900px; }
.rhead { display: flex; align-items: center; gap: 14px; }
.rav { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 3px 10px rgba(0,0,0,.6); flex: 0 0 auto; }
.rmid { flex: 1 1 auto; min-width: 0; }
.rname { display: flex; align-items: center; gap: 8px; }
.rname input { font: 28px/1.1 "IM Fell English SC", Georgia, serif; color: #fff2c8; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 0 6px; min-width: 0; width: auto; max-width: 100%; }
.rname input:hover, .rname input:focus { border-color: #8a7045; background: #1a130a; outline: none; }
.rlvl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rlvl b { font: 20px "IM Fell English SC", Georgia, serif; color: #ffe39a; }
.lvb { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 5px; border-radius: 50%; font-weight: 800; color: #2a1a06; background: radial-gradient(circle at 40% 35%, #fff3c0, #e8c050 55%, #9a7020); box-shadow: 0 0 0 2px #3a2a10, 0 2px 5px rgba(0,0,0,.6); }
.rrul { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rrul .opt-l { flex: none; }
.rtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin: 12px 0; }
.rt { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 8px; background: rgba(0,0,0,0.28); border: 1px solid rgba(216,178,90,0.35); }
.rt b { font: 22px/1.1 "IM Fell English SC", Georgia, serif; color: #fff2c8; white-space: nowrap; }
.rt span { font-size: 11px; line-height: 1.15; font-weight: 800; color: #cdb88c; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.rt.w b { color: #bff0a0; } .rt.l b { color: #ffb0a4; }
.rcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rcols section, .rtabs table { background: rgba(0,0,0,0.22); border: 1px solid rgba(216,178,90,0.3); border-radius: 8px; padding: 6px 10px; }
.rcols h4, h4.rh { margin: 2px 0 4px; font: 18px "IM Fell English SC", Georgia, serif; color: var(--gold-hi); }
.rkv { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; margin: 0; font-size: 13px; }
.rkv dt { color: #cdbf9f; } .rkv dd { margin: 0; font-weight: 800; color: #fff2c8; text-align: right; font-variant-numeric: tabular-nums; }
.rtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; align-items: start; }
.rtab { width: 100%; border-collapse: collapse; font-size: 13px; }
.rtab th { font-size: 11px; font-weight: 800; color: #cdb88c; text-transform: uppercase; letter-spacing: .04em; text-align: right; padding: 2px 4px; }
.rtab th:first-child, .rtab td:first-child { text-align: left; }
.rtab td { text-align: right; padding: 2px 4px; border-top: 1px solid rgba(184,146,74,0.2); font-variant-numeric: tabular-nums; }
.rhist { max-height: 220px; overflow: auto; background: rgba(0,0,0,0.22); border: 1px solid rgba(216,178,90,0.3); border-radius: 8px; padding: 4px 8px; }
.rhist td:nth-child(2) b { font-weight: 800; }
.rhist tr.r-w td:nth-child(2) { color: #bff0a0; } .rhist tr.r-l td:nth-child(2) { color: #ffb0a4; } .rhist tr.r-d td:nth-child(2) { color: #e0d8c0; }
h4.rh { margin-top: 12px; }
.rfoot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.rfoot button { padding: 4px 12px; }
@media (max-width: 860px) { .rcols { grid-template-columns: 1fr; } .rtabs { grid-template-columns: 1fr; } .rhead { flex-wrap: wrap; } .rav { width: 60px; height: 60px; } }
@media (max-width: 480px) { .rhist td:nth-child(4), .rhist th:nth-child(4), .rhist td:nth-child(6), .rhist th:nth-child(6) { display: none; } }
/* experience earned, on the results screen */
.xpsum { margin: 12px auto 0; max-width: 520px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--gold); background: linear-gradient(rgba(60,44,16,0.6), rgba(24,16,6,0.6)); text-align: left; }
.xph { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.xph > b { font: 26px "IM Fell English SC", Georgia, serif; color: #ffe39a; text-shadow: 0 0 10px rgba(255,210,100,0.5); }
.lvup { font-weight: 800; color: #bff0a0; animation: lvpulse 1.2s ease-in-out 3; }
@keyframes lvpulse { 50% { color: #fff; text-shadow: 0 0 12px rgba(190,255,160,0.9); } }
.xpp { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12.5px; color: #d7cab0; margin-bottom: 2px; }
.xpp b { color: #ffe39a; }
#lg-acct { display: flex; flex-direction: column; gap: 8px; }
/* battles waiting to be finished */
.resume { max-width: 760px; margin: 6px auto 0; display: flex; flex-direction: column; gap: 4px; }
.resume[hidden] { display: none; }
.rs-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 9px; text-align: left;
  border: 1px solid #c8a050; background: linear-gradient(rgba(90,62,20,0.55), rgba(40,26,8,0.55)); box-shadow: 0 0 12px rgba(255,200,90,0.18); }
.rs-t { flex: 1 1 auto; min-width: 0; font-size: 13px; color: #e6d6b0; }
.rs-t b { color: #fff2c8; margin-right: 4px; }
.rs-row button { padding: 4px 10px; white-space: nowrap; }
.rs-row button:disabled { opacity: 0.5; cursor: default; }
.rs-note { font-size: 13px; padding: 4px 10px; border-radius: 8px; background: rgba(30,50,70,0.55); color: #cfe6ff; }
@media (max-width: 640px) { .rs-row { flex-wrap: wrap; } .rs-t { flex-basis: 100%; } }
/* the kingdom at a glance (info panel with nothing selected) */
.ks { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.ks-h { display: flex; align-items: center; gap: 7px; }
.ks-h img { width: 24px; height: 24px; }
.ks-h b { font: 18px "IM Fell English SC", Georgia, serif; color: var(--gold-hi); }
.ks-h .muted { font-size: 12px; }
.ks-row { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ks-c { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 2px; border-radius: 9px; background: rgba(0,0,0,0.35); border: 1px solid rgba(184,146,74,0.35); }
.ks-c img { width: 20px; height: 20px; border-radius: 4px; }
.ks-c b { color: #fff2c8; font-variant-numeric: tabular-nums; }
.ks-c small { color: #c8b68f; font-size: 11px; font-weight: 700; }
.ks-c.warn { border-color: #e8905a; } .ks-c.warn b { color: #ffc4a0; }
.ks-s span { color: #cdbf9f; } .ks-s b { color: #fff2c8; } .ks-s .good { color: #b8f0a0; }
.ks-tip { color: #a69a80; font-size: 12px; font-style: italic; border-top: 1px solid rgba(184,146,74,0.25); padding-top: 4px; }
@media (max-width: 760px), (max-height: 520px) { .ks-c small { display: none; } .ks-tip { display: none; } }
/* notices: a dark pill under each line so they read over any ground */
#notice div { display: table; margin: 3px auto 0; padding: 1px 12px 2px; border-radius: 12px; background: rgba(12,8,4,0.5); box-shadow: 0 2px 8px rgba(0,0,0,0.3); animation: notein .3s ease-out; }
@keyframes notein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* email / username sign-in */
#lg-acct input { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.lg-btns { display: flex; gap: 6px; }
.lg-btns button { flex: 1 1 0; }
.lg-link { background: none; border: none; box-shadow: none; color: #cfe0ff; text-decoration: underline; padding: 4px; margin-top: 4px; font-size: 13px; cursor: pointer; }

/* the opening cinematic */
#intro { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#intro .ib { position: absolute; left: 0; right: 0; height: 8vh; background: #000; }
#intro .ib.top { top: 0; } #intro .ib.bot { bottom: 0; }
#intro-cap { position: absolute; left: 0; right: 0; bottom: 12vh; text-align: center; color: #f6ecd2; opacity: 0; transition: opacity 0.9s ease; text-shadow: 0 2px 10px rgba(0,0,0,0.85), 0 0 2px #000; padding: 0 16px; }
#intro-cap.show { opacity: 1; }
#intro-cap b { display: block; font-family: 'IM Fell English SC', Georgia, serif; font-weight: 400; font-size: clamp(30px, 6vw, 64px); letter-spacing: 0.02em; }
#intro-cap span { display: block; margin-top: 4px; font-size: clamp(14px, 2.2vw, 20px); color: #e6dcc0; }
#intro-skip { position: absolute; right: 16px; top: calc(8vh + 12px); pointer-events: auto; background: rgba(0,0,0,0.45); color: #f4ecd6; border: 1px solid rgba(255,255,255,0.35); border-radius: 18px; padding: 6px 14px; font-size: 14px; cursor: pointer; }
body.intro #menu, body.intro #login, body.intro #record, body.intro #offers, body.intro #notice { display: none !important; }

/* the Game Master's emblem */
.gm-badge { display: inline-block; padding: 0 5px; margin-left: 2px; border-radius: 4px; font-size: 10.5px; font-weight: 900; letter-spacing: 0.06em; line-height: 16px; vertical-align: 1px;
  color: #2a1a04; background: linear-gradient(#fff2a8, #e8b52a 55%, #b07a10); border: 1px solid #7a5208; box-shadow: 0 0 6px rgba(255,210,80,0.7); }
.pf-kind.gm { color: #2a1a04; background: linear-gradient(#fff2a8, #e8b52a 55%, #b07a10); border-color: #7a5208; box-shadow: 0 0 8px rgba(255,210,80,0.8); font-weight: 900; }

/* ---- the store ---- */
.store-btn { background: linear-gradient(#b8892e, #6e4c14) !important; color: #fff6d0 !important; border-color: #ffd873 !important; }
.store-box { max-width: 900px; }
#store-tabs { flex-wrap: wrap; justify-content: center; }
#store-tabs button { font-size: 14px !important; padding: 4px 12px !important; }
#store-tabs button.sel { border-color: #ffe08a; color: #fff4cf; background: linear-gradient(#8a6a32, #4f3a17); }
#store-body { text-align: left; }
.st-lead { margin: 6px 0 10px; }
.st-list { margin: 0 0 12px 18px; padding: 0; line-height: 1.6; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 8px 0; }
.st-card { border: 1px solid rgba(255,224,138,0.3); border-radius: 8px; padding: 10px; background: rgba(0,0,0,0.25); display: flex; flex-direction: column; gap: 8px; }
.st-card.owned { border-color: rgba(150,230,140,0.55); }
.st-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.st-price { color: #ffe08a; font-weight: 800; white-space: nowrap; }
.st-tag { font-size: 11px; background: #3f7a2a; color: #eaffd8; padding: 1px 6px; border-radius: 8px; margin-left: 4px; }
.st-b { display: flex; gap: 8px; align-items: center; font-size: 13px; flex: 1; }
.st-skin { width: 132px; height: 72px; flex: none; image-rendering: auto; }
.st-a { display: flex; gap: 6px; flex-wrap: wrap; }
.st-a button { font-size: 14px; padding: 4px 12px; }
.st-a button.sel { border-color: #9ae08a; }
.st-bar { height: 10px; border-radius: 6px; background: rgba(0,0,0,0.4); overflow: hidden; }
.st-bar div { height: 100%; background: linear-gradient(90deg, #d9a93a, #ffe08a); }
.st-tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.st-tracks h4 { margin: 4px 0; }
.st-rw { padding: 4px 6px; border-radius: 6px; font-size: 13px; opacity: 0.7; }
.st-rw.got { opacity: 1; background: rgba(120,200,110,0.15); }
.st-lv { display: inline-block; min-width: 26px; font-weight: 800; color: #ffe08a; }
.st-foot { margin-top: 10px; border-top: 1px solid rgba(255,224,138,0.2); padding-top: 8px; }
.st-msg { color: #fff4cf; font-weight: 700; }
.st-foot a { color: #ffe08a; }
.vip-crown { color: #ffd873; margin-right: 3px; }
.p-title { color: #d9c393; font-size: 0.85em; font-style: italic; margin-left: 4px; }
@media (max-width: 600px) { .st-tracks { grid-template-columns: 1fr; } .st-skin { width: 100px; height: 55px; } }
.stats .nw { white-space: nowrap; }
