:root {
  --bg: #070a0f;
  --panel: #10161f;
  --panel-2: #161e29;
  --line: #28313d;
  --text: #f3f0e8;
  --muted: #9ca6b4;
  --gold: #d6ac59;
  --gold-light: #f0d28e;
  --blue: #4b86ba;
  --green: #50c28a;
  --red: #ef7076;
  --yellow: #e4b45d;
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.public-page {
  background:
    radial-gradient(circle at 18% 15%, #24385266, transparent 31rem),
    radial-gradient(circle at 85% 82%, #5d472344, transparent 28rem),
    linear-gradient(135deg, #070a0f, #0d131b 48%, #080b10);
}
.public-page::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 48px 48px; mask-image: linear-gradient(to bottom, black, transparent 75%);
}
.registration-shell {
  position: relative; z-index: 1; width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 58px);
  margin: auto; display: grid; grid-template-columns: 1fr minmax(440px, .82fr); gap: 70px; align-items: center; padding: 52px 0;
}
.intro h1 { margin: 12px 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7vw, 84px); line-height: .98; font-weight: 500; letter-spacing: -.04em; }
.intro h1 span { color: var(--gold-light); }
.eyebrow, .step { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .22em; }
.lead { max-width: 480px; color: #b9c1cc; font-size: 18px; line-height: 1.8; }
.server-note { display: flex; align-items: center; gap: 12px; margin-top: 32px; color: #d7dce2; }
.server-note small { display: block; margin-top: 4px; color: var(--muted); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 15px var(--green); }

.form-card {
  padding: 34px; background: #111822ed; border: 1px solid #34404d; border-radius: 18px;
  box-shadow: 0 28px 100px #000b, inset 0 1px #ffffff0d; backdrop-filter: blur(16px);
}
.card-heading { margin-bottom: 25px; }
.card-heading h2, .success-view h2 { margin: 8px 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; }
.card-heading p:last-child, .success-view > p { margin: 0; color: var(--muted); line-height: 1.6; }
form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full { grid-column: 1 / -1; }
.field { display: grid; align-content: start; gap: 7px; }
label { color: #d4d9df; font-size: 13px; font-weight: 650; }
small { color: var(--muted); line-height: 1.45; }
.field small { font-size: 11px; }
.field small strong { color: var(--gold-light); }
input, select {
  width: 100%; min-height: 44px; padding: 10px 12px; color: var(--text); background: #090e15;
  border: 1px solid var(--line); border-radius: 8px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #d6ac591c; }
input::placeholder { color: #626d79; }
button { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; color: var(--text); background: var(--panel-2); }
button:hover { filter: brightness(1.1); border-color: #526173; }
button.primary { min-height: 47px; color: #181307; background: linear-gradient(135deg, var(--gold-light), var(--gold)); border: 0; font-weight: 800; }
button.primary span { float: right; }
button.ghost { background: transparent; }
button.danger { color: #ffd9dc; background: #58242a; border-color: #8f3d48; }
button:disabled { opacity: .46; cursor: not-allowed; }
.alert { padding: 11px 13px; border-radius: 8px; font-size: 13px; }
.alert.error { color: #ffdadd; background: #3d1c23; border: 1px solid #73313b; }
.alert.warning { color: #ffe8b8; background: #3b2d14; border: 1px solid #755822; margin-bottom: 18px; }
.valid { color: var(--green) !important; }
.invalid { color: var(--red) !important; }
.privacy { margin: 18px 0 0; color: #717c89; font-size: 11px; text-align: center; }
footer { position: relative; z-index: 1; height: 58px; display: grid; place-items: center; color: #6e7884; font-size: 11px; letter-spacing: .08em; }

.success-view { text-align: center; padding: 12px 0; }
.success-mark { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 22px; color: #07150f; background: var(--green); border-radius: 50%; font-size: 32px; box-shadow: 0 0 30px #50c28a44; }
.result-row { margin: 25px 0; padding: 15px; display: flex; justify-content: space-between; background: #090e15; border: 1px solid var(--line); border-radius: 8px; }
.result-row span { color: var(--muted); }
.result-row strong { color: var(--gold-light); letter-spacing: .08em; }
.guide { padding: 18px; text-align: left; background: #0b1119; border-radius: 10px; }
.guide h3 { margin: 0 0 8px; }
.guide p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.copy-code { width: 100%; display: flex; justify-content: space-between; color: var(--gold-light); }

.admin-page { background: #090d13; }
.login-view { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 20%, #263a50, #080b10 55%); }
.login-card { width: min(380px, 100%); display: grid; grid-template-columns: 1fr; gap: 13px; padding: 32px; background: #111822; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 25px 80px #000a; }
.login-card h1, .login-card p { margin: 0; text-align: center; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; margin: auto; border-radius: 10px; color: #171207; background: linear-gradient(135deg, var(--gold-light), var(--gold)); font-family: Georgia, serif; font-weight: 900; }
.brand-mark.small { width: 36px; height: 36px; margin: 0; font-size: 12px; }
.form-error { min-height: 18px; color: var(--red); text-align: center; font-size: 12px; }
.admin-header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; min-height: 68px; padding: 12px max(20px, calc((100% - 1280px) / 2)); background: #0b1017ed; border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.admin-brand { display: flex; align-items: center; gap: 11px; }
.admin-brand small { display: block; margin-top: 2px; }
.admin-main { width: min(1280px, calc(100% - 32px)); margin: auto; padding: 34px 0 60px; }
.page-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title h1 { margin: 5px 0; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.page-title p { margin: 0; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, .8fr); gap: 18px; }
.panel { padding: 20px; background: linear-gradient(145deg, #111822, #0e141d); border: 1px solid var(--line); border-radius: 12px; }
.panel h2 { margin: 0 0 18px; font-size: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 15px; }
.created-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.created-code { display: grid; text-align: left; }
.created-code strong, .mono, .code-button { font-family: Consolas, monospace; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { padding: 13px 5px; text-align: center; background: #090e15; border-radius: 8px; }
.stats span { display: block; color: var(--gold-light); font: 25px Georgia, serif; }
.stats small { font-size: 11px; }
.stats-panel p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.tabs { display: flex; gap: 5px; margin: 26px 0 10px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-radius: 7px 7px 0 0; color: var(--muted); background: transparent; }
.tabs button.active { color: var(--gold-light); box-shadow: inset 0 -2px var(--gold); }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: var(--muted); font-weight: 600; text-align: left; white-space: nowrap; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: #232c38; font-size: 10px; white-space: nowrap; }
.badge.good { color: #8de3b7; background: #173528; }
.badge.notice { color: #f1ca7e; background: #3b2c13; }
.badge.bad { color: #ffabb0; background: #401e24; }
.code-button { padding: 0; color: var(--gold-light); background: none; border: 0; white-space: nowrap; }
.small-button { padding: 5px 8px; font-size: 10px; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.detail-cell { max-width: 420px; overflow-wrap: anywhere; color: #b8c1cc; }
.empty { padding: 38px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 30; padding: 11px 15px; background: #263445; border: 1px solid #4b6077; border-radius: 8px; box-shadow: 0 12px 34px #000a; }

@media (max-width: 850px) {
  .registration-shell { grid-template-columns: 1fr; gap: 30px; padding-top: 36px; }
  .intro { text-align: center; }
  .intro h1 { font-size: clamp(45px, 13vw, 68px); }
  .lead { margin-inline: auto; }
  .server-note { justify-content: center; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .registration-shell { width: min(100% - 24px, 500px); padding: 26px 0; }
  .intro h1 { margin-bottom: 14px; }
  .lead { font-size: 15px; }
  .form-card { padding: 23px 18px; border-radius: 13px; }
  form, .form-grid { grid-template-columns: 1fr; }
  .field, .full { grid-column: 1; }
  .admin-main { width: min(100% - 20px, 1280px); padding-top: 22px; }
  .page-title { align-items: flex-start; }
  .page-title h1 { font-size: 28px; }
  .created-codes { grid-template-columns: 1fr; }
  .admin-header { padding-inline: 12px; }
}
