:root {
  --bg: #12061f;
  --panel: #1f0f33;
  --panel-2: #2a1645;
  --line: #3d2463;
  --text: #f6efff;
  --muted: #b7a5d6;
  --gold: #ffc83d;
  --gold-2: #ff9f1a;
  --red: #ff3d5a;
  --green: #2bd38b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Kanit", "Noto Sans Thai", Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
img { display: block; }

/* ---------- PIN pad ---------- */
.pin-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 50% 20%, #4a1677 0, #12061f 60%); }
.pin-box { width: min(340px, 100%); text-align: center; }
.pin-logo { font-size: 44px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff6c9, var(--gold) 45%, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #7a3b00) drop-shadow(0 0 18px rgba(255, 200, 61, .45)); }
.pin-title { color: var(--muted); margin: 4px 0 18px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--gold); transition: .15s; }
.pin-dots span.on { background: var(--gold); box-shadow: 0 0 12px var(--gold); transform: scale(1.1); }
.pin-msg { min-height: 26px; color: var(--red); margin-bottom: 8px; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-key { height: 66px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(180deg, #34195a, #241140);
  color: var(--text); font-size: 28px; font-weight: 600; box-shadow: 0 4px 0 #0c0416; transition: transform .06s; }
.pin-key:active { transform: translateY(3px); box-shadow: 0 1px 0 #0c0416; }
.pin-key.fn { font-size: 22px; color: var(--muted); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: #000c; color: #fff; padding: 10px 18px; border-radius: 999px; transition: .25s; z-index: 1000; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- screen corner controls (play / board / winners) ---------- */
.corner { position: fixed; right: 12px; top: 12px; display: flex; gap: 8px; z-index: 50; opacity: .25; transition: opacity .3s; }
.corner:hover, .corner:focus-within { opacity: 1; }
.corner button, .corner a { width: 42px; height: 42px; border-radius: 50%; border: 1px solid #ffffff33; background: #0008; color: #fff;
  display: grid; place-items: center; text-decoration: none; font-size: 18px; }

.small-note { font-size: 15px; opacity: .7; margin-top: 8px; }
.empty-note { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); font-size: 22px; }
