/* ============================================================
   เส้นทางอิสระ — style.css  (Pixel Art Theme)
   ============================================================ */

:root {
  --bg-deep:    #1a1228;
  --bg-mid:     #2a2040;
  --panel:      #322a4a;
  --panel-2:    #3d3458;
  --ink:        #f4f0ff;
  --ink-dim:    #b8aed6;
  --gold:       #f4c542;
  --green:      #4caf50;
  --green-2:    #2ecc71;
  --red:        #e74c3c;
  --blue:       #3aa0ff;
  --purple:     #8e6fd6;
  --border:     #0c0818;
  --shadow:     #0c0818;
  --pixel-font: 'Press Start 2P', monospace;
  --thai-font:  'Sarabun', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--thai-font);
  background: var(--bg-deep);
  color: var(--ink);
  image-rendering: pixelated;
}

body {
  background:
    radial-gradient(circle at 20% 10%, #2c2150 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, #241a3c 0%, transparent 50%),
    var(--bg-deep);
}

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.screen.active { display: flex; }
#screen-game.active { display: block; }

/* ---------- Pixel panel / buttons ---------- */
.pixel-panel {
  background: var(--panel);
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 var(--shadow);
  border-radius: 2px;
  padding: 28px;
}

.pixel-btn {
  font-family: var(--thai-font);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel-2);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 12px 18px;
  cursor: pointer;
  transition: transform .05s, box-shadow .05s;
  border-radius: 2px;
}
.pixel-btn:hover { filter: brightness(1.12); }
.pixel-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--shadow); }
.pixel-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: 4px 4px 0 var(--shadow); }
.pixel-btn.primary { background: var(--green); color: #fff; }
.pixel-btn.primary:hover { background: var(--green-2); }
.pixel-btn.small { font-size: 13px; padding: 8px 12px; box-shadow: 3px 3px 0 var(--shadow); }
.pixel-btn.tiny  { font-size: 12px; padding: 6px 10px; box-shadow: 2px 2px 0 var(--shadow); }
.pixel-btn.big   { font-size: 18px; padding: 16px 26px; }

/* ---------- Home ---------- */
.game-title {
  font-family: var(--pixel-font);
  font-size: 30px;
  color: var(--gold);
  text-shadow: 4px 4px 0 var(--border);
  text-align: center;
  line-height: 1.4;
  margin-bottom: 10px;
  animation: titlePulse 2.4s ease-in-out infinite;
}
@keyframes titlePulse {
  0%, 100% { text-shadow: 4px 4px 0 var(--border), 0 0 8px rgba(244,197,66,.0); transform: translateY(0); }
  50%      { text-shadow: 4px 4px 0 var(--border), 0 0 22px rgba(244,197,66,.7); transform: translateY(-3px); }
}
.game-subtitle { text-align: center; color: var(--ink-dim); margin-bottom: 14px; }

/* ---- ลูกเล่นหน้าแรก ---- */
#screen-home { overflow: hidden; }
.home-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.float-icon {
  position: absolute; bottom: -60px; font-size: 34px; opacity: .35;
  animation-name: floatUp; animation-timing-function: linear; animation-iteration-count: infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: .4; }
  90%  { opacity: .4; }
  100% { transform: translateY(-108vh) rotate(40deg); opacity: 0; }
}
.home-box { width: min(460px, 94vw); position: relative; z-index: 1; }
.home-coin {
  font-size: 46px; text-align: center; line-height: 1;
  animation: coinBob 1.8s ease-in-out infinite; margin-bottom: 4px;
}
@keyframes coinBob { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-8px) rotate(8deg); } }

.home-field { margin-bottom: 18px; }
.home-field label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--ink-dim); }

input, select {
  width: 100%;
  font-family: var(--thai-font);
  font-size: 16px;
  padding: 12px;
  background: var(--bg-mid);
  color: var(--ink);
  border: 3px solid var(--border);
  border-radius: 2px;
  outline: none;
}
input:focus, select:focus { border-color: var(--gold); }

.home-actions { display: flex; flex-direction: column; gap: 14px; }
.home-join { display: flex; gap: 10px; }
.home-join input { flex: 1; }
.error-text { color: var(--red); text-align: center; margin-top: 14px; min-height: 20px; font-weight: 600; }

/* ---------- Lobby ---------- */
.lobby-box { width: min(760px, 96vw); }
.lobby-box h2 { font-family: var(--pixel-font); font-size: 18px; color: var(--gold); margin-bottom: 18px; }
.room-code-display {
  font-size: 20px; font-weight: 800; margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
}
#lobby-code { font-family: var(--pixel-font); color: var(--gold); letter-spacing: 4px; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.lobby-players h3, .lobby-settings h3 { margin-bottom: 12px; color: var(--ink-dim); font-size: 15px; }
#player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
#player-list li {
  background: var(--bg-mid); border: 2px solid var(--border);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-radius: 2px;
}
.player-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); flex: none; }
.badge-host { margin-left: auto; font-size: 11px; background: var(--gold); color: var(--border); padding: 3px 7px; border-radius: 2px; font-weight: 800; }
.setting-row { margin-bottom: 16px; }
.setting-row label { display: block; margin-bottom: 6px; color: var(--ink-dim); }
.hint { color: var(--ink-dim); font-size: 13px; margin-top: 10px; }

/* ---------- Career select ---------- */
.career-box { width: min(960px, 97vw); max-height: 92vh; overflow-y: auto; }
.career-box h2 { font-family: var(--pixel-font); font-size: 16px; color: var(--gold); margin-bottom: 18px; }
.career-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.career-card {
  background: var(--bg-mid); border: 3px solid var(--border);
  padding: 12px; cursor: pointer; border-radius: 2px;
  box-shadow: 3px 3px 0 var(--shadow); transition: transform .05s;
  text-align: center;
}
.career-card:hover { transform: translateY(-3px); filter: brightness(1.1); }
.career-card.taken { opacity: .4; cursor: not-allowed; filter: grayscale(1); }
.career-card.selected { border-color: var(--gold); box-shadow: 3px 3px 0 var(--gold); }
.career-portrait {
  width: 84px; height: 84px; margin: 0 auto 8px; border: 3px solid var(--border);
  background: var(--panel-2); image-rendering: pixelated; object-fit: cover; display: block;
}
.career-card h4 { font-size: 16px; margin-bottom: 4px; }
.career-stat { font-size: 12px; color: var(--ink-dim); }
.career-stat b { color: var(--green-2); }

/* ---------- Game canvas ---------- */
#board-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- Announce bar ---------- */
.announce-bar {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-bottom: 3px solid var(--border);
  padding: 10px 16px; text-align: center; font-weight: 800;
  z-index: 30; text-shadow: 1px 1px 0 var(--border);
}

.turn-banner {
  position: absolute; top: 52px; left: 12px; z-index: 30;
  background: var(--panel); border: 3px solid var(--border);
  box-shadow: 3px 3px 0 var(--shadow); padding: 8px 14px; font-weight: 800;
  border-radius: 2px; max-width: 60vw;
}
#turn-label .me { color: var(--gold); }

/* ---------- HUD buttons ---------- */
.hud-buttons { position: absolute; top: 52px; right: 12px; z-index: 80; display: flex; gap: 8px; }

/* ---------- Control bar ---------- */
.control-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; align-items: center; gap: 14px;
  background: rgba(26,18,40,.7); padding: 12px 16px; border: 3px solid var(--border);
  border-radius: 4px; box-shadow: 4px 4px 0 var(--shadow);
}
.dice-result { font-family: var(--pixel-font); font-size: 20px; color: var(--gold); min-width: 32px; }

/* ---------- Dice overlay ---------- */
.dice-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12,8,24,.45); pointer-events: none;
}
#dice-canvas { width: 320px; height: 320px; }

/* ---------- Side panels ---------- */
.side-panel {
  position: absolute; top: 92px; bottom: 90px; width: 340px; z-index: 82;
  background: var(--panel); border: 3px solid var(--border);
  box-shadow: 6px 6px 0 var(--shadow); display: flex; flex-direction: column;
  border-radius: 2px;
}
.side-panel.right { right: 12px; }
.side-panel.left  { left: 12px; }
.side-panel.chat  { right: 12px; bottom: 90px; top: auto; height: 380px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 3px solid var(--border); background: var(--panel-2);
}
.panel-head h3 { font-size: 16px; }
.panel-close { background: none; border: none; color: var(--ink); font-size: 18px; cursor: pointer; }
.panel-close:hover { color: var(--red); }
.panel-body { padding: 14px; overflow-y: auto; flex: 1; }

/* ---------- Finance sheet ---------- */
.fin-section { margin-bottom: 18px; }
.fin-section h4 {
  font-size: 14px; color: var(--gold); border-bottom: 2px solid var(--border);
  padding-bottom: 6px; margin-bottom: 8px; text-transform: uppercase;
}
.fin-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.fin-row .lbl { color: var(--ink-dim); }
.fin-row .val { font-weight: 700; }
.fin-row.total { border-top: 2px dashed var(--border); margin-top: 6px; padding-top: 8px; font-size: 15px; }
.pos { color: var(--green-2); }
.neg { color: var(--red); }
.fin-cashflow {
  background: var(--bg-mid); border: 3px solid var(--border); padding: 12px;
  text-align: center; margin: 10px 0; border-radius: 2px;
}
.fin-cashflow .big-num { font-family: var(--pixel-font); font-size: 18px; }
.asset-item, .liab-item {
  background: var(--bg-mid); border: 2px solid var(--border);
  padding: 8px 10px; margin-bottom: 6px; font-size: 13px; border-radius: 2px;
}
.asset-item .a-name { font-weight: 700; }
.asset-item .a-meta { color: var(--ink-dim); font-size: 12px; }
.liab-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.liab-item .liab-name { flex: 1 1 100%; }
.liab-pay { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.liab-pay .pay-amt { width: 110px; padding: 5px 8px; font-size: 13px; }
.liab-item .pay-debt { flex: none; white-space: nowrap; }
.freedom-meter {
  height: 18px; background: var(--bg-deep); border: 2px solid var(--border);
  border-radius: 2px; overflow: hidden; margin-top: 6px;
}
.freedom-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); width: 0; transition: width .4s; }

/* ---------- Log ---------- */
.log-entry { font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--bg-mid); }
.log-entry .log-time { color: var(--ink-dim); font-size: 11px; margin-right: 6px; }
.log-entry.money-pos { border-left: 3px solid var(--green-2); }
.log-entry.money-neg { border-left: 3px solid var(--red); }
.log-entry.event     { border-left: 3px solid var(--purple); }

.mini-log {
  position: absolute; bottom: 90px; left: 12px; z-index: 25; width: 320px;
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.mini-log .toast {
  background: rgba(26,18,40,.85); border: 2px solid var(--border);
  padding: 6px 10px; font-size: 13px; border-radius: 2px;
  animation: fadein .2s; box-shadow: 2px 2px 0 var(--shadow);
}
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ---------- Chat ---------- */
.chat-messages { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: 13px; }
.chat-msg .c-name { font-weight: 800; color: var(--blue); margin-right: 5px; }
.chat-msg.system { color: var(--gold); font-style: italic; }
.chat-input-row { display: flex; gap: 6px; padding: 8px; border-top: 2px solid var(--border); }
.chat-input-row input { flex: 1; }

/* ---------- Modal ---------- */
/* modal-root ไม่บล็อกคลิก (เปิดแผงอื่นระหว่างมี modal ได้) — เฉพาะการ์ดเท่านั้นที่กดได้ */
.modal-root { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12,8,24,.55); }
.modal-card { position: relative; width: min(460px, 94vw); max-height: 90vh; overflow-y: auto; z-index: 1; pointer-events: auto; }
.modal-card h3 { font-size: 18px; color: var(--gold); margin-bottom: 6px; }
.modal-card .card-tag { display: inline-block; font-size: 11px; padding: 3px 8px; border: 2px solid var(--border); border-radius: 2px; margin-bottom: 12px; font-weight: 800; }
.tag-opportunity { background: var(--green); }
.tag-expense { background: var(--red); }
.tag-market { background: var(--blue); }
.tag-life { background: var(--purple); }
.tag-luck { background: var(--gold); color: var(--border); }
.tag-bigdeal { background: #c0392b; }
.modal-card .card-text { color: var(--ink-dim); margin-bottom: 14px; line-height: 1.6; }
.modal-card .card-figures {
  background: var(--bg-mid); border: 2px solid var(--border); padding: 12px;
  border-radius: 2px; margin-bottom: 16px;
}
.modal-card .card-figures .fin-row { font-size: 14px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions .pixel-btn { flex: 1; min-width: 120px; }
.modal-field { margin-bottom: 12px; }
.modal-field label { display: block; margin-bottom: 5px; color: var(--ink-dim); font-size: 13px; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .career-grid { grid-template-columns: repeat(2, 1fr); }
  .side-panel { width: 92vw; left: 4vw !important; right: 4vw !important; }
  .game-title { font-size: 20px; }
}

/* ============================================================
   REF THEME — ลุคหน้าเล่น "กระดานบนโต๊ะทำงาน + แผงน่ารัก"
   ============================================================ */

/* พื้นหลัง: โต๊ะทำงาน + วิวเมือง (ใส่ assets/bg/desk-bg.png เพื่อความสมจริง,
   ถ้าไม่มีไฟล์จะใช้ gradient ออฟฟิศแทนอัตโนมัติ) */
#screen-game {
  background:
    radial-gradient(ellipse 82% 72% at 50% 56%, rgba(8,6,20,0) 32%, rgba(8,6,20,0.42) 74%, rgba(8,6,20,0.72) 100%),
    url('assets/bg/desk-bg.png') center/cover no-repeat,
    linear-gradient(180deg,#3f5666 0%,#4b5d66 22%,#6a5a44 48%,#4f3d28 74%,#352818 100%);
}
#board-canvas { background: transparent; }

/* การ์ดข้อมูลห้อง (บนซ้าย) */
.room-card {
  position: absolute; top: 50px; left: 12px; z-index: 30; width: 210px;
  background: #fff; border: 3px solid #4a3a72; border-radius: 14px; overflow: hidden;
  box-shadow: 0 6px 0 rgba(74,58,114,.35);
}
.room-card-head {
  background: linear-gradient(90deg,#9b6fe0,#6f8fe0); color: #fff; font-weight: 800;
  padding: 8px 12px; font-size: 15px; text-shadow: 1px 1px 0 rgba(0,0,0,.2);
}
.room-card-body { padding: 8px 12px; color: #3a2e5e; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.room-card-body b { color: #7a3ad0; }

.announce-bar { background: linear-gradient(90deg,#9b6fe0,#6f8fe0); border-bottom: none; box-shadow: 0 3px 8px rgba(0,0,0,.2); }
#turn-banner { display: none; }

/* แผงข้าง: ขาว-ม่วง มีประกายดาว */
#screen-game .side-panel {
  background: #fbf8ff; border: 3px solid #4a3a72; border-radius: 16px;
  box-shadow: 0 8px 0 rgba(74,58,114,.3); color: #33285a;
}
#screen-game .panel-head {
  background: linear-gradient(90deg,#9b6fe0,#6f8fe0); border-bottom: none; color: #fff;
  border-radius: 13px 13px 0 0;
}
#screen-game .panel-head h3::before { content: '✨ '; }
#screen-game .panel-head h3::after  { content: ' ✨'; }
#screen-game .panel-close { color: #fff; }

#screen-game .fin-section h4 { color: #7a3ad0; border-bottom: 2px solid #e3d8f5; }
#screen-game .fin-row .lbl { color: #6a5f86; }
#screen-game .fin-row .val { color: #33285a; }
#screen-game .fin-row.total { border-top: 2px dashed #c9bce6; }
#screen-game .fin-cashflow { background: #f1e9ff; border: 2px solid #c9bce6; }
#screen-game .asset-item, #screen-game .liab-item { background: #f4eefc; border: 2px solid #e0d4f3; color: #33285a; }
#screen-game .asset-item .a-meta { color: #6a5f86; }
#screen-game .hint { color: #8a7faa; }
#screen-game .freedom-meter { background: #e3d8f5; border: 2px solid #c9bce6; }
#screen-game .modal-field label { color: #6a5f86; }
#screen-game input, #screen-game select { background: #fff; color: #33285a; border: 2px solid #c9bce6; }

/* ===== แผงการเงิน ดีไซน์ใหม่ (การ์ดเป็นหมวด อ่านง่าย) ===== */
.fin-hero {
  background: linear-gradient(135deg, #6f4fc7, #4f6fd0); color: #fff;
  border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: 0 4px 0 rgba(74,58,114,.35);
}
.fin-hero-main { display: flex; flex-direction: column; }
.fin-hero-label { font-size: 12px; opacity: .9; }
.fin-hero-num { font-family: var(--pixel-font); font-size: 22px; line-height: 1.5; }
.fin-hero-num.pos { color: #b6ffce; }
.fin-hero-num.neg { color: #ffc1c1; }
.fin-hero-cash { display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.25); font-size: 14px; }
.fin-hero-cash b { font-size: 16px; }
.fin-hero-cash .pos { color: #b6ffce; } .fin-hero-cash .neg { color: #ffc1c1; }

.fin-card {
  background: #fff; border: 2px solid #e6ddf6; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; box-shadow: 0 2px 0 rgba(74,58,114,.12);
}
.fin-card.accent-pos { border-left: 5px solid #2ecc71; }
.fin-card.accent-neg { border-left: 5px solid #e74c3c; }
.fin-card-h {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; color: #4a3a72; font-size: 15px; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 2px solid #f0eafb;
}
.fin-card-sum { font-size: 15px; }
.fin-card-sum.pos { color: #27ae60; } .fin-card-sum.neg { color: #e74c3c; }
.fin-card .fin-row { font-size: 14px; padding: 3px 0; }
.fin-card .fin-row .lbl { color: #6a5f86; } .fin-card .fin-row .val { color: #33285a; font-weight: 700; }

.freedom-meter.big { height: 22px; border-radius: 11px; }
.freedom-meter.big .freedom-fill { border-radius: 11px; }
.freedom-sub { font-size: 12px; color: #8a7faa; text-align: center; margin-top: 6px; }

#screen-game .asset-item, #screen-game .liab-item {
  background: #faf7ff; border: 1px solid #e6ddf6; border-radius: 8px; padding: 8px 10px;
}
.asset-item .a-name { font-weight: 700; color: #33285a; }
.asset-item .a-meta b { color: #33285a; }

#screen-game .log-entry { color: #33285a; border-bottom: 1px solid #efe8fb; }
#screen-game .log-entry .log-time { color: #a99fc6; }

#screen-game .pixel-btn {
  background: #fff; color: #5a3aa0; border: 3px solid #4a3a72; border-radius: 12px;
  box-shadow: 0 4px 0 rgba(74,58,114,.35); font-weight: 800;
}
#screen-game .pixel-btn.primary { background: linear-gradient(180deg,#7be08a,#3cc46a); color: #fff; border-color: #2a7a45; }
#screen-game .pixel-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(74,58,114,.35); }
#screen-game .pixel-btn:disabled { opacity: .5; }

/* แถบควบคุมล่าง: บาร์ม่วงเต็มความกว้าง */
#screen-game .control-bar {
  left: 0; right: 0; bottom: 0; transform: none; width: 100%;
  background: linear-gradient(90deg,#7b53c6,#5a6fd0); border: none; border-top: 3px solid #4a3a72;
  border-radius: 0; box-shadow: 0 -3px 12px rgba(0,0,0,.25);
  justify-content: center; padding: 12px; flex-wrap: wrap;
}
.turn-foot { color: #fff; font-weight: 800; margin-right: auto; padding-left: 8px; text-shadow: 1px 1px 0 rgba(0,0,0,.25); }
.turn-foot .me { color: #ffe27a; }
#screen-game .dice-result { color: #ffe27a; }

#screen-game .mini-log { bottom: 80px; }
#screen-game .mini-log .toast { background: rgba(255,255,255,.94); color: #33285a; border: 2px solid #4a3a72; box-shadow: 0 2px 0 rgba(74,58,114,.3); }

#screen-game .chat-msg { color: #33285a; }
#screen-game .chat-msg .c-name { color: #7a3ad0; }
#screen-game .chat-msg.system { color: #a06a00; }
#screen-game .side-panel.chat { bottom: 80px; }

/* ---------- reveal: โชว์ผู้เล่น+อาชีพ ---------- */
.reveal-box { width: min(920px, 96vw); max-height: 92vh; overflow-y: auto; text-align: center; }
.reveal-box h2 { font-family: var(--pixel-font); font-size: 16px; color: var(--gold); margin-bottom: 8px; }
.reveal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
#btn-begin { min-width: 220px; margin-top: 8px; }
@media (max-width: 760px) { .reveal-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- career tag ในแถบเทิร์น ---------- */
.career-tag {
  display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; margin-left: 4px;
  background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.35); border-radius: 8px;
}

/* ---------- players panel (สถานะผู้เล่นทุกคน) ---------- */
.player-status {
  background: #fff; border: 2px solid #e6ddf6; border-radius: 12px;
  padding: 12px; margin-bottom: 12px; box-shadow: 0 2px 0 rgba(74,58,114,.12);
}
.player-status.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244,197,66,.45); }
.ps-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 16px; color: #33285a; }
.ps-head .player-dot { width: 16px; height: 16px; }
.ps-loop {
  margin-left: auto; font-size: 11px; color: #fff; font-weight: 800;
  background: linear-gradient(90deg,#9b6fe0,#6f8fe0); padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.ps-row { display: flex; justify-content: space-between; font-size: 13px; color: #6a5f86; padding: 3px 0; border-top: 1px solid #f3eefc; }
.ps-row:first-of-type { border-top: none; }
.ps-row span:last-child { color: #33285a; font-weight: 800; }
.ps-row .pos { color: #27ae60; } .ps-row .neg { color: #e74c3c; }
.player-status .freedom-meter { margin-top: 8px; height: 14px; border-radius: 7px; }
.player-status .freedom-meter .freedom-fill { border-radius: 7px; }

/* ---------- ตลาดหุ้น (การ์ดอ่านง่าย — ใช้ทั้ง modal และแผงดูราคา) ---------- */
.stk-list { display: flex; flex-direction: column; gap: 10px; max-height: 56vh; overflow-y: auto; margin-bottom: 12px; }
.stk-card { background: #fff; border: 2px solid #e6ddf6; border-radius: 12px; padding: 10px 12px; box-shadow: 0 2px 0 rgba(74,58,114,.12); }
.stk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.stk-id { display: flex; flex-direction: column; }
.stk-sym { font-weight: 800; color: #33285a; font-size: 18px; line-height: 1.1; }
.stk-sec { font-size: 11px; color: #8a7faa; font-weight: 600; }
.stk-price { text-align: right; }
.stk-now { display: block; font-weight: 800; color: #33285a; font-size: 17px; }
.stk-chg { font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 999px; display: inline-block; margin-top: 2px; }
.stk-chg.up { color: #1e8c4e; background: #e3f9ec; }
.stk-chg.down { color: #c0392b; background: #fdeaea; }
.stk-mid { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.stk-spark { flex: 1; background: #faf7ff; border: 1px solid #ece4fb; border-radius: 8px; padding: 2px; }
.stk-spark .spark { width: 100%; height: 40px; display: block; }
.stk-own { flex: none; width: 92px; text-align: right; font-size: 12px; color: #6a5f86; line-height: 1.3; }
.stk-own b { color: #7a3ad0; font-size: 14px; }
.stk-own.dim { color: #b3a9cf; }
.stk-trade { display: flex; gap: 6px; margin-top: 10px; }
.stk-trade .stock-qty { width: 70px; padding: 6px; font-size: 14px; }
.stk-trade .stock-buy, .stk-trade .stock-sell { flex: 1; padding: 8px; font-size: 14px; }
.stk-trade .stock-buy { background: linear-gradient(180deg,#7be08a,#3cc46a); color: #fff; border-color: #2a7a45; }
.stk-trade .stock-sell { background: linear-gradient(180deg,#ff9b8a,#e8604a); color: #fff; border-color: #b83b28; }
.a-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- สรุปอันดับ (หน้าจบเกม) ---------- */
.rank-list { margin: 10px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.rank-row { font-size: 16px; padding: 8px 12px; background: #f4eefc; border: 2px solid #e0d4f3; border-radius: 10px; color: #33285a; }
.rank-row .hint { color: #8a7faa; }

/* ============================================================
   PIXEL ART OVERRIDE (8–16 bit) — ทำให้ UI ในเกมเป็นบล็อก ขอบหนา
   เงา offset ไม่มีมุมโค้ง สีแบน ๆ (ข้อความไทยคงฟอนต์ Sarabun เพื่ออ่านง่าย)
   ============================================================ */
:root { --px: #0c0818; }

/* 1) ตัดมุมโค้งทั้งหมดในเกม + ภาพคมแบบพิกเซล */
#screen-game, #screen-reveal, #screen-career, #screen-lobby, .modal-root { image-rendering: pixelated; }
#screen-game *, #screen-reveal *, #screen-career *, #screen-lobby *, .modal-card * ,
.modal-card, .side-panel, .room-card, .career-card, .reveal-box, .lobby-box, .career-box {
  border-radius: 0 !important;
}

/* 2) แผง/การ์ด/โมดัล: ขอบหนา 3px + เงา offset แข็ง (ไม่เบลอ) */
#screen-game .side-panel, .modal-card, .room-card, .career-card,
.fin-card, .fin-hero, .stk-card, .player-status, .rank-row, .asset-item, .liab-item {
  border: 3px solid var(--px) !important;
  box-shadow: 4px 4px 0 var(--px) !important;
}
.asset-item, .liab-item, .stk-spark { box-shadow: 2px 2px 0 var(--px) !important; }

/* 3) ฆ่า gradient → สีแบน */
.announce-bar, #screen-game .control-bar, #screen-game .panel-head,
.fin-hero, .ps-loop, .room-card-head, .career-tag,
#screen-game .pixel-btn.primary, .stk-trade .stock-buy, .stk-trade .stock-sell,
.stk-chg, .freedom-fill, .home-coin { background-image: none !important; }

.announce-bar { background: #7a4fd0 !important; border-bottom: 3px solid var(--px) !important; }
#screen-game .control-bar { background: #5a3aa0 !important; border-top: 3px solid var(--px) !important; }
#screen-game .panel-head, .room-card-head { background: #7a4fd0 !important; }
.fin-hero { background: #4a2f8f !important; }
.ps-loop, .career-tag { background: #7a4fd0 !important; border: 2px solid var(--px) !important; }
.fin-card.accent-pos { border-left: 6px solid #2ecc71 !important; }
.fin-card.accent-neg { border-left: 6px solid #e74c3c !important; }

/* 4) ปุ่ม: บล็อก ขอบหนา เงา offset กดแล้วยุบ */
#screen-game .pixel-btn, .modal-card .pixel-btn, #screen-reveal .pixel-btn, #screen-career .pixel-btn {
  border: 3px solid var(--px) !important; box-shadow: 4px 4px 0 var(--px) !important;
}
#screen-game .pixel-btn.primary { background: #3cc46a !important; color: #fff; }
.stk-trade .stock-buy { background: #3cc46a !important; color: #fff; border-color: var(--px) !important; }
.stk-trade .stock-sell { background: #e05a4a !important; color: #fff; border-color: var(--px) !important; }
#screen-game .pixel-btn:active, .modal-card .pixel-btn:active { transform: translate(4px,4px); box-shadow: 0 0 0 var(--px) !important; }

/* 5) input/select: บล็อก ขอบหนา */
#screen-game input, #screen-game select, .modal-card input, .modal-card select {
  border: 3px solid var(--px) !important; box-shadow: inset 2px 2px 0 rgba(0,0,0,.12);
}

/* 6) แถบ progress = บล็อกพิกเซล (มีลาย step) */
.freedom-meter, .player-status .freedom-meter {
  border: 3px solid var(--px) !important; background: #d8c9f2 !important; image-rendering: pixelated;
}
.freedom-fill {
  background: repeating-linear-gradient(90deg,#3cc46a 0,#3cc46a 8px,#2ea85a 8px,#2ea85a 12px) !important;
}

/* 7) badge %หุ้น + เหรียญ: บล็อก */
.stk-chg.up { background: #d6f5e2 !important; color: #1e7a44; border: 2px solid var(--px); }
.stk-chg.down { background: #f8d7d2 !important; color: #b3382a; border: 2px solid var(--px); }
.stk-spark { border: 2px solid var(--px) !important; }

/* 8) หัวเรื่องในการ์ด/แผง = ตัวหนาบล็อก */
.fin-card-h, .panel-head h3, .stk-sym, .fin-hero-num { letter-spacing: .5px; }
