/* DERYVIER · English Tenses Trainer */

:root {
    --bg:        #07080a;
    --bg-2:      #0d0f13;
    --panel:     #12151b;
    --panel-2:   #171b23;
    --line:      #232833;
    --border:    #262c38;
    --gold:      #d4af37;
    --gold-soft: #f0d47a;
    --gold-dim:  #8a7226;
    --text:      #e8e9ee;
    --muted:     #8d94a6;
    --red:       #ff4d5e;
    --red-bg:    #3a1017;
    --ok:        #3ddc97;
    --ok-bg:     #0e2a20;
    --warn:      #ffb340;
    --radius:    14px;
    --shadow:    0 10px 40px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(212,175,55,.10), transparent 60%),
        radial-gradient(700px 400px at 100% 0%, rgba(212,175,55,.05), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--gold-soft); text-decoration: none; }
a:hover { color: var(--gold); }

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 18px 80px; }
.narrow { max-width: 560px; }

/* ------------------------------------------------------------- ШАПКА */

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px;
    padding: 14px 18px;
    background: rgba(7,8,10,.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar .inner { display: flex; align-items: center; gap: 16px; width: 100%; max-width: 1080px; margin: 0 auto; }
.logo {
    font-family: 'Russo One', sans-serif;
    font-size: 17px; letter-spacing: .5px;
    background: linear-gradient(100deg, var(--gold-soft), var(--gold) 60%, var(--gold-dim));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    white-space: nowrap;
}
.logo small { display: block; font-family: 'Exo 2'; font-size: 10px; letter-spacing: 2.4px; color: var(--muted); -webkit-text-fill-color: var(--muted); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button {
    padding: 8px 13px; border-radius: 9px; font-size: 14px;
    color: var(--muted); background: none; border: 1px solid transparent; cursor: pointer;
    font-family: inherit;
}
.nav a:hover, .nav button:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--gold); border-color: var(--border); background: var(--panel); }
.badge-dot {
    display: inline-block; min-width: 19px; padding: 0 5px; margin-left: 6px;
    background: var(--red); color: #fff; border-radius: 10px;
    font-size: 11px; line-height: 19px; text-align: center; font-weight: 700;
}

/* ------------------------------------------------------------ БЛОКИ */

h1 { font-family: 'Russo One', sans-serif; font-size: 26px; font-weight: 400; margin: 26px 0 6px; letter-spacing: .3px; }
h2 { font-family: 'Russo One', sans-serif; font-size: 18px; font-weight: 400; margin: 28px 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }

.card {
    background: linear-gradient(180deg, var(--panel), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------------------------------------------------------- КНОПКИ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; border-radius: 11px; border: 1px solid var(--border);
    background: var(--panel-2); color: var(--text);
    font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
    transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--gold-dim); }
.btn:active { transform: translateY(1px); }
.btn-gold {
    background: linear-gradient(120deg, var(--gold-soft), var(--gold) 55%, #b8941f);
    color: #171208; border-color: transparent; box-shadow: 0 6px 22px rgba(212,175,55,.22);
}
.btn-gold:hover { filter: brightness(1.07); }
.btn-ghost { background: none; }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ----------------------------------------------------------- ФОРМЫ */

label.fl { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password] {
    width: 100%; padding: 13px 15px; border-radius: 11px;
    border: 1px solid var(--border); background: #0a0c10; color: var(--text);
    font-family: inherit; font-size: 16px; outline: none;
}
input:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(212,175,55,.10); }
.check { display: flex; align-items: center; gap: 9px; margin-top: 14px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--gold); }

.msg { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-top: 14px; display: none; }
.msg.err { display: block; background: var(--red-bg); color: #ffb3bb; border: 1px solid #5a1a25; }
.msg.ok  { display: block; background: var(--ok-bg); color: #9df0cd; border: 1px solid #17503c; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs a, .tabs button {
    padding: 11px 16px; background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--muted); font-family: inherit; font-size: 15px; cursor: pointer;
    text-decoration: none; display: inline-block;
}
.tabs a.on, .tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }

/* ------------------------------------------------------ ВЫБОР ВЕТКИ */

.branch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tcard {
    position: relative; text-align: left; cursor: pointer;
    padding: 16px 16px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--panel);
    font-family: inherit; color: var(--text); transition: .15s;
}
.tcard:hover { border-color: var(--gold-dim); background: var(--panel-2); }
.tcard.on { border-color: var(--gold); background: linear-gradient(160deg, rgba(212,175,55,.13), transparent 70%), var(--panel-2); }
.tcard .num {
    font-family: 'Russo One'; font-size: 12px; color: var(--gold);
    border: 1px solid var(--gold-dim); border-radius: 6px; padding: 1px 7px; display: inline-block; margin-bottom: 8px;
}
.tcard .tt { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600; display: block; }
.tcard .ds { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: block; }
.tcard .fm { color: var(--gold-dim); font-size: 11.5px; font-family: 'JetBrains Mono', monospace; margin-top: 7px; display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 9px 15px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--panel); color: var(--muted); cursor: pointer;
    font-family: inherit; font-size: 14px; transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--gold-dim); }
.chip.on { background: rgba(212,175,55,.13); border-color: var(--gold); color: var(--gold-soft); }

/* -------------------------------------------------------- ПРАКТИКА */

.pbar { height: 5px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold-soft)); width: 0; transition: width .35s; }

.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: 12px; }
.tag {
    padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border);
    color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
}
.tag.gold { color: var(--gold); border-color: var(--gold-dim); }
.tag.case { color: var(--warn); border-color: #6b4a15; background: rgba(255,179,64,.08); }

.prompt-ru {
    font-size: 23px; line-height: 1.4; font-weight: 600; margin: 6px 0 12px;
    letter-spacing: .2px;
}
.prompt-hint {
    display: inline-flex; flex-wrap: wrap; gap: 7px; align-items: center;
    font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted);
    margin-bottom: 18px;
}
.prompt-hint b {
    background: #0b0d11; border: 1px solid var(--border); border-radius: 7px;
    padding: 3px 9px; color: var(--gold-soft); font-weight: 500;
}

#answer {
    font-family: 'JetBrains Mono', monospace; font-size: 17px; padding: 15px 16px;
    letter-spacing: .2px;
}
.answer-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.answer-row .btn { flex: 1 1 auto; }

/* --------------------------------------------------- РАЗБОР ОТВЕТА */

.result { margin-top: 18px; }
.tokens {
    font-family: 'JetBrains Mono', monospace; font-size: 17px; line-height: 2.1;
    padding: 15px 16px; border-radius: 12px; background: #0a0c10; border: 1px solid var(--border);
    word-break: break-word;
}
.tk { padding: 3px 6px; border-radius: 6px; }
.tk.ok    { color: var(--text); }
.tk.wrong { background: var(--red-bg); color: #ff8a95; border-bottom: 2px solid var(--red); font-weight: 600; }
.tk.extra { background: var(--red-bg); color: #ff8a95; text-decoration: line-through; opacity: .85; }
.tk.gap {
    display: inline-block; width: 34px; height: 6px; vertical-align: middle;
    border-bottom: 2px dashed var(--red); margin: 0 4px;
}
.verdict {
    display: flex; align-items: center; gap: 10px; margin-top: 14px;
    font-size: 15px; font-weight: 600;
}
.verdict.bad { color: var(--red); }
.verdict.good { color: var(--ok); }
.verdict .ic {
    width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    font-size: 15px; flex: 0 0 auto;
}
.verdict.bad .ic { background: var(--red-bg); }
.verdict.good .ic { background: var(--ok-bg); }

.correct-line {
    margin-top: 12px; padding: 14px 16px; border-radius: 12px;
    background: var(--ok-bg); border: 1px solid #17503c;
    font-family: 'JetBrains Mono', monospace; font-size: 16px; color: #b6f2d8;
}

/* -------------------------------------------------------- АННОТАЦИИ */

.notes { margin-top: 16px; display: grid; gap: 12px; }
.note {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    background: var(--panel);
    animation: slidein .28s ease both;
}
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.note-h {
    display: flex; align-items: center; gap: 10px; padding: 13px 16px;
    background: linear-gradient(90deg, rgba(212,175,55,.12), transparent);
    border-bottom: 1px solid var(--border);
}
.note-h .t { font-family: 'Russo One', sans-serif; font-size: 14px; color: var(--gold-soft); font-weight: 400; }
.note-h .tag { margin-left: auto; }
.note-b { padding: 14px 16px; font-size: 14.5px; color: #c8ccd8; }
.formula {
    font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--gold);
    background: #0a0c10; border: 1px dashed var(--gold-dim); border-radius: 8px;
    padding: 9px 12px; margin-bottom: 12px; word-break: break-word;
}
.pairs { margin-top: 13px; display: grid; gap: 8px; }
.pair {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    background: #0a0c10; border-radius: 9px; padding: 9px 12px;
}
.pair .w { color: #ff8a95; text-decoration: line-through; opacity: .8; }
.pair .r { color: var(--ok); }
.pair .ar { color: var(--muted); }
.pair-note { grid-column: 1 / -1; color: var(--muted); font-family: 'Exo 2'; font-size: 12.5px; }

.soft {
    margin-top: 12px; padding: 11px 14px; border-radius: 10px; font-size: 13.5px;
    background: rgba(255,179,64,.08); border: 1px solid #6b4a15; color: #ffd79a;
}

/* -------------------------------------------------------- СТАТИСТИКА */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.kpi .v { font-family: 'Russo One', sans-serif; font-size: 26px; color: var(--gold); line-height: 1.2; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.bar-row { display: grid; grid-template-columns: 190px 1fr 58px; gap: 12px; align-items: center; margin-bottom: 11px; font-size: 14px; }
.bar-row .nm { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted); }
.bar { height: 9px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold-soft)); }
.bar.red i { background: linear-gradient(90deg, #7a1f2b, var(--red)); }
.bar-row .pc { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--gold-soft); }

.heat { display: flex; gap: 3px; flex-wrap: wrap; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--panel-2); display: block; }
.heat i.l1 { background: #4a3c14; } .heat i.l2 { background: #7a6420; }
.heat i.l3 { background: #b08d2c; } .heat i.l4 { background: var(--gold); }

.case-item {
    display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin-bottom: 10px;
}
.case-item .body { flex: 1; min-width: 0; }
.case-item .ru { font-size: 15px; font-weight: 600; }
.case-item .rl { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; }
.case-item .st {
    flex: 0 0 auto; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted);
}
.dots { display: flex; gap: 4px; justify-content: center; margin-top: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--border); }
.dots i.f { background: var(--gold); border-color: var(--gold); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: 'JetBrains Mono', monospace; }
.mt { margin-top: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* -------------------------------------------------------- МОБИЛЬНАЯ */

@media (max-width: 760px) {
    .wrap { padding: 0 13px 60px; }
    h1 { font-size: 21px; margin-top: 18px; }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .branch { grid-template-columns: 1fr; }
    .prompt-ru { font-size: 19px; }
    #answer { font-size: 16px; }
    .tokens { font-size: 15px; line-height: 2; }
    .bar-row { grid-template-columns: 1fr 52px; }
    .bar-row .bar { grid-column: 1 / -1; }
    .answer-row .btn { flex: 1 1 100%; }
    .topbar { padding: 11px 13px; }
    .logo { font-size: 15px; }
    .nav a, .nav button { padding: 7px 10px; font-size: 13px; }
    .pair { grid-template-columns: 1fr; gap: 4px; }
    .pair .ar { display: none; }
    .card { padding: 16px; }
}

@media (max-width: 380px) {
    .kpis { grid-template-columns: 1fr; }
}
