*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

:root {
    --coral: #FF6F61;
    --pink: #DE4DAA;
    --teal: #4ECDC4;
    --bg: #FFF7F0;
    --card: #fff;
    --text: #2D2235;
    --muted: #8A7F94;
    --light: #B0A3BE;
    --border: #EDE8F3;
    --input-bg: #FAF8FD;
    --hover: #F3EFF8;
    --gradient: linear-gradient(135deg, var(--coral), var(--pink));
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    background-image: radial-gradient(circle at 15% 85%, #FFE8D6 0%, transparent 45%),
                      radial-gradient(circle at 85% 15%, #E8DDFF 0%, transparent 45%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    padding-top: calc(2rem + env(safe-area-inset-top, 0px));
    overflow-x: hidden;
}
body.has-nav { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }

.app { width: 100%; max-width: 480px; }

.logo { text-align: center; margin-bottom: 0.5rem; }
.logo span {
    font-size: 1.7rem; font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; letter-spacing: -0.02em;
}
.logo-sub { text-align: center; font-size: 0.8rem; color: var(--light); font-weight: 600; margin-bottom: 1.5rem; }

.card {
    background: var(--card); border-radius: 20px; padding: 1.5rem;
    margin-bottom: 1rem; box-shadow: 0 2px 12px rgba(45,34,53,0.05);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.card h2 {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--light); font-weight: 700; margin-bottom: 0;
}
.card h2.mb { margin-bottom: 0.75rem; }

label {
    display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--light); margin-bottom: 0.3rem;
}
input, select, textarea {
    width: 100%; padding: 0.65rem 0.85rem; border: 2px solid var(--border);
    border-radius: 13px; font-size: 1rem; font-family: 'Nunito', sans-serif;
    font-weight: 600; background: var(--input-bg); color: var(--text); transition: border-color 0.15s;
}
input::placeholder, textarea::placeholder { color: #C8BFD4; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--coral); background: #fff; }
textarea { resize: vertical; min-height: 60px; font-size: 1rem; }
.field { margin-bottom: 0.85rem; }

button {
    font-family: 'Nunito', sans-serif; font-size: 0.92rem; font-weight: 700;
    border: none; border-radius: 13px; padding: 0.65rem 1.2rem;
    cursor: pointer; transition: all 0.15s;
}
.btn { background: var(--gradient); color: #fff; }
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-g { background: var(--teal); color: #fff; }
.btn-g:hover { background: #44B09E; }
.btn-g:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-s { background: var(--hover); color: #6B5F7A; }
.btn-s:hover { background: #EAE4F2; }
.btn-sm { font-size: 0.7rem; padding: 0.3rem 0.7rem; border-radius: 8px; }
.btn-row { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.btn-row button { flex: 1; }

.hidden { display: none !important; }
.tab-hidden { display: none !important; }

.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 7px;
}
.badge-ok { background: #E6FAF8; color: #2D9F93; }
.badge-warn { background: #FFF3E0; color: #E67E22; }
.badge-err { background: #FFEFED; color: var(--coral); }
.badge-tonie { background: var(--gradient); color: #fff; }

.empty { text-align: center; color: var(--light); padding: 2rem 1rem; font-size: 0.9rem; font-weight: 600; }

/* ── Bottom nav ── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; align-items: flex-end; justify-content: space-around;
    background: var(--card);
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    z-index: 100;
    box-shadow: 0 -1px 16px rgba(45,34,53,0.07);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.nav-tab {
    flex: 1; text-align: center;
    padding: 1rem 1.5rem; background: none; border: none;
    font-family: 'Nunito', sans-serif; font-size: 0.8rem; font-weight: 800;
    color: var(--light); cursor: pointer; transition: color 0.15s; letter-spacing: 0.01em;
}
.nav-tab:hover { color: var(--muted); }
.nav-tab.active { color: var(--coral); }
.nav-fab {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--gradient); border: none;
    display: grid; place-items: center;
    cursor: pointer; transition: transform 0.15s;
    padding: 0; margin-top: -22px; margin-bottom: 10px; flex-shrink: 0;
    overflow: hidden; box-sizing: border-box;
    -webkit-appearance: none; appearance: none;
    line-height: 1;
    box-shadow: 0 4px 16px rgba(222,77,170,0.3);
    position: relative; z-index: 102;
}
.nav-fab:hover { transform: translateY(-2px); }
.nav-fab:active { transform: translateY(0); }
.nav-fab img {
    width: 36px; height: 36px; object-fit: contain;
    display: block;
}

/* ── Record button ── */
.record-area { display: flex; flex-direction: column; align-items: center; padding: 1.25rem 0; }
.record-btn {
    width: 100px; height: 100px; border-radius: 50%;
    border: 5px solid var(--border); background: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.record-btn:hover { border-color: var(--coral); }
.record-btn .dot {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gradient); transition: all 0.2s;
}
.record-btn.recording { border-color: var(--coral); animation: rec-pulse 1.5s ease-out infinite; }
.record-btn.recording .dot { width: 30px; height: 30px; border-radius: 8px; }
.record-btn.paused { border-color: var(--pink); }
.record-btn.paused .dot {
    width: 0; height: 0; border-radius: 0; background: none;
    border-left: 22px solid var(--pink);
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    margin-left: 6px;
}

@keyframes rec-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255,111,97,0.35); }
    100% { box-shadow: 0 0 0 18px rgba(255,111,97,0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.rec-timer, .timer {
    margin-top: 0.7rem; font-size: 1.7rem; font-weight: 800;
    font-variant-numeric: tabular-nums; color: var(--text);
}
.rec-timer.recording, .timer.recording { color: var(--coral); }
.rec-hint, .hint { font-size: 0.8rem; color: var(--light); margin-top: 0.25rem; font-weight: 600; }

.status {
    text-align: center; font-size: 0.88rem; font-weight: 600;
    margin-top: 0.75rem; min-height: 1.4em;
}
.status.error { color: var(--coral); }
.status.success { color: var(--teal); }

.generating-spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.section-label {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--light);
    text-align: center; margin-bottom: 0.5rem; margin-top: 0.5rem;
}

/* ── Shared page styles ── */

.welcome-hero { text-align: center; padding: 2rem 0.5rem 0.5rem; }
.welcome-logo { width: 120px; height: 120px; object-fit: contain; margin-bottom: 0.75rem; }
.welcome-hero h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 0.5rem; }
.welcome-hero p { color: var(--muted); font-size: 0.9rem; font-weight: 600; line-height: 1.55; }
.welcome-card { display: flex; flex-direction: column; gap: 0.65rem; }
.welcome-btn { width: 100%; padding: 0.85rem 1.25rem; font-size: 1rem; }
.btn-submit { background: var(--gradient); color: #fff; }
.btn-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--hover); color: #6B5F7A; border-radius: 13px; }
.btn-secondary:hover { background: #EAE4F2; }

.steps { display: flex; flex-direction: column; gap: 1rem; }
.step { display: flex; align-items: flex-start; gap: 0.85rem; }
.step-num {
    width: 32px; height: 32px; border-radius: 50%; background: var(--gradient);
    color: #fff; font-size: 0.85rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-content { display: flex; flex-direction: column; gap: 0.15rem; }
.step-content strong { font-size: 0.95rem; color: var(--text); }
.step-content span { font-size: 0.85rem; color: var(--muted); font-weight: 600; line-height: 1.5; }

.info-icon { width: 40px; height: 40px; color: var(--coral); margin: 0 auto 0.75rem; }
.info-icon svg { width: 100%; height: 100%; }
.info-steps { text-align: left; display: flex; flex-direction: column; gap: 0.75rem; }
.info-step { display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1.5; }
.info-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--gradient); color: #fff; font-size: 0.8rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.landing-footer { text-align: center; font-size: 0.8rem; color: var(--light); font-weight: 600; padding: 1.5rem 0 0.5rem; }
.landing-footer span { font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1rem; margin-top: 0.6rem; }
.footer-links a { color: var(--light); text-decoration: none; font-size: 0.78rem; font-weight: 700; transition: color 0.15s; }
.footer-links a:hover { color: var(--coral); }
