:root {
  color-scheme: dark;
  --bg: #202027;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  --bg-deep: #1b1b21;
  --surface: rgba(41, 40, 47, .94);
  --surface-soft: rgba(231, 227, 234, .035);
  --line: rgba(231, 227, 234, .11);
  --line-purple: rgba(201, 167, 255, .23);
  --text: #e7e3ea;
  --muted: #aaa6b1;
  --dim: #85818d;
  --purple: #c9a7ff;
  --purple-soft: #d8c0f7;
  --green: #b8d9c0;
  --green-soft: rgba(184, 217, 192, .1);
  --blue: #a9d6e5;
  --yellow: #e8d9a7;
  font-family: var(--mono), "Noto Sans TC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 42% at 10% -8%, rgba(184, 217, 192, .075), transparent 68%),
    radial-gradient(ellipse 55% 38% at 100% 16%, rgba(169, 214, 229, .045), transparent 72%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.glow { display: none; }
.glow-purple { top: -160px; right: -100px; background: var(--purple); }
.glow-green { bottom: -210px; left: -160px; background: var(--green); }

.floating-header {
  position: sticky;
  z-index: 10;
  top: 14px;
  width: min(1040px, calc(100% - 28px));
  margin: 14px auto 0;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(32, 32, 39, .88);
  box-shadow: 0 18px 50px rgba(8, 8, 10, .3);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 8px; object-fit: contain; }
.brand span { display: grid; line-height: 1.05; }
.brand b { font-size: 13px; }
.brand small { margin-top: 5px; color: var(--dim); font: 500 8px var(--mono); letter-spacing: .14em; }
nav { margin-left: auto; display: flex; gap: 22px; }
nav a { color: #b8b5c0; font-size: 12px; text-decoration: none; }
nav a:hover { color: var(--green); }

main { width: min(1040px, calc(100% - 28px)); margin: 0 auto; padding: 66px 0 84px; }
.login-view { min-height: 580px; display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: center; gap: 70px; }
.welcome-mark { margin-bottom: 18px; color: var(--green); font-size: 15px; font-weight: 600; letter-spacing: .3em; }
.eyebrow { margin: 0 0 13px; color: var(--dim); font: 600 9px var(--mono); letter-spacing: .17em; }
.eyebrow span { margin-right: 7px; color: var(--green); }
h1 { margin: 0; font-size: clamp(38px, 5vw, 56px); line-height: 1.08; letter-spacing: -.045em; }
h1 em { color: var(--green); font-style: normal; }
.login-copy > p:last-child { max-width: 520px; margin: 20px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }

.login-card-slot { position: relative; }
.login-card, .panel { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 20px 65px rgba(8, 8, 10, .2); }
.login-card { position: relative; padding: 29px; display: grid; gap: 13px; border-radius: 20px; }
.login-card::before, .panel::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(135deg, rgba(255,255,255,.025), transparent 38%); }
.login-card .step { position: absolute; top: 20px; right: 22px; color: rgba(184, 217, 192, .4); font: 600 25px var(--mono); }
.login-card h2, .panel h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.02em; }
.login-lede { margin: 0 0 2px; color: var(--muted); font-size: 12px; line-height: 1.7; }

.link-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; padding: 12px; border: 1px solid rgba(184,217,192,.28); border-radius: 14px; background: var(--green-soft); }
.link-banner div { display: grid; gap: 2px; min-width: 0; }
.link-banner b { font-size: 13px; overflow-wrap: anywhere; }
.link-banner small { color: var(--muted); font-size: 10.5px; line-height: 1.5; }

.skin-avatar { flex: none; width: 42px; height: 42px; border-radius: 10px; object-fit: cover; image-rendering: pixelated; border: 1px solid rgba(184,217,192,.3); background: rgba(255,255,255,.03); }
.skin-avatar.fallback { display: grid; place-items: center; border: 0; background: var(--green); color: var(--bg); font: 600 15px var(--mono); }
.binding-identity { display: flex; align-items: center; gap: 16px; }
.binding-identity .skin-avatar { width: 60px; height: 60px; border-radius: 14px; }
.binding-identity .skin-avatar.fallback { font-size: 21px; }
.binding-identity-text { display: grid; gap: 7px; min-width: 0; }
.binding-identity-text h2 { margin: 0; }
.binding-identity-text .status { margin-bottom: 0; }

.sent-card { text-align: center; }
.sent-icon { margin: 2px auto 0; font-size: 32px; color: var(--green); }
.sent-target { margin: 2px 0 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.sent-card .ghost-button { margin: 6px auto 0; }
label { display: grid; gap: 7px; color: #b4acb9; font-size: 11px; font-weight: 500; }
input, select, textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: rgba(255,255,255,.04); color: var(--text); }
input::placeholder, textarea::placeholder { color: #6f6874; }
input:focus, select:focus, textarea:focus { border-color: rgba(184,217,192,.5); box-shadow: 0 0 0 3px rgba(184,217,192,.09); }
textarea { min-height: 96px; resize: vertical; }
.primary-button, .ghost-button, .small-button { border: 0; border-radius: 10px; cursor: pointer; font-weight: 600; transition: transform .16s ease, filter .16s ease; }
.primary-button:hover, .small-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button:disabled, .small-button:disabled { cursor: wait; opacity: .6; transform: none; }
.primary-button { margin-top: 3px; padding: 13px 17px; color: var(--bg); background: var(--green); box-shadow: 0 12px 30px rgba(184,217,192,.08); }
.link-button { display: inline-block; margin-top: 13px; text-decoration: none; }
.ghost-button { padding: 9px 13px; color: #c9c2cd; border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.small-button { padding: 8px 10px; color: var(--bg); background: var(--green); }
.small-button.secondary { color: #d0c9d3; background: #29252d; }
.small-button.danger { color: #f0c5c5; background: rgba(205,91,91,.17); }
.form-note, .form-message, .panel p, .contact-hint { color: var(--muted); font-size: 12px; line-height: 1.72; }
.contact-hint { margin: -6px 0 0; }
.form-message { min-height: 20px; margin: 0; color: var(--green); }
.form-message.error { color: #ef9a9a; }

.dashboard-heading { margin-bottom: 30px; padding: 8px 2px; display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.dashboard-heading h1 { font-size: clamp(30px, 4vw, 42px); }
.email-pill { min-width: 245px; padding: 13px 15px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.email-pill small { color: var(--green); font-size: 9px; font-weight: 600; letter-spacing: .08em; }
.email-pill b { overflow-wrap: anywhere; font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.panel { position: relative; padding: 22px; border-radius: 17px; overflow: hidden; }
.panel-top { margin-bottom: 18px; display: flex; justify-content: space-between; color: var(--dim); font: 600 9px var(--mono); letter-spacing: .11em; }
.wallet-panel h2 { font: 600 27px var(--mono); letter-spacing: -.01em; }
.wallet-panel p { margin: 7px 0 0; }
.wallet-refresh { margin-top: 13px; }
.wallet-hint { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; line-height: 1.6; }
.vip-link { display: flex; align-items: center; justify-content: space-between; gap: 14px; text-decoration: none; color: inherit; }
.vip-link b { font-size: 15px; }
.vip-link p { margin: 6px 0 0; }
.vip-link-arrow { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 18px; }
.panel-top span { color: var(--green); }
.stack-form { display: grid; gap: 12px; }
.command-box { margin: 15px 0; padding: 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(184,217,192,.24); border-radius: 12px; background: var(--green-soft); }
.command-box code { color: var(--green); font: 600 20px var(--mono); }
.command-box small { color: var(--muted); font-size: 10px; line-height: 1.55; text-align: right; }
.status { display: inline-flex; margin-bottom: 12px; padding: 5px 8px; border-radius: 999px; color: var(--yellow); background: rgba(239,215,131,.1); font-size: 10px; font-weight: 600; }
.status.approved, .status.active { color: var(--green); background: var(--green-soft); }
.metric { margin: 11px 0; padding: 11px 0; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.metric:last-child { border-bottom: 1px solid var(--line); }
.metric span { color: var(--muted); font-size: 11px; }
.metric b { font-size: 12px; }
.history { margin-top: 14px; }
.history-row { padding: 12px 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; border-top: 1px solid var(--line); }
.history-row:first-child { border-top: 0; }
.history-row b { font-size: 12px; }
.history-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.admin { margin-top: 30px; border-color: rgba(201,167,255,.22); background: linear-gradient(160deg, rgba(201,167,255,.045), transparent 34%), var(--surface); }
.admin-heading { display: flex; justify-content: space-between; gap: 18px; }
.admin-heading h2 { margin: 0; }
.admin-heading p { margin: 5px 0 0; }
.admin-grid { margin-top: 22px; display: grid; grid-template-columns: .72fr 1.28fr; gap: 22px; }
.admin-grid h3, .admin-expiry h3 { font-size: 11px; color: #b4acb9; }
.admin-expiry { margin-top: 22px; }
.admin-item .sync-note { color: var(--yellow); }
.admin-item .sync-note.failed { color: #ef9a9a; }
.admin-list { display: grid; gap: 9px; }
.admin-item { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.023); }
.admin-item b, .admin-item small { display: block; overflow-wrap: anywhere; }
.admin-item small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.admin-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; }
.approval-fields { margin-top: 10px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.empty { color: var(--dim); font-size: 12px; }

@media (max-width: 760px) {
  nav { display: none; }
  .floating-header { top: 8px; }
  main { padding-top: 48px; }
  .login-view { grid-template-columns: 1fr; gap: 34px; padding: 28px 0 52px; }
  .login-copy { text-align: center; }
  .login-copy > p:last-child { margin-inline: auto; }
  .dashboard-heading { align-items: stretch; flex-direction: column; }
  .email-pill { min-width: 0; }
  .dashboard-grid, .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .brand small { display: none; }
  .panel, .login-card { padding: 19px; }
  .command-box { align-items: flex-start; flex-direction: column; }
  .command-box small { text-align: left; }
  .approval-fields { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
