@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@500;600;700&family=IBM+Plex+Sans+Thai:wght@400;500;600&family=Silkscreen&display=swap');

:root {
  --bg: #0e0d0c;
  --rail: #090908;
  --panel: #161513;
  --raised: #1f1d1a;
  --line: #252320;
  --line-strong: #36332e;
  --fg: #f1ebdf;
  --muted: #948c7f;
  --faint: #5c5750;
  --accent: #ff5c8a;
  --accent-hi: #ff7aa0;
  --on-accent: #1c0911;
  --sky: #8ec5ff;
  --ok: #a3dd8c;
  --bad: #ff6b57;
  --r: 6px;
  --sans: 'IBM Plex Sans Thai', 'Leelawadee UI', 'Segoe UI', system-ui, sans-serif;
  --display: 'Bai Jamjuree', 'IBM Plex Sans Thai', 'Leelawadee UI', sans-serif;
  --pixel: 'Silkscreen', 'Bai Jamjuree', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--on-accent); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }

.display { font-family: var(--display); }
.pixel { font-family: var(--pixel); font-weight: 400; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.accent { color: var(--accent); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }

.sq { display: inline-block; width: 7px; height: 7px; background: var(--accent); flex: none; }
.lamp { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,92,138,.18), 0 0 14px rgba(255,92,138,.55); animation: lamp 2.4s ease-in-out infinite; }
@keyframes lamp { 50% { box-shadow: 0 0 0 3px rgba(255,92,138,.1), 0 0 6px rgba(255,92,138,.3); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--r);
  font: 600 15px/1 var(--display); color: var(--fg);
  background: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 54px; padding: 0 30px; font-size: 17px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-light { background: var(--fg); color: var(--bg); }
.btn-light:hover { background: #fff; }
.btn-dark { background: var(--bg); color: var(--fg); }
.btn-dark:hover { background: #000; }
.btn-ghost { border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--raised); }
.btn-danger { border-color: var(--line-strong); color: var(--bad); }
.btn-danger:hover { background: rgba(255,107,87,.1); border-color: rgba(255,107,87,.4); }
.btn-link { height: auto; padding: 0; font: 500 14px var(--sans); color: var(--muted); }
.btn-link:hover { color: var(--fg); }
.btn:focus-visible, .input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Inputs */
.input {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--rail); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  font: 15px var(--sans);
  transition: border-color .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); }
select.input {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.75); }
.modal-box { width: 100%; max-width: 400px; padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.stack > * + * { margin-top: 10px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--r);
  background: var(--fg); color: var(--bg); font-weight: 500; font-size: 14px;
}

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 400 13px var(--sans); color: var(--faint); padding: 0 14px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--panel); }
.table .right { text-align: right; }
