[data-team="0"] { --c: #5b8bd3; }
[data-team="1"] { --c: #d0555a; }
[data-team="2"] { --c: #a273cf; }
[data-team="3"] { --c: #4bb08d; }
[data-team="4"] { --c: #e0963c; }
[data-team="5"] { --c: #e3c84b; }
[data-team="6"] { --c: #5ec7d6; }
[data-team="7"] { --c: #e07ab8; }
[data-team="8"] { --c: #8fbf45; }
[data-team="9"] { --c: #c9c9c9; }
[data-team="10"] { --c: #9a6b4f; }
[data-team="11"] { --c: #7a7fe0; }
[data-team="12"] { --c: #f08a6c; }
[data-team="13"] { --c: #3fa34d; }
[data-team="14"] { --c: #b4a0ff; }
[data-team="15"] { --c: #ff6f91; }
.fan-card.c0 { --c: #e3c84b; }
.fan-card.c1 { --c: #4bb08d; }
.fan-card.c2 { --c: #9a6b4f; }
.fan-card.c3 { --c: #d0555a; }
.fan-card.c4 { --c: #a273cf; }

/* หน้าแรก: พัดการ์ด */
.fan { height: 176px; perspective: 700px; }
.fan-in { position: relative; height: 100%; transform-style: preserve-3d; transform: rotateX(14deg); }
.fan-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 78px;
  height: 118px;
  margin-left: -39px;
  border-radius: 10px;
  transform-origin: 50% 170%;
  background: linear-gradient(170deg, var(--paper), var(--paper-2));
  border: 2px solid var(--c);
  border-top-width: 10px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font: 600 13px/1.25 var(--serif);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .55);
}
.fan-card span { font-size: 28px; }
.fan-card:nth-child(1) { transform: rotate(-30deg) translateZ(-8px); }
.fan-card:nth-child(2) { transform: rotate(-15deg) translateZ(-4px); }
.fan-card:nth-child(3) { transform: translateZ(0); }
.fan-card:nth-child(4) { transform: rotate(15deg) translateZ(4px); }
.fan-card:nth-child(5) { transform: rotate(30deg) translateZ(8px); }
.hero { padding: 26px 0 16px; }
.winner .crown { display: inline-block; animation: crownSpin 3.4s linear infinite; }
.winner { perspective: 500px; }
@keyframes crownSpin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
.confetti { position: fixed; inset: 0; z-index: 40; pointer-events: none; }

/* ---------- เต็มจอระหว่างเล่น ---------- */
body.in-game { overflow: hidden; overscroll-behavior: none; }
body.in-game main { display: none; }
#boardHost { position: fixed; inset: 0; z-index: 0; }
#boardHost[hidden] { display: none; }
.world { position: absolute; inset: 0; overflow: hidden; background: #0d1720; }
.world canvas { display: block; }
.world::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px rgba(5, 8, 12, .6); }
.no-world { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; }
.world-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.world-label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  will-change: transform;
  color: #fff;
  font-weight: 700;
  line-height: 1.35;
}
.city-label {
  padding: 1px 7px 2px;
  border-radius: 6px;
  background: rgba(16, 12, 9, .86);
  border-bottom: 3px solid var(--gold);
  font: 700 12.5px/1.35 var(--serif);
  text-align: center;
}
.city-label.mine { outline: 1.5px solid var(--gold); color: #ffe7a8; }
.city-label.remembered { opacity: .6; }
.hp-bar { display: block; height: 4px; min-width: 34px; background: rgba(0, 0, 0, .65); border-radius: 2px; overflow: hidden; margin-top: 1px; }
.hp-bar b { display: block; height: 100%; background: #6fd36a; }
.hp-bar b.low { background: #e8583f; }
.unit-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 3px 1px;
  border-radius: 6px;
  background: rgba(10, 8, 6, .72);
  border: 1.5px solid var(--team, #fff);
  font-size: 12px;
  line-height: 1.2;
}
.unit-label .hp-bar { min-width: 22px; height: 3px; margin: 0; }
.unit-label.mine.idle { box-shadow: 0 0 0 2px #ffe08a; animation: idlePulse 1.3s ease-in-out infinite; }
.unit-label.fort { opacity: .75; }
.world.far .unit-label .hp-bar { display: none; }
.world.far .city-label { font-size: 11px; }
@keyframes idlePulse { 50% { box-shadow: 0 0 0 4px rgba(255, 224, 138, .35); } }
.float-text { font: 800 19px/1 var(--serif); text-shadow: 0 2px 3px #000, 0 0 6px #000; animation: floatUp 1.2s ease-out forwards; z-index: 3; }
.float-text.bad { color: #ff8f7a; }
.float-text.good { color: #b6f0a8; }
.float-text.big { font-size: 25px; color: #ffe08a; }
@keyframes floatUp { from { margin-top: 10px; opacity: 1; } to { margin-top: -34px; opacity: 0; } }

/* ---------- แถบบนจอ ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud:empty { display: none; }
#hud button, #hud .panel-back { pointer-events: auto; }
.hud-top {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 6px);
  left: 8px;
  right: 96px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 3px 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(20, 15, 11, .86);
  color: var(--ink-on-dark);
  font: 700 14px/1.1 var(--sans);
  font-variant-numeric: tabular-nums;
}
.chip small { color: #a9d68f; font-weight: 700; font-size: 12px; }
.chip.strong { color: var(--gold); font-family: var(--serif); }
.chip .warn { color: #ffb45a; }
.chip.timer:empty { display: none; }
.chip.timer.low { color: #fff; background: var(--danger); }
.central-chip {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 88px);
  left: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 7px;
  align-items: center;
  max-width: 62vw;
  padding: 4px 10px;
  text-align: left;
  border-radius: 9px;
  border: 1px solid #806a3c;
  background: linear-gradient(170deg, rgba(241, 228, 201, .96), rgba(230, 213, 178, .96));
  color: var(--ink);
}
.central-chip span { grid-row: span 2; font-size: 24px; line-height: 1; }
.central-chip b { font: 700 13px/1.2 var(--serif); }
.central-chip small { font-size: 12px; font-weight: 600; color: #6b3c1a; }
@media (min-width: 560px) { .central-chip { top: calc(env(safe-area-inset-top) + 48px); } }
.offline-banner { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: var(--danger); color: #fff; padding: 5px 12px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.hud-dead { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(92vw, 440px); padding: 10px 14px; text-align: center; border-radius: 10px; background: rgba(20, 15, 11, .9); }

.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; }
.race-card { display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; min-height: 66px; padding: 7px 9px; text-align: left; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-on-dark); }
.race-card.on { border-color: var(--gold); background: #3a2d20; outline: 2px solid var(--gold); }
.race-card .ico { grid-row: span 2; font-size: 26px; }
.race-card b { font: 700 15px/1.2 var(--serif); }
.race-card small { font-size: 12px; line-height: 1.25; color: var(--muted-on-dark); }
.world-info { color: var(--gold) !important; font-size: 14px; }
.chip.mana { color: #c9b4ff; }
.newcomer { position: absolute; top: calc(env(safe-area-inset-top) + 166px); left: 8px; padding: 2px 8px; border-radius: 7px; background: rgba(40, 70, 110, .88); font-size: 12.5px; }
.aim-bar { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 160px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px; background: rgba(120, 40, 20, .94); white-space: nowrap; font-weight: 700; }
#miniHost { position: fixed; z-index: 9; left: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px); }
#miniHost[hidden] { display: none; }
.minimap { display: block; width: 112px; height: auto; border: 1px solid rgba(255, 255, 255, .28); border-radius: 7px; cursor: pointer; }
.lair-label { padding: 0 5px; border-radius: 5px; background: rgba(70, 10, 10, .85); color: #ffc8b8; font-size: 10.5px; }
.world.very-far .lair-label, .world.very-far .unit-label:not(.hero) { display: none !important; }
.unit-label.hero { border-width: 2px; border-color: #ffe08a; }
.unit-label.monster { background: rgba(70, 10, 10, .8); }
.item-row { display: grid; grid-template-columns: 30px 1fr; align-items: center; column-gap: 7px; padding: 5px 8px; margin-bottom: 5px; border-radius: 8px; background: var(--bg-2); }
.item-row span { grid-row: span 2; font-size: 21px; text-align: center; }
.item-row small { color: var(--muted-on-dark); font-size: 12.5px; }
.room-code small { display: block; }

.hud-menu {
  position: absolute;
  right: 8px;
  top: calc(env(safe-area-inset-top) + 56px);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.hud-menu button {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(20, 15, 11, .88);
  font-size: 21px;
}
.hud-menu i { position: absolute; right: -4px; top: -4px; min-width: 19px; height: 19px; line-height: 19px; border-radius: 10px; background: var(--gold); color: #2b1d08; font: 700 12px/19px var(--sans); }
#audioCtl { position: fixed; top: calc(env(safe-area-inset-top) + 6px); right: 8px; z-index: 20; display: flex; gap: 4px; }
#audioCtl button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(20, 15, 11, .88); font-size: 17px; }
#audioCtl button[aria-pressed="false"] { opacity: .4; filter: grayscale(1); }

/* ---------- แถบล่าง ---------- */
.turn-bar {
  position: absolute;
  right: 8px;
  bottom: calc(env(safe-area-inset-bottom) + 8px);
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  max-width: calc(100vw - 136px);
}
.turn-bar .waiting { pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(20, 15, 11, .88); margin: 0; }
.btn-task, .btn-end {
  min-height: 50px;
  padding: 6px 15px;
  border-radius: 12px;
  font: 700 15.5px/1.15 var(--sans);
  border: 1px solid var(--gold);
}
.btn-task { background: var(--gold); color: #2b1d08; box-shadow: 0 3px 12px rgba(0, 0, 0, .5); }
.btn-end { background: #b4412f; border-color: #e5836f; color: #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .5); }
.btn-end.ghost { background: rgba(20, 15, 11, .92); border-color: rgba(255, 255, 255, .24); color: var(--ink-on-dark); font-size: 14px; }

.unit-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  max-width: 560px;
  bottom: calc(env(safe-area-inset-bottom) + 136px);
  padding: 8px 10px;
  border-radius: 13px;
  background: rgba(20, 15, 11, .93);
  border: 1px solid rgba(255, 255, 255, .14);
  border-left: 5px solid var(--c, #888);
  pointer-events: auto;
}
.unit-info { display: flex; align-items: center; gap: 9px; }
.unit-icon { font-size: 30px; line-height: 1; }
.unit-info b { display: block; font: 700 16px/1.25 var(--serif); }
.unit-info small { display: block; font-size: 13px; color: var(--ink-on-dark); }
.unit-info .hint { color: var(--muted-on-dark); font-size: 12px; }
.unit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.btn-mini {
  min-height: 42px;
  padding: 4px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-on-dark);
  font-weight: 700;
  font-size: 14px;
}
.btn-mini.primary { background: var(--gold); border-color: var(--gold); color: #2b1d08; }
.btn-mini:disabled { opacity: .45; }

/* ---------- ข่าวและการ์ดกลาง ---------- */
#news { position: fixed; z-index: 12; left: 8px; bottom: calc(env(safe-area-inset-bottom) + 230px); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; max-width: min(82vw, 380px); pointer-events: none; }
.news-item {
  pointer-events: auto;
  padding: 6px 10px;
  min-height: 34px;
  text-align: left;
  border-radius: 8px;
  border: 0;
  border-left: 4px solid var(--gold);
  background: rgba(20, 15, 11, .92);
  color: var(--ink-on-dark);
  font-size: 13.5px;
  animation: newsIn .25s ease-out;
}
.news-item.good { border-left-color: var(--good); }
.news-item.bad { border-left-color: var(--danger); }
@keyframes newsIn { from { transform: translateX(-20px); opacity: 0; } }
#centralFlash { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .3s; }
#centralFlash.show { opacity: 1; }
.flash-card {
  width: min(70vw, 260px);
  padding: 13px 15px 15px;
  text-align: center;
  border-radius: 14px;
  background: linear-gradient(170deg, var(--paper), var(--paper-2));
  border: 3px solid #806a3c;
  color: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .65);
}
#centralFlash.show .flash-card { animation: cardFlip .55s ease-out; }
@keyframes cardFlip { from { transform: perspective(700px) rotateY(90deg); } to { transform: perspective(700px) rotateY(0); } }
.flash-card small { color: var(--muted); font-weight: 700; }
.flash-card .big-icon, .central-big .big-icon { font-size: 54px; line-height: 1.2; }
.flash-card h2 { font-size: 19px; }
.flash-card p { margin: 3px 0 0; font-size: 14px; }
.flash-card .fx { font-weight: 700; color: #6b3c1a; }

/* ---------- แผงเต็ม: เมือง เทค การ์ด ---------- */
.panel-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); display: flex; justify-content: center; align-items: flex-end; }
.panel {
  width: min(100%, 620px);
  max-height: 84dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: panelIn .22s ease-out;
}
@keyframes panelIn { from { transform: translateY(30px); } }
.panel header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px 16px; border-bottom: 1px solid var(--line); }
.panel header h2 { font-size: 19px; color: var(--gold); }
.panel header small { color: var(--muted-on-dark); }
.btn-close { margin-left: auto; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-on-dark); font-size: 17px; }
.panel-body { overflow-y: auto; padding: 10px 14px 16px; -webkit-overflow-scrolling: touch; }
.panel .section-title { margin: 12px 0 5px; font-size: 14px; }
.leave-btn { margin-top: 10px; }

.city-stats { display: flex; flex-wrap: wrap; gap: 5px 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.city-stats small { color: #a9d68f; }
progress { display: block; width: 100%; height: 7px; margin: 6px 0; border: 0; border-radius: 4px; overflow: hidden; background: #3a2d20; appearance: none; }
progress::-webkit-progress-bar { background: #3a2d20; }
.bar-food::-webkit-progress-value { background: #7fb56a; }
.bar-food::-moz-progress-bar { background: #7fb56a; }
.bar-prod::-webkit-progress-value { background: #e0963c; }
.bar-prod::-moz-progress-bar { background: #e0963c; }
.now-building { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 14.5px; }
.warn-note { color: #ffb45a; font-weight: 700; margin: 8px 0; }
.build-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  margin-bottom: 6px;
  padding: 5px 10px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-on-dark);
}
.build-row.on { border-color: var(--gold); background: #3a2d20; }
.build-row:disabled { opacity: .45; }
.build-row .ico { font-size: 24px; }
.build-row .txt { flex: 1; min-width: 0; }
.build-row b { display: block; font-size: 15px; }
.build-row small { display: block; font-size: 12.5px; color: var(--muted-on-dark); }
.build-row .cost { text-align: right; font-weight: 700; font-size: 14px; white-space: nowrap; }

.tech-tree { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.tech-col { display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.tech {
  min-height: 76px;
  padding: 7px 9px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-on-dark);
}
.tech b { display: block; font-size: 14.5px; }
.tech small { display: block; font-size: 12px; color: var(--muted-on-dark); }
.tech .unlocks { color: #d8c79f; margin-top: 2px; }
.tech.done { background: #27381f; border-color: #54794a; }
.tech.on { border-color: var(--gold); outline: 2px solid var(--gold); }
.tech:disabled { opacity: .62; }
.tech.done:disabled { opacity: 1; }

.hand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; }
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 170px;
  padding: 9px 10px;
  text-align: left;
  border-radius: 12px;
  border: 3px solid #806a3c;
  background: linear-gradient(170deg, var(--paper), var(--paper-2));
  color: var(--ink);
}
.game-card.type-attack { border-color: #b8574a; }
.game-card.type-develop { border-color: #5a8a55; }
.game-card.type-trade { border-color: #b78d2e; }
.game-card.type-recruit { border-color: #4f719c; }
.game-card:disabled { opacity: .5; filter: grayscale(.5); }
.game-card .icon { font-size: 30px; line-height: 1.2; }
.game-card h3 { font-size: 15.5px; }
.game-card p { margin: 2px 0; font-size: 13px; line-height: 1.3; color: var(--muted); }
.game-card .fx { margin-top: auto; font-weight: 700; font-size: 13px; color: #6b3c1a; }
.game-card .price { position: absolute; top: 7px; right: 8px; font-weight: 700; font-size: 13px; }

.king-row { display: grid; --c: #888; grid-template-columns: 1fr auto; gap: 0 10px; align-items: center; padding: 7px 11px; margin-bottom: 6px; border-radius: 10px; background: var(--bg-2); border-left: 5px solid var(--c); }
.king-row.me { outline: 1px solid var(--gold); }
.king-row.dead { opacity: .5; }
.king-row small { grid-row: 2; color: var(--muted-on-dark); }
.king-row .score { grid-row: 1 / span 2; grid-column: 2; font: 800 22px/1 var(--serif); color: var(--gold); }
.log-row { display: block; width: 100%; min-height: 40px; margin-bottom: 5px; padding: 6px 10px; text-align: left; border-radius: 8px; border: 0; border-left: 4px solid var(--line); background: var(--bg-2); color: var(--ink-on-dark); font-size: 14px; }
.log-row.good { border-left-color: var(--good); }
.log-row.bad { border-left-color: var(--danger); }
.central-big { text-align: center; }
.central-big .fx { font-weight: 700; color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- ภาพจากชุดดีไซน์ ---------- */
body:not(.in-game) { background: linear-gradient(rgba(28, 22, 18, .55), rgba(28, 22, 18, .96) 340px), url(/art/home_bg.jpg) top center / 100% auto no-repeat, var(--bg); }
.hero h1 { position: relative; z-index: 2; margin-top: 30px; text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
img.art { display: block; width: 100%; height: 100%; object-fit: contain; }
.race-card .ico { width: 44px; height: 54px; display: grid; place-items: center; }
.unit-icon { width: 54px; height: 54px; display: grid; place-items: center; flex: none; }
.build-row .ico { width: 42px; height: 42px; display: grid; place-items: center; flex: none; }
.central-chip span { width: 34px; height: 44px; }
.central-chip span img.art { object-fit: cover; border-radius: 4px; }
.hud-menu button img.art { object-fit: cover; border-radius: 10px; }
.unit-art { display: block; width: 26px; height: 26px; object-fit: contain; }
.unit-label.hero .unit-art { width: 34px; height: 34px; }
.card-art { display: block; width: 100%; aspect-ratio: 3 / 2.6; object-fit: cover; border-radius: 7px; margin-bottom: 5px; }
.central-art { display: block; width: 100%; max-height: 300px; object-fit: cover; border-radius: 9px; margin: 5px 0; }
.hero-art { display: block; width: 180px; height: 180px; object-fit: contain; margin: 0 auto 6px; }
.game-card .price { background: rgba(241, 228, 201, .92); padding: 0 6px; border-radius: 6px; top: 13px; right: 14px; }

/* ---------- การทูต เควสต์ เนื้อเรื่อง ---------- */
.diplo { grid-column: 1 / -1; margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); }
.diplo small { display: block; margin-bottom: 4px; font-weight: 700; color: var(--ink-on-dark); }
.diplo-btns { display: flex; flex-wrap: wrap; gap: 5px; }
.diplo .btn-mini { min-height: 38px; font-size: 13px; }
.offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 10px; margin-bottom: 7px; border-radius: 10px; background: #3a2d20; border: 1px solid var(--gold); font-weight: 700; }
.offer span { flex: 1 1 100%; }
.quest { padding: 8px 11px; margin-bottom: 7px; border-radius: 10px; background: var(--bg-2); border-left: 4px solid var(--gold); }
.quest b { display: block; font: 700 15px/1.3 var(--serif); }
.quest p { margin: 3px 0; font-size: 14px; }
.quest small { color: var(--muted-on-dark); }
.quest-story { color: #e8dcc4; font-style: italic; }
.quest-task { font-weight: 700; color: var(--gold); }
.quest.saga { border-left-color: var(--danger); }
.tech s { color: var(--muted-on-dark); }
.story-card { position: fixed; z-index: 35; left: 50%; top: 18%; transform: translateX(-50%); width: min(88vw, 400px); padding: 14px 16px; text-align: center; border-radius: 14px; border: 3px solid #806a3c; background: linear-gradient(170deg, var(--paper), var(--paper-2)); color: var(--ink); box-shadow: 0 14px 40px rgba(0, 0, 0, .65); }
.story-card .story-icon { display: block; font-size: 34px; }
.story-card b { display: block; font: 800 18px/1.3 var(--serif); }
.story-card small { display: block; color: var(--muted); font-weight: 700; }
.story-card p { margin: 7px 0; font-size: 15px; line-height: 1.45; }
.story-card .story-close { font-weight: 400; }

/* ---------- ฝึกสอนและเมืองกลาง ---------- */
.tutor { position: absolute; left: 8px; right: 62px; max-width: 420px; top: calc(env(safe-area-inset-top) + 142px); z-index: 2; padding: 9px 12px; border-radius: 12px; pointer-events: auto; background: rgba(36, 28, 18, .96); border: 2px solid var(--gold); box-shadow: 0 6px 20px rgba(0, 0, 0, .55); }
.tutor small { color: var(--gold); font-weight: 700; }
.tutor b { display: block; font: 800 16px/1.3 var(--serif); }
.tutor p { margin: 3px 0 7px; font-size: 14px; line-height: 1.4; }
.tutor-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.tutor-target { outline: 3px solid #ffe08a; outline-offset: 2px; animation: tutorPulse 1.1s ease-in-out infinite; }
@keyframes tutorPulse { 50% { outline-color: rgba(255, 224, 138, .25); transform: scale(1.05); } }
.hub-label { border-bottom-color: #ffe08a; color: #ffe7a8; }
.fx-line { margin: 10px 0 7px; font-size: 15px; }
.fx-line b { color: var(--gold); font-size: 18px; }
.panel .diplo-btns { margin-bottom: 2px; }

.cat-title { margin: 8px 0 4px; font: 700 13px/1.3 var(--sans); color: var(--muted-on-dark); }

/* ---------- ไอคอน แถบ แท็บ กล่องยืนยัน ---------- */
.i { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; flex: none; vertical-align: -.2em; }
.i svg { width: 100%; height: 100%; display: block; }
.hud-menu .i { width: 26px; height: 26px; }
.btn-close .i { width: 18px; height: 18px; }
.chip .i { width: 19px; height: 19px; }
.chip.minus { border-color: var(--danger); }
.chip.minus small { color: #ff9f8c; }
.chip.full { color: #ffd98a; }
.alert-banner { position: absolute; top: calc(env(safe-area-inset-top) + 134px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 90vw; padding: 5px 12px; border-radius: 8px; background: var(--danger); color: #fff; font-weight: 700; font-size: 13.5px; animation: alertPulse 1.6s ease-in-out infinite; }
@keyframes alertPulse { 50% { filter: brightness(1.25); } }
.bar { height: 7px; margin: 5px 0; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #e0963c, #ffd661); transition: width .45s ease-out; }
.bar.food i { background: linear-gradient(90deg, #5e9a4b, #a8e07f); }
.bar.hp i { background: linear-gradient(90deg, #4ea84a, #9be07a); }
.tabs { display: flex; gap: 4px; margin: 10px 0 8px; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, .28); }
.tab { flex: 1; min-height: 40px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-on-dark); font: 700 13.5px/1.2 var(--sans); transition: background .18s, color .18s; }
.tab.on { background: linear-gradient(180deg, #f0c766, #c9962e); color: #2b1d08; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.modal-back { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px; background: rgba(4, 3, 2, .6); pointer-events: auto; animation: fadeIn .15s ease-out; }
.modal { width: min(100%, 400px); padding: 16px 18px; border-radius: 14px; border: 2px solid var(--gold); background: linear-gradient(170deg, #33271c, #1d1610); box-shadow: 0 16px 50px rgba(0, 0, 0, .7); animation: modalIn .2s cubic-bezier(.2, 1.3, .5, 1); }
.modal h3 { margin: 0 0 6px; font: 800 18px/1.3 var(--serif); color: var(--gold); }
.modal p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.45; word-break: break-word; }
.modal-btns { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.btn-mini.danger { background: linear-gradient(180deg, #d0604a, #a03a2a); border-color: #e5836f; color: #fff; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { transform: scale(.9); opacity: 0; } }

/* ---------- กรอบแผงแบบแฟนตาซี ---------- */
.panel {
  border: 1px solid #8a6d3c;
  border-bottom: 0;
  background:
    linear-gradient(180deg, rgba(224, 176, 74, .08), transparent 90px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 2l4 20-4 20-4-20z' fill='%23ffffff' opacity='.012'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #2a2017, #1a140f);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 224, 138, .25);
  animation: panelIn .26s cubic-bezier(.2, .9, .3, 1);
}
@keyframes panelIn { from { transform: translateY(46px); opacity: .4; } }
.panel-back { animation: fadeIn .18s ease-out; }
.panel header { position: relative; background: linear-gradient(180deg, rgba(224, 176, 74, .14), transparent); border-bottom: 1px solid #6e5730; }
.panel header::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, #ffe08a, transparent); }
.panel-title { min-width: 0; }
.panel-title h2 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 19px; color: var(--gold); text-shadow: 0 1px 2px #000; }
.panel-title small { display: block; color: var(--muted-on-dark); font-size: 12.5px; }
.panel .section-title { display: flex; align-items: center; gap: 8px; color: #ffe7a8; font-family: var(--serif); }
.panel .section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #6e5730, transparent); }
.cat-title { color: #ffe7a8; }

.medal { position: relative; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5a4630, #241a11); box-shadow: 0 0 0 2px #a8853f, 0 0 0 3px #3d2f1c, 0 2px 6px rgba(0, 0, 0, .55); overflow: hidden; }
.medal img.art { object-fit: cover; object-position: top; }
.medal.small { width: 42px; height: 42px; flex: none; font-size: 21px; }
.build-row .ico.medal { width: 44px; height: 44px; font-size: 22px; }
.unit-icon.medal { width: 54px; height: 54px; font-size: 26px; }
.cat-food { background: radial-gradient(circle at 35% 30%, #5f7f3c, #243312); }
.cat-prod { background: radial-gradient(circle at 35% 30%, #8a5a30, #33200f); }
.cat-gold { background: radial-gradient(circle at 35% 30%, #a8853f, #3d2c0c); }
.cat-sci { background: radial-gradient(circle at 35% 30%, #3f76a0, #122a3d); }
.cat-mil { background: radial-gradient(circle at 35% 30%, #9a4a3c, #351510); }
.cat-def { background: radial-gradient(circle at 35% 30%, #6d7680, #23282d); }
.cat-magic { background: radial-gradient(circle at 35% 30%, #7a50c0, #261544); }
.cat-culture { background: radial-gradient(circle at 35% 30%, #b0568a, #3a142c); }
.build-row, .king-row, .quest, .item-row, .log-row { background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .015)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03); transition: border-color .15s, transform .1s, background .15s; }
.build-row:active:not(:disabled), .btn-mini:active:not(:disabled), .btn-task:active, .btn-end:active, .hud-menu button:active, .chip:active { transform: scale(.97); }
.build-row.on { background: linear-gradient(180deg, rgba(224, 176, 74, .22), rgba(224, 176, 74, .06)); }
.btn-mini, .btn-task, .btn-end, .hud-menu button, .chip { transition: transform .1s, filter .15s, background .15s; }
.btn-mini.primary, .btn-task { background: linear-gradient(180deg, #f3cb6c, #c9962e); box-shadow: 0 2px 6px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .45); }
.chip, .hud-menu button, #audioCtl button, .btn-end.ghost { background: linear-gradient(180deg, rgba(48, 37, 26, .94), rgba(20, 15, 11, .94)); border-color: rgba(224, 176, 74, .42); box-shadow: 0 2px 7px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 224, 138, .16); }
.hud-menu { max-height: calc(100dvh - 210px); overflow-y: auto; scrollbar-width: none; padding: 4px; margin: -4px; }
.hud-menu::-webkit-scrollbar { display: none; }
.hud-menu button { display: grid; place-items: center; flex: none; }
.hud-menu i.bad { background: var(--danger); color: #fff; }
.unit-bar { background: linear-gradient(170deg, rgba(48, 37, 26, .97), rgba(20, 15, 11, .97)); border-color: rgba(224, 176, 74, .36); box-shadow: 0 6px 20px rgba(0, 0, 0, .55); animation: barIn .18s ease-out; }
@keyframes barIn { from { transform: translateY(10px); opacity: .3; } }
.unit-info > div { min-width: 0; flex: 1; }
.unit-actions { max-height: 150px; overflow-y: auto; }
.inspect .unit-info small { color: var(--ink-on-dark); line-height: 1.35; }

.city-hero { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: linear-gradient(100deg, color-mix(in srgb, var(--c, #888) 34%, transparent), rgba(255, 255, 255, .02)); border: 1px solid rgba(255, 255, 255, .08); }
.city-hero > div { flex: 1; min-width: 0; }
.city-hero b { display: block; font: 700 15.5px/1.3 var(--serif); }
.city-hero small { color: var(--muted-on-dark); }
.city-portrait { width: 60px; height: 60px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 30px; background: rgba(0, 0, 0, .35); box-shadow: 0 0 0 2px #a8853f; }
.city-portrait img.art { object-fit: cover; object-position: top; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 5px 2px; border-radius: 9px; background: rgba(0, 0, 0, .25); font-variant-numeric: tabular-nums; }
.stat .i { width: 21px; height: 21px; }
.stat b { font-size: 13.5px; }
.stat small { font-size: 11.5px; color: #a9d68f; }
.now-building { padding: 7px 9px; border-radius: 11px; border: 1px solid #6e5730; background: rgba(224, 176, 74, .08); }
.now-building .grow { flex: 1; min-width: 0; }
.now-building b { display: block; }
.now-building small { color: var(--muted-on-dark); font-size: 12px; }
.built-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 6px; }
.built { display: grid; grid-template-columns: auto 1fr; column-gap: 7px; padding: 7px 9px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); }
.built span { grid-row: span 2; font-size: 22px; }
.built b { font-size: 13.5px; }
.built small { font-size: 11.5px; line-height: 1.25; color: var(--ink-on-dark); opacity: .85; }

.king-row { grid-template-columns: 44px 1fr auto; }
.king-face { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 22px; background: rgba(0, 0, 0, .35); box-shadow: 0 0 0 2px var(--c); }
.king-face img.art { object-fit: cover; object-position: top; }
.king-row small { grid-column: 2; }
.king-row .score { grid-column: 3; }

.wonder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; margin-top: 8px; }
.wonder { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; border: 2px solid #6e5730; background: #1f1812; }
.wonder[data-team] { border-color: var(--c); }
.wonder.mine { box-shadow: 0 0 0 2px #ffe08a; }
.wonder-art { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.wonder-body { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px 9px; flex: 1; }
.wonder-body b { font: 700 14px/1.25 var(--serif); }
.wonder-body small { font-size: 12px; line-height: 1.3; color: var(--muted-on-dark); }
.wonder-body .wonder-owner { color: #ffe7a8; font-weight: 700; }
.wonder-body .btn-mini { margin-top: auto; min-height: 36px; }
.season-goal { border-left-color: #ffe08a; }
.season-goal p { margin: 4px 0; }

/* ---------- จัดวางบนมือถือไม่ให้ทับกัน ---------- */
body.panel-open #news { display: none; }
#news { top: calc(env(safe-area-inset-top) + 142px); bottom: auto; max-width: min(70vw, 360px); }
.turn-bar { max-width: calc(100vw - 132px); }
.btn-task { flex: 1 1 100%; }
.btn-end.ghost { min-height: 44px; padding: 5px 11px; font-size: 13.5px; white-space: nowrap; }
.unit-bar { bottom: calc(env(safe-area-inset-bottom) + 124px); max-height: 46dvh; overflow-y: auto; }
@media (min-width: 720px) { .turn-bar { max-width: 320px; } .unit-bar { bottom: calc(env(safe-area-inset-bottom) + 10px); left: 132px; right: auto; width: clamp(280px, calc(100vw - 480px), 560px); } }

.worker-tip { flex-basis: 100%; color: #ffe7a8; font-size: 12.5px; }
.minimap { width: 128px; image-rendering: pixelated; }
.btn-mini { max-width: 100%; white-space: normal; text-align: left; }

.auto-row { margin-top: 8px; padding: 7px 9px; border-radius: 11px; background: rgba(0, 0, 0, .22); border: 1px solid rgba(224, 176, 74, .25); }
.auto-row small { display: block; margin-bottom: 5px; color: var(--ink-on-dark); }
.auto-row .btn-mini { min-height: 36px; font-size: 13px; }

/* เวลาในเกม */
.clock-chip { position: absolute; top: calc(env(safe-area-inset-top) + 134px); left: 8px; display: flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 9px; border: 1px solid rgba(224, 176, 74, .5); background: rgba(20, 15, 11, .82); color: var(--ink-on-dark); font-size: 13px; }
.clock-chip span { font-size: 17px; line-height: 1; }
.clock-chip b { font: 700 13px/1.2 var(--serif); }
.clock-chip .ev { font-style: normal; font-size: 15px; animation: evPulse 1.6s ease-in-out infinite; }
.clock-chip small { font-weight: 700; color: var(--muted-on-dark); }
.clock-chip.night, .clock-now.night { background: rgba(22, 26, 58, .9); }
.clock-chip.dusk, .clock-now.dusk { background: rgba(78, 36, 30, .9); }
.clock-chip.dawn, .clock-now.dawn { background: rgba(84, 54, 40, .9); }
@media (min-width: 560px) { .clock-chip { top: calc(env(safe-area-inset-top) + 94px); } .newcomer { top: calc(env(safe-area-inset-top) + 126px); } }
@keyframes evPulse { 50% { transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .clock-chip .ev { animation: none; } }
.up { color: #8fe07a !important; }
.down { color: #ff8a7a !important; }
.clock-now { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(120, 90, 40, .5); color: #fff4d8; }
.clock-now .big { font-size: 40px; line-height: 1; }
.clock-now h3 { margin: 0; }
.clock-now p { margin: 2px 0 0; }
.race-event { margin: 10px 0; padding: 9px 11px; border-radius: 12px; border: 1px solid rgba(224, 176, 74, .45); background: rgba(0, 0, 0, .2); }
.race-event h3 { margin: 0 0 4px; }
.race-event ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.race-event li.me, .time-table tr.me { outline: 1px solid var(--gold); border-radius: 6px; }
.time-table-wrap { overflow-x: auto; }
.time-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.time-table th, .time-table td { padding: 4px 5px; text-align: center; white-space: nowrap; }
.time-table tbody th { text-align: left; }
.time-table .now { background: rgba(224, 176, 74, .18); }

/* เมนูยุบ */
.hud-menu .more-btn { font: 700 22px/1 var(--sans); color: var(--gold); }
.hud-menu .more-btn.on { background: rgba(224, 176, 74, .3); }
.menu-more { display: flex; flex-direction: column; gap: 7px; animation: moreIn .2s cubic-bezier(.2, .9, .3, 1); }
@keyframes moreIn { from { opacity: 0; transform: translateY(-8px) scale(.9); } }
/* ปิดแผงนุ่ม ๆ */
.panel-back.closing { animation: fadeOut .17s ease-in forwards; }
.panel-back.closing .panel { animation: panelOut .17s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes panelOut { to { transform: translateY(60px); opacity: 0; } }
/* ปุ่มทุกปุ่มยุบเล็กน้อยตอนกด */
#hud button { transition: transform .08s ease-out, filter .12s; }
#hud button:active:not(:disabled) { transform: scale(.94); filter: brightness(1.15); }
button.chip { font: inherit; cursor: pointer; }
.num { font-weight: 700; transition: color .3s; }
.num.rising { color: #ffe9a0; }
.bar i, .ledger-bar i { transition: width .45s cubic-bezier(.2, .9, .3, 1); }
/* บัญชี */
.ledger-total { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; margin: 10px 0 4px; padding: 10px 12px; border-radius: 12px; background: rgba(80, 140, 60, .22); border: 1px solid rgba(143, 224, 122, .35); }
.ledger-total.minus { background: rgba(160, 60, 40, .25); border-color: rgba(255, 138, 122, .4); }
.ledger-total b { font: 800 24px/1 var(--serif); }
.ledger-total small { grid-column: span 2; color: var(--muted-on-dark); }
.ledger-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ledger-list li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; padding: 6px 9px; border-radius: 9px; background: rgba(0, 0, 0, .2); }
.ledger-list li.plus b { color: #8fe07a; }
.ledger-list li.minus b { color: #ff8a7a; }
.ledger-bar { grid-column: span 2; display: block; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.ledger-bar i { display: block; height: 100%; width: 0; background: #8fe07a; }
.ledger-list li.minus .ledger-bar i { background: #ff8a7a; }
.ledger-list .link { background: none; border: 0; padding: 0; color: var(--ink-on-dark); text-align: left; font: inherit; }

/* แถบกองทัพ */
.squad-bar { flex-basis: 100%; display: flex; justify-content: flex-end; gap: 5px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.squad-bar::-webkit-scrollbar { display: none; }
.squad-chip { flex: none; display: flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 10px; border: 1px solid rgba(224, 176, 74, .45); background: rgba(20, 15, 11, .88); color: var(--ink-on-dark); font-size: 13px; white-space: nowrap; }
.squad-chip.on { background: rgba(224, 176, 74, .32); border-color: var(--gold); }
.squad-chip small { color: var(--gold); font-weight: 700; }
/* กรอบลากเลือก */
.select-box { position: absolute; pointer-events: none; border: 2px dashed #ffe08a; background: rgba(255, 224, 138, .12); border-radius: 4px; z-index: 3; }
#modalInput { margin: 6px 0 10px; width: 100%; }
body.has-squads .unit-bar { bottom: calc(env(safe-area-inset-bottom) + 178px); }
@media (min-width: 720px) { body.has-squads .unit-bar { bottom: calc(env(safe-area-inset-bottom) + 10px); } }

/* เลือกสาย */
.path-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.path-card { display: grid; justify-items: start; gap: 3px; padding: 9px 10px; text-align: left; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-on-dark); }
.path-card span { font-size: 24px; }
.path-card b { font: 700 15px/1.2 var(--serif); }
.path-card small { font-size: 12px; line-height: 1.3; color: var(--muted-on-dark); }
.path-card.on { border-color: var(--gold); background: #3a2d20; outline: 2px solid var(--gold); }
.chip.hide { display: none; }
.chip.fame { color: #ffe08a; }
/* กิลด์ */
.rank-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(224, 176, 74, .25), rgba(0, 0, 0, .2)); border: 1px solid rgba(224, 176, 74, .5); }
.rank-card .rank-id { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a0, #b8862a); color: #2b1d08; font: 800 24px/1 var(--serif); box-shadow: 0 0 14px rgba(255, 224, 138, .5); }
.rank-card small { display: block; color: var(--muted-on-dark); }
.bounty { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; margin-bottom: 6px; border-radius: 10px; background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .08); }
.bounty.done { border-color: rgba(143, 224, 122, .5); background: rgba(80, 140, 60, .18); }
.bounty small { display: block; color: var(--muted-on-dark); font-size: 12px; }
.bounty-btns { display: flex; flex-direction: column; gap: 4px; }

.squad-chip { padding: 4px 8px; font-size: 12.5px; }

.squad-chip i { font-style: normal; display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 5px; background: var(--gold); color: #2b1d08; font-weight: 800; font-size: 12px; }
.squad-chip.add { border-style: dashed; color: #ffe08a; }
.unit-label.boxed { box-shadow: 0 0 0 2px #fff4c7, 0 0 10px #ffe08a; }

.goods-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 7px 9px; margin-bottom: 5px; border-radius: 10px; background: rgba(0, 0, 0, .22); }
.goods-row .ico { font-size: 22px; text-align: center; }
.goods-row small { display: block; color: var(--muted-on-dark); font-size: 12px; }

.auction-card { padding: 12px; border-radius: 12px; border: 1px solid rgba(224, 176, 74, .5); background: linear-gradient(160deg, rgba(224, 176, 74, .18), rgba(0, 0, 0, .25)); }
.auction-card .lot { font: 700 18px/1.3 var(--serif); margin-bottom: 6px; }
.auction-card .lot small { display: block; font: 600 13px/1.3 var(--sans); color: var(--muted-on-dark); }
.auction-card .price { color: #ffe08a; font-size: 18px; }
.trade-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 7px 9px; margin-bottom: 5px; border-radius: 10px; background: rgba(0, 0, 0, .22); }
.trade-row.mine { border: 1px solid rgba(224, 176, 74, .45); }
.trade-row small { display: block; color: var(--muted-on-dark); }
.price-hub { padding: 7px 9px; margin-bottom: 6px; border-radius: 10px; background: rgba(0, 0, 0, .2); }
.price-list { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 13px; }
.item-row.equip { grid-template-columns: 30px 1fr auto; }
.item-row.equip button { grid-row: span 2; }
.item-row.bag { opacity: .7; }

.unit-label[data-stars="1"]::before, .unit-label[data-stars="2"]::before, .unit-label[data-stars="3"]::before { color: #ffe08a; font-size: 10px; line-height: 1; text-shadow: 0 0 3px #000; }
.unit-label[data-stars="1"]::before { content: '★'; }
.unit-label[data-stars="2"]::before { content: '★★'; }
.unit-label[data-stars="3"]::before { content: '★★★'; }

/* ภาพ 2 มิติในบรรทัดข้อความ */
img.art-inline { display: inline-block; width: 1.5em; height: 1.5em; object-fit: contain; vertical-align: middle; margin: -0.2em 0.1em 0 0; }
.clock-chip img.art-inline { width: 22px; height: 22px; margin: 0; }
.clock-now .big img.art-inline { width: 52px; height: 52px; margin: 0; }
.race-event .event-art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; margin-bottom: 8px; }
.wonder img.wonder-art { width: 96px; height: 96px; flex: none; object-fit: cover; border-radius: 10px; }
.item-row span img.art { width: 30px; height: 30px; }
.race-card .ico img.art { width: 44px; height: 44px; }

/* ปุ่มปิดที่มุมหน้าต่าง */
.win-x { position: absolute; top: 6px; right: 6px; z-index: 2; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1.5px solid rgba(224, 176, 74, .7); background: rgba(20, 15, 11, .92); color: #ffe08a; font: 700 16px/1 var(--sans); display: grid; place-items: center; }
.win-x:active { background: rgba(224, 176, 74, .4); }
.unit-bar { padding-right: 46px; }
.modal { position: relative; padding-right: 50px; }
.unit-actions .btn-mini { min-height: 40px; }
/* รายการในกล่องเมนู: ปุ่มเต็มความกว้าง กดง่ายบนมือถือ */
.modal-btns.list { display: grid; grid-template-columns: 1fr; gap: 7px; max-height: 60dvh; overflow-y: auto; margin-right: -32px; }
.modal-btns .modal-opt { min-height: 44px; text-align: left; }
.modal-btns.list .modal-opt { width: 100%; }
.modal-opt small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; opacity: .8; }
@media (min-width: 560px) { .modal-btns.list { grid-template-columns: 1fr 1fr; } }
/* แถบกองให้รับแตะทั้งแถบ ไม่ทะลุไปโดนแผนที่ */
.squad-bar { pointer-events: auto; }

/* ---------- ชุดภาพ UI: กรอบ ปุ่ม ไอคอน (ภาพอยู่ใน public/art/ui_*) ---------- */
/* หน้าต่างหลัก กล่องเมนู แถบยูนิต: กรอบหนังสีเข้มขอบทอง */
.panel, .modal { border: 18px solid transparent; border-image: url("/art/ui_slot.jpg") 34 fill / 18px stretch; background: none; box-shadow: 0 -8px 30px rgba(0, 0, 0, .55); }
.panel { border-bottom-width: 10px; }
.unit-bar { border: 14px solid transparent; border-image: url("/art/ui_slot.jpg") 34 fill / 14px stretch; background: none; }
.panel header { background: url("/art/ui_header.jpg") center / 100% 100% no-repeat; border-bottom: 0; min-height: 58px; padding: 6px 12px 6px 22px; }
.panel header::after { display: none; }
.panel header h2 { color: #ffe9a8; text-shadow: 0 2px 4px rgba(0, 0, 0, .8); }
.panel header small { color: #f3d9a0; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.section-title { padding-bottom: 10px; background: url("/art/ui_divider.png") center bottom / auto 12px no-repeat; }
/* ปุ่มทอง ปุ่มเข้ม ปุ่มแดง */
.btn.primary, .btn-task, .btn-mini.primary, .tab.on { border: 9px solid transparent; border-image: url("/art/ui_button_gold.jpg") 44 fill / 9px stretch; background: none; box-shadow: none; color: #2b1d08; }
.btn, .btn-mini, .btn-end.ghost { border: 9px solid transparent; border-image: url("/art/ui_button_dark.jpg") 40 fill / 9px stretch; background: none; box-shadow: none; }
.btn-mini.danger, .btn.danger, .btn-end:not(.ghost) { border: 9px solid transparent; border-image: url("/art/ui_button_red.jpg") 40 fill / 9px stretch; background: none; color: #fff; }
.btn-mini { padding: 2px 6px; }
.btn-mini:disabled, .btn:disabled { opacity: .5; filter: grayscale(.6); }
/* ป้ายทรัพยากรด้านบน */
.chip { border: 8px solid transparent; border-image: url("/art/ui_pill.png") 26 fill / 8px stretch; background: none; box-shadow: none; padding: 0 4px; }
/* ปุ่มกลมด้านขวา: ใช้ไอคอนวงกลมจากชุดภาพ */
.hud-menu button { background: url("/art/ui_button_round.png") center / contain no-repeat; border: 0; box-shadow: none; }
.hud-menu button[data-panel=cities], .hud-menu button[data-panel=kings], .hud-menu button[data-panel=quests], .hud-menu button[data-panel=hub], .hud-menu button[data-panel=log], .hud-menu .more-btn { background-size: contain; background-position: center; background-repeat: no-repeat; color: transparent; }
.hud-menu button[data-panel=cities] { background-image: url("/art/ui_icon_city.png"); }
.hud-menu button[data-panel=kings] { background-image: url("/art/ui_icon_diplomacy.png"); }
.hud-menu button[data-panel=quests] { background-image: url("/art/ui_icon_research.png"); }
.hud-menu button[data-panel=hub] { background-image: url("/art/ui_icon_map.png"); }
.hud-menu button[data-panel=log] { background-image: url("/art/ui_icon_bell.png"); }
.hud-menu .more-btn { background-image: url("/art/ui_icon_menu.png"); font-size: 0; }
.hud-menu .more-btn.on { background-image: url("/art/ui_icon_back.png"); }
.hud-menu button[data-panel=cities] > .i, .hud-menu button[data-panel=kings] > .i, .hud-menu button[data-panel=quests] > .i, .hud-menu button[data-panel=hub] > .i, .hud-menu button[data-panel=log] > .i { visibility: hidden; }
/* ปุ่มปิด */
.win-x, .btn-close { background: url("/art/ui_close.png") center / contain no-repeat; border: 0; color: transparent; font-size: 0; box-shadow: none; }
.btn-close .i { display: none; }
.btn-close { width: 40px; height: 40px; }
/* ปุ่มเสียง */
#audioCtl button { background: url("/art/ui_button_round.png") center / contain no-repeat; border: 0; box-shadow: none; }
#btnSfx { background-image: url("/art/ui_icon_sound.png"); color: transparent; }
#btnSfx[aria-pressed=false] { background-image: url("/art/ui_icon_mute.png"); }
/* ข้อความแจ้งเตือน: ป้ายกระดาษ */
#toast { border: 16px solid transparent; border-image: url("/art/ui_toast.jpg") 56 fill / 16px stretch; background: none; color: #2b1d08; font-weight: 700; box-shadow: none; }
#toast.bad { border-image-source: url("/art/ui_button_red.jpg"); border-image-slice: 40 fill; color: #fff; }
/* แผนที่ย่อ */
#miniHost { border: 10px solid transparent; border-image: url("/art/ui_minimap.jpg") 30 / 10px stretch; }
/* หน้าแรก: ชื่อเกมอยู่ในกรอบห้าบัลลังก์ */
.hero h1 { display: inline-block; min-width: min(86vw, 360px); padding: 30px 26px 46px; background: url("/art/ui_logo.png") center / 100% 100% no-repeat; color: #ffe08a; }
#audioCtl #btnSfx { background-image: url("/art/ui_icon_sound.png"); color: transparent; }
#audioCtl #btnSfx[aria-pressed=false] { background-image: url("/art/ui_icon_mute.png"); }
.btn-end.ghost, .btn-task { border-width: 7px; border-image-width: 7px; padding: 2px 8px; }

/* แชท */
.chat-list { height: min(46dvh, 420px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 2px; overscroll-behavior: contain; }
.chat-msg { max-width: 86%; align-self: flex-start; padding: 5px 10px 7px; border-radius: 12px 12px 12px 3px; background: rgba(0, 0, 0, .32); border: 1px solid rgba(224, 176, 74, .2); }
.chat-msg.mine { align-self: flex-end; border-radius: 12px 12px 3px 12px; background: rgba(224, 176, 74, .18); border-color: rgba(224, 176, 74, .45); }
.chat-msg p { margin: 2px 0 0; word-break: break-word; line-height: 1.35; }
.chat-msg small { margin-left: 6px; font-size: 11px; color: var(--muted-on-dark); }
.chat-name { padding: 0; border: 0; background: none; color: #ffe08a; font: 700 13px/1.2 var(--sans); }
.chat-send { display: flex; gap: 6px; margin-top: 8px; }
.chat-send .input { flex: 1; min-width: 0; }

/* ประกาศอัปเดต */
.update-back { z-index: 30; }
.update-modal { width: min(100%, 440px); max-height: 80dvh; overflow-y: auto; }
.update-date { display: block; color: var(--gold); font-weight: 700; margin-bottom: 2px; }
.update-list { margin: 6px 0 12px; padding-left: 20px; display: grid; gap: 5px; line-height: 1.4; }
.reload-banner { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 92px); transform: translateX(-50%); z-index: 6; padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--gold); background: rgba(36, 28, 18, .96); color: #ffe08a; font: 700 14px/1.2 var(--sans); white-space: nowrap; animation: alertPulse 1.6s ease-in-out infinite; }
.update-row b { color: #ffe08a; }

/* ================================================================
   ธีมแฟนตาซีใหม่: กรอบวาดด้วย CSS คมชัดทุกขนาดจอ แทนกรอบภาพที่ยืดแล้วเบลอ
   ม่วงครามเข้ม ขอบทอง ปุ่มหลักทองเรืองแสง ปุ่มรองกระจกเข้ม
   ================================================================ */
:root {
  --f-bg1: #24203a;
  --f-bg2: #141122;
  --f-gold: #ecc873;
  --f-gold-hi: #fff0bf;
  --f-gold-lo: #a97f33;
  --f-edge: rgba(236, 200, 115, .55);
  --f-edge-soft: rgba(236, 200, 115, .22);
  --f-arcane: #8fd8ff;
  --f-text: #f6eedb;
  --f-muted: #b8aed0;
  --f-glass: linear-gradient(180deg, rgba(42, 36, 64, .95), rgba(20, 17, 33, .96));
}

/* หน้าต่างล่าง กล่องถาม แถบยูนิต */
.panel, .modal, .unit-bar {
  border-image: none;
  background:
    radial-gradient(130% 55% at 50% 0%, rgba(143, 216, 255, .10), transparent 62%),
    linear-gradient(180deg, var(--f-bg1), var(--f-bg2));
  color: var(--f-text);
}
.panel {
  border: 1.5px solid var(--f-edge);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, .28), inset 0 0 0 5px var(--f-edge-soft), 0 -14px 44px rgba(0, 0, 0, .6);
}
/* ที่จับด้านบน บอกว่าเป็นแผ่นที่เลื่อนขึ้นมา */
.panel::before { content: ''; flex: none; align-self: center; width: 46px; height: 4px; margin: 7px 0 -2px; border-radius: 4px; background: linear-gradient(90deg, var(--f-gold-lo), var(--f-gold-hi), var(--f-gold-lo)); opacity: .7; }
.modal {
  border: 1.5px solid var(--f-edge);
  border-radius: 20px;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, .28), inset 0 0 0 5px var(--f-edge-soft), 0 20px 50px rgba(0, 0, 0, .65), 0 0 40px rgba(143, 216, 255, .08);
  animation: modalIn .22s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes modalIn { from { transform: scale(.92) translateY(8px); opacity: 0; } }
.unit-bar {
  border: 1.5px solid var(--f-edge-soft);
  border-left: 5px solid var(--c, var(--f-gold));
  border-radius: 18px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* หัวหน้าต่าง: แถบทองจาง ๆ เส้นประดับมีอัญมณีกลาง */
.panel header {
  background: linear-gradient(180deg, rgba(236, 200, 115, .13), rgba(236, 200, 115, 0));
  min-height: 54px;
  padding: 4px 10px 8px 18px;
  border-bottom: 0;
}
.panel header::after {
  display: block;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--f-gold-lo) 18%, var(--f-gold-hi) 50%, var(--f-gold-lo) 82%, transparent);
}
.panel header::before { content: ''; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; margin-left: -4px; transform: rotate(45deg); background: linear-gradient(135deg, var(--f-gold-hi), var(--f-gold-lo)); box-shadow: 0 0 8px rgba(255, 224, 138, .7); z-index: 1; }
.panel header h2, .panel-title h2 { color: var(--f-gold-hi); font-size: 20px; letter-spacing: .01em; text-shadow: 0 2px 6px rgba(0, 0, 0, .7), 0 0 14px rgba(236, 200, 115, .25); }
.panel header small, .panel-title small { color: var(--f-muted); text-shadow: none; }
.panel-body { padding: 12px 14px 18px; }

/* หัวข้อย่อย: เส้นทองแทนภาพ */
.section-title { background: none; padding-bottom: 0; }
.panel .section-title { color: var(--f-gold); font-size: 14.5px; letter-spacing: .02em; }
.panel .section-title::before { content: '◆'; font-size: 9px; color: var(--f-gold); text-shadow: 0 0 6px rgba(236, 200, 115, .8); }
.panel .section-title::after { background: linear-gradient(90deg, var(--f-edge), transparent); }

/* ปุ่มทั่วไป: กระจกเข้ม ขอบทองบาง */
.btn, .btn-mini, .btn-end.ghost {
  border: 1px solid var(--f-edge-soft);
  border-image: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #332d4c, #1d192f);
  color: var(--f-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 2px 7px rgba(0, 0, 0, .4);
}
.btn-mini { padding: 4px 12px; }
.btn-end.ghost, .btn-task { border-width: 1px; padding: 5px 14px; }
@media (hover: hover) {
  .btn:hover:not(:disabled), .btn-mini:hover:not(:disabled), .btn-end:hover, .build-row:hover:not(:disabled), .log-row:hover { border-color: var(--f-gold); filter: brightness(1.12); }
}
/* ปุ่มหลัก: ทองเรืองแสง มีแสงวิ่งผ่านเป็นระยะ ชวนกด */
.btn.primary, .btn-task, .btn-mini.primary {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--f-gold-hi);
  border-image: none;
  background: linear-gradient(180deg, #ffe9a6, #edbf5a 46%, #b88629);
  color: #2a1903;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 4px 14px rgba(236, 180, 80, .32), inset 0 1px 0 rgba(255, 255, 255, .75);
}
.btn.primary::after, .btn-task::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-18deg); animation: shine 4.2s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 130%; } }
/* ปุ่มอันตราย */
.btn-mini.danger, .btn.danger, .btn-end:not(.ghost) {
  border: 1px solid #ff9e88;
  border-image: none;
  background: linear-gradient(180deg, #e0705a, #b23c2b 55%, #7e2519);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 4px 12px rgba(200, 60, 40, .3), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn-mini:disabled, .btn:disabled { opacity: .45; filter: grayscale(.7); box-shadow: none; }
.btn-mini:disabled::after, .btn:disabled::after { display: none; }

/* แท็บ: เม็ดยา ช่องที่เลือกเป็นทอง */
.tabs { background: rgba(0, 0, 0, .35); border: 1px solid var(--f-edge-soft); border-radius: 14px; }
.tab { border-radius: 10px; color: var(--f-muted); font-weight: 700; }
.tab.on { border: 0; border-image: none; background: linear-gradient(180deg, #ffe39a, #d9a640); color: #2a1903; box-shadow: 0 2px 8px rgba(236, 180, 80, .35), inset 0 1px 0 rgba(255, 255, 255, .6); }

/* ป้ายทรัพยากรด้านบน: เม็ดยาโปร่ง อ่านง่าย */
.chip {
  border: 1px solid var(--f-edge-soft);
  border-image: none;
  border-radius: 999px;
  padding: 3px 11px 3px 7px;
  background: linear-gradient(180deg, rgba(44, 38, 66, .9), rgba(18, 15, 29, .9));
  color: var(--f-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.chip.strong { color: var(--f-gold-hi); }
.chip small { color: #9fe08a; }
.chip.minus { border-color: #ff8a73; }

/* แถวในรายการ */
.build-row, .king-row, .quest, .item-row, .log-row {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015));
}
.build-row.on { border-color: var(--f-gold); background: linear-gradient(180deg, rgba(236, 200, 115, .22), rgba(236, 200, 115, .05)); box-shadow: 0 0 14px rgba(236, 200, 115, .18); }
.log-row.good { border-left: 4px solid var(--good); }
.log-row.bad { border-left: 4px solid var(--danger); }
.stat { border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .05); }

/* ปุ่มปิด: วงกลมขอบทอง เห็นชัดว่ากดปิดได้ */
.win-x, .btn-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--f-edge);
  background: radial-gradient(circle at 35% 30%, #3b345a, #17132a);
  color: var(--f-gold-hi);
  font: 700 15px/1 var(--sans);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
.btn-close { margin-left: auto; width: 40px; height: 40px; }
.btn-close .i { display: inline-grid; width: 17px; height: 17px; }
.win-x:active, .btn-close:active { transform: scale(.92); background: radial-gradient(circle at 35% 30%, #5a4d86, #241d40); }

/* ข้อความแจ้งเตือน */
#toast {
  border: 1.5px solid var(--f-edge);
  border-image: none;
  border-radius: 14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #2f2a48, #17142a);
  color: var(--f-text);
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55), 0 0 18px rgba(143, 216, 255, .12);
}
#toast.bad { border-color: #ff9e88; border-image: none; background: linear-gradient(180deg, #a83a2a, #6e2016); color: #fff; }

/* แผนที่ย่อ */
#miniHost { border: 2px solid var(--f-edge); border-image: none; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 3px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .5); }

/* ปุ่มกลมด้านขวา: วงแสงเมื่อกด ป้ายแจ้งเตือนสดใส */
.hud-menu button { transition: transform .12s, filter .15s; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .55)); }
.hud-menu button:active { transform: scale(.9); filter: drop-shadow(0 0 10px rgba(255, 224, 138, .8)); }
.hud-menu i, .hud-menu i.bad { border: 1.5px solid #1a1528; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }

/* ช่องพิมพ์ */
.input { border-radius: 12px; border: 1px solid var(--f-edge-soft); background: rgba(0, 0, 0, .35); color: var(--f-text); }
.input:focus { outline: none; border-color: var(--f-gold); box-shadow: 0 0 0 3px rgba(236, 200, 115, .2); }

/* แชทกับประกาศ ให้เข้าโทนเดียวกัน */
.chat-msg { border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .07); }
.chat-msg.mine { border-radius: 14px 14px 4px 14px; background: linear-gradient(180deg, rgba(236, 200, 115, .22), rgba(236, 200, 115, .1)); border-color: var(--f-edge); }
.reload-banner { border-radius: 999px; background: linear-gradient(180deg, #2f2a48, #17142a); border-color: var(--f-gold); }
/* หน้าต่างต้องอยู่เหนือปุ่มปิดของแถบยูนิตที่อยู่ข้างหลัง */
.panel-back { z-index: 5; }

/* คลังหลวง */
.vault-box { margin: 10px 0 4px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--f-edge-soft); background: rgba(0, 0, 0, .25); display: grid; gap: 7px; }
.vault-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.vault-head b { color: var(--f-gold-hi); }
.vault-head small { color: var(--f-muted); font-variant-numeric: tabular-nums; }
.vault-bar { display: block; height: 8px; }
.vault-box .note.warn { color: #ffb45a; margin: 0; }

/* ---------- เป้าหมายระยะยาว: ยุคสมัย เกียรติยศ ทางแยก ศึกอสูร (2026-11-08) ---------- */
.era-head { font-size: 12.5px; font-weight: 700; text-align: center; padding: 5px 6px; border-radius: 8px; border: 1px dashed var(--f-edge-soft); color: var(--f-muted); }
.era-head.open { border-style: solid; border-color: var(--f-edge); color: var(--f-gold-hi); background: rgba(236, 200, 115, .08); }
.tech.era { border-color: rgba(143, 216, 255, .45); }
.tech.era:not(:disabled):not(.done) { box-shadow: 0 0 0 1px rgba(143, 216, 255, .25) inset; }
.feat { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin: 6px 0; border-radius: 10px; border: 1px solid var(--f-edge-soft); background: rgba(255, 255, 255, .03); }
.feat .ico { font-size: 22px; line-height: 1; filter: grayscale(.85); opacity: .7; }
.feat .txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.feat .txt small { color: var(--f-muted); }
.feat progress { width: 100%; height: 6px; }
.feat.done { border-color: var(--f-edge); background: rgba(236, 200, 115, .08); }
.feat.done .ico { filter: none; opacity: 1; }
.feat.rare b { color: var(--f-arcane); }
.crowns { color: var(--f-gold); letter-spacing: -2px; }
.btn-task.horde { background: linear-gradient(180deg, #e0573e, #9b2c20); color: #fff; }
.btn-task.cross { background: linear-gradient(180deg, #8fd8ff, #4d8fc2); color: #10233a; }
.crossroads { margin-bottom: 12px; padding: 8px; border-radius: 12px; border: 1px solid rgba(143, 216, 255, .5); background: rgba(143, 216, 255, .06); }
.game-card.type-choice { border-color: rgba(143, 216, 255, .7); }
.game-card.type-choice .price { background: rgba(143, 216, 255, .2); color: var(--f-text); }

/* ---------- หน้าเข้าเกม: ทางกลับเข้าอาณาจักรอยู่บนสุด (2026-11-08) ---------- */
.return-box { display: flex; flex-direction: column; gap: 8px; margin: 4px auto 18px; padding: 14px; max-width: 560px; border-radius: 14px; border: 1px solid var(--f-edge); background: rgba(236, 200, 115, .07); }
.return-box .btn.big { font-size: 18px; padding: 14px 18px; }
.return-box .code-row { display: flex; gap: 8px; }
.return-box .code-row .input { flex: 1; min-width: 0; }
.btn-link { background: none; border: 0; color: var(--f-muted); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }
.return-box .code-row .btn { flex: 0 0 auto; width: auto; padding-left: 22px; padding-right: 22px; }
.gfx-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
