/* The free typing test at /typing-test. Everything is scoped under .tt or
   .tt-dialog. Green is NirmanTech's, because NirmanTech issues the certificate. */

/* Used only on the certificate. A variable font, so one file covers every weight. */
@font-face {
    font-family: 'Source Serif 4'; font-style: normal; font-weight: 200 900; font-display: swap;
    src: url(../vendor/fonts/sourceserif4_v14_vEFI2_tTDB4M7-auWDN0ahZJW1gb8tc.woff2) format('woff2');
}

:root {
    --font: 'Inter', 'Noto Sans Bengali', system-ui, sans-serif;
    --font-head: 'Poppins', 'Noto Sans Bengali', system-ui, sans-serif;
    --tt-green: #34d27a;
    --tt-green-solid: #09843a;
    --tt-rose: #ff7d89;
    --tt-rose-bg: rgba(255, 71, 87, .22);
    --tt-now: rgba(52, 210, 122, .16);
    --tt-forest: #12261d;
}
:root[data-theme="light"] {
    --tt-green: #087a36;
    --tt-rose: #c0182f;
    --tt-rose-bg: rgba(192, 24, 47, .13);
    --tt-now: rgba(9, 132, 58, .13);
}

.tt section { padding-block: 0; }
.tt-wrap { max-width: 980px; }

.tt-stage { padding-top: calc(var(--nav-h) + 2.2rem) !important; padding-bottom: 3.5rem !important; }

.tt-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1.2rem 2rem; margin-bottom: 1.8rem; }
.tt-head h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.7rem); letter-spacing: 0; line-height: 1.3; }
.tt-head p { margin-top: .25rem; }

.tt-options { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.tt-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 2px; }
.tt-seg legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tt-seg label { cursor: pointer; }
.tt-seg input { position: absolute; opacity: 0; }
.tt-seg span { display: block; padding: .32rem .78rem; border-radius: 6px; font-size: .9rem; color: var(--ink-2); white-space: nowrap; }
.tt-seg input:checked + span { background: var(--tt-green-solid); color: #fff; font-weight: 600; }
.tt-seg input:focus-visible + span { outline: 2px solid var(--tt-green); outline-offset: 1px; }
.tt-sound { width: 40px; height: 40px; border-radius: var(--r-sm); background: none; border: 1px solid var(--border-strong); color: var(--ink-2); cursor: pointer; }
.tt-sound[aria-pressed="true"] { color: var(--tt-green); }

/* The clock is the page's one loud thing. */
.tt-meter { display: grid; grid-template-columns: 2.1fr 1fr 1fr 1fr; align-items: end; gap: 1rem; }
.tt-meter b { display: block; font-family: var(--font-head); font-weight: 600; font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.5rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tt-meter span { font-size: .88rem; color: var(--ink-2); }
.tt-clock b { font-size: clamp(4.2rem, 3rem + 6.5vw, 7.2rem); font-weight: 700; line-height: .95; color: var(--tt-green); letter-spacing: -.03em; }

.tt-drain { height: 4px; margin-top: 1rem; background: var(--border); border-radius: 2px; overflow: hidden; }
.tt-drain i { display: block; height: 100%; background: var(--tt-green); transform-origin: left; }

.tt-words {
    position: relative; height: 12.6rem; overflow: hidden; margin-top: 1.1rem;
    font-size: clamp(1.3rem, 1.1rem + .9vw, 1.75rem); line-height: 4.2rem;
    user-select: none; -webkit-user-select: none; overflow-wrap: anywhere;
}
.tt-words[data-lang="en"] { font-family: var(--font); }
.tt-words span { padding: .12em .2em; border-radius: 5px; color: var(--ink-2); }
.tt-words .now { color: var(--ink); background: var(--tt-now); box-shadow: inset 0 -3px 0 var(--tt-green); }
.tt-words .now.bad { background: var(--tt-rose-bg); box-shadow: inset 0 -3px 0 var(--tt-rose); }
.tt-words .ok { color: var(--tt-green); }
.tt-words .no { color: var(--tt-rose); text-decoration: line-through; }

.tt-input {
    width: 100%; margin-top: 1rem; padding: .85rem 1.1rem; font-size: 1.3rem;
    background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--r-sm); outline: none;
}
.tt-input:focus { border-color: var(--tt-green); }
.tt-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem 1.5rem; margin-top: .9rem; }
.tt-foot p { font-size: .9rem; flex: 1 1 20rem; }
.tt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.tt-result { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2rem 4rem; padding-block: 2.2rem 1rem; }
.tt-result[hidden] { display: none; }
.tt-score { outline: none; text-align: center; }
.tt-score b { display: block; font-family: var(--font-head); font-size: clamp(6rem, 4rem + 9vw, 10rem); font-weight: 700; line-height: .95; letter-spacing: -.04em; color: var(--tt-green); font-variant-numeric: tabular-nums; }
.tt-msg { font-size: 1.15rem; color: var(--ink); }
.tt-detail dl { display: flex; flex-wrap: wrap; gap: .6rem 2.6rem; margin: 1rem 0; }
.tt-detail dt { font-size: .88rem; color: var(--ink-2); }
.tt-detail dd { margin: 0; font-family: var(--font-head); font-size: 1.5rem; font-weight: 600; }
.tt-note { font-size: .95rem; margin-bottom: 1rem; }
.tt-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.tt-actions [hidden] { display: none; }
.tt-btn-green { background: var(--tt-green-solid); color: #fff; border: 0; }
.tt-btn-green:hover { background: #0a9743; color: #fff; }
.tt-btn-green:disabled { opacity: .45; cursor: not-allowed; }

.tt-about { padding-block: 3rem 4.5rem !important; background: var(--bg-2); }
.tt-issuer { display: flex; align-items: center; gap: 1.1rem 1.6rem; flex-wrap: wrap; background: var(--tt-forest); color: #fff; padding: 1.15rem 1.5rem; border-radius: var(--r-sm); margin-bottom: 2.2rem; }
.tt-issuer img { width: min(100%, 370px); }
.tt-issuer span { font-size: .95rem; color: rgba(255, 255, 255, .78); }
.tt-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem 3.5rem; }
.tt-kinds h2 { font-size: 1.32rem; letter-spacing: 0; line-height: 1.4; margin-bottom: .45rem; }
.tt-links { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin-top: .6rem; }
.tt-links a { color: var(--tt-green); font-weight: 600; }
.tt-links a:hover { text-decoration: underline; }

.tt-dialog {
    margin: auto; width: min(100% - 1.6rem, 820px); max-height: calc(100dvh - 1.6rem); padding: 1.4rem;
    color: var(--ink); background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: var(--r);
}
.tt-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.tt-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.tt-dialog h2 { font-size: 1.3rem; letter-spacing: 0; }
.tt-name { display: block; font-size: .93rem; color: var(--ink-2); }
.tt-name input { display: block; width: 100%; margin-top: .3rem; padding: .62rem .85rem; font-size: 1.05rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); outline: none; }
.tt-name input:focus { border-color: var(--tt-green); }
.tt-dialog canvas { display: block; width: 100%; height: auto; margin: .9rem 0; border-radius: 4px; }
.tt-signed { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.tt-links a:not([href]) { opacity: .45; pointer-events: none; }

.tv-wrap { max-width: 680px; }
.tv-stage { min-height: 70vh; }
.tv-wrap h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.7rem); letter-spacing: 0; }
.tv-form { margin-top: 1.6rem; }
.tv-form label { font-size: .93rem; color: var(--ink-2); }
.tv-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.tv-row input { flex: 1 1 15rem; padding: .75rem 1rem; font-size: 1.1rem; background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--r-sm); outline: none; }
.tv-row input:focus { border-color: var(--tt-green); }
.tv-result { margin-top: 1.6rem; padding: 1.1rem 1.3rem; border-left: 4px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.tv-result[hidden] { display: none; }
.tv-valid { border-left-color: var(--tt-green); }
.tv-cancelled { border-left-color: var(--amber); }
.tv-none { border-left-color: var(--tt-rose); }
.tv-verdict { color: var(--ink); font-weight: 600; font-size: 1.1rem; }
.tv-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .7rem 1.5rem; margin: 1rem 0 0; }
.tv-facts[hidden] { display: none; }
.tv-facts dt { font-size: .86rem; color: var(--ink-2); }
.tv-facts dd { margin: 0; font-weight: 600; }
.tv-note { margin-top: 1.6rem; font-size: .9rem; }

@media (max-width: 720px) {
    .tt-meter { grid-template-columns: repeat(3, 1fr); }
    .tt-clock { grid-column: 1 / -1; }
    .tt-result { grid-template-columns: 1fr; gap: 1.4rem; }
    .tt-kinds { grid-template-columns: 1fr; }
    .tt-words { height: 9.6rem; line-height: 3.2rem; }
    .tt-seg span { padding: .3rem .55rem; font-size: .86rem; }
}
