:root {
  color-scheme: dark;
  --bg: #06110d;
  --panel: #0a1d16;
  --panel-2: #0e281e;
  --ink: #edf3e8;
  --muted: #8fa59a;
  --dim: #60766c;
  --gold: #d8bd78;
  --lime: #c9f06c;
  --red: #d56b62;
  --line: rgba(207, 232, 217, .13);
  --serif: Georgia, "Noto Serif SC", serif;
  --sans: Inter, "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: radial-gradient(circle at 20% 0, rgba(29, 93, 67, .22), transparent 34%), radial-gradient(circle at 90% 80%, rgba(216, 189, 120, .07), transparent 30%), var(--bg); font-family: var(--sans); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { border: 0; color: inherit; background: transparent; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }

.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(6, 17, 13, .82); backdrop-filter: blur(18px); }
.brand { display: grid; grid-template-columns: 42px auto; grid-template-rows: 21px 16px; align-items: center; column-gap: 13px; letter-spacing: .16em; }
.brand > span { grid-row: 1/3; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font: italic 19px var(--serif); }
.brand b { align-self: end; font-size: 13px; }
.brand small { color: var(--muted); font-size: 7px; }
.topbar nav { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.topbar nav a, .topbar nav button { padding: 10px 12px; border: 1px solid var(--line); }

main { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.auth-shell { min-height: calc(100vh - 82px); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); align-items: center; gap: clamp(48px, 8vw, 120px); padding: 64px clamp(0px, 3vw, 36px); }
.eyebrow, .panel-head span, .form-heading span { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: .24em; }
.hero-copy h1, .dashboard-head h1 { max-width: 700px; margin: 16px 0 24px; font: 400 clamp(42px, 6vw, 76px)/1.05 var(--serif); }
.hero-copy h1 em, .dashboard-head h1 em { display: block; color: var(--lime); font-style: normal; }
.hero-copy > p:not(.eyebrow) { max-width: 610px; color: var(--muted); font-size: 16px; line-height: 1.9; }
.security-note { max-width: 640px; display: grid; grid-template-columns: auto 1fr; gap: 14px; margin-top: 36px; padding: 18px; border: 1px solid rgba(216, 189, 120, .2); background: rgba(216, 189, 120, .045); }
.security-note b { color: var(--gold); white-space: nowrap; }
.security-note span { color: var(--muted); font-size: 12px; line-height: 1.7; }

.auth-card { min-height: 570px; padding: clamp(24px, 4vw, 42px); border: 1px solid var(--line); background: rgba(8, 29, 21, .94); box-shadow: 0 40px 120px rgba(0, 0, 0, .35); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 44px; color: var(--dim); font-size: 12px; }
.tabs button.active { border-bottom: 2px solid var(--lime); color: var(--ink); }
.auth-form { display: none; gap: 14px; }
.auth-form.active { display: grid; }
.form-heading { margin-bottom: 8px; }
.form-heading h2 { margin: 8px 0 0; font: 400 29px var(--serif); }
label { display: grid; gap: 7px; color: #cdd9d3; font-size: 12px; }
label small { color: var(--dim); font-weight: 400; }
input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 0; padding: 0 14px; outline: 0; color: var(--ink); background: #071611; }
input:focus { border-color: rgba(201, 240, 108, .65); box-shadow: 0 0 0 3px rgba(201, 240, 108, .08); }
.consent { grid-template-columns: 20px 1fr; align-items: start; margin: 5px 0; color: var(--muted); line-height: 1.6; }
.consent input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--lime); }
.consent b { color: var(--gold); }
.primary, .secondary { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 18px; padding: 0 20px; font-size: 12px; font-weight: 800; }
.primary { color: #102016; background: var(--lime); }
.secondary { border: 1px solid var(--line); background: #112c21; }
.form-error { min-height: 18px; margin: 0; color: #f08e84; font-size: 11px; line-height: 1.5; }
.status-result { padding: 16px; border: 1px solid var(--line); color: var(--muted); background: rgba(255, 255, 255, .025); line-height: 1.7; }
.status-result b { color: var(--gold); }

.dashboard { padding: 62px 0 80px; }
.dashboard-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 38px; }
.dashboard-head h1 { margin: 10px 0 8px; font-size: clamp(36px, 5vw, 58px); }
.dashboard-head h1 em { display: inline; }
.dashboard-head > div > p:last-child { color: var(--muted); }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; border: 1px solid var(--line); }
.metric { min-height: 100px; padding: 22px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.metric strong { margin-top: 10px; color: var(--gold); font: 400 25px var(--serif); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr); gap: 20px; }
.panel { border: 1px solid var(--line); padding: 28px; background: rgba(8, 27, 20, .78); }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.panel-head h2 { margin: 7px 0 0; font: 400 27px var(--serif); }
.panel-head small { color: var(--dim); }
.text-button { color: var(--lime); font-size: 11px; }
.game-list { display: grid; gap: 12px; }
.game-card { min-height: 150px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 24px; border: 1px solid var(--line); background: linear-gradient(125deg, rgba(33, 89, 65, .22), rgba(216, 189, 120, .035)); transition: transform .2s ease, border-color .2s ease; }
.game-card:hover { transform: translateY(-2px); border-color: rgba(201, 240, 108, .4); }
.game-card h3 { margin: 6px 0; font: 400 28px var(--serif); }
.game-card p { margin: 0; color: var(--muted); font-size: 12px; }
.game-stats { display: flex; gap: 18px; margin-top: 18px; }
.game-stats span { color: var(--muted); font-size: 10px; }
.game-stats b { display: block; margin-top: 4px; color: var(--gold); font-size: 15px; }
.game-card > b { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--lime); border-radius: 50%; color: var(--lime); }
.friend-search, .message-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.friend-search button, .message-form button { min-width: 80px; padding: 0 14px; color: #102016; background: var(--lime); font-size: 11px; font-weight: 800; }
.friend-list { max-height: 420px; overflow-y: auto; margin-top: 18px; }
.friend-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.friend-row b, .friend-row small { display: block; }
.friend-row small { margin-top: 4px; color: var(--dim); }
.friend-actions { display: flex; gap: 6px; }
.friend-actions button { padding: 7px 9px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.friend-actions .accept { color: var(--lime); }
.messages-panel { grid-column: 1/-1; }
.messages { height: 310px; overflow-y: auto; padding: 18px; border: 1px solid var(--line); background: #06140f; }
.empty { color: var(--dim); text-align: center; }
.message { max-width: 72%; margin: 8px 0; padding: 10px 13px; border: 1px solid var(--line); color: #dfe8e3; background: #10291f; font-size: 12px; line-height: 1.6; }
.message.mine { margin-left: auto; border-color: rgba(201, 240, 108, .22); background: #183728; }
.message time { display: block; margin-top: 5px; color: var(--dim); font-size: 9px; }
.message-form { margin-top: 10px; }

dialog { width: min(440px, calc(100% - 30px)); border: 1px solid var(--line); padding: 28px; color: var(--ink); background: #0a2017; }
dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; max-width: calc(100vw - 30px); padding: 12px 18px; border: 1px solid var(--line); color: var(--ink); background: #10291f; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 850px) {
  .auth-shell { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-copy { text-align: center; }
  .hero-copy > p, .security-note { margin-left: auto; margin-right: auto; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .messages-panel { grid-column: auto; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .topbar { height: 66px; padding: 0 14px; }
  .brand { grid-template-columns: 34px auto; grid-template-rows: 17px 13px; column-gap: 8px; }
  .brand > span { width: 34px; height: 34px; font-size: 15px; }
  .brand small { display: none; }
  .topbar nav a { display: none; }
  main { width: calc(100% - 20px); }
  .auth-shell { min-height: calc(100vh - 66px); gap: 32px; padding: 34px 0 50px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-copy > p:not(.eyebrow) { font-size: 14px; }
  .security-note { grid-template-columns: 1fr; text-align: left; }
  .auth-card { min-height: 0; padding: 22px 16px; }
  .tabs button { font-size: 11px; }
  .dashboard { padding-top: 38px; }
  .dashboard-head { align-items: start; flex-direction: column; }
  .metric { padding: 16px; }
  .metric strong { font-size: 20px; }
  .panel { padding: 20px 15px; }
  .game-card { min-height: 135px; padding: 18px 15px; }
  .game-stats { gap: 10px; }
  .message { max-width: 88%; }
}
