/* style-dark.css — Dark mode e-ink inspired theme */

@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400&display=swap");

/*
 * Design System: Dark Palette (3 colors only)
 *
 * --white:       #1a1a1a  (dark background, replaces white)
 * --grey-light:  #404040  (light grey, replaces light grey)
 * --grey-dark:   #e8e8e8  (white-ish text, replaces dark grey)
 *
 * Typography:
 *   --font-display: Cormorant Garamond, Georgia, serif (thin, elegant)
 *   --font-ui:      system-ui, -apple-system, sans-serif
 */

:root {
    /* 3-color palette (dark inverted) */
    --white: #1a1a1a;
    --grey-light: #404040;
    --grey-dark: #e8e8e8;

    /* Typography */
    --font-display: "Cormorant Garamond", Georgia, serif;
    --font-ui: system-ui, -apple-system, sans-serif;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 24px;
    --radius-pill: 99px;

    /* Transitions */
    --t-fast: 0.15s ease;
    --t-base: 0.25s ease;
    --t-slow: 0.3s ease;
}

/* ─────────────────────────────────────────────────────────────────── */
/* RESET & BODY */
/* ─────────────────────────────────────────────────────────────────── */

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

body {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: stretch;
    background: var(--white);
    color: var(--grey-dark);
    font-family: var(--font-ui);
    font-size: 16px;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1.5;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: stretch;
}

/* ─────────────────────────────────────────────────────────────────── */
/* ANIMATIONS */
/* ─────────────────────────────────────────────────────────────────── */

@keyframes pop {
    0% {
        color: var(--grey-light);
    }
    100% {
        color: var(--grey-dark);
    }
}

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

@keyframes cursor-blink {
    0%,
    49% {
        opacity: 1;
    }
    50%,
    100% {
        opacity: 0;
    }
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

@keyframes slide-diag {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

/* ─────────────────────────────────────────────────────────────────── */
/* CURSOR */
/* ─────────────────────────────────────────────────────────────────── */

.cursor {
    position: fixed;
    width: 1.5px;
    background: var(--grey-dark);
    border-radius: 0;
    pointer-events: none;
    animation: cursor-blink 1s steps(1) infinite;
    z-index: 100;
}

/* ─────────────────────────────────────────────────────────────────── */
/* LETTER STATES */
/* ─────────────────────────────────────────────────────────────────── */

.letter {
    color: var(--grey-light);
    letter-spacing: -0.02em;
}

.letter.done {
    color: var(--grey-dark);
}

.letter.pop {
    color: var(--grey-dark);
    animation: pop 0.25s ease-out;
}

.segment {
    isolation: isolate;
}

.track-word {
    isolation: isolate;
}

.shake {
    animation: shake 0.28s ease;
}

/* ─────────────────────────────────────────────────────────────────── */
/* TOP BAR */
/* ─────────────────────────────────────────────────────────────────── */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
    background: transparent;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: var(--grey-light);
    cursor: pointer;
    transition: color var(--t-fast);
    background: none;
    border: none;
    font-family: var(--font-ui);
    padding: 0;
    flex-shrink: 0;
}

.back-btn:hover {
    color: var(--grey-dark);
}

.score-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.score-display {
    font-size: 14px;
    font-weight: 400;
    color: var(--grey-dark);
    -webkit-text-stroke: 0;
    paint-order: normal;
    font-family: var(--font-ui);
    line-height: 1;
}

.best-score-display {
    font-size: 14px;
    font-weight: 400;
    color: var(--grey-light);
    font-family: var(--font-ui);
    line-height: 1;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 400;
    color: var(--grey-light);
    font-family: var(--font-ui);
    transition: color var(--t-fast);
}

.toggle-group:hover {
    color: var(--grey-dark);
}

.toggle-group .switch {
    width: 34px;
    height: 18px;
    background: var(--grey-light);
    border: 1px solid var(--grey-light);
    border-radius: var(--radius-pill);
    position: relative;
    cursor: pointer;
}

.toggle-group .switch::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--grey-dark);
    border-radius: 50%;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    transition: all var(--t-fast);
}

.toggle-group.on .switch {
    background: var(--grey-light);
    border-color: var(--grey-light);
}

.toggle-group.on .switch::after {
    background: var(--white);
    left: 20px;
    transform: translateY(-50%);
}

.replay-btn {
    font-size: 20px;
    color: var(--grey-light);
    cursor: pointer;
    transition: color var(--t-fast);
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replay-btn:hover {
    color: var(--grey-dark);
}

.counter {
    font-size: 14px;
    font-weight: 400;
    color: var(--grey-light);
    font-family: var(--font-ui);
}

/* ─────────────────────────────────────────────────────────────────── */
/* STREAK BAR */
/* ─────────────────────────────────────────────────────────────────── */

.streak-wrap {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.streak-bar {
    width: 280px;
    height: 3px;
    background: var(--grey-light);
    border: none;
    border-radius: var(--radius-pill);
    position: relative;
}

.streak-fill {
    height: 100%;
    background: var(--grey-dark);
    border-radius: var(--radius-pill);
    width: 0%;
    transition: width 0.3s ease;
}

.streak-label {
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 400;
    color: var(--grey-dark);
    font-family: var(--font-ui);
    -webkit-text-stroke: 0;
    paint-order: normal;
    white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────── */
/* FLOATING SCORE */
/* ─────────────────────────────────────────────────────────────────── */

.score-float {
    position: fixed;
    font-size: 18px;
    font-weight: 300;
    font-family: var(--font-display);
    color: var(--grey-light);
    -webkit-text-stroke: 0;
    paint-order: normal;
    filter: grayscale(60%);
    pointer-events: none;
    z-index: 999;
    animation: float-up 0.6s ease-out forwards;
}

/* ─────────────────────────────────────────────────────────────────── */
/* HOME SCREEN */
/* ─────────────────────────────────────────────────────────────────── */

.screen-home {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    overflow: hidden;
}

.home-container {
    display: flex;
    gap: 80px;
    z-index: 1;
}

.home-half {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-half:first-child {
    border-right: 1px solid var(--grey-light);
    padding-right: 80px;
}

.home-half-eyebrow {
    font-size: 10px;
    font-weight: 400;
    color: var(--grey-light);
    letter-spacing: 5px;
    text-transform: uppercase;
    font-family: var(--font-ui);
}

.home-half-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 300;
    color: var(--grey-dark);
    line-height: 1.05;
}

.home-half-desc {
    font-size: 14px;
    font-weight: 400;
    color: var(--grey-light);
    line-height: 1.6;
    font-family: var(--font-ui);
}

.home-half-btns {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: auto;
    padding-top: 32px;
}

/* ─────────────────────────────────────────────────────────────────── */
/* CARD (PRIMARY BUTTON) */
/* ─────────────────────────────────────────────────────────────────── */

.card {
    background: var(--grey-light);
    border: 1px solid var(--grey-light);
    border-radius: var(--radius-md);
    padding: 10px 48px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 300;
    color: var(--white);
    min-width: 280px;
    text-align: center;
    transition: border-color var(--t-fast), background-color var(--t-fast), color var(--t-fast);
    outline: none;
    -webkit-appearance: none;
    -webkit-text-stroke: 0;
}

.card:hover {
    border-color: var(--grey-dark);
    background: var(--grey-dark);
    color: var(--white);
}

.card:active {
    background: var(--grey-light);
    border-color: var(--grey-light);
    color: var(--white);
}

/* ─────────────────────────────────────────────────────────────────── */
/* MODE PICKER SCREEN */
/* ─────────────────────────────────────────────────────────────────── */

.screen-mode-picker {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

/* ─────────────────────────────────────────────────────────────────── */
/* BOARD */
/* ─────────────────────────────────────────────────────────────────── */

.board {
    background: var(--white);
    border: 1px solid var(--grey-light);
    border-radius: var(--radius-lg);
    padding: 0 24px 24px;
    box-shadow: none;
    width: calc(100vw - 48px);
    height: calc(100vh - 56px - 24px);
    margin-top: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: auto;
}

/* ─────────────────────────────────────────────────────────────────── */
/* WORD-BY-WORD MODE */
/* ─────────────────────────────────────────────────────────────────── */

.screen-word {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

.word-display {
    text-align: center;
}

.segment {
    font-family: var(--font-display);
    font-size: 88px;
    font-weight: 300;
    color: var(--grey-dark);
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.segment.secondary {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 300;
    color: var(--grey-light);
    line-height: 1.4;
}

/* ─────────────────────────────────────────────────────────────────── */
/* CONTINUOUS MODE */
/* ─────────────────────────────────────────────────────────────────── */

.screen-continuous {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

.track-board {
    width: 100%;
    padding: 24px 0;
    overflow-x: clip;
    display: flex;
    align-items: center;
}

.track {
    display: flex;
    gap: 48px;
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 300;
    color: var(--grey-dark);
    line-height: 1.5;
    white-space: nowrap;
    transition: transform 0.3s ease;
    padding: 0 24px;
    letter-spacing: 0.01em;
}

.track-word {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 300;
    color: var(--grey-dark);
}

/* ─────────────────────────────────────────────────────────────────── */
/* WRITE FROM DICTATION (WFD) MODE */
/* ─────────────────────────────────────────────────────────────────── */

.screen-wfd {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

.sentence-display {
    font-family: var(--font-display);
    font-size: 46px;
    font-weight: 300;
    color: var(--grey-dark);
    line-height: 1.7;
    max-width: 70vw;
    text-align: center;
    letter-spacing: 0.015em;
}
