@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap');

:root {
    --ink-950: #0a0a0b;
    --ink-900: #161618;
    --ink-800: #232326;
    --ink-600: #57575c;
    --ink-400: #8b8b90;
    --ink-200: #d4d4d8;
    --ink-100: #ececef;
    --paper-0: #ffffff;
    --paper-50: #f7f7f8;

    --accent: #0a84ff;          /* Apple system blue — primary actions only */
    --accent-dim: #0a84ff22;
    --correct: #17a34a;
    --correct-dim: #17a34a1a;
    --incorrect: #e5484d;
    --incorrect-dim: #e5484d1a;
    --warn: #f5a623;

    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;

    --shadow-soft: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
    --shadow-elevated: 0 4px 12px rgba(0,0,0,0.08), 0 20px 48px rgba(0,0,0,0.12);

    --font-display: 'Outfit', 'Google Sans', sans-serif;
    --font-body: 'Outfit', 'Google Sans', sans-serif;
    --font-mono: 'SF Mono', ui-monospace, 'Menlo', monospace;

    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --bg: var(--paper-50);
    --surface: var(--paper-0);
    --text: var(--ink-950);
    --text-muted: var(--ink-600);
    --border: var(--ink-100);
}

[data-theme="dark"] {
    --bg: #000000;
    --surface: var(--ink-900);
    --text: var(--ink-100);
    --text-muted: var(--ink-400);
    --border: var(--ink-800);
    --shadow-soft: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    transition: background 0.4s var(--ease-out-quint), color 0.4s var(--ease-out-quint);
}

h1, h2, h3, .display {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    font-weight: 650;
    margin: 0;
}

a { color: inherit; }

/* ---- Glass surface, used sparingly: palette drawer, dialogs, top bar ---- */
.glass {
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.7rem 1.3rem;
    cursor: pointer;
    transition: transform 0.15s var(--ease-spring), background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.85; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--paper-50); }
[data-theme="dark"] .btn-ghost:hover { background: var(--ink-800); }
.btn-accent { background: var(--accent); color: white; }
.btn-danger { background: var(--incorrect); color: white; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--ink-100);
    color: var(--ink-600);
}
[data-theme="dark"] .pill { background: var(--ink-800); color: var(--ink-400); }

/* ---- Dialog / modal base — all custom dialogs share this shell ---- */
.dialog-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.dialog-panel {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-elevated);
    padding: 1.75rem;
    border: 1px solid var(--border);
}
.dialog-icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Focus visibility for keyboard nav — never suppressed */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--ink-800); }
