:root {
  --bg: #0d0f14;
  --bg-2: #151924;
  --panel: #1b2030;
  --panel-2: #232a3d;
  --line: #2e3650;
  --text: #e9ecf4;
  --muted: #9aa3ba;
  --accent: #f2b84b;
  --accent-2: #ffd27a;
  --accent-ink: #1a1205;
  --good: #3ecf8e;
  --bad: #ff5d6c;
  --info: #6ea8ff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  --display: 'Black Han Sans', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(242, 184, 75, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(110, 168, 255, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
button, input, select { font: inherit; color: inherit; }

.container { width: min(1180px, 100%); margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #d9772b); color: var(--accent-ink);
  font-family: var(--display); font-size: 20px;
}
.brand-name { font-weight: 800; letter-spacing: 0.02em; }
.brand-name small { color: var(--muted); font-weight: 500; margin-left: 6px; }

/* ---------- buttons / inputs ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover:not(:disabled) { border-color: #4a5577; background: #2a3250; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 0.875rem; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 1.1rem; }

.input {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-width: 0; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.2); }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.pill-accent { color: var(--accent-2); border-color: rgba(242, 184, 75, 0.4); }
.hidden { display: none !important; }

/* ---------- landing ---------- */
.hero { padding: 40px 0 28px; display: grid; gap: 22px; }
.hero h1 {
  font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05; margin: 0; letter-spacing: 0.01em;
}
.hero h1 .accent { color: var(--accent); }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; font-size: 1.05rem; }
.join-box { display: flex; gap: 8px; flex-wrap: wrap; }
.join-box .input { text-transform: uppercase; letter-spacing: 0.3em; width: 9.5em; font-weight: 700; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.15rem; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding-bottom: 60px; }
.game-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.game-card:hover { transform: translateY(-2px); border-color: rgba(242, 184, 75, 0.5); }
.game-card h3 { margin: 0; font-size: 1.3rem; }
.game-card .ko { color: var(--muted); font-weight: 500; font-size: 0.95rem; margin-left: 6px; }
.game-card p { margin: 0; color: var(--muted); font-size: 0.95rem; flex: 1; }
.game-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.game-card.soon { opacity: 0.5; border-style: dashed; }
.game-card.soon:hover { transform: none; border-color: var(--line); }

/* ---------- room ---------- */
.room-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); margin-bottom: 16px;
}
.room-code { font-family: var(--display); font-size: 1.4rem; letter-spacing: 0.15em; color: var(--accent); }
.lobby { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; padding-bottom: 40px; }
@media (max-width: 820px) { .lobby { grid-template-columns: 1fr; } }
.lobby h2 { margin: 0 0 6px; }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.member .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.member.offline { opacity: 0.55; }
.member.offline .dot { background: var(--muted); }
.member .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.me .name { font-weight: 700; }

.settings { display: grid; gap: 10px; }
.setting { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.setting .input { width: 7em; }

.share-link { display: flex; gap: 8px; }
.share-link .input { flex: 1; font-size: 0.9rem; }

.center-card { max-width: 420px; margin: 10vh auto; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none;
  width: min(420px, calc(100% - 32px));
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  box-shadow: var(--shadow); animation: toast-in 0.18s ease-out; font-weight: 600; text-align: center;
}
.toast.good { border-color: rgba(62, 207, 142, 0.6); }
.toast.bad { border-color: rgba(255, 93, 108, 0.6); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.site-footer { color: var(--muted); font-size: 0.8rem; padding: 20px 0 30px; text-align: center; }

/* ---------- shared game building blocks (used by duel games; reuse for new games) ---------- */
.g-wrap { display: grid; gap: 16px; padding-bottom: 40px; }
.g-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.g-title { font-family: var(--display); font-size: 1.6rem; letter-spacing: 0.04em; }
.g-title small { color: var(--muted); font-family: var(--font); font-size: 0.9rem; margin-left: 6px; }
.g-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .g-main { grid-template-columns: 1fr; } }
.g-stage { position: relative; display: grid; gap: 16px; }
.g-side { display: grid; gap: 12px; }
.g-side .panel { padding: 14px; }
.g-side h3 { margin: 0 0 8px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.g-status {
  text-align: center; font-weight: 700; font-size: 1.15rem; padding: 12px 16px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.g-status.you { border-color: rgba(242, 184, 75, 0.7); background: rgba(242, 184, 75, 0.1); color: var(--accent-2); }
.g-status.good { border-color: rgba(62, 207, 142, 0.6); color: var(--good); }
.g-status.bad { border-color: rgba(255, 93, 108, 0.6); color: var(--bad); }
.g-seat {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line);
}
.g-seat.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(242, 184, 75, 0.25); }
.g-seat .who { font-weight: 800; font-size: 1.05rem; }
.g-seat .stat { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.3rem; }
.g-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 5;
  background: rgba(8, 10, 14, 0.72); backdrop-filter: blur(3px); border-radius: 18px; animation: toast-in 0.2s ease-out;
}
.g-overlay .panel { max-width: 460px; width: 100%; text-align: center; display: grid; gap: 12px; }
.g-overlay h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 2.2rem; color: var(--accent); }
.g-rules { font-size: 0.88rem; color: var(--muted); }
.g-rules summary { cursor: pointer; color: var(--text); font-weight: 700; }
.g-rules ul { padding-left: 18px; margin: 8px 0 0; }
.g-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.g-table th, .g-table td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.g-table th { color: var(--muted); font-weight: 600; }
