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

        :root {
            --primary: #58cc02;
            --primary-dark: #46a302;
            --secondary: #1cb0f6;
            --danger: #ff4b4b;
            --warning: #ffc800;
            --bg: #131f24;
            --bg-light: #1a2c35;
            --card: #233a44;
            --text: #ffffff;
            --text-muted: #afafaf;
            --purple: #ce82ff;
        }

        body {
            font-family: 'Segoe UI', system-ui, sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
        }

        .splash-screen {
            position: fixed;
            inset: 0;
            z-index: 3000;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1rem;
            padding: 1.5rem;
            background: #070b12;
            opacity: 1;
            visibility: visible;
            transition: opacity 0.35s ease, visibility 0.35s ease;
        }

        .splash-screen.hide {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        .splash-character {
            width: min(480px, 88vw);
            max-height: 72vh;
            object-fit: contain;
            border-radius: 28px;
            filter: drop-shadow(0 20px 45px rgba(255, 38, 58, 0.35));
            animation: splash-pop 0.55s ease-out;
        }

        .splash-title {
            color: white;
            font-size: clamp(1.35rem, 5vw, 2rem);
            text-align: center;
        }

        @keyframes splash-pop {
            from { transform: scale(0.72); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }

        /* ===== HEADER ===== */
        .header {
            background: var(--bg-light);
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 2px solid var(--card);
            display: none;
        }

        .logo {
            font-size: 1.4rem;
            font-weight: bold;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .stats {
            display: flex;
            gap: 1.5rem;
        }

        .stat {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-weight: 600;
            font-size: 1rem;
        }

        .sound-toggle {
            background: var(--card);
            color: var(--text);
            border: 0;
            border-radius: 10px;
            padding: 0.45rem 0.7rem;
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 700;
        }

        .sound-toggle:hover { background: var(--secondary); }

        /* ===== CONTAINER ===== */
        .container {
            max-width: 620px;
            margin: 0 auto;
            padding: 2rem 1.5rem;
        }

        /* ===== SCREENS ===== */
        .screen { display: none; }
        .screen.active { display: block; }

        /* ===== ONBOARDING ===== */
        .onboarding {
            text-align: center;
            padding-top: 2rem;
        }

        .owl-big {
            width: min(360px, 86vw);
            aspect-ratio: 1;
            display: block;
            object-fit: cover;
            margin: 0 auto 1.5rem;
            border-radius: 28%;
            box-shadow: 0 18px 55px rgba(255, 123, 0, 0.28);
            animation: float 3s ease-in-out infinite;
        }

        .logo-character {
            width: 34px;
            height: 34px;
            border-radius: 10px;
            object-fit: cover;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-12px); }
        }

        .onboarding h1 {
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }

        .onboarding p {
            color: var(--text-muted);
            margin-bottom: 2rem;
        }

        .form-group {
            margin-bottom: 1.25rem;
            text-align: left;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 600;
            color: var(--text-muted);
            font-size: 0.9rem;
        }

        .form-group input,
        .form-group select {
            width: 100%;
            padding: 0.9rem 1rem;
            background: var(--card);
            border: 2px solid var(--card);
            border-radius: 12px;
            color: var(--text);
            font-size: 1rem;
            transition: border-color 0.2s;
        }

        .form-group input:focus,
        .form-group select:focus {
            outline: none;
            border-color: var(--secondary);
        }

        .form-group select option {
            background: var(--bg-light);
        }

        .language-source { display: none; }

        .goal-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.75rem;
        }

        .goal-btn {
            padding: 0.9rem;
            background: var(--card);
            border: 2px solid var(--card);
            border-radius: 12px;
            color: var(--text);
            cursor: pointer;
            font-size: 0.95rem;
            transition: all 0.2s;
            text-align: center;
        }

        .goal-btn:hover { border-color: var(--secondary); }
        .goal-btn.selected {
            border-color: var(--primary);
            background: rgba(88,204,2,0.15);
        }

        /* ===== PLACEMENT TEST ===== */
        .test-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .test-header h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }
        .test-header p { color: var(--text-muted); }

        .progress-bar {
            height: 14px;
            background: var(--card);
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 0.5rem;
        }

        .progress-fill {
            height: 100%;
            background: var(--primary);
            border-radius: 8px;
            transition: width 0.4s ease;
        }

        .progress-text {
            text-align: center;
            color: var(--text-muted);
            font-size: 0.85rem;
            margin-bottom: 1.5rem;
        }

        .q-word {
            background: var(--card);
            border-radius: 16px;
            padding: 1.5rem;
            text-align: center;
            font-size: 2rem;
            font-weight: bold;
            margin-bottom: 1.5rem;
            letter-spacing: 1px;
        }

        .q-label {
            color: var(--text-muted);
            font-size: 0.9rem;
            margin-bottom: 1.25rem;
        }

        .options {
            display: grid;
            gap: 0.75rem;
        }

        .option {
            background: var(--card);
            border: 2px solid var(--card);
            border-radius: 12px;
            padding: 1rem 1.25rem;
            cursor: pointer;
            font-size: 1rem;
            text-align: left;
            color: var(--text);
            transition: all 0.2s;
            width: 100%;
        }

        .option:hover:not(.disabled) { border-color: var(--secondary); background: rgba(28,176,246,0.1); }
        .option.selected { border-color: var(--secondary); background: rgba(28,176,246,0.2); }
        .option.correct { border-color: var(--primary); background: rgba(88,204,2,0.2); }
        .option.wrong { border-color: var(--danger); background: rgba(255,75,75,0.2); animation: shake 0.4s ease; }
        .option.disabled { cursor: not-allowed; }

        @keyframes shake {
            0%,100% { transform: translateX(0); }
            25% { transform: translateX(-8px); }
            75% { transform: translateX(8px); }
        }

        /* ===== PLACEMENT RESULT ===== */
        .placement-result {
            text-align: center;
            padding: 2rem 0;
        }

        .level-badge-big {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 3rem;
            font-weight: bold;
            margin-bottom: 1rem;
            box-shadow: 0 6px 25px rgba(88,204,2,0.4);
            animation: pop 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
        }

        @keyframes pop {
            0% { transform: scale(0); opacity: 0; }
            80% { transform: scale(1.15); }
            100% { transform: scale(1); opacity: 1; }
        }

        .placement-result h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
        .placement-result p { color: var(--text-muted); margin-bottom: 2rem; }

        /* ===== HOME SCREEN ===== */
        .home-top {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 2rem;
            background: var(--card);
            border-radius: 16px;
            padding: 1rem 1.25rem;
        }

        .avatar {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.75rem;
            flex-shrink: 0;
            background-size: cover;
            background-position: center;
        }

        .home-top-info h3 { font-size: 1.1rem; }
        .home-top-info span { color: var(--text-muted); font-size: 0.9rem; }

        .verified-badge {
            display: none;
            width: fit-content;
            margin-top: 0.3rem;
            padding: 0.2rem 0.55rem;
            border-radius: 999px;
            background: rgba(28, 176, 246, 0.16);
            color: var(--secondary) !important;
            font-size: 0.72rem !important;
            font-weight: 800;
            line-height: 1.2;
        }

        .verified-badge.show { display: inline-flex; }

        .owner-title {
            display: none;
            width: fit-content;
            margin-top: 0.3rem;
            color: var(--warning) !important;
            font-size: 0.78rem !important;
            font-weight: 800;
        }

        .owner-title.show { display: block; }
        #home-level-text { display: block; margin-top: 0.3rem; }

        .home-top-xp {
            margin-left: auto;
            text-align: center;
        }

        .home-top-xp .xp-num {
            font-size: 1.4rem;
            font-weight: bold;
            color: var(--warning);
        }

        .home-top-xp span { color: var(--text-muted); font-size: 0.8rem; display: block; }
        .stat-fire { color: #ff9600; }
        .stat-xp { color: var(--warning); }
        .stat-hearts { color: var(--danger); }

        .profile-reset-btn {
            margin-top: -1rem;
            margin-bottom: 1.5rem;
            padding: 0.75rem 1rem;
            font-size: 0.95rem;
        }

        .section-title {
            font-size: 1.2rem;
            font-weight: 700;
            margin-bottom: 1rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-size: 0.85rem;
        }

        /* ===== UNIT TRACK ===== */
        .unit-track {
            margin-bottom: 2rem;
        }

        .unit-header {
            background: linear-gradient(135deg, var(--card), #2a4a58);
            border-radius: 16px 16px 0 0;
            padding: 1rem 1.5rem;
            display: flex;
            align-items: center;
            gap: 1rem;
            border-bottom: 2px solid var(--bg);
        }

        .unit-icon { font-size: 2rem; }

        .unit-header-info h3 { font-size: 1.1rem; }
        .unit-header-info span { color: var(--text-muted); font-size: 0.85rem; }

        .unit-badge {
            margin-left: auto;
            background: var(--bg);
            padding: 0.3rem 0.75rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .unit-badge.locked { color: var(--text-muted); }
        .unit-badge.active { color: var(--primary); }
        .unit-badge.done { color: var(--warning); }

        .lesson-nodes {
            background: var(--bg-light);
            border-radius: 0 0 16px 16px;
            padding: 1.5rem;
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            justify-content: center;
        }

        .lesson-node {
            width: 70px;
            height: 70px;
            border-radius: 50%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            font-size: 1.5rem;
            position: relative;
            border: 3px solid transparent;
        }

        .lesson-node span {
            font-size: 0.65rem;
            font-weight: 600;
            margin-top: 2px;
        }

        .lesson-node.available {
            background: var(--primary);
            box-shadow: 0 4px 0 var(--primary-dark);
        }

        .lesson-node.available:hover {
            transform: translateY(-3px);
            box-shadow: 0 7px 0 var(--primary-dark);
        }

        .lesson-node.available:active {
            transform: translateY(1px);
            box-shadow: 0 2px 0 var(--primary-dark);
        }

        .lesson-node.completed {
            background: var(--warning);
            box-shadow: 0 4px 0 #cc9f00;
        }

        .lesson-node.locked {
            background: var(--card);
            cursor: not-allowed;
            opacity: 0.5;
        }

        .lesson-node.current {
            background: var(--primary);
            box-shadow: 0 4px 0 var(--primary-dark);
            border-color: white;
            animation: pulse-node 2s ease-in-out infinite;
        }

        @keyframes pulse-node {
            0%, 100% { box-shadow: 0 4px 0 var(--primary-dark), 0 0 0 0 rgba(88,204,2,0.4); }
            50% { box-shadow: 0 4px 0 var(--primary-dark), 0 0 0 10px rgba(88,204,2,0); }
        }

        /* ===== LESSON SCREEN ===== */
        .lesson-top {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }

        .close-btn {
            background: var(--card);
            border: none;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            color: var(--text-muted);
            font-size: 1.2rem;
            cursor: pointer;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .close-btn:hover { background: var(--danger); color: white; }

        .lesson-progress-bar {
            flex: 1;
            height: 14px;
            background: var(--card);
            border-radius: 8px;
            overflow: hidden;
        }

        .lesson-progress-fill {
            height: 100%;
            background: var(--primary);
            border-radius: 8px;
            transition: width 0.4s ease;
        }

        .hearts-display {
            display: flex;
            gap: 3px;
            flex-shrink: 0;
        }

        .heart { font-size: 1.3rem; transition: all 0.3s; }
        .heart.lost { opacity: 0.2; transform: scale(0.8); }

        .q-type-label {
            color: var(--text-muted);
            font-size: 0.9rem;
            margin-bottom: 0.5rem;
        }

        .q-text {
            font-size: 1.4rem;
            font-weight: 600;
            margin-bottom: 1.5rem;
            line-height: 1.4;
        }

        .q-word-card {
            background: var(--card);
            border-radius: 16px;
            padding: 1.25rem 1.5rem;
            display: inline-flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 1.75rem;
            font-size: 1.5rem;
            font-weight: bold;
        }

        .speak-btn {
            background: var(--secondary);
            border: none;
            width: 38px;
            height: 38px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1rem;
            transition: transform 0.2s;
            flex-shrink: 0;
        }

        .speak-btn:hover { transform: scale(1.1); }

        /* ===== FEEDBACK BAR ===== */
        .feedback-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 1.25rem 1.5rem;
            transform: translateY(100%);
            transition: transform 0.3s ease;
            z-index: 100;
        }

        .feedback-bar.show { transform: translateY(0); }
        .feedback-bar.correct-fb { background: #3a6f0a; border-top: 3px solid var(--primary); }
        .feedback-bar.wrong-fb { background: #6f1515; border-top: 3px solid var(--danger); }

        .feedback-inner {
            max-width: 620px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .fb-text h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
        .fb-text p { color: rgba(255,255,255,0.8); font-size: 0.9rem; }

        .continue-btn {
            background: var(--primary);
            color: white;
            border: none;
            padding: 0.75rem 1.75rem;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.2s;
            white-space: nowrap;
        }

        .continue-btn:hover { transform: scale(1.05); }
        .feedback-bar.wrong-fb .continue-btn { background: var(--danger); }

        /* ===== RESULTS ===== */
        .results-screen {
            text-align: center;
            padding: 2rem 0;
        }

        .results-emoji { font-size: 5rem; animation: bounce 0.8s ease; margin-bottom: 1rem; }

        @keyframes bounce {
            0%,100% { transform: translateY(0); }
            50% { transform: translateY(-20px); }
        }

        .results-screen h2 { font-size: 2rem; margin-bottom: 0.5rem; }
        .results-screen p { color: var(--text-muted); margin-bottom: 2rem; }

        .result-stats {
            display: flex;
            justify-content: center;
            gap: 3rem;
            margin-bottom: 2.5rem;
        }

        .rs { text-align: center; }
        .rs-val { font-size: 2.5rem; font-weight: bold; color: var(--primary); }
        .rs-val.gold { color: var(--warning); }
        .rs-label { color: var(--text-muted); font-size: 0.85rem; }

        /* ===== BUTTONS ===== */
        .btn-primary {
            background: var(--primary);
            color: white;
            border: none;
            padding: 1rem 2.5rem;
            border-radius: 12px;
            font-size: 1.1rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            width: 100%;
            margin-bottom: 0.75rem;
        }

        .btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }

        .btn-secondary {
            background: transparent;
            color: var(--text-muted);
            border: 2px solid var(--card);
            padding: 0.8rem 2rem;
            border-radius: 12px;
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.2s;
            width: 100%;
        }

        .btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

        /* ===== GAMEOVER ===== */
        .gameover-screen { text-align: center; padding: 3rem 0; }
        .gameover-screen .emoji { font-size: 5rem; margin-bottom: 1rem; }
        .gameover-screen h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
        .gameover-screen p { color: var(--text-muted); margin-bottom: 2rem; }

        /* ===== CONFETTI ===== */
        .confetti-wrap {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none; z-index: 999;
        }

        .cp {
            position: absolute;
            width: 10px; height: 10px;
            animation: cf 2.5s ease-out forwards;
        }

        @keyframes cf {
            0% { transform: translateY(-80px) rotate(0deg); opacity: 1; }
            100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
        }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 480px) {
            .header { padding: 0.75rem 1rem; }
            .stats { gap: 1rem; }
            .stat .stat-label { display: none; }
            .container { padding: 1rem; }
            .result-stats { gap: 1.5rem; }
        }

/* ===== PRIVACY / STORE READINESS ADDITIONS ===== */
.privacy-note {
    margin: 0.85rem auto 1.1rem;
    padding: 0.85rem 1rem;
    max-width: 460px;
    border: 1px solid rgba(88, 204, 2, 0.35);
    border-radius: 16px;
    background: rgba(88, 204, 2, 0.08);
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.45;
}

.legal-links, .app-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.legal-links { margin-top: 1rem; }
.app-footer { padding: 1rem 1.5rem 1.5rem; }

.legal-links a, .app-footer a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 700;
}

.legal-links a:hover, .app-footer a:hover { text-decoration: underline; }

.safe-area-pad {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.speech-warning {
    margin: 10px auto 0;
    max-width: 520px;
    min-height: 20px;
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
    color: #7a5b00;
    font-weight: 700;
}

/* ===== APP LANGUAGE SELECTION ===== */
.language-onboarding { padding-top: 1rem; }
.language-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-top: 1.5rem;
}
.ui-lang-btn {
    border: 2px solid var(--card);
    background: var(--card);
    color: var(--text);
    border-radius: 14px;
    padding: 0.95rem 0.75rem;
    text-align: left;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.ui-lang-btn small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-weight: 600;
}
.ui-lang-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: rgba(88,204,2,0.12);
}
@media (max-width: 520px) {
    .language-grid { grid-template-columns: 1fr; }
}

/* ===== DICTIONARY v1.6 ===== */
body.dictionary-open .container {
    max-width: 1040px;
    padding-bottom: 7.5rem;
}

.dictionary-shell {
    --dictionary-purple: #9b5cff;
    --dictionary-purple-dark: #6d38df;
    --dictionary-orange: #ff8a1f;
    --dictionary-white: #ffffff;
    display: grid;
    gap: 1.25rem;
}

.dictionary-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: clamp(1.35rem, 4vw, 2.25rem);
    border: 1px solid rgba(155, 92, 255, 0.45);
    border-radius: 26px;
    background:
        radial-gradient(circle at 88% 8%, rgba(255, 138, 31, 0.28), transparent 36%),
        linear-gradient(135deg, rgba(109, 56, 223, 0.36), rgba(26, 44, 53, 0.96));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.dictionary-hero::after {
    content: "✦";
    position: absolute;
    inset-inline-end: 4%;
    top: -28px;
    color: rgba(255, 255, 255, 0.09);
    font-size: 9rem;
    pointer-events: none;
}

.dictionary-eyebrow,
.dictionary-card-kicker {
    color: #d7bcff;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.dictionary-hero h1 {
    margin: 0.35rem 0 0.55rem;
    color: var(--dictionary-white);
    font-size: clamp(2rem, 7vw, 3.15rem);
    line-height: 1;
}

.dictionary-hero p {
    max-width: 650px;
    color: #d9e0e3;
    line-height: 1.55;
}

.dictionary-random-button,
.dictionary-day-card button {
    position: relative;
    z-index: 1;
    min-height: 48px;
    flex: 0 0 auto;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--dictionary-orange), #ffb35c);
    color: #201307;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(255, 138, 31, 0.22);
}

.dictionary-random-button:hover,
.dictionary-day-card button:hover { transform: translateY(-1px); filter: brightness(1.06); }

.dictionary-search {
    padding: clamp(1rem, 3vw, 1.45rem);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 22px;
    background: var(--bg-light);
}

.dictionary-search > label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e8edf0;
    font-size: 0.9rem;
    font-weight: 800;
}

.dictionary-search-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.65rem;
}

.dictionary-search-row input,
.dictionary-language-row select {
    min-height: 50px;
    width: 100%;
    border: 2px solid #35505c;
    border-radius: 14px;
    background: #213640;
    color: white;
    font: inherit;
}

.dictionary-search-row input {
    padding: 0.85rem 1rem;
    font-size: 1.08rem;
}

.dictionary-search-row input:focus,
.dictionary-language-row select:focus {
    outline: none;
    border-color: var(--dictionary-purple);
    box-shadow: 0 0 0 4px rgba(155, 92, 255, 0.14);
}

.dictionary-search-row > button {
    min-width: 92px;
    min-height: 50px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--dictionary-purple), var(--dictionary-purple-dark));
    color: white;
    font-weight: 900;
    cursor: pointer;
}

.dictionary-search-row > button:disabled { opacity: 0.62; cursor: progress; }
.dictionary-search-row .dictionary-stop-button { background: #b43c50; }

.dictionary-language-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 0.65rem;
    margin-top: 0.85rem;
}

.dictionary-language-row label span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.dictionary-language-row select { padding: 0.7rem 0.85rem; }

.dictionary-privacy-note {
    margin: 0;
    color: #ffd9b0;
    font-size: 0.8rem;
    line-height: 1.45;
}

.dictionary-swap-button {
    width: 48px;
    height: 50px;
    border: 2px solid #495f69;
    border-radius: 14px;
    background: #263f4a;
    color: white;
    font-size: 1.35rem;
    cursor: pointer;
}

.dictionary-swap-button:hover { border-color: var(--dictionary-orange); }

.dictionary-status {
    padding: 0.85rem 1rem;
    border: 1px solid #38515c;
    border-radius: 14px;
    background: #1b3039;
    color: #dce7eb;
    line-height: 1.4;
}
.dictionary-status[data-kind="error"] { border-color: rgba(255, 75, 75, 0.7); background: rgba(255, 75, 75, 0.11); color: #ffd8d8; }
.dictionary-status[data-kind="success"] { border-color: rgba(88, 204, 2, 0.55); background: rgba(88, 204, 2, 0.09); color: #dcffc2; }

.dictionary-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dictionary-card,
.dictionary-result {
    min-width: 0;
    padding: 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    background: var(--bg-light);
}

.dictionary-card h2 {
    margin: 0 0 0.8rem;
    font-size: 1.03rem;
}

.dictionary-day-card {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(109, 56, 223, 0.32), rgba(255, 138, 31, 0.13));
    border-color: rgba(155, 92, 255, 0.38);
}

.dictionary-day-card h2 {
    margin: 0.3rem 0;
    color: white;
    font-size: 1.75rem;
}
.dictionary-day-card p { color: var(--text-muted); }

.dictionary-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}
.dictionary-card-heading small { color: var(--text-muted); text-align: end; }

.dictionary-chip-list,
.dictionary-translation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.dictionary-word-chip,
.dictionary-translation-chip {
    padding: 0.52rem 0.72rem;
    border: 1px solid rgba(155, 92, 255, 0.45);
    border-radius: 999px;
    background: rgba(155, 92, 255, 0.11);
    color: #eee5ff;
    font-weight: 750;
}
.dictionary-word-chip { min-height: 44px; cursor: pointer; }
.dictionary-word-chip:hover { border-color: var(--dictionary-orange); color: white; }

.dictionary-saved-list {
    display: grid;
    gap: 0.55rem;
    max-height: 250px;
    overflow: auto;
}

.dictionary-history-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #314a55;
    border-radius: 12px;
    background: #20343d;
    color: white;
    text-align: start;
    cursor: pointer;
    min-width: 0;
    overflow-wrap: anywhere;
}
.dictionary-history-chip:hover { border-color: var(--dictionary-purple); }
.dictionary-history-chip small { color: var(--text-muted); text-align: end; }
.dictionary-empty { color: var(--text-muted); font-size: 0.9rem; }

.dictionary-result {
    scroll-margin-top: 1rem;
    border-color: rgba(155, 92, 255, 0.32);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.2);
    min-width: 0;
    overflow-wrap: anywhere;
}

.dictionary-result-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.dictionary-result-words h2 { margin: 0.4rem 0; font-size: clamp(1.8rem, 6vw, 2.7rem); }
.dictionary-language-tag { color: #c8b1f8; font-size: 0.84rem; font-weight: 850; }
.dictionary-direction { display: block; color: var(--dictionary-orange); font-size: 1.25rem; }
.dictionary-primary-translation { color: white; font-size: clamp(1.35rem, 4vw, 1.9rem); font-weight: 850; overflow-wrap: anywhere; }
.dictionary-suggestion-label { display: block; margin-top: 0.7rem; color: var(--text-muted); font-weight: 750; }
.dictionary-result-caution { margin: 0.7rem 0 0; color: #ffd9b0; font-size: 0.82rem; line-height: 1.45; }

.dictionary-result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    align-content: start;
}

.dictionary-icon-button {
    min-height: 44px;
    padding: 0.6rem 0.7rem;
    border: 1px solid #405964;
    border-radius: 11px;
    background: #233a44;
    color: white;
    font-weight: 750;
    cursor: pointer;
}
.dictionary-icon-button:hover { border-color: var(--dictionary-orange); }

.dictionary-detail-section {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}
.dictionary-detail-section h3 { margin: 0 0 0.65rem; color: #f3ebff; font-size: 0.98rem; }
.dictionary-detail-list { display: grid; gap: 0.5rem; padding-inline-start: 1.25rem; color: #dce3e6; line-height: 1.55; }
.dictionary-detail-list li::marker { color: var(--dictionary-orange); }
.dictionary-missing { color: var(--text-muted); font-style: italic; }
.dictionary-phonetic { color: #f7c997; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.1rem; }
.dictionary-lexical-note { margin-top: 1rem; color: var(--text-muted); font-size: 0.85rem; }

.dictionary-provider-box,
.dictionary-legal-note {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 138, 31, 0.3);
    border-radius: 14px;
    background: rgba(255, 138, 31, 0.07);
    color: #dce3e6;
    font-size: 0.82rem;
    line-height: 1.5;
}
.dictionary-provider-box p { margin-top: 0.35rem; }
.dictionary-provider-box a { color: #f2c291; font-weight: 800; }
.dictionary-legal-note a { color: #f2c291; font-weight: 800; }

.app-tabs {
    position: fixed;
    z-index: 180;
    inset-inline-start: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 0.45rem;
    width: min(92vw, 380px);
    padding: 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(18, 31, 37, 0.94);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
}
.app-tabs[hidden] { display: none; }
.app-tab {
    min-height: 50px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 850;
    cursor: pointer;
}
.app-tab span:first-child { margin-inline-end: 0.35rem; }
.app-tab.active {
    background: linear-gradient(135deg, rgba(155, 92, 255, 0.95), rgba(109, 56, 223, 0.95));
    color: white;
}

body.tabs-visible .app-footer { padding-bottom: 6.5rem; }

@media (max-width: 700px) {
    .dictionary-hero { align-items: flex-start; flex-direction: column; }
    .dictionary-dashboard { grid-template-columns: 1fr; }
    .dictionary-day-card { grid-column: auto; }
    .dictionary-result-header { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    body.dictionary-open .container { padding: 0.8rem 0.75rem 7.5rem; }
    body.dictionary-open .header { align-items: flex-start; gap: 0.55rem; }
    body.dictionary-open .stats { gap: 0.45rem; flex-wrap: wrap; justify-content: flex-end; }
    body.dictionary-open .sound-toggle { font-size: 0; }
    body.dictionary-open .sound-toggle::first-letter { font-size: 1rem; }
    .dictionary-search-row { grid-template-columns: 1fr auto; }
    .dictionary-search-row .dictionary-stop-button { grid-column: 1 / -1; }
    .dictionary-language-row { grid-template-columns: 1fr 48px 1fr; }
    .dictionary-language-row label span { font-size: 0.72rem; }
    .dictionary-language-row select { padding-inline: 0.45rem; font-size: 0.86rem; }
    .dictionary-day-card { align-items: flex-start; flex-direction: column; }
    .dictionary-day-card button { width: 100%; }
    .dictionary-card-heading { align-items: flex-start; flex-direction: column; }
    .dictionary-card-heading small { text-align: start; }
    .dictionary-history-chip { align-items: flex-start; flex-direction: column; }
    .dictionary-history-chip small { text-align: start; }
    .dictionary-result-actions { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .dictionary-random-button,
    .dictionary-day-card button,
    .dictionary-result { scroll-behavior: auto; transition: none; }
}
