:root {
    --bg: #08111f;
    --surface: #101c2d;
    --surface2: #16243a;
    --text: #f8fafc;
    --muted: #94a3b8;
    --primary: #22c55e;
    --primary2: #16a34a;
    --danger: #ef4444;
    --border: rgba(255,255,255,.09);
    --shadow: 0 20px 50px rgba(0,0,0,.25);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background:
        radial-gradient(
            circle at top right,
            #172554 0,
            var(--bg) 40%
        );
    color: var(--text);
}

body.light {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface2: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(15,23,42,.1);
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(8,17,31,.8);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-weight: 900;
    background:
        linear-gradient(
            135deg,
            #dc2626,
            #991b1b
        );
}

.brand strong {
    display: block;
}

.brand span {
    display: block;
    color: var(--muted);
    font-size: .78rem;
}

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

.icon-button,
.back,
.sound {
    border: 0;
    color: var(--text);
    background: var(--surface2);
    border-radius: 12px;
    min-height: 42px;
    padding: 0 13px;
}

.app {
    width: min(100%, 900px);
    margin: auto;
    padding: 28px 18px 110px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.hero {
    padding: 28px 0 20px;
}

.eyebrow {
    color: #4ade80;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
}

h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    line-height: .98;
    margin: 10px 0 16px;
}

h2 {
    margin-top: 34px;
}

.hero p {
    color: var(--muted);
    max-width: 650px;
    font-size: 1.05rem;
    line-height: 1.6;
}

.primary {
    border: 0;
    color: #052e16;
    background:
        linear-gradient(
            135deg,
            #4ade80,
            #22c55e
        );
    border-radius: 14px;
    font-weight: 800;
    padding: 13px 20px;
}

.primary.large {
    width: 100%;
    min-height: 56px;
    font-size: 1rem;
}

.primary.large span {
    float: right;
}

.secondary {
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 16px;
}

.danger {
    color: #f87171;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stats > div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    box-shadow: var(--shadow);
}

.stats strong {
    display: block;
    font-size: 1.5rem;
}

.stats span {
    color: var(--muted);
    font-size: .8rem;
}

.home-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.feature-button {
    text-align: left;
    padding: 17px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.feature-button span {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

.feature-button strong,
.feature-button small {
    display: block;
}

.feature-button small {
    color: var(--muted);
    margin-top: 4px;
}

.category-grid {
    display: grid;
    gap: 10px;
}

.category {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    background: var(--surface);
    color: var(--text);
}

.category-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--surface2);
    border-radius: 13px;
}

.category strong,
.category small {
    display: block;
}

.category small {
    color: var(--muted);
    margin-top: 3px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.section-head h1 {
    font-size: 2rem;
    margin-bottom: 0;
}

.mode-info {
    color: var(--muted);
    margin-bottom: 16px;
}

.mode-grid {
    display: grid;
    gap: 14px;
}

.mode-card {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 20px;
    padding: 24px;
    text-align: left;
}

.mode-card span {
    font-size: 2rem;
}

.mode-card strong,
.mode-card small {
    display: block;
}

.mode-card strong {
    font-size: 1.25rem;
    margin-top: 12px;
}

.mode-card small {
    color: var(--muted);
    line-height: 1.5;
    margin-top: 6px;
}

.learn-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.progress-wrap {
    width: 100%;
}

.progress-bar {
    height: 7px;
    background: var(--surface2);
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar div {
    height: 100%;
    width: 0;
    background: var(--primary);
    transition: width .2s;
}

.progress-wrap small {
    color: var(--muted);
}

.flashcard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 25px;
    min-height: 430px;
    box-shadow: var(--shadow);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: .8rem;
}

.turkish {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 850;
    line-height: 1.1;
    margin: 55px 0 14px;
}

.pronunciation {
    color: #4ade80;
    font-size: 1rem;
    margin-bottom: 30px;
}

.answer {
    font-size: 1.25rem;
    line-height: 1.5;
}

.tip {
    color: var(--muted);
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin-top: 18px;
    font-size: .95rem;
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 35px;
}

.card-action {
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    border-radius: 12px;
    padding: 11px 15px;
}

.learn-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.reveal {
    border: 0;
    width: 100%;
    padding: 16px;
    border-radius: 13px;
    background: var(--primary);
    color: #052e16;
    font-weight: 800;
}

.rating {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.rating button {
    border: 0;
    border-radius: 14px;
    padding: 13px 5px;
    font-weight: 800;
}

.again {
    background: #fecaca;
    color: #7f1d1d;
}

.hard {
    background: #fde68a;
    color: #713f12;
}

.good {
    background: #bbf7d0;
    color: #14532d;
}

.search,
.editor-form input,
.editor-form textarea,
.editor-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    color: var(--text);
    padding: 14px;
}

.search {
    margin-bottom: 14px;
}

.browse-list,
.manage-list {
    display: grid;
    gap: 8px;
}

.browse-card,
.manage-card {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 14px;
    padding: 14px;
}

.browse-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 15px;
}

.browse-card strong,
.browse-card small {
    display: block;
}

.browse-card small {
    color: #4ade80;
}

.browse-card span {
    color: var(--muted);
}

.manage-card {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.manage-card strong,
.manage-card small {
    display: block;
}

.manage-card small {
    color: var(--muted);
    margin-top: 5px;
}

.manage-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.editor-form {
    display: grid;
    gap: 15px;
}

.editor-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
}

.editor-form textarea {
    min-height: 110px;
    resize: vertical;
}

.setting-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 17px;
    padding: 18px;
    margin-bottom: 12px;
}

.setting-card p {
    color: var(--muted);
}

.good-status {
    color: #4ade80;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 70px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(8,17,31,.94);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    z-index: 20;
}

.nav-item {
    border: 0;
    background: transparent;
    color: var(--muted);
}

.nav-item span {
    display: block;
    font-size: 1.2rem;
}

.nav-item.active {
    color: #4ade80;
}

.finish {
    min-height: 370px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    text-align: center;
}

.finish-icon {
    font-size: 4rem;
    color: #4ade80;
}

.finish h1 {
    font-size: 2.5rem;
}

.finish p {
    color: var(--muted);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-card {
    width: min(100%, 480px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.auth-section {
    margin-top: 30px;
}

.auth-section input {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
}

.auth-section > button {
    width: 100%;
    margin-top: 12px;
}

.qr-box {
    display: grid;
    place-items: center;
    background: white;
    border-radius: 16px;
    padding: 15px;
    margin: 20px auto;
    width: 230px;
}

.qr-box img {
    width: 100%;
}

.secret-label {
    color: var(--muted);
}

.auth-card code {
    word-break: break-all;
}

.message {
    color: #fca5a5;
    margin-top: 12px;
    line-height: 1.5;
}

.warning {
    margin-top: 18px;
    padding: 14px;
    border-radius: 13px;
    background: rgba(234,179,8,.12);
    color: #fde68a;
    font-size: .9rem;
}

@media (max-width: 600px) {

    .home-actions {
        grid-template-columns: 1fr;
    }

    .manage-card {
        flex-direction: column;
    }

    .turkish {
        margin-top: 35px;
    }

    .flashcard {
        min-height: 390px;
    }
}
