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

:root {
    --bg: #000;
    --text: #f5f5f7;
    --muted: #86868b;
    --accent: #2997ff;
    --green: #30d158;
    --pink: #ff375f;
    --purple: #bf5af2;
    --border: #1d1d1f;
    --card: #141414;
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(0,0,0,0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    font-size: 16px; font-weight: 600;
    color: var(--text); text-decoration: none;
    letter-spacing: -0.5px;
    font-family: 'SF Mono', monospace;
    flex-shrink: 0;
}
.logo span { color: var(--accent); }

nav { display: flex; gap: 20px; align-items: center; }

nav a {
    color: var(--muted); text-decoration: none;
    font-size: 14px; cursor: pointer;
    transition: color 0.2s; user-select: none;
    white-space: nowrap;
}
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); }

main { flex: 1; padding-top: 52px; }

/* ── Loading ── */
.page-loading {
    min-height: calc(100vh - 112px);
    display: flex; align-items: center; justify-content: center;
}
.loader { display: flex; gap: 8px; }
.loader span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--muted);
    animation: dotPulse 1.2s ease-in-out infinite;
}
.loader span:nth-child(2) { animation-delay: 0.2s; }
.loader span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Buttons ── */
.btn {
    padding: 12px 24px; border-radius: 980px;
    font-size: 15px; font-weight: 500; cursor: pointer;
    transition: all 0.2s; border: none;
    text-decoration: none; display: inline-block;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn-fill { background: var(--accent); color: #fff; }
.btn-fill:hover { background: #0077ed; }
.btn-fill:active { transform: scale(0.97); }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid rgba(41,151,255,0.45); }
.btn-outline:hover { background: rgba(41,151,255,0.08); border-color: var(--accent); }
.btn-outline:active { transform: scale(0.97); }
.btn-pink { background: var(--pink); color: #fff; }
.btn-pink:hover { background: #e0284f; }
.btn-pink:active { transform: scale(0.97); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #a040e0; }
.btn-purple:active { transform: scale(0.97); }

/* ── Hero ── */
.hero {
    min-height: calc(100vh - 112px);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 80px 24px 60px; text-align: center;
}
.hero-badge {
    font-family: 'SF Mono', monospace;
    font-size: 11px; color: var(--accent);
    border: 1px solid rgba(41,151,255,0.35);
    padding: 5px 14px; border-radius: 20px;
    margin-bottom: 28px; letter-spacing: 1px;
}
.hero h1 {
    font-size: clamp(44px, 10vw, 96px);
    font-weight: 700; letter-spacing: -3px; line-height: 1.0;
    margin-bottom: 20px;
    background: linear-gradient(160deg, #f5f5f7 30%, #555 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: clamp(15px, 2.5vw, 20px); color: var(--muted);
    max-width: 540px; line-height: 1.65; margin-bottom: 40px;
    padding: 0 4px;
}
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ── Terminal ── */
.terminal-wrap { padding: 0 20px 80px; display: flex; justify-content: center; }
.terminal {
    width: 100%; max-width: 660px;
    background: var(--card); border-radius: 14px;
    border: 1px solid var(--border); overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.t-bar {
    background: #1c1c1e; padding: 11px 16px;
    display: flex; align-items: center; gap: 7px;
    border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.d-r { background: #ff5f57; } .d-y { background: #febc2e; } .d-g { background: #28c840; }
.t-title { flex: 1; text-align: center; font-family: 'SF Mono', monospace; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-body { padding: 18px 20px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; line-height: 1.9; overflow-x: auto; }
.t-row { display: flex; gap: 8px; }
.t-ps { color: var(--green); user-select: none; flex-shrink: 0; }
.t-out { color: var(--muted); padding-left: 16px; word-break: break-all; }
.t-key { color: var(--accent); }
.cursor { display: inline-block; width: 7px; height: 14px; background: var(--text); vertical-align: middle; animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0; } }

/* ── Stats ── */
.stats {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 36px 48px; padding: 48px 24px;
    border-top: 1px solid var(--border);
}
.stat { text-align: center; min-width: 80px; }
.stat-num { font-size: 34px; font-weight: 700; letter-spacing: -2px; font-family: 'SF Mono', monospace; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Lab ── */
.lab-hero { padding: 72px 24px 40px; text-align: center; }
.lab-hero h2 { font-size: clamp(36px,7vw,64px); font-weight: 700; letter-spacing: -3px; margin-bottom: 12px; }
.lab-hero p { color: var(--muted); font-size: 16px; }
.grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
    gap: 16px; padding: 0 20px 72px; max-width: 1020px; margin: 0 auto;
}
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 18px; padding: 26px; transition: border-color 0.25s, transform 0.25s;
}
.card:hover { border-color: #2a2a2a; transform: translateY(-3px); }
.card-icon { font-size: 28px; margin-bottom: 12px; }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.3px; }
.card p { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: 'SF Mono', monospace; font-size: 11px; padding: 3px 9px; border-radius: 5px; }
.tag-blue { color: var(--accent); background: rgba(41,151,255,0.12); }
.tag-green { color: var(--green); background: rgba(48,209,88,0.12); }
.tag-link { color: #fff; background: rgba(255,255,255,0.08); cursor: pointer; text-decoration: none; }
.tag-link:hover { background: rgba(255,255,255,0.14); }

/* ════════════════════════════════════
   ── FUN PAGE ──
════════════════════════════════════ */
.fun-page { padding: 60px 20px 80px; }

.fun-header { text-align: center; margin-bottom: 44px; }
.fun-header h2 {
    font-size: clamp(30px,6vw,60px); font-weight: 700;
    letter-spacing: -2px; margin-bottom: 10px;
}
.fun-header p { color: var(--muted); font-size: 14px; padding: 0 8px; }

.fun-step { display: none; }
.fun-step.active { display: block; }

.input-box {
    max-width: 460px; margin: 0 auto;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 20px; padding: 32px 28px; text-align: center;
}
.input-box h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.input-box .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.field { margin-bottom: 18px; text-align: left; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-family: 'SF Mono', monospace; }
.field input, .field select {
    width: 100%; padding: 12px 14px;
    background: #0a0a0a; border: 1px solid var(--border);
    border-radius: 10px; color: var(--text);
    font-size: 16px; /* 16px prevents iOS zoom */
    outline: none; transition: border-color 0.2s;
    font-family: inherit; -webkit-appearance: none; appearance: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.field select option { background: #1c1c1e; }

.choices-box {
    max-width: 540px; margin: 0 auto;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 20px; padding: 32px 28px;
}
.choices-box h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.choices-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.choice-group { margin-bottom: 22px; }
.choice-group .qlabel { font-size: 14px; font-weight: 500; margin-bottom: 10px; }

.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-btn {
    padding: 9px 14px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--border); background: #0a0a0a;
    color: var(--text); font-size: 14px; transition: all 0.15s;
    user-select: none; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.choice-btn:active { transform: scale(0.96); }
.choice-btn.selected { border-color: var(--accent); background: rgba(41,151,255,0.12); color: #fff; }

.choices-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; }

.scan-box {
    max-width: 460px; margin: 0 auto;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 20px; padding: 36px 28px; text-align: center;
}
.scan-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.scan-sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }

.scan-avatar {
    width: 76px; height: 76px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    margin: 0 auto 22px; display: flex; align-items: center;
    justify-content: center; font-size: 30px;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(41,151,255,0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(41,151,255,0); }
}

.progress-bar {
    width: 100%; height: 4px; background: var(--border);
    border-radius: 2px; overflow: hidden; margin-bottom: 18px;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 2px; width: 0%; transition: width 0.3s ease;
}

.scan-log {
    font-family: 'SF Mono', monospace; font-size: 12px;
    color: var(--muted); text-align: left; line-height: 2; min-height: 100px;
}
.scan-log .ok { color: var(--green); }
.scan-log .warn { color: #febc2e; }
.scan-log .err { color: var(--pink); }

.result-box {
    max-width: 540px; margin: 0 auto;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 20px; overflow: hidden;
}

.result-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    padding: 28px 24px; text-align: center; border-bottom: 1px solid var(--border);
}
.result-avatar {
    width: 66px; height: 66px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    margin: 0 auto 12px; display: flex; align-items: center;
    justify-content: center; font-size: 26px;
}
.result-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.result-type {
    display: inline-block;
    font-family: 'SF Mono', monospace; font-size: 11px;
    color: var(--purple); border: 1px solid rgba(191,90,242,0.4);
    padding: 4px 12px; border-radius: 20px; margin-top: 6px;
}

.result-body { padding: 20px; }

.result-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 12px 0; border-bottom: 1px solid #1a1a1a; gap: 12px;
}
.result-row:last-of-type { border-bottom: none; }
.result-key { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.result-val { font-size: 13px; font-weight: 500; text-align: right; }

.fortune-stars { color: #febc2e; font-size: 15px; letter-spacing: 2px; }

.fortune-quote {
    margin: 16px 0;
    background: #0a0a0a; border-left: 3px solid var(--accent);
    padding: 12px 14px; border-radius: 0 8px 8px 0;
    font-size: 13px; line-height: 1.7; color: var(--muted); font-style: italic;
}

.roast-section { text-align: center; margin-top: 20px; }
.roast-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.roast-reveal {
    background: #1a0a0a; border: 1px solid rgba(255,55,95,0.3);
    border-radius: 12px; padding: 14px; margin-top: 12px;
    display: none; text-align: left;
}
.roast-reveal.show { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.roast-title { color: var(--pink); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.roast-text { font-size: 13px; color: #ccc; line-height: 1.7; }

.result-actions {
    display: flex; gap: 10px; justify-content: center;
    margin-top: 20px; flex-wrap: wrap;
}
.result-actions .btn { font-size: 14px; padding: 11px 20px; }

/* ════════════════════════════════════
   ── SHARE CARD OVERLAY ──
════════════════════════════════════ */
.card-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.card-overlay.show { display: flex; animation: fadeIn 0.3s ease; }

.sc-wrap {
    width: min(320px, 88vw);
    border-radius: 20px;
    overflow: hidden;
    padding: 28px 22px 24px;
    color: #f5f5f7;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    position: relative;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7);
    background: linear-gradient(150deg, #0d0d1a 0%, #1a0a2e 50%, #0a1020 100%);
    border: 1px solid rgba(191,90,242,0.35);
    flex-shrink: 0;
}

.sc-orb1 {
    position: absolute; top: -50px; right: -50px;
    width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle, rgba(191,90,242,0.28) 0%, transparent 70%);
    pointer-events: none;
}
.sc-orb2 {
    position: absolute; bottom: -40px; left: -40px;
    width: 150px; height: 150px; border-radius: 50%;
    background: radial-gradient(circle, rgba(41,151,255,0.2) 0%, transparent 70%);
    pointer-events: none;
}

.sc-body { position: relative; text-align: center; }
.sc-avatar { font-size: 48px; line-height: 1; margin-bottom: 8px; }
.sc-name { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 2px; }
.sc-brand {
    font-family: 'SF Mono', monospace; font-size: 9px;
    color: rgba(191,90,242,0.75); letter-spacing: 1.5px;
    text-transform: uppercase; margin-bottom: 14px;
}
.sc-pill {
    display: inline-block;
    background: linear-gradient(135deg, rgba(191,90,242,0.18), rgba(41,151,255,0.15));
    border: 1px solid rgba(191,90,242,0.45);
    border-radius: 9px; padding: 8px 16px;
    font-size: 13px; font-weight: 600; margin-bottom: 16px;
    max-width: 100%; word-break: break-all;
}
.sc-stats { text-align: left; margin-bottom: 14px; }
.sc-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border-radius: 7px; margin-bottom: 3px;
    background: rgba(255,255,255,0.05); gap: 8px;
}
.sc-lbl { font-size: 11px; color: rgba(134,134,139,0.9); white-space: nowrap; flex-shrink: 0; }
.sc-val { font-size: 11px; font-weight: 500; text-align: right; }
.sc-gold { color: #febc2e; }
.sc-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 12px 0 10px; }
.sc-quote {
    font-size: 11px; color: rgba(245,245,247,0.5);
    line-height: 1.7; font-style: italic; margin-bottom: 14px;
}
.sc-watermark {
    font-family: 'SF Mono', monospace; font-size: 10px;
    color: rgba(134,134,139,0.45); letter-spacing: 0.5px;
}

.card-actions { display: flex; gap: 10px; width: min(320px, 88vw); }
.card-actions .btn { flex: 1; text-align: center; font-size: 14px; padding: 12px 16px; }
.card-tip { font-size: 12px; color: var(--muted); text-align: center; }

/* ── Footer ── */
footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px; display: flex;
    align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
}
footer span { font-size: 12px; color: var(--muted); }
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { font-size: 12px; color: var(--muted); text-decoration: none; cursor: pointer; transition: color 0.2s; }
.footer-nav a:hover { color: var(--text); }

/* ════════════════════════════════════
   ── RESPONSIVE: TABLET ──
════════════════════════════════════ */
@media (max-width: 768px) {
    .grid { grid-template-columns: 1fr 1fr; }
    .hero { padding: 60px 20px 48px; min-height: auto; }
}

/* ════════════════════════════════════
   ── RESPONSIVE: MOBILE ──
════════════════════════════════════ */
@media (max-width: 600px) {
    header { padding: 0 16px; }
    nav { gap: 16px; }

    .hero { padding: 52px 16px 44px; min-height: auto; }
    .hero h1 { letter-spacing: -2px; }
    .hero-btns { gap: 10px; }
    .hero-btns .btn { padding: 11px 20px; font-size: 14px; }

    .terminal-wrap { padding: 0 16px 64px; }
    .t-body { font-size: 11px; padding: 14px 14px; }
    .t-out { padding-left: 10px; }

    .stats { gap: 24px 36px; padding: 36px 16px; }
    .stat-num { font-size: 28px; }

    .lab-hero { padding: 56px 16px 32px; }
    .grid { grid-template-columns: 1fr; padding: 0 16px 60px; gap: 12px; }

    .fun-page { padding: 40px 16px 60px; }
    .fun-header { margin-bottom: 32px; }

    .input-box, .choices-box, .scan-box { padding: 24px 18px; }
    .result-body { padding: 16px; }

    .choice-btn { font-size: 13px; padding: 8px 12px; }

    .choices-nav { gap: 10px; }
    .choices-nav .btn { flex: 1; text-align: center; padding: 11px 12px; font-size: 14px; }

    .result-actions { gap: 8px; }
    .result-actions .btn { font-size: 13px; padding: 10px 16px; }

    footer { justify-content: center; text-align: center; gap: 12px; }
    .footer-nav { gap: 16px; }
}

/* ════════════════════════════════════
   ── RESPONSIVE: SMALL MOBILE ──
════════════════════════════════════ */
@media (max-width: 390px) {
    nav a { font-size: 13px; }
    nav { gap: 12px; }

    .hero h1 { font-size: 38px; letter-spacing: -2px; }
    .hero-badge { font-size: 10px; padding: 4px 10px; }

    .result-key { font-size: 12px; }
    .result-val { font-size: 12px; }

    .result-actions { flex-direction: column; align-items: center; }
    .result-actions .btn { width: 100%; max-width: 260px; text-align: center; }

    .card-overlay { padding: 16px 12px; gap: 14px; }
    .card-actions { flex-direction: column; gap: 8px; }
    .card-actions .btn { width: 100%; }
}

