/* =========================================================
   Will I Win Today — ChatGPT-inspired design system
   Clean, minimal, generous whitespace, pill buttons
   ========================================================= */

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

:root {
    /* Surface & Background — clean white */
    --bg:           #ffffff;
    --bg-elevated:  #ffffff;
    --surface:      #f7f7f8;
    --surface-hover:#ececee;
    --border:       rgba(0,0,0,.08);
    --border-mid:   rgba(0,0,0,.14);

    /* Text */
    --text-primary:   #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary:  #8e8e8e;
    --text-inverse:   #ffffff;

    /* Accent — OpenAI green */
    --accent:        #10a37f;
    --accent-hover:  #0d8a6a;
    --accent-subtle: rgba(16,163,127,.08);

    /* Semantic */
    --positive:      #10a37f;
    --positive-bg:   rgba(16,163,127,.08);
    --negative:      #e03e3e;
    --negative-bg:   rgba(224,62,62,.07);
    --neutral:       #5b6abf;
    --neutral-bg:    rgba(91,106,191,.07);
    --gold:          #c8940a;
    --gold-bg:       rgba(200,148,10,.07);

    /* Radii — generous like ChatGPT */
    --radius-sm:  8px;
    --radius-md:  16px;
    --radius-lg:  24px;
    --radius-xl:  9999px;   /* pill */

    /* Spacing scale */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
    --sp-9: 48px;
    --sp-10: 64px;

    /* Typography */
    --font: 'Söhne', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Söhne Mono', ui-monospace, 'Cascadia Code', 'Menlo', monospace;

    /* Shadows — softer for light bg */
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.1);

    /* Transitions */
    --ease: cubic-bezier(.4,0,.2,1);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    font-size: 16px;
}

/* ===== Starfield canvas ===== */
#starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .18;
}

/* ===== Layout container ===== */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: var(--sp-10) var(--sp-6) var(--sp-10);
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    margin-bottom: var(--sp-9);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--accent-subtle);
    font-size: 28px;
    color: var(--accent);
    margin-bottom: var(--sp-5);
}

.hero h1 {
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin-bottom: var(--sp-3);
    color: var(--text-primary);
}

.hero h1 .gold { color: var(--accent); }

.subtitle {
    font-size: .95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
}

.desc {
    font-size: .875rem;
    color: var(--text-tertiary);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-7);
    box-shadow: var(--shadow-sm);
}

/* ===== FORM ===== */
.form-card { margin-bottom: var(--sp-8); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
    margin-bottom: var(--sp-7);
}

.form-group label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-2);
}

.form-group select {
    width: 100%;
    height: 44px;
    padding: 0 var(--sp-4);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--text-primary);
    font-size: .9rem;
    font-family: var(--font);
    appearance: none;
    cursor: pointer;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 5 5-5' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ===== Text input (same style as select) ===== */
.text-input {
    width: 100%;
    height: 44px;
    padding: 0 var(--sp-4);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--text-primary);
    font-size: .9rem;
    font-family: var(--font);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.text-input::placeholder { color: var(--text-tertiary); }

.text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ===== Autocomplete ===== */
.form-group-autocomplete { position: relative; }

.autocomplete-wrapper { position: relative; }

.suggestions-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.suggestions-dropdown.open { display: block; }

.suggestion-item {
    padding: var(--sp-3) var(--sp-4);
    font-size: .85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .12s var(--ease);
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
}

.suggestion-item:last-child { border-bottom: none; }

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--surface);
    color: var(--text-primary);
}

.suggestion-item .suggestion-main {
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-item .suggestion-sub {
    font-size: .75rem;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.suggestion-loading {
    padding: var(--sp-3) var(--sp-4);
    font-size: .8rem;
    color: var(--text-tertiary);
    text-align: center;
}

.locate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    height: 44px;
    padding: 0 var(--sp-4);
    border: 1px dashed var(--border-mid);
    border-radius: var(--radius-xl);
    background: transparent;
    color: var(--text-secondary);
    font-size: .875rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all .2s var(--ease);
}

.locate-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.locate-btn.located {
    border-style: solid;
    border-color: var(--positive);
    color: var(--positive);
    background: var(--positive-bg);
}

.locate-icon { font-size: 1rem; }

.location-info {
    font-size: .75rem;
    color: var(--text-tertiary);
    margin-top: var(--sp-1);
    padding-left: var(--sp-4);
    min-height: 1.1em;
}

/* Primary CTA — pill button */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background .2s var(--ease), transform .1s var(--ease), box-shadow .2s var(--ease);
    box-shadow: var(--shadow-sm);
}

.submit-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.submit-btn:active { transform: scale(.985); }

.submit-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESULT SECTION ===== */
.result-section { margin-top: var(--sp-8); }

.result-card {
    animation: fadeUp .5s var(--ease);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-header {
    text-align: center;
    padding-bottom: var(--sp-6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-7);
}

.result-emoji {
    font-size: 56px;
    margin-bottom: var(--sp-3);
}

.result-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: var(--sp-1);
}

.result-verdict {
    font-size: .925rem;
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.55;
}

/* ===== Score Ring ===== */
.score-ring-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto var(--sp-8);
}

.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-ring-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 10;
}

.score-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 534;
    stroke-dashoffset: 534;
    transition: stroke-dashoffset 1.4s var(--ease);
}

.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#scoreNumber {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.score-pct {
    font-size: 1rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.score-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-tertiary);
    margin-top: var(--sp-1);
}

/* ===== Details Grid ===== */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
    margin-bottom: var(--sp-7);
}

.detail-box {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    border: 1px solid var(--border);
    transition: border-color .2s var(--ease);
}

.detail-box:hover { border-color: var(--border-mid); }

.detail-box-wide { grid-column: 1 / -1; }

.detail-icon {
    font-size: 20px;
    margin-bottom: var(--sp-2);
    opacity: .7;
}

.detail-box h3 {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-3);
}

.detail-box p {
    font-size: .875rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ===== BaZi Pillar Grid ===== */
.bazi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-2);
    text-align: center;
}

.bazi-pillar {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: var(--sp-3) var(--sp-1);
}

.bazi-pillar .stem {
    font-size: 1.15rem;
    font-weight: 700;
    display: block;
    line-height: 1.3;
}

.bazi-pillar .branch {
    font-size: 1.15rem;
    display: block;
    line-height: 1.3;
}

.bazi-pillar .label {
    font-size: .6rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .04em;
    display: block;
    margin-top: var(--sp-1);
}

/* ===== Five Elements Bars ===== */
.elements-bar-group { display: flex; flex-direction: column; gap: var(--sp-2); }

.element-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: .8rem;
}

.element-name {
    width: 46px;
    text-align: right;
    font-weight: 600;
    flex-shrink: 0;
    font-size: .75rem;
}

.element-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,.06);
    border-radius: 3px;
    overflow: hidden;
}

.element-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s var(--ease);
}

.element-count {
    width: 18px;
    font-size: .7rem;
    color: var(--text-tertiary);
    text-align: left;
}

/* ===== Analysis / Advice sections ===== */
.analysis-section,
.advice-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--sp-6);
    border: 1px solid var(--border);
    margin-bottom: var(--sp-5);
}

.analysis-section h3,
.advice-section h3 {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: var(--sp-4);
}

.analysis-list { list-style: none; }

.analysis-list li {
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.analysis-list li:last-child { border-bottom: none; }

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-xl);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: var(--sp-2);
    vertical-align: middle;
}

.tag.positive { background: var(--positive-bg); color: var(--positive); }
.tag.negative { background: var(--negative-bg); color: var(--negative); }
.tag.neutral  { background: var(--neutral-bg);  color: var(--neutral);  }

.advice-content p {
    font-size: .875rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
}

.lucky-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-4);
}

.lucky-chip {
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-xl);
    font-size: .8rem;
    font-weight: 600;
    background: var(--gold-bg);
    color: var(--gold);
    border: 1px solid rgba(200,148,10,.15);
    white-space: nowrap;
}

/* ===== Result Actions ===== */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-top: var(--sp-2);
}

/* ===== Share Button — solid pill ===== */
.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    height: 48px;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--accent);
    color: #fff;
    font-size: .925rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all .25s var(--ease);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.share-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.share-btn:active { transform: scale(.985); }

.share-btn-icon { font-size: 1.05rem; }

.share-btn.copied {
    background: #1b8a3e;
    pointer-events: none;
}

.share-btn.copied .share-btn-icon::before {
    content: '\2713';
}

/* ===== Retry Button — ghost pill ===== */
.retry-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-xl);
    background: transparent;
    color: var(--text-secondary);
    font-size: .925rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all .2s var(--ease);
    margin-top: var(--sp-2);
}

.retry-btn:hover {
    border-color: var(--text-tertiary);
    background: var(--surface);
    color: var(--text-primary);
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: var(--sp-8);
    margin-bottom: var(--sp-9);
    padding: var(--sp-5) 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: .72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: var(--sp-1);
}

/* ===== Form Header ===== */
.form-header {
    margin-bottom: var(--sp-6);
}

.form-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: var(--sp-1);
    color: var(--text-primary);
}

.form-desc {
    font-size: .85rem;
    color: var(--text-tertiary);
    line-height: 1.55;
}

.form-note {
    text-align: center;
    font-size: .75rem;
    color: var(--text-tertiary);
    margin-top: var(--sp-4);
}

/* ===== Generic Section ===== */
.section {
    margin-top: var(--sp-10);
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--sp-2);
    color: var(--text-primary);
}

.section-desc {
    font-size: .875rem;
    color: var(--text-tertiary);
    text-align: center;
    max-width: 500px;
    margin: 0 auto var(--sp-7);
    line-height: 1.6;
}

/* ===== How It Works ===== */
.steps-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-4);
}

.step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-6);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.step-card:hover {
    border-color: var(--border-mid);
    box-shadow: var(--shadow-md);
}

.step-number {
    font-size: .7rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: var(--sp-3);
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--sp-2);
    color: var(--text-primary);
}

.step-card p {
    font-size: .85rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ===== Features Grid ===== */
.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.feature-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.feature-item:hover {
    border-color: var(--border-mid);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 22px;
    margin-bottom: var(--sp-2);
    opacity: .75;
}

.feature-item h3 {
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: var(--sp-2);
    color: var(--text-primary);
}

.feature-item p {
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== FAQ ===== */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.faq-item {
    border-bottom: 1px solid var(--border);
    padding: var(--sp-5) 0;
}

.faq-item:first-child {
    border-top: 1px solid var(--border);
}

.faq-item summary {
    font-size: .925rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    transition: color .2s var(--ease);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: transform .2s var(--ease);
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item summary:hover { color: var(--accent); }

.faq-item p {
    font-size: .85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: var(--sp-3);
    padding-right: var(--sp-7);
}

/* ===== Footer (enhanced) ===== */
.footer {
    text-align: center;
    margin-top: var(--sp-10);
    padding-top: var(--sp-7);
    border-top: 1px solid var(--border);
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}

.footer-logo {
    font-size: 1.1rem;
    color: var(--accent);
}

.footer-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-copy {
    font-size: .78rem;
    color: var(--text-tertiary);
    max-width: 460px;
    margin: 0 auto var(--sp-4);
    line-height: 1.6;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--sp-2);
    font-size: .75rem;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-4);
}

.footer-disclaimer {
    font-size: .72rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: var(--sp-3);
}

.footer-copyright {
    font-size: .7rem;
    color: var(--text-tertiary);
    opacity: .7;
}

/* ==========================================================
   RESPONSIVE — Desktop / Tablet / Mobile
   ========================================================== */

/* Large desktop (1200+) */
@media (min-width: 1200px) {
    .container {
        max-width: 720px;
        padding: 80px var(--sp-6) 80px;
    }
}

/* Tablet landscape (992 – 1199) */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 680px;
        padding: 64px var(--sp-6) 64px;
    }
}

/* Tablet portrait (768 – 991) */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 600px;
        padding: var(--sp-9) var(--sp-6);
    }

    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-4);
    }

    .details-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-3);
    }
}

/* Mobile large (481 – 767) */
@media (max-width: 767px) {
    .container {
        padding: var(--sp-7) var(--sp-4) var(--sp-8);
    }

    .hero { margin-bottom: var(--sp-7); }
    .hero h1 { font-size: 1.65rem; }

    .card { padding: var(--sp-6); }

    .form-grid,
    .details-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-3);
    }

    .features-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-3);
    }

    .detail-box { padding: var(--sp-4); }
    .result-title { font-size: 1.35rem; }

    .score-ring-wrapper { width: 160px; height: 160px; }
    #scoreNumber { font-size: 2.2rem; }

    .stats-bar { gap: var(--sp-6); }
    .stat-value { font-size: 1.3rem; }

    .section { margin-top: var(--sp-9); }
    .section-title { font-size: 1.2rem; }
}

/* Mobile small (≤ 480) */
@media (max-width: 480px) {
    .container {
        padding: var(--sp-5) var(--sp-3) var(--sp-7);
    }

    .hero h1 { font-size: 1.45rem; }
    .desc { font-size: .81rem; }

    .card {
        padding: var(--sp-5);
        border-radius: var(--radius-md);
    }

    .form-grid,
    .details-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-3);
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-3);
    }

    .stats-bar {
        gap: var(--sp-4);
    }

    .stat-value { font-size: 1.15rem; }
    .stat-label { font-size: .65rem; }

    .bazi-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--sp-1);
    }

    .bazi-pillar .stem,
    .bazi-pillar .branch { font-size: 1rem; }

    .analysis-section,
    .advice-section { padding: var(--sp-5); }

    .submit-btn { height: 48px; font-size: .925rem; }

    .score-ring-wrapper { width: 140px; height: 140px; }
    #scoreNumber { font-size: 2rem; }

    .result-emoji { font-size: 44px; }
    .result-title { font-size: 1.2rem; }
    .result-verdict { font-size: .85rem; }

    .section { margin-top: var(--sp-8); }
    .section-title { font-size: 1.1rem; }
    .section-desc { font-size: .8rem; }

    .step-card { padding: var(--sp-5); }
    .feature-item { padding: var(--sp-4); }

    .faq-item summary { font-size: .85rem; }
    .faq-item p { font-size: .8rem; padding-right: var(--sp-4); }

    .footer-links { flex-wrap: wrap; justify-content: center; }
}

/* Shake animation for validation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}
