*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --black: #080808;
    --ink: #0e0e0e;
    --surface: #141414;
    --surface-2: #1b1b1b;
    --border: #232323;
    --border-mid: #2c2c2c;
    --border-light: #383838;
    --gold: #C4A265;
    --gold-dim: #9a7d50;
    --gold-faint: #3e2f1a;
    --cream: #EDE8DF;
    --text: #C8C0B5;
    --sub: #A09890;
    --muted: #7A7068;
    --faint: #4a4440;
    --font-display: 'Cormorant Garamond', 'Noto Serif TC', Georgia, serif;
    --font-body: 'Noto Sans TC', sans-serif;
    --font-mono: 'DM Mono', monospace;
    --t-xs: 0.75rem;
    --t-sm: 0.85rem;
    --t-base: 0.95rem;
    --t-lg: 1.1rem;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background: var(--black);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: var(--t-base);
    line-height: 1.75;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection { background: var(--gold-faint); color: var(--cream); }

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
    opacity: 0.022;
    pointer-events: none;
    z-index: 9000;
}

nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: 60px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 clamp(1.25rem, 5vw, 2.5rem);
    border-bottom: 1px solid var(--border);
    background: rgba(8,8,8,0.93);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav-logo { font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; color: var(--cream); text-decoration: none; letter-spacing: 0.03em; }
.nav-logo em { font-style: normal; color: var(--gold); }
.nav-logo-prefix { font-family: 'Noto Sans TC', sans-serif; margin-right: 4px; }
.nav-back { font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 300; color: var(--muted); text-decoration: none; letter-spacing: 0.14em; text-transform: uppercase; border: 1px solid var(--border-mid); padding: 0.5rem 1.1rem; min-height: 36px; display: flex; align-items: center; border-radius: 1px; transition: color 0.2s, border-color 0.2s; }
.nav-back:hover { color: var(--cream); border-color: var(--border-light); }

main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 100px clamp(1.25rem, 5vw, 2rem) 5rem; position: relative; overflow: hidden; }

.glow { position: absolute; pointer-events: none; border-radius: 50%; filter: blur(130px); }
.glow-1 { width: min(600px, 90vw); height: 400px; background: radial-gradient(ellipse, rgba(196,162,101,0.10) 0%, transparent 70%); top: -80px; left: 50%; transform: translateX(-50%); animation: drift 18s ease-in-out infinite; }
@keyframes drift { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(32px); } }

.page-header { max-width: 600px; width: 100%; text-align: center; margin-bottom: 3rem; position: relative; z-index: 1; }

.eyebrow { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 300; letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: center; gap: 0.75rem; }
.eyebrow::before, .eyebrow::after { content: ''; display: block; width: 28px; height: 1px; background: var(--border-light); flex-shrink: 0; }

.page-title { font-family: var(--font-display); font-size: clamp(2.2rem, 5.5vw, 3.4rem); font-weight: 300; line-height: 1.15; color: var(--cream); letter-spacing: -0.01em; margin-bottom: 1.2rem; }
.page-title em { font-style: italic; color: var(--gold); }
.page-sub { font-size: var(--t-base); font-weight: 400; color: var(--sub); line-height: 1.85; max-width: 420px; margin: 0 auto; }

.card { max-width: 580px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 2px; position: relative; z-index: 1; overflow: hidden; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 35%, var(--gold-dim) 65%, transparent); }

.card-inner { padding: clamp(1.75rem, 5vw, 2.75rem); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.field { margin-bottom: 1.5rem; }
.field:last-of-type { margin-bottom: 0; }
.field-label { display: block; font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; letter-spacing: 0.06em; color: var(--gold-dim); margin-bottom: 0.55rem; }
.field-input { width: 100%; background: var(--ink); border: 1px solid var(--border-mid); border-radius: 1px; padding: 0.9rem 1rem; min-height: 48px; color: var(--cream); font-family: var(--font-body); font-size: var(--t-base); font-weight: 400; outline: none; transition: border-color 0.22s, box-shadow 0.22s; appearance: none; -webkit-appearance: none; }
.field-input::placeholder { color: var(--faint); font-weight: 300; }
.field-input:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(196,162,101,0.07); }

.divider { height: 1px; background: var(--border); margin: 1.75rem 0; }

.btn-submit { width: 100%; background: transparent; border: 1px solid var(--gold-dim); color: var(--gold); font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; letter-spacing: 0.04em; padding: 1.1rem 2rem; min-height: 52px; border-radius: 2px; cursor: pointer; transition: color 0.25s, border-color 0.25s, box-shadow 0.25s; display: flex; align-items: center; justify-content: center; gap: 0.7rem; position: relative; overflow: hidden; }
.btn-submit::before { content: ''; position: absolute; inset: 0; background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform 0.35s cubic-bezier(0.4,0,0.2,1); }
.btn-submit:hover::before { transform: scaleX(1); }
.btn-submit:hover { color: var(--black); border-color: var(--gold); box-shadow: 0 0 24px rgba(196,162,101,0.18); }
.btn-submit > * { position: relative; z-index: 1; }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-submit:disabled::before { display: none; }

.btn-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid currentColor; flex-shrink: 0; }
.spinner { width: 14px; height: 14px; border: 1.5px solid rgba(196,162,101,0.25); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card-note { padding: 1.1rem clamp(1.75rem, 5vw, 2.75rem); border-top: 1px solid var(--border); background: rgba(255,255,255,0.012); }
.card-note p { font-size: var(--t-sm); font-weight: 400; color: var(--sub); line-height: 1.75; text-align: center; }

/* ── Success Panel ── */
.success-panel { display: none; padding: 0; }

/* Terminal block */
.scan-terminal { background: var(--ink); border-bottom: 1px solid var(--border); }
.scan-terminal-bar { display: flex; align-items: center; gap: 6px; padding: 0.65rem 1.25rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.scan-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.scan-dot-r { background: #4d2020; }
.scan-dot-y { background: #4d4520; }
.scan-dot-g { background: #204d28; }
.scan-terminal-label { font-family: var(--font-mono); font-size: 0.68rem; color: var(--faint); letter-spacing: 0.1em; margin-left: auto; }
.scan-terminal-body { padding: 1.25rem 1.5rem 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; line-height: 2.1; min-height: 180px; }

.scan-line { display: flex; align-items: center; gap: 0.7rem; opacity: 0; transition: opacity 0.2s ease; }
.scan-line.show { opacity: 1; }
.scan-line-icon { width: 16px; flex-shrink: 0; text-align: center; font-size: 0.75rem; }
.scan-line-text { color: var(--faint); }
.scan-line.running .scan-line-text { color: var(--sub); }
.scan-line.done .scan-line-text { color: #5a9060; }
.scan-line.done .scan-line-icon { color: #5a9060; }
.scan-line.final .scan-line-text { color: var(--gold-dim); }
.scan-line.final .scan-line-icon { color: var(--gold-dim); }

.scan-spinner { width: 12px; height: 12px; border: 1.5px solid rgba(196,162,101,0.2); border-top-color: var(--gold-dim); border-radius: 50%; animation: spin 0.75s linear infinite; }

.scan-cursor::after { content: '▋'; color: var(--gold-dim); animation: blink 1.1s step-end infinite; font-size: 0.75rem; }
@keyframes blink { 50% { opacity: 0; } }

.success-msg {
    padding: 2.5rem clamp(1.75rem, 5vw, 2.75rem) 2rem;
    text-align: center;
    opacity: 0;
    display: none;
    transition: opacity 0.6s ease;
}
.success-msg.show { opacity: 1; }

.success-icon { width: 48px; height: 48px; border: 1px solid var(--gold-dim); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; }
.success-icon svg { width: 18px; height: 18px; stroke: var(--gold); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.success-title { font-family: var(--font-display); font-size: 1.8rem; font-weight: 300; color: var(--cream); letter-spacing: 0.01em; margin-bottom: 0.65rem; }
.success-body { font-size: var(--t-base); font-weight: 400; color: var(--sub); line-height: 1.85; margin-bottom: 1.5rem; }
.success-body strong { color: var(--cream); font-weight: 500; }

.success-hint { background: var(--surface-2); border: 1px solid var(--border); border-radius: 1px; padding: 1.1rem 1.4rem; text-align: left; margin-bottom: 1.75rem; }
.success-hint-label { font-family: var(--font-body); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.04em; color: var(--gold-dim); margin-bottom: 0.4rem; }
.success-hint p { font-size: var(--t-sm); font-weight: 400; color: var(--sub); line-height: 1.8; }
.success-hint p strong { color: var(--text); font-weight: 500; }

.btn-restart { font-family: var(--font-body); font-size: var(--t-sm); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: none; border: none; cursor: pointer; transition: color 0.2s; min-height: 36px; }
.btn-restart:hover { color: var(--gold); }

/* Process strip */
.process-strip { max-width: 580px; width: 100%; margin-top: 3.5rem; border-top: 1px solid var(--border); padding-top: 2.5rem; position: relative; z-index: 1; }
.process-strip-label { font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; letter-spacing: 0.06em; color: var(--gold-dim); margin-bottom: 1.75rem; display: flex; align-items: center; gap: 0.6rem; }
.process-strip-label::before { content: ''; width: 20px; height: 1px; background: var(--gold-dim); flex-shrink: 0; }
.process-steps { display: flex; flex-direction: column; gap: 0; }
.ps-item { display: grid; grid-template-columns: 36px 1fr; gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--border); align-items: start; }
.ps-item:first-child { border-top: none; }
.ps-num { font-family: var(--font-display); font-size: 1.4rem; font-weight: 300; font-style: italic; color: var(--border-light); line-height: 1.2; padding-top: 0.1rem; }
.ps-title { font-family: var(--font-body); font-size: var(--t-base); font-weight: 500; color: var(--cream); margin-bottom: 0.35rem; line-height: 1.3; }
.ps-body { font-size: var(--t-sm); font-weight: 400; color: var(--sub); line-height: 1.8; }
.ps-badge { display: inline-block; font-family: var(--font-body); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-dim); border: 1px solid var(--gold-faint); padding: 0.2rem 0.6rem; border-radius: 1px; margin-top: 0.5rem; }

footer { border-top: 1px solid var(--border); padding: 2.25rem clamp(1.25rem, 5vw, 2.5rem) 2rem; text-align: center; }
.footer-disclaimer { max-width: 580px; margin: 0 auto 1.25rem; font-size: var(--t-sm); font-weight: 400; color: var(--muted); line-height: 1.85; }
.footer-disclaimer strong { color: var(--sub); font-weight: 500; }
.footer-copy { font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 300; color: var(--muted); letter-spacing: 0.08em; }
.footer-nav-link { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-nav-link:hover { color: var(--gold-dim); }

#progressBar { position: fixed; top: 0; left: 0; height: 1px; width: 0%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); z-index: 300; transition: width 2.4s cubic-bezier(0.4,0,0.2,1); }

@media (max-width: 580px) {
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .field-row .field { margin-bottom: 1.25rem; }
}
@media (max-width: 420px) {
    .page-title { font-size: clamp(1.9rem, 8vw, 2.4rem); }
    .card-inner { padding: 1.5rem; }
    .card-note { padding: 1rem 1.5rem; }
    .scan-terminal-body { padding: 1rem 1.1rem 1.25rem; font-size: 0.74rem; }
    .process-strip { padding-top: 2rem; }
    footer { padding: 1.75rem 1.25rem; }
}
