/* ================================================================
   StenoSathi v1.4.1 — Clean Light UI
   White background, readable Inter type, left vertical sidebar.
   Typewriter font reserved for the logo only. Steno-pad character
   kept ONLY where it helps: the ruled writing sheet + red margin.
   ================================================================ */

:root {
    --bg:        #ffffff;
    --bg-soft:   #f6f7f5;       /* page canvas behind cards */
    --card:      #ffffff;
    --line:      #e7e9e4;       /* borders */
    --ink:       #1c2620;
    --ink-soft:  #687066;
    --green:     #2f5d45;
    --green-600: #356b50;
    --green-soft:#eaf1e6;
    --red:       #c0392f;       /* steno margin + accents */
    --red-soft:  #fbecea;
    --amber:     #9a6b1a;

    --font-logo: 'JetBrains Mono', monospace;   /* logo only */
    --font-display: 'Tiro Devanagari Hindi', serif;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --sidebar-w: 248px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(28,38,32,0.06), 0 1px 2px rgba(28,38,32,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    background: var(--bg-soft);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---- App shell: sidebar + content ------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex; align-items: center; gap: 9px;
    font-family: var(--font-logo);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    padding: 4px 8px;
    letter-spacing: -0.02em;
}
.brand svg { color: var(--red); flex-shrink: 0; }
.brand em { font-style: normal; color: var(--green); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
    display: flex; align-items: center; gap: 11px;
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.94rem;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.12s ease, color 0.12s ease;
}
.nav a .ico { font-size: 1rem; width: 20px; text-align: center; }
.nav a:hover { background: var(--bg-soft); color: var(--ink); }
.nav a.active { background: var(--green-soft); color: var(--green); font-weight: 600; }

.nav-toggle {
    display: none;
    position: fixed; top: 12px; left: 12px; z-index: 60;
    width: 42px; height: 42px;
    border: 1px solid var(--line);
    background: var(--bg);
    border-radius: 9px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* ---- Page (content column) -------------------------------------- */
.page {
    flex: 1;
    min-width: 0;
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
    padding: 36px clamp(16px, 4vw, 44px) 60px;
    display: flex;
    flex-direction: column;
}

.page-head { margin-bottom: 24px; }
.page-head h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1.18;
    letter-spacing: -0.01em;
}
.page-head p { color: var(--ink-soft); margin-top: 6px; font-size: 0.95rem; }

/* ---- Cards ------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(16px, 3vw, 24px);
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

/* The writing sheet keeps the steno-pad identity (ruled + red margin) */
.steno-sheet {
    position: relative;
    background:
        repeating-linear-gradient(to bottom, #ffffff 0 30px, #eef1ea 30px 31px);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 20px 16px 46px;
    line-height: 31px;
    font-size: 1.05rem;
}
.steno-sheet::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 34px;
    width: 2px; background: var(--red); opacity: 0.4;
    pointer-events: none;
}

/* ---- Forms ------------------------------------------------------- */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    margin: 14px 0 6px;
}
input[type="text"], input[type="number"], select, textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 0.97rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px 13px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { min-height: 180px; resize: vertical; line-height: 1.7; }
textarea.steno-sheet { font-size: 1.02rem; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}
input[type="range"] { padding: 6px 0; accent-color: var(--green); border: none; box-shadow: none; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--green); }
input[type="color"] { width: 40px; height: 34px; padding: 2px; border-radius: 8px; cursor: pointer; }

/* ---- Buttons ----------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font);
    font-size: 0.94rem;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease, transform 0.06s ease, box-shadow 0.12s ease;
}
.btn:hover:not(:disabled) { background: var(--green-600); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--bg); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg-soft); }
.btn.danger { background: var(--bg); color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.big { font-size: 1rem; padding: 13px 22px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---- Upload dropzone --------------------------------------------- */
.dropzone {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 40px 18px;
    text-align: center;
    color: var(--ink-soft);
    cursor: pointer;
    background: var(--bg-soft);
    transition: border-color 0.12s ease, background 0.12s ease;
}
.dropzone strong { color: var(--ink); font-size: 1.02rem; }
.dropzone.dragover { border-color: var(--green); background: var(--green-soft); }
.dropzone input { display: none; }

/* ---- Progress bar ------------------------------------------------ */
.progressbar {
    height: 9px;
    border-radius: 6px;
    background: var(--line);
    overflow: hidden;
    margin-top: 12px;
}
.progressbar > div { height: 100%; width: 0%; background: var(--green); transition: width 0.25s ease; }
.status-line { font-size: 0.86rem; color: var(--ink-soft); margin-top: 8px; }

/* ---- Player stats ------------------------------------------------ */
.player-stats {
    display: flex; flex-wrap: wrap; gap: 0;
    margin: 16px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
}
.player-stats .stat {
    flex: 1 1 auto; min-width: 110px;
    padding: 14px 16px; text-align: center;
    border-right: 1px solid var(--line);
}
.player-stats .stat:last-child { border-right: none; }
.player-stats .stat b {
    display: block;
    font-family: var(--font-mono);
    font-size: clamp(1.4rem, 4vw, 1.9rem);
    font-weight: 600;
    color: var(--green);
}
.player-stats .stat span {
    font-size: 0.72rem; color: var(--ink-soft);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}

.countdown {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 11vw, 4.5rem);
    font-weight: 600;
    text-align: center;
    color: var(--red);
    min-height: 1.15em;
}

.word-live { background: #fff6c2; border-radius: 3px; box-shadow: 0 1px 0 var(--green); }

.clickable-sheet span[data-chunk] { cursor: pointer; border-radius: 2px; transition: background 0.1s ease; }
.clickable-sheet span[data-chunk]:hover { background: var(--green-soft); }

/* ---- Diff -------------------------------------------------------- */
.diff-correct { color: var(--green); }
.diff-wrong   { color: var(--red); text-decoration: line-through; }
.diff-missed  { color: var(--amber); border-bottom: 2px dotted var(--amber); }
.diff-extra   { color: var(--ink-soft); font-style: italic; }
.accuracy-big { font-family: var(--font-mono); font-size: clamp(2.4rem, 8vw, 3.4rem); font-weight: 600; color: var(--green); }

/* ---- Tables ------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th, .table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
.table th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 600; }
.table td .muted { color: var(--ink-soft); font-size: 0.84rem; }
.table tbody tr:hover { background: var(--bg-soft); }

/* ---- Badges ------------------------------------------------------ */
.badge {
    display: inline-block;
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
    padding: 3px 9px; border-radius: 20px;
    background: var(--green-soft); color: var(--green);
}
.badge.hindi { background: var(--red-soft); color: var(--red); }

/* AI note: clean callout */
.coach-box {
    margin-top: 14px;
    padding: 16px 18px;
    background: #fffaf0;
    border: 1px solid #f0e4c8;
    border-left: 3px solid var(--amber);
    border-radius: 9px;
    font-size: 0.98rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.weak-chip { cursor: pointer; transition: background 0.1s ease; }
.weak-chip:hover { background: var(--green-soft); }

/* ---- Layout helpers ---------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty-state { text-align: center; color: var(--ink-soft); padding: 38px 10px; }
.empty-state a { color: var(--green); font-weight: 600; }

.footer {
    margin-top: auto;
    padding-top: 28px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

/* ---- Mobile ------------------------------------------------------ */
@media (max-width: 820px) {
    .grid-2 { grid-template-columns: 1fr; }
    .nav-toggle { display: block; }
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 55;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.12);
    }
    .sidebar.open { transform: translateX(0); }
    .page { padding-top: 64px; }
    .table { display: block; overflow-x: auto; white-space: nowrap; }
    .player-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: var(--bg); border-top: 1px solid var(--line);
    }
    .player-bar .btn { flex: 1 1 22%; padding: 12px 8px; font-size: 0.84rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
