/* CryptoSeabed หน้าเกม: ทะเลกลางคืน + ทองเหลือง (สีจริง/ฟอนต์พิกเซลมาในแชท B) */
:root {
  --bg: #0b1a2a; --panel: #12283f; --panel2: #183552; --line: #2a4a6b;
  --text: #e8f1f8; --dim: #8fa7bd; --brass: #c8902e; --brass2: #f2c75c; --brass-dark: #7d5119;
  --good: #5fd38d; --warn: #f2b84b; --bad: #ff6b6b; --rare: #ffd84a;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body.busy { cursor: progress; }
a { color: var(--brass2); }
code { font: 12px ui-monospace, Consolas, monospace; background: #0003; padding: 1px 4px; border-radius: 3px; word-break: break-all; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.bad { color: var(--bad); }
[hidden] { display: none !important; }

button {
  font: inherit; color: #2a1a05; background: var(--brass); border: 1px solid var(--brass-dark); border-top-color: var(--brass2);
  border-radius: 4px; padding: 5px 10px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
button:hover:not(:disabled) { background: var(--brass2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--brass2); border-color: var(--line); }
button.ghost:hover:not(:disabled) { background: #fff1; }
button.hot { background: var(--brass2); }
button.small { padding: 2px 6px; font-size: 12px; }
button.big { font-size: 20px; padding: 12px 28px; }
button.icon { background: transparent; border: 0; font-size: 18px; padding: 2px 6px; }
.blink { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { box-shadow: 0 0 0 3px #ffd84a88; background: #ffe58a; } }
input, select { font: inherit; background: #0a1826; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; min-width: 0; }
input { width: 11em; }

/* แถบบน */
#top { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: #081421; border-bottom: 2px solid var(--brass-dark); flex-wrap: wrap; }
.brand { font-weight: 800; color: var(--brass2); letter-spacing: .5px; }
.tag { font-size: 10px; font-weight: 700; background: #ffffff1a; color: var(--warn); padding: 1px 5px; border-radius: 3px; vertical-align: middle; }
.tag:empty { display: none; }
.tag.new { color: var(--good); }
#bar { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip { display: flex; align-items: baseline; gap: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.chip .lbl { font-size: 11px; color: var(--dim); }
.chip small { color: var(--dim); font-size: 11px; }
.chip button { padding: 1px 7px; font-size: 12px; margin-left: 4px; align-self: center; }
#c-energy.bad b { color: var(--bad); }
.corner { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* ภาพเกม */
main { max-width: 980px; margin: 0 auto; padding: 10px 12px 40px; }
#stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #06111c; border: 2px solid var(--brass-dark); border-radius: 6px; overflow: hidden; }
#scene { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#mini { display: block; width: 100%; aspect-ratio: 384 / 32; margin-top: 4px; image-rendering: pixelated; border: 2px solid var(--brass-dark); border-radius: 4px; cursor: pointer; touch-action: manipulation; background: #0b1a2a; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 16px; background: #04101c99; }
.overlay h1 { margin: 0; font-size: 34px; color: var(--brass2); text-shadow: 2px 2px 0 var(--brass-dark); }
#dive { margin: 8px 2px; display: grid; gap: 2px; }
.rare { color: var(--rare); font-weight: 700; }

#notices { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
#notices li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 5px; background: var(--panel); border-left: 4px solid var(--line); }
#notices li.warn { border-left-color: var(--warn); }
#notices li.good { border-left-color: var(--good); }
#notices li.info { border-left-color: #6fb8ff; }

#nav { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
#nav button { font-size: 16px; padding: 9px 22px; min-width: 64px; }

/* หน้าต่าง */
#modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 10px; z-index: 10; }
.win { width: 100%; max-width: 760px; max-height: 92vh; display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--brass); border-radius: 8px; }
.win > header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.win h2 { margin: 0; font-size: 18px; color: var(--brass2); }
#win-close { background: transparent; color: var(--text); border: 0; font-size: 18px; }
#win-body { overflow: auto; padding: 10px 14px 16px; }
section { margin-bottom: 14px; }
h3 { margin: 6px 0; font-size: 15px; color: var(--brass2); }
h4 { margin: 12px 0 4px; font-size: 14px; }
.row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.warn { color: var(--warn); }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { background: var(--panel2); color: var(--text); border-color: var(--line); }
.tabs button.on { background: var(--brass); color: #2a1a05; }
table { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 13px; }
th, td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; }
tr.mine td { background: #c8902e33; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--dim); }
ul.hist { padding-left: 18px; margin: 4px 0; }
.help ul { padding-left: 18px; }
.help p, .help li { margin: 3px 0; }

/* นักดำน้ำ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.diver { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gc, #888); border-radius: 5px; padding: 5px 8px; }
.diver.empty { opacity: .5; border-style: dashed; }
.dg { font-weight: 800; width: 26px; color: var(--gc, #888); }
.dinfo { flex: 1; min-width: 0; }
.dact { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.dact button { padding: 2px 7px; font-size: 12px; }
.skill { font-size: 11px; color: var(--brass2); }
.g1 { --gc: #9aa3ad; } .g2 { --gc: #7fbf6a; } .g3 { --gc: #4fa3e0; } .g4 { --gc: #a678e8; }
.g5 { --gc: #e8a23c; } .g6 { --gc: #e85c5c; } .g7 { --gc: #ff8a2a; } .g8 { --gc: #ffd84a; }
.reveal { margin: 8px 0; padding: 8px; background: #0003; border-radius: 6px; }
.hire-cv { display: block; width: 100%; max-width: 480px; aspect-ratio: 16 / 9; margin: 0 auto 8px; image-rendering: pixelated; border-radius: 4px; cursor: pointer; }
.big-hire { font-size: 18px; font-weight: 800; color: var(--rare); margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-d { border: 1px solid var(--gc); color: var(--gc); border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 600; }

/* แลก */
.exbox { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: grid; gap: 6px; }
.big-n { font-size: 16px; font-weight: 700; }
.q { display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%; background: var(--line); font-size: 11px; cursor: help; }
.mebox { background: var(--panel2); border: 1px solid var(--brass-dark); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }

#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(120px); background: #10324f; border: 1px solid var(--good); padding: 8px 14px; border-radius: 6px; max-width: 92vw; transition: transform .25s; z-index: 20; }
#toast.show { transform: translateX(-50%); }
#toast.err { border-color: var(--bad); }
#dev { position: fixed; right: 6px; bottom: 6px; background: #300; border: 1px solid #a33; padding: 4px 6px; font-size: 12px; border-radius: 4px; z-index: 30; }
#dev input { width: 3em; padding: 1px 3px; }
#dev button { padding: 1px 5px; font-size: 11px; }


/* ไอคอนทองเหลือง (แชท B) — ภาพอยู่ใน icons.css */
button .ic { margin-right: 1px; }
.chip .ic { align-self: center; }
.chip small .ic { width: 1.1em; height: 1.1em; vertical-align: -.22em; }
button.icon .ic { width: 22px; height: 22px; vertical-align: middle; }
#win-close .ic { width: 18px; height: 18px; vertical-align: middle; }
.win h2 .ic { width: 22px; height: 22px; vertical-align: -4px; }
#nav button .ic { width: 20px; height: 20px; vertical-align: -4px; }
.brand { display: flex; align-items: center; gap: 6px; }
.brand img, #landing h1 img { image-rendering: pixelated; }
body:not(.in) #mini { display: none; }

/* หน้าแรกก่อนกด Play (TEXT.md ข้อ 7) */
#landing { margin-top: 12px; text-align: center; }
#landing h1 { margin: 4px 0 0; font-size: 36px; color: var(--brass2); text-shadow: 2px 2px 0 var(--brass-dark); display: flex; align-items: center; justify-content: center; gap: 10px; }
#landing .tagline { margin: 4px 0 12px; font-size: 17px; color: var(--text); }
.land-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.land-btns button { font-size: 16px; padding: 9px 18px; }
.land-btns button.big { font-size: 22px; padding: 10px 40px; }
.facts { list-style: none; padding: 0; margin: 0 auto; max-width: 640px; display: grid; gap: 6px; text-align: left; }
.facts li { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brass); border-radius: 6px; padding: 8px 10px; }
.facts li .ic { width: 24px; height: 24px; margin-top: 1px; }
.facts b { color: var(--brass2); }
.land-warn { max-width: 640px; margin: 12px auto 0; padding: 8px 10px; border-radius: 6px; background: #3a2a0a; border: 1px solid var(--warn); color: #ffe9b8; text-align: left; }

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  #nav button { padding: 8px 12px; }
  .overlay h1 { font-size: 24px; }
  #bar { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; flex-basis: 100%; order: 3; }
  #bar .chip { padding: 2px 6px; font-size: 13px; }
  #c-energy { grid-column: span 2; }
  #bar .chip { white-space: nowrap; overflow: hidden; }
  #b-reset2, #b-farm2 { display: none; }
  #nav { gap: 6px; }
  #nav button { padding: 8px 10px; font-size: 15px; }
  #landing h1 { font-size: 26px; }
  #landing h1 img { width: 40px; height: 40px; }
  #landing .tagline { font-size: 15px; }
  .land-btns button.big { width: 100%; }
  .overlay { gap: 4px; padding: 8px; }
  .overlay p { margin: 0; }
}
