/* SetuSpain Typing: same colours as setuspain.com (navy, gold, red, green). */
:root {
    --navy: #0F2C4D; --navy-2: #173A63; --gold: #F9AB0D; --red: #E3081C; --green: #02522F;
    --bg: #F4F7FB; --card: #FFFFFF; --text: #13233A; --muted: #5B6B80; --line: #DCE3EC;
    --ok: #1E8E5A; --bad: #D6243A; --bad-bg: rgba(214, 36, 58, 0.12); --todo: #8A97A8; --cur: var(--gold);
    --radius: 18px;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #0B1726; --card: #12233A; --text: #E7EEF7; --muted: #9AACC2; --line: #24384F;
    --ok: #4ED39A; --bad: #FF6B7D; --bad-bg: rgba(255, 107, 125, 0.16); --todo: #6F8299;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.6;
}
a { color: inherit; }

/* header */
.top {
    display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.2rem;
    background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.brand img { border-radius: 8px; background: #fff; }
.brand b { color: var(--gold); }
.top-nav { display: flex; gap: 0.3rem; margin-left: auto; flex-wrap: wrap; }
.top-nav a { padding: 0.35rem 0.75rem; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.top-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.16); }
.top-nav a:hover { background: rgba(255, 255, 255, 0.1); }
.theme-btn { border: 1px solid rgba(255, 255, 255, 0.35); background: transparent; color: #fff; border-radius: 999px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1rem; }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { margin: 0.5rem 0 0.2rem; font-size: clamp(1.6rem, 4vw, 2.2rem); color: var(--text); }
.lead { margin: 0 0 1.2rem; color: var(--muted); }

/* app card */
.app { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 1.2rem; box-shadow: 0 10px 30px rgba(15, 44, 77, 0.07); }
.tt-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.tt-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(15, 44, 77, 0.07); }
:root[data-theme="dark"] .tt-seg { background: rgba(255, 255, 255, 0.07); }
.tt-seg[hidden] { display: none; }
.tt-seg-btn, .tt-chip, .tt-btn {
    border: 0; border-radius: 999px; padding: 0.45rem 0.95rem; background: transparent; color: var(--muted);
    font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.tt-seg-btn[aria-pressed="true"] { background: var(--gold); color: #1A1300; }
.tt-chip { border: 1px solid var(--line); margin-left: auto; }
.tt-chip[aria-pressed="true"] { border-color: var(--gold); color: var(--text); }
.tt-seg-btn:focus-visible, .tt-chip:focus-visible, .tt-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.tt-stats { display: flex; gap: 0.6rem; margin: 0.9rem 0 0.7rem; flex-wrap: wrap; }
.tt-stat { padding: 0.3rem 0.8rem; border-radius: 10px; background: rgba(15, 44, 77, 0.06); font-weight: 700; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .tt-stat { background: rgba(255, 255, 255, 0.06); }

/* the text */
.tt-box { position: relative; border: 2px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; cursor: text; transition: border-color .2s; }
.tt-box.has-focus { border-color: var(--navy-2); }
:root[data-theme="dark"] .tt-box.has-focus { border-color: var(--gold); }
.tt-view { height: calc(3 * 2.4rem); overflow: hidden; }
.tt-text {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 1.35rem; line-height: 2.4rem; transition: transform .12s ease-out; word-break: normal;
}
.tt-w { display: inline; }
.tt-c { color: var(--todo); border-radius: 3px; }
.tt-c.ok { color: var(--ok); }
.tt-c.bad { color: var(--bad); background: var(--bad-bg); }
.tt-c.bad.sp { background: var(--bad-bg); }
.tt-c.cur { box-shadow: inset 2px 0 0 var(--cur); animation: tt-blink 1s steps(2) infinite; }
@keyframes tt-blink { 50% { box-shadow: inset 2px 0 0 transparent; } }
.app.is-big .tt-text { font-size: 1.7rem; line-height: 2.9rem; }
.app.is-big .tt-view { height: calc(3 * 2.9rem); }
.tt-input { position: absolute; inset: 0; opacity: 0; resize: none; border: 0; font-size: 16px; color: transparent; background: transparent; caret-color: transparent; }
.tt-cover {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px;
    background: color-mix(in srgb, var(--card) 70%, transparent); backdrop-filter: blur(2px);
    font-weight: 700; color: var(--text); pointer-events: none;
}
.tt-box.has-focus .tt-cover, .tt-box.is-done .tt-cover { display: none; }
.tt-box.is-done { opacity: 0.55; }

.tt-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.8rem; flex-wrap: wrap; }
.tt-btn { border: 1px solid var(--line); color: var(--text); }
.tt-btn:hover { border-color: var(--navy-2); }
.tt-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .tt-primary { background: var(--gold); color: #1A1300; border-color: var(--gold); }
.tt-hint { font-size: 0.82rem; color: var(--muted); }

/* result */
.tt-result { margin-top: 1rem; padding: 1.1rem; border-radius: 14px; background: linear-gradient(135deg, rgba(249, 171, 13, 0.14), rgba(15, 44, 77, 0.05)); border: 1px solid var(--line); }
.tt-done { margin: 0; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tt-big { display: flex; gap: 2rem; margin: 0.4rem 0; }
.tt-big-item strong { display: block; font-size: 3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tt-big-item span { color: var(--muted); font-weight: 700; }
.tt-best { margin: 0.2rem 0; color: var(--green); font-weight: 800; }
:root[data-theme="dark"] .tt-best { color: var(--ok); }
.tt-sub { margin: 0.2rem 0; color: var(--muted); }
.tt-detail { display: grid; grid-template-columns: auto auto; gap: 0.15rem 1rem; margin: 0.6rem 0 0; max-width: 320px; }
.tt-detail dt { color: var(--muted); }
.tt-detail dd { margin: 0; font-weight: 700; text-align: right; }

.tt-history { margin-top: 1.2rem; }
.tt-history h2 { font-size: 1rem; margin: 0 0 0.4rem; }
.tt-hlist { list-style: none; margin: 0; padding: 0; }
.tt-hlist li { display: grid; grid-template-columns: 4.5rem 1fr auto auto; gap: 0.8rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.tt-h-wpm { font-weight: 800; }
.tt-h-acc, .tt-h-when { color: var(--muted); }

/* text below */
.info { margin-top: 2.2rem; }
.info h2 { font-size: 1.3rem; }
.info h3 { font-size: 1.05rem; margin: 1.2rem 0 0.3rem; }
.info p { color: var(--muted); }
.privacy-line { font-size: 0.85rem; }
.noscript { padding: 1rem; background: var(--bad-bg); border-radius: 10px; }
.foot { text-align: center; padding: 1.5rem 1rem 2rem; color: var(--muted); font-size: 0.88rem; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
    .top { padding: 0.55rem 0.7rem; gap: 0.4rem; }
    .brand { font-size: 0.95rem; }
    .brand img { width: 28px; height: 28px; }
    .top-nav a { padding: 0.3rem 0.55rem; font-size: 0.85rem; }
    .theme-btn { width: 2rem; height: 2rem; flex: none; }
    .top-link { display: none; }
    .tt-text { font-size: 1.15rem; line-height: 2.1rem; }
    .tt-view { height: calc(3 * 2.1rem); }
    .tt-chip { margin-left: 0; }
    .tt-hint { display: none; }
    .tt-big-item strong { font-size: 2.4rem; }
}
@media (prefers-reduced-motion: reduce) { .tt-text { transition: none; } .tt-c.cur { animation: none; } }

/* lessons, drill focus line */
.tt-lessons { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.7rem 0 0.2rem; scrollbar-width: thin; }
.tt-lessons[hidden] { display: none; }
.tt-les { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; min-width: 7.5rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tt-les[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(249, 171, 13, 0.35); }
.tt-les.is-done .tt-les-n { background: var(--ok); color: #fff; }
.tt-les.is-locked { opacity: 0.45; cursor: not-allowed; }
.tt-les-n { font-size: 0.7rem; font-weight: 800; padding: 0.05rem 0.45rem; border-radius: 999px; background: rgba(15, 44, 77, 0.1); }
.tt-les-name { font-weight: 700; font-size: 0.85rem; }
.tt-les-keys { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; color: var(--muted); letter-spacing: 0.08em; }
.tt-focus { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--muted); }
.tt-focus[hidden] { display: none; }

/* coach panel */
.tt-coach { margin-top: 1.3rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; }
.tt-coach h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.tt-coach h3 { font-size: 0.9rem; margin: 1rem 0 0.4rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tt-coach-head { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.tt-level strong { display: block; font-size: 1.5rem; line-height: 1.1; }
.tt-level span { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.tt-level-bar { width: 180px; height: 8px; margin-top: 0.4rem; border-radius: 999px; background: rgba(15, 44, 77, 0.1); overflow: hidden; }
:root[data-theme="dark"] .tt-level-bar, :root[data-theme="dark"] .tt-les-n { background: rgba(255, 255, 255, 0.12); }
.tt-level-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); border-radius: 999px; transition: width .4s; }
.tt-keys { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tt-keycap { display: inline-flex; flex-direction: column; align-items: center; min-width: 3.4rem; padding: 0.35rem 0.5rem; border-radius: 10px; border: 1px solid var(--line); border-bottom-width: 3px; background: var(--card); }
.tt-keycap b { font-size: 1.2rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tt-keycap small { color: var(--muted); font-size: 0.68rem; white-space: nowrap; }
.tt-rec { margin-top: 1rem; padding: 0.8rem 0.9rem; border-radius: 12px; background: rgba(249, 171, 13, 0.12); }
.tt-rec-what { margin: 0.1rem 0; font-weight: 800; font-size: 1.1rem; }
.tt-rec .tt-btn { margin-top: 0.4rem; }
.tt-coach-foot { margin: 0.9rem 0 0; font-size: 0.8rem; }
.tt-link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: inherit; cursor: pointer; }
@media (max-width: 600px) { .tt-seg { flex-wrap: wrap; border-radius: 14px; } .tt-level-bar { width: 140px; } }
