:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-2: #0ea5e9;
    --good: #4ade80;
    --warn: #facc15;
    --bad: #f87171;
    --record: #ef4444;
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

.topbar {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: 44px 1fr 64px;
    align-items: center;
    padding: env(safe-area-inset-top, 0) 12px 8px;
    padding-top: calc(env(safe-area-inset-top, 0) + 8px);
    background: var(--bg);
    z-index: 10;
    border-bottom: 1px solid var(--surface);
}
.topbar h1 {
    margin: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.icon-btn {
    background: none;
    border: 0;
    color: var(--accent);
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
}
.progress {
    text-align: right;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}

.screen {
    padding: 16px 12px 64px;
    max-width: 720px;
    margin: 0 auto;
}

.card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.15s, transform 0.05s;
}
.card:active { transform: scale(0.99); }
.card:hover { border-color: var(--surface-2); }
.card .title {
    font-weight: 600;
    margin-bottom: 4px;
}
.card .meta {
    color: var(--muted);
    font-size: 13px;
}
.card .es {
    font-size: 17px;
    font-weight: 500;
}
.card .ru {
    color: var(--muted);
    font-size: 14px;
    margin-top: 2px;
}

.subgroup-label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 14px 4px 6px;
}

.practice {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.phrase-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 18px;
    text-align: center;
    border: 1px solid var(--surface-2);
}
.phrase-card .es {
    font-size: 26px;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.25;
}
.phrase-card .ru {
    color: var(--muted);
    font-size: 16px;
    margin: 0;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.05s, opacity 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #082f49; }
.btn-secondary { background: var(--accent-2); color: #082f49; }
.btn-record { background: var(--surface-2); }
.btn-record.is-recording {
    background: var(--record);
    animation: pulse 1.2s infinite;
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--surface-2);
    color: var(--text);
}

.nav-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.status {
    text-align: center;
    color: var(--muted);
    min-height: 1.2em;
    font-size: 14px;
}
.status.error { color: var(--bad); }

.result {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    border-left: 4px solid var(--accent);
}
.result.good { border-left-color: var(--good); }
.result.ok { border-left-color: var(--warn); }
.result.bad { border-left-color: var(--bad); }

.score {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}
.heard {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 14px;
}
.heard em { color: var(--text); font-style: normal; }
.feedback { margin: 0; font-size: 15px; line-height: 1.5; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
