/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d0d0d;
    --surface:   #161616;
    --border:    #2a2a2a;
    --accent:    #e8c547;
    --accent2:   #c47a3a;
    --text:      #f0ece0;
    --muted:     #7a7060;
    --error:     #e05555;
    --radius:    16px;
    --font-head: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 300;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

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

/* ── Layout ── */
.container {
    width: 100%;
    max-width: 640px;
    position: relative;
    z-index: 1;
}

/* ── Header ── */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-tag {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    color: var(--accent);
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeUp 0.6s 0.1s ease forwards;
}

h1 {
    font-family: var(--font-head);
    font-size: clamp(3.5rem, 12vw, 6rem);
    font-weight: 900;
    line-height: 0.9;
    color: var(--text);
    letter-spacing: -0.02em;
    opacity: 0;
    animation: fadeUp 0.6s 0.2s ease forwards;
}

h1 span {
    color: var(--accent);
    font-style: italic;
}

.subtitle {
    margin-top: 1.2rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0;
    animation: fadeUp 0.6s 0.35s ease forwards;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    opacity: 0;
    animation: fadeUp 0.6s 0.45s ease forwards;
}

/* ── Input Card ── */
.input-card label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

input[type="date"] {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.85rem 1rem;
    outline: none;
    transition: border-color 0.2s;
    color-scheme: dark;
}

input[type="date"]:focus {
    border-color: var(--accent);
}

#calculateBtn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #0d0d0d;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    padding: 0.85rem 1.4rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

#calculateBtn:hover { background: #f0d060; transform: translateY(-1px); }
#calculateBtn:active { transform: translateY(0); }

#calculateBtn svg {
    width: 16px; height: 16px;
    transition: transform 0.2s;
}

#calculateBtn:hover svg { transform: translateX(3px); }

.error-msg {
    color: var(--error);
    font-size: 0.82rem;
    margin-top: 0.6rem;
    min-height: 1.1rem;
}

/* ── Results ── */
.results-grid {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.results-grid.hidden { display: none; }

/* Main age result */
.result-main {
    text-align: center;
    animation-delay: 0.1s !important;
}

.age-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 0.5rem;
}

.age-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.age-num {
    font-family: var(--font-head);
    font-size: clamp(2.8rem, 10vw, 4.5rem);
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.03em;
}

.age-label {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted);
    margin-top: 0.3rem;
}

.divider {
    font-family: var(--font-head);
    font-size: 2.5rem;
    color: var(--border);
    line-height: 1;
    margin-bottom: 1.5rem;
}

.result-caption {
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.stat-card {
    text-align: center;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    animation-delay: 0.2s !important;
}

.stat-icon { font-size: 1.3rem; }

.stat-num {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

/* Info card */
.info-card {
    animation-delay: 0.3s !important;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
}

.info-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.divider-h {
    height: 1px;
    background: var(--border);
}

/* ── Footer ── */
footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--muted);
    opacity: 0;
    animation: fadeUp 0.6s 0.6s ease forwards;
}

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.results-grid .card {
    animation: fadeUp 0.45s ease forwards;
    opacity: 0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .input-wrapper { flex-direction: column; }
    #calculateBtn { width: 100%; justify-content: center; }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .stat-num { font-size: 1.2rem; }
    .divider { font-size: 1.8rem; }
}