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

:root {
    --blue: #1769ff;
    --blue-dark: #0d47c9;
    --blue-light: #eaf2ff;
    --text: #132238;
    --muted: #7b8798;
    --background: #f5f8fc;
    --card: #ffffff;
    --green: #16b87f;
    --yellow: #f4b740;
    --red: #ef5363;
    --border: #e8edf4;
    --radius: 20px;
}

html, body {
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
}

input {
    font-family: inherit;
}

#app {
    min-height: 100vh;
    max-width: 430px;
    margin: 0 auto;
    background: var(--background);
    position: relative;
    overflow-x: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding-bottom: 90px;
}

.screen.active {
    display: block;
}

.topbar {
    height: 72px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #153b9b 0 33%,
        white 33% 66%,
        #ed2939 66%
    );
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.flag.is-en,
.mini-flag.is-en {
    background: linear-gradient(
        180deg,
        #012169 0 33%,
        white 33% 66%,
        #c8102e 66%
    );
}

.flag.is-es,
.mini-flag.is-es {
    background: linear-gradient(
        180deg,
        #c60b1e 0 25%,
        #ffc400 25% 75%,
        #c60b1e 75%
    );
}

.brand strong {
    font-size: 18px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f6fa;
    font-size: 18px;
}

.content {
    max-width: 520px;
    margin: auto;
    padding: 20px;
}

.greeting {
    margin: 8px 0 20px;
}

.greeting h1 {
    font-size: 25px;
    line-height: 1.2;
    margin-bottom: 6px;
}

.greeting p {
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 5px 20px rgba(31, 56, 88, .04);
}

.main-level-card {
    background: linear-gradient(135deg, #ffffff, #f5f9ff);
    position: relative;
    overflow: hidden;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 3px;
}

.level-number {
    color: var(--blue);
    font-size: 36px;
    font-weight: 800;
}

.mini-flag {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #153b9b 0 33%,
        white 33% 66%,
        #ed2939 66%
    );
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #e9eef5;
    border-radius: 99px;
    overflow: hidden;
    margin: 12px 0 6px;
}

.progress-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 99px;
    transition: width .5s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--muted);
}

.primary-button {
    width: 100%;
    height: 48px;
    border-radius: 13px;
    background: var(--blue);
    color: white;
    font-size: 15px;
    font-weight: 700;
    margin-top: 15px;
    transition: .2s;
}

.primary-button:active {
    transform: scale(.98);
}

.secondary-button {
    width: 100%;
    height: 46px;
    border-radius: 13px;
    background: white;
    border: 1px solid #dce4ef;
    color: var(--text);
    font-weight: 600;
    margin-top: 10px;
}

.account-actions {
    margin-top: 28px;
    padding-bottom: 12px;
}

.danger-button {
    width: 100%;
    height: 46px;
    border-radius: 13px;
    background: #fff5f6;
    border: 1px solid #ffd0d5;
    color: #d93346;
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
}

.stat {
    padding: 17px 8px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.stat:last-child {
    border-right: none;
}

.stat-icon {
    font-size: 20px;
    margin-bottom: 5px;
}

.stat strong {
    display: block;
    font-size: 16px;
}

.stat span {
    color: var(--muted);
    font-size: 11px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 22px 2px 12px;
}

.section-title h2 {
    font-size: 17px;
}

.problem {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.problem:last-child {
    border-bottom: none;
}

.problem-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.red {
    background: var(--red);
}

.yellow {
    background: var(--yellow);
}

.problem-text {
    flex: 1;
    font-size: 14px;
}

.arrow {
    color: #a1adbc;
}

.page-title {
    margin: 10px 0 5px;
    font-size: 25px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.lesson {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 17px;
    margin-bottom: 10px;
    transition: .2s;
}

.lesson:active {
    transform: scale(.98);
}

.lesson-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--blue-light);
    font-size: 20px;
}

.lesson.locked {
    opacity: .55;
}

.lesson-info {
    flex: 1;
}

.lesson-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.lesson-info span {
    font-size: 12px;
    color: var(--muted);
}

.lesson-status {
    color: var(--green);
    font-size: 18px;
}

.exercise-screen {
    background: white;
}

.exercise-header {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.back {
    font-size: 22px;
    background: none;
}

.exercise-header-info {
    flex: 1;
}

.exercise-header-info strong {
    display: block;
    font-size: 13px;
}

.exercise-header-info span {
    color: var(--muted);
    font-size: 11px;
}

.exercise-body {
    max-width: 520px;
    margin: auto;
    padding: 24px 20px;
}

.instruction {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: 12px 0 18px;
}

.phrase-card {
    padding: 24px 18px;
    background: #f8fbff;
    border: 1px solid #e4edfa;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.phrase {
    font-size: 23px;
    font-weight: 750;
    line-height: 1.35;
    margin-bottom: 8px;
}

.translation {
    color: var(--muted);
    font-size: 14px;
}

.listen-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
    margin-top: 18px;
}

.speed-selector {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 15px 0 28px;
}

.speed {
    padding: 7px 14px;
    border-radius: 20px;
    color: var(--muted);
    font-size: 12px;
    background: #f3f6fa;
}

.speed.selected {
    background: var(--blue);
    color: white;
}

.microphone-area {
    text-align: center;
}

.microphone {
    width: 125px;
    height: 125px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2680ff, #0e5ee9);
    color: white;
    font-size: 42px;
    box-shadow:
        0 15px 35px rgba(23, 105, 255, .28),
        inset 0 2px 3px rgba(255,255,255,.2);
    position: relative;
    transition: .25s;
}

.microphone::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid #dceaff;
    pointer-events: none;
}

.microphone.play {
    font-size: 46px;
    padding-left: 6px;
}

.microphone.playing {
    animation: pulse-blue 1.1s infinite;
    font-size: 42px;
    padding-left: 0;
}

.microphone.recording {
    animation: pulse 1.1s infinite;
    background: linear-gradient(145deg, #ef5363, #d93346);
}

.microphone.error {
    background: linear-gradient(145deg, #ef5363, #d93346);
    box-shadow:
        0 15px 35px rgba(239, 83, 99, .3),
        inset 0 2px 3px rgba(255,255,255,.2);
}

.microphone.error::after {
    border-color: #ffd0d5;
}

.microphone.retry {
    background: linear-gradient(145deg, #f4b740, #e09a1c);
    box-shadow:
        0 15px 35px rgba(244, 183, 64, .32),
        inset 0 2px 3px rgba(255,255,255,.2);
}

.microphone.retry::after {
    border-color: #ffe7b0;
}

.microphone.ok {
    background: linear-gradient(145deg, #16b87f, #0e9a68);
    box-shadow:
        0 15px 35px rgba(22, 184, 127, .28),
        inset 0 2px 3px rgba(255,255,255,.2);
}

.microphone.ok::after {
    border-color: #c8f3e2;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239,83,99,.3);
    }
    70% {
        box-shadow: 0 0 0 25px rgba(239,83,99,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239,83,99,0);
    }
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(23,105,255,.32);
    }
    70% {
        box-shadow: 0 0 0 25px rgba(23,105,255,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(23,105,255,0);
    }
}

.mic-label {
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
}

.result {
    display: none;
    margin-top: 30px;
}

.result.visible {
    display: block;
    animation: appear .35s ease;
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.score-circle {
    width: 125px;
    height: 125px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, white 60%, transparent 61%),
        conic-gradient(var(--green) 0 0%, #e7edf3 0% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-circle strong {
    font-size: 29px;
}

.score-circle span {
    font-size: 12px;
    color: var(--muted);
}

.score-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.metrics {
    display: grid;
    gap: 11px;
    margin-top: 18px;
}

.metric {
    display: flex;
    align-items: center;
    gap: 10px;
}

.metric-name {
    width: 80px;
    font-size: 12px;
}

.metric-track {
    flex: 1;
    height: 7px;
    border-radius: 20px;
    background: #edf1f5;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    border-radius: 20px;
    background: var(--blue);
}

.metric-value {
    width: 30px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
}

.teacher {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    padding: 15px;
    background: #f7faff;
    border-radius: 16px;
    border: 1px solid #e3edfc;
}

.teacher-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e8f1ff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
}

.teacher-message strong {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}

.teacher-message p {
    color: #5c6877;
    font-size: 13px;
    line-height: 1.5;
}

#conversation.screen {
    overflow-x: hidden;
}

#conversation .content {
    max-width: 100%;
    padding-bottom: 240px;
}

#conversation .brand {
    min-width: 0;
    flex: 1;
}

#conversation .brand strong {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 8px;
    max-width: 100%;
}

.message {
    max-width: 82%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
}

.message.ai {
    background: white;
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.message.user {
    background: var(--blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.conversation-top {
    margin-bottom: 14px;
    max-width: 100%;
}

.topic-list {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.topic-list::-webkit-scrollbar {
    display: none;
}

.level-hint {
    margin: 0 0 4px;
    font-size: 12px;
    color: var(--muted);
}

.topic {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 13px;
    border-radius: 20px;
    background: white;
    border: 1px solid var(--border);
    font-size: 12px;
}

.topic.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.chat-input {
    position: fixed;
    z-index: 8;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: min(430px, calc(100% - 24px));
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 8px;
    display: flex;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.voice-dock {
    flex-direction: column;
    align-items: center;
    padding: 10px 12px 12px;
    gap: 6px;
}

.chat-mic {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.chat-mic::after {
    inset: -6px;
    pointer-events: none;
}

.voice-dock .mic-label {
    margin-top: 0;
}

.message.fix {
    background: #fff7e6;
    border-color: #ffe7b0;
}

.message.fix strong {
    display: block;
    margin-bottom: 6px;
}

.chat-input input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px;
    font-size: 16px;
}

.chat-send {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--blue);
    color: white;
}

.big-progress {
    text-align: center;
    padding: 25px;
}

.big-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--blue);
}

.skill {
    margin-bottom: 18px;
}

.skill-head {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 7px;
}

.profile-header {
    text-align: center;
    padding: 15px 0 25px;
}

.profile-avatar {
    width: 85px;
    height: 85px;
    margin: auto;
    border-radius: 50%;
    background: linear-gradient(145deg, #dbe9ff, #edf4ff);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 42px;
}

.profile-header h2 {
    margin-top: 12px;
}

.profile-header p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    background: none;
    color: inherit;
    text-align: left;
}

.setting:last-child {
    border-bottom: none;
}

.bottom-nav {
    position: fixed;
    z-index: 100;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.nav-inner {
    width: 100%;
    max-width: 520px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

.nav-item {
    background: none;
    color: #9aa6b5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.nav-item span:first-child {
    font-size: 20px;
}

.nav-item.active {
    color: var(--blue);
    font-weight: 700;
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 0 14px;
    font-size: 16px;
    background: white;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #5c6877;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.password-toggle svg {
    width: 22px;
    height: 22px;
}

.password-toggle .eye-off {
    display: none;
}

.password-toggle.is-on .eye-on {
    display: none;
}

.password-toggle.is-on .eye-off {
    display: block;
}

.flag,
.flag-img,
.mini-flag,
.mini-flag-img {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    max-width: 34px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #153b9b 0 33%,
        white 33% 66%,
        #ed2939 66%
    );
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.mini-flag,
.mini-flag-img {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    max-width: 48px;
}

.flag.is-en,
.mini-flag.is-en {
    background: linear-gradient(
        180deg,
        #012169 0 33%,
        white 33% 66%,
        #c8102e 66%
    );
}

.flag.is-es,
.mini-flag.is-es {
    background: linear-gradient(
        180deg,
        #c60b1e 0 25%,
        #ffc400 25% 75%,
        #c60b1e 75%
    );
}

.avatar {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    max-width: 72px;
    border-radius: 50%;
    background: linear-gradient(145deg, #dbe9ff, #edf4ff);
    color: var(--blue);
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 800;
}

.avatar.sm {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    max-width: 42px;
    font-size: 20px;
}

.avatar.lg {
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
    max-width: 88px;
    font-size: 36px;
    margin: 0 auto;
}

.topbar.is-soft {
    background: transparent;
    border-bottom: none;
}

.avatar-edit.small {
    width: 88px;
    height: 88px;
    margin: 0 auto 12px;
}

.avatar-edit.small .avatar-face {
    width: 88px;
    height: 88px;
    max-width: 88px;
}

.avatar-edit {
    position: relative;
    display: block;
    width: 108px;
    height: 108px;
    margin: 28px auto 28px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}

.avatar-face {
    width: 108px;
    height: 108px;
    max-width: 108px;
    border-radius: 50%;
    display: block;
    object-fit: cover;
    background: #d7e6ff;
}

.avatar-cam {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    display: grid;
    place-items: center;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(23, 105, 255, .28);
    pointer-events: none;
}

.photo-sheet {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.photo-sheet[hidden] {
    display: none;
}

.photo-sheet-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    background: rgba(10, 18, 32, .45);
}

.photo-sheet-card {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    background: var(--card);
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
}

.photo-sheet-card p {
    text-align: center;
    font-weight: 800;
    margin: 4px 0 12px;
}

.photo-sheet-card .primary-button,
.photo-sheet-card .ghost-button {
    margin-top: 8px;
}

.profile-setup {
    min-height: 100dvh;
    background: #fff;
}

.profile-setup-wrap {
    max-width: 430px;
    margin: 0 auto;
    padding: 36px 22px 32px;
}

.profile-setup .page-title {
    margin: 0 0 6px;
    font-size: 28px;
}

.profile-setup .page-subtitle {
    margin-bottom: 8px;
}

.profile-setup .field {
    margin-bottom: 16px;
}

.profile-setup .field label {
    font-size: 13px;
    font-weight: 600;
    color: #5c6877;
}

.profile-setup .field input,
.profile-setup .field select {
    appearance: none;
    background: #fff;
}

.profile-setup .field select {
    background-image: linear-gradient(45deg, transparent 50%, #7b8798 50%), linear-gradient(135deg, #7b8798 50%, transparent 50%);
    background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.profile-setup .primary-button {
    margin-top: 18px;
}

.form-error {
    color: #d93346;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 0;
}

.auth-alt {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--muted);
}

.auth-alt a {
    color: var(--blue);
    font-weight: 700;
}

.field select,
.search {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 0 14px;
    font-size: 16px;
    background: white;
    color: var(--text);
    font-family: inherit;
}

.search {
    margin-bottom: 12px;
}

.speaker-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    margin-bottom: 10px;
}

.exercise-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
}

.text-link {
    background: none;
    color: var(--muted);
    font-weight: 600;
}

.send-pill {
    min-width: 110px;
    height: 42px;
    border-radius: 21px;
    background: #dce4ef;
    color: #7b8798;
    font-weight: 700;
}

.send-pill.ready {
    background: var(--blue);
    color: white;
}

.word-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.word-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 20px;
    background: white;
    border: 1px solid var(--border);
    font-size: 13px;
}

.tip {
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
    background: #fff6df;
    color: #6a5416;
}

.tip[hidden] {
    display: none;
}

.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin-bottom: 14px;
}

.tab {
    padding: 8px 14px;
    border-radius: 20px;
    background: white;
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
}

.tab.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.vocab-row,
.grammar-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 17px;
    padding: 14px;
    margin-bottom: 10px;
}

.vocab-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vocab-row strong {
    display: block;
}

.vocab-row span {
    color: var(--muted);
    font-size: 12px;
}

.placement-q {
    margin: 0 0 14px;
    padding: 14px 4px 4px;
}

.placement-q:last-child {
    margin-bottom: 0;
}

.radio {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    cursor: pointer;
}

.radio:last-child {
    border-bottom: none;
}

.welcome-page {
    min-height: 100dvh;
    margin: 0;
    background: #d8dee8;
}

.welcome {
    min-height: 100dvh;
    margin: 0 auto;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    background: var(--card);
    position: relative;
    overflow: visible;
}

.welcome-hero {
    position: relative;
    width: 100%;
    height: 58vh;
    min-height: 280px;
    flex: 1 1 auto;
    overflow: hidden;
    background: #7a93b3 url("/static/images/hero-paris.png") center 28% / cover;
}

.welcome-photo {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
}

.welcome-photo.is-on,
.welcome-photo:first-of-type {
    opacity: 1;
}

.lang-pick h1 {
    font-size: 28px;
    margin-bottom: 6px;
}

.lang-pick > p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 18px;
}

.lang-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lang-card {
    position: relative;
    display: block;
    width: 100%;
    height: 132px;
    padding: 0;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(19, 34, 56, .12);
}

.lang-card img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    display: block;
}

.lang-card.is-selected {
    box-shadow: 0 0 0 3px var(--blue), 0 10px 24px rgba(19, 34, 56, .12);
}

.lang-card span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: white;
    font-size: 28px;
    font-weight: 800;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.35));
}

.hub-screen {
    position: relative;
}

.hub-photo {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 220px;
    background-size: cover;
    background-position: center;
    opacity: .28;
    pointer-events: none;
}

.hub-screen .topbar,
.hub-screen .content {
    position: relative;
    z-index: 1;
}

.welcome-hero-copy {
    position: absolute;
    left: 24px;
    right: 24px;
    top: 18%;
    z-index: 2;
    text-align: center;
}

.welcome-icon,
.welcome-icon.flag {
    position: static;
    display: block;
    width: 80px;
    height: 80px;
    max-width: 80px;
    margin: 0 auto 12px;
    padding: 8px;
    box-sizing: border-box;
    transform: none;
    border-radius: 22px;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 10px 24px rgba(19, 34, 56, .28);
}

.welcome-hero-copy h1 {
    font-size: 30px;
    line-height: 1.15;
    margin-bottom: 8px;
    color: #132238;
    text-shadow: 0 1px 8px rgba(255,255,255,.55);
}

.welcome-hero-copy p {
    color: #2a3648;
    font-size: 15px;
    line-height: 1.4;
    text-shadow: 0 1px 8px rgba(255,255,255,.5);
}

.welcome-sheet {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    background: var(--card);
    border-radius: 28px 28px 0 0;
    margin-top: -32px;
    padding: 28px 24px 28px;
    text-align: center;
    color: var(--text);
}

.welcome .primary-button {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.welcome .ghost-button {
    margin-top: 12px;
    border: 1.5px solid var(--blue);
    color: var(--blue);
}

.welcome-foot {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}

.ghost-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border-radius: 13px;
    margin-top: 10px;
    background: white;
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.pwa-screen {
    background: linear-gradient(180deg, #1769ff, #0d47c9);
    color: white;
}

.pwa-copy {
    padding-top: 72px;
    text-align: center;
}

.pwa-icon,
.pwa-icon.flag {
    display: block;
    width: 72px;
    height: 72px;
    max-width: 72px;
    flex: none;
    border-radius: 18px;
    object-fit: contain;
    margin: 0 auto 18px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}

.pwa-screen h1 {
    margin-bottom: 20px;
}

.pwa-screen .card {
    text-align: left;
    color: var(--text);
}

#exercise.active ~ .bottom-nav,
#pwa.active ~ .bottom-nav,
#placement.active ~ .bottom-nav {
    display: none;
}

#exercise.active,
#pwa.active,
#placement.active {
    padding-bottom: 24px;
}

#conversation.active .chat-input {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

html[data-theme="dark"] {
    --background: #0b1118;
    --card: #151d28;
    --text: #f3f6fb;
    --muted: #9aa6b5;
    --border: #243042;
    --blue-light: #1a2a48;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .exercise-screen,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .chat-input,
html[data-theme="dark"] .lesson,
html[data-theme="dark"] .stats,
html[data-theme="dark"] .tab,
html[data-theme="dark"] .topic,
html[data-theme="dark"] .word-chip,
html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .search {
    background: var(--background);
    color: var(--text);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .phrase-card,
html[data-theme="dark"] .teacher,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .chat-input {
    background: var(--card);
}

@media (min-width: 800px) {
    :root {
        --shell: min(720px, 92vw);
    }

    body {
        background: #eef3f9;
    }

    #app {
        max-width: var(--shell);
        box-shadow: 0 0 48px rgba(19, 34, 56, .08);
    }

    .content,
    .exercise-body {
        max-width: none;
    }

    .welcome-page {
        background: #1a2333;
        display: block;
    }

    .welcome {
        max-width: none;
        width: 100%;
        min-height: 100dvh;
        box-shadow: none;
    }

    .welcome-hero {
        height: 70vh;
        min-height: 480px;
    }

    .welcome-hero-copy {
        top: 14%;
        left: 10%;
        right: 10%;
    }

    .welcome-icon,
    .welcome-icon.flag {
        width: 104px;
        height: 104px;
        max-width: 104px;
        padding: 10px;
        border-radius: 26px;
        background: #fff;
    }

    .welcome-hero-copy h1 {
        font-size: 52px;
        color: #fff;
        text-shadow: 0 2px 18px rgba(0, 0, 0, .5);
    }

    .welcome-hero-copy p {
        font-size: 20px;
        color: #fff;
        text-shadow: 0 2px 14px rgba(0, 0, 0, .5);
    }

    .welcome-sheet {
        max-width: 560px;
        width: calc(100% - 48px);
        margin: -56px auto 0;
        padding: 36px 40px 40px;
        border-radius: 28px 28px 0 0;
    }

    .welcome .primary-button,
    .welcome .ghost-button {
        height: 56px;
        font-size: 17px;
    }

    .bottom-nav {
        width: var(--shell);
        max-width: var(--shell);
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }

    .chat-input {
        width: min(var(--shell), calc(100% - 24px));
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    #conversation.active .chat-input {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    .profile-setup-wrap {
        max-width: 560px;
        padding: 48px 32px 40px;
    }

    .photo-sheet-card {
        width: min(560px, 100%);
    }

    .lang-card {
        height: 168px;
    }
}
