@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("/assets/fonts/space-grotesk-500.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("/assets/fonts/space-grotesk-700.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --paper: #fafaf7;
  --white: #ffffff;
  --ink: #121212;
  --body: #3c3c39;
  --muted: #5e5e5a;
  --line: #dededa;
  --soft: #f0f1ec;
  --blue: #2f54ff;
  --blue-deep: #1f3fe0;
  --red: #b42318;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --num: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
input, select, textarea, button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.shell { width: min(100% - 48px, 1160px); margin: 0 auto; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand strong { font-weight: 900; font-size: 1.45rem; letter-spacing: -.02em; }
.brand span { font-family: var(--num); font-weight: 500; font-size: .78rem; letter-spacing: .2em; color: var(--muted); }
.toplink { display: inline-flex; align-items: center; min-height: 44px; font-size: .94rem; font-weight: 500; text-decoration: none; }
.toplink:hover { color: var(--blue); }

.eyebrow { font-size: .875rem; color: var(--muted); }
.num { font-family: var(--num); }
.big-num { font-family: var(--num); font-weight: 700; font-size: clamp(3.5rem, 9vw, 5.5rem); line-height: .9; letter-spacing: -.04em; color: var(--blue); }

/* Buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 20px; border-radius: 22px; border: 1px solid transparent; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:disabled { opacity: .55; cursor: progress; }
.primary { background: var(--blue); color: var(--white); }
.primary:hover:not(:disabled) { background: var(--blue-deep); }
.dark { background: var(--ink); color: var(--paper); }
.dark:hover:not(:disabled) { background: var(--blue); }
.secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
.secondary:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.small { min-height: 36px; padding: 0 14px; font-size: .85rem; font-weight: 500; }
.danger { border-color: var(--red); color: var(--red); }
.danger:hover:not(:disabled) { background: var(--red); color: var(--white); }

/* Forms */
label { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 500; }
input, select, textarea { display: block; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid #b5b5ae; border-radius: 4px; background: var(--white); font-size: 1rem; }
input:hover, select:hover { border-color: var(--ink); }
textarea { resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; line-height: 1.7; }
.field { margin-bottom: 18px; }
.hint { color: var(--muted); font-size: .85rem; line-height: 1.6; }

.message { min-height: 0; font-size: .92rem; }
.message:not(:empty) { margin-bottom: 18px; padding: 12px 14px; border-radius: 4px; background: #e9edff; color: #1a2a80; }
.message[data-kind="error"]:not(:empty) { background: #fdecea; color: var(--red); }

/* Player page */
.player-layout { min-height: calc(100vh - 76px); display: flex; flex-wrap: wrap; align-items: center; gap: 48px 80px; padding-block: 40px 96px; }
.intro { flex: 1 1 380px; min-width: 0; }
.intro h1 { margin-top: 20px; font-weight: 900; font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.08; letter-spacing: -.02em; }
.intro h1 span { font-family: var(--num); font-weight: 500; }
.deck { margin-top: 18px; max-width: 30em; color: var(--body); line-height: 1.75; }
.steps { list-style: none; margin: 36px 0 0; padding: 0; max-width: 34em; border-top: 1px solid var(--ink); }
.steps li { display: flex; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .95rem; line-height: 1.6; }
.steps .num { flex: 0 0 28px; color: var(--muted); }
.panel { flex: 1 1 360px; max-width: 440px; padding: 36px; background: var(--white); border: 1px solid var(--line); border-radius: 4px; }
.panel h2 { margin-bottom: 22px; font-weight: 900; font-size: 1.5rem; }
.panel form button[type="submit"] { width: 100%; min-height: 52px; border-radius: 26px; margin-top: 4px; }
.panel .hint { margin-top: 14px; }
.entitlement { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 16px 0; border-block: 1px solid var(--line); }
.entitlement strong { font-size: 1.15rem; }
.player-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.player-actions .primary { flex: 1 1 auto; min-height: 52px; border-radius: 26px; }

/* Status dots */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 4px; box-sizing: border-box; border: 1.5px solid currentColor; }
.status.redeemed { color: var(--ink); }
.status.redeemed::before { background: var(--blue); border-color: var(--blue); }
.status.unused { color: var(--muted); }
.status.revoked { color: var(--red); }
.status.revoked::before { background: var(--red); border-color: var(--red); }

/* Admin page */
.admin-layout { padding-block: 24px 96px; }
.admin-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--ink); margin-bottom: 28px; }
.admin-heading h1 { margin-top: 6px; font-weight: 900; font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -.02em; }
.admin-login { max-width: 440px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.stats div { padding: 4px 0 24px; }
.stats dt { font-size: .85rem; color: var(--muted); }
.stats dd { margin: 8px 0 0; font-family: var(--num); font-weight: 700; font-size: 2.6rem; line-height: 1; letter-spacing: -.03em; }
.stats .accent dd { color: var(--blue); }
.section { margin-bottom: 48px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.section-head h2 { font-weight: 900; font-size: 1.5rem; }
.generator { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(100px, .6fr) minmax(200px, 2fr) auto; align-items: end; gap: 16px; }
.generator .field { margin: 0; }
.generator button { min-height: 48px; }
.generated { margin-top: 24px; padding: 24px; border-radius: 4px; background: var(--white); border: 1px solid var(--blue); }
.generated-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.generated-head strong { font-size: 1.05rem; }
.generated-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters input { width: 260px; min-height: 44px; }
.filters select { width: auto; min-height: 44px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { padding: 12px 10px; text-align: left; font-size: .8rem; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--soft); }
td.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; white-space: nowrap; }
td.code .muted { color: var(--muted); margin-right: 8px; }
td.note { max-width: 16em; overflow-wrap: anywhere; color: var(--body); }
td.time { white-space: nowrap; color: var(--muted); font-family: var(--num); font-size: .85rem; }
.more { margin-top: 18px; }

@media (max-width: 860px) {
  .generator { grid-template-columns: 1fr 1fr; }
  .generator .note-field { grid-column: 1 / -1; }
  .generator button { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 40px, 1160px); }
  .panel { padding: 24px; }
  .filters input { width: 100%; }
}
