/* Self-hosted: Alegreya and Alegreya Sans (Huerta Tipográfica, SIL OFL 1.1, fonts/OFL.txt), subset to Latin with
   Latin Extended and the combining marks, so every Lithuanian letter and stress mark comes from the same face. */
@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/alegreya.woff2) format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/alegreya-italic.woff2) format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/alegreya-sans.woff2) format('woff2'); }
@font-face { font-family: 'Alegreya Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/alegreya-sans-bold.woff2) format('woff2'); }
:root {
  --bg: #121726;
  --panel: #1a2034;
  --panel-2: #20273f;
  --line: #2b3350;
  --text: #f0e9d8;
  --soft: #d9d0bb;
  --muted: #8f97b0;
  --gold: #e6b450;
  --good: #8fcf9b;
  --bad: #e8806f;
  --serif: 'Alegreya', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: 'Alegreya Sans', 'Avenir Next', Avenir, 'Segoe UI', system-ui, sans-serif;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 17px; line-height: 1.45; }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
#app { max-width: 540px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.primary { background: var(--gold); color: #1a1406; border: 0; font-weight: 700; }
button.link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
kbd { font-family: var(--sans); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; line-height: 1.4; }
.gold { color: var(--gold); }
.muted { color: var(--muted); }
.loading { color: var(--muted); text-align: center; margin-top: 40vh; }

/* menu */
.menu .top { display: flex; justify-content: flex-end; }
.lang { display: flex; gap: 2px; background: var(--panel); border-radius: 999px; padding: 2px; }
.lang .chip { border: 0; padding: 3px 10px; font-size: 13px; background: none; color: var(--muted); }
.lang .chip.on { background: var(--panel-2); color: var(--text); }
.lead { color: var(--muted); margin: 0 0 28px; font-family: var(--serif); font-style: italic; font-size: 19px; }
.levels { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -10px 0 20px; }
.levels .label { margin-right: 6px; }
.modes { display: grid; border-top: 1px solid var(--line); }
.mode { display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 4px; }
.mode:not(:disabled):hover { background: var(--panel); }
.m-text { flex: 1; display: grid; gap: 2px; }
.mode b { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.mode small { color: var(--muted); font-size: 15px; }
.m-best { color: var(--gold); font-variant-numeric: lining-nums tabular-nums; font-size: 15px; }
.m-go { color: var(--muted); font-size: 24px; line-height: 1; }
.settings { margin: 24px 0 18px; }
.settings summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; padding: 6px 0; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before { content: '›'; color: var(--muted); display: inline-block; transition: transform .15s; }
.settings[open] summary::before { transform: rotate(90deg); }
.settings summary small { color: var(--muted); font-size: 14px; }
.settings .row { display: grid; gap: 6px; margin: 12px 0; }
.label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 12px; border-radius: 999px; font-size: 15px; }
.chip.on { border-color: var(--gold); color: var(--gold); }
.toggles { display: grid; gap: 4px; margin-top: 14px; }
.toggle { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 16px; cursor: pointer; }
.toggle input { accent-color: var(--gold); width: 18px; height: 18px; margin: 0; }
.credits { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-top: 32px; }
.credits a { color: inherit; }

/* play */
.play { display: flex; flex-direction: column; min-height: calc(100dvh - 48px); }
.play header, .guide header, .duel header, .about header { display: flex; align-items: center; gap: 14px; min-height: 40px; }
.back { padding: 4px 12px; font-size: 20px; background: none; border-color: transparent; color: var(--muted); }
.back:hover { color: var(--text); }
.status { display: flex; gap: 16px; flex: 1; font-variant-numeric: lining-nums tabular-nums; color: var(--soft); }
.lives { color: var(--bad); letter-spacing: 2px; }
.lives s { opacity: .25; text-decoration: none; }
.score { color: var(--gold); font-weight: 700; }
.streak { color: var(--good); }
.cat { color: var(--muted); font-size: 13px; }
.cat em { color: var(--bad); font-style: normal; margin-left: 4px; border: 1px solid; border-radius: 6px; padding: 0 4px; font-size: 11px; }
.stage { position: relative; padding: 110px 0 8px; text-align: center; }
/* the word: one line always; main.js shrinks the font when a long word would not fit */
.word { display: flex; justify-content: center; flex-wrap: nowrap; white-space: nowrap; gap: 0; font-family: var(--serif); font-size: clamp(40px, 13vw, 64px); }
.letter { font-size: 1em; line-height: 1.2; padding: .06em .045em .1em; background: none; border: 0; border-bottom: .05em solid transparent; border-radius: .12em; }
.letter.s1 { color: var(--soft); }
.letter.dim { opacity: .5; }
.letter:not(:disabled):hover { background: var(--panel); }
.letter.sel { background: var(--panel-2); border-bottom-color: var(--gold); }
.armed .letter:not(.dim):hover { border-bottom-color: var(--gold); }
.letter:disabled { opacity: 1; }
.letter.right, .syl.right { color: var(--gold); }
.letter.wrong, .syl.wrong { color: var(--bad); text-decoration: line-through; text-decoration-thickness: .04em; }
.word.by-syl { font-size: clamp(34px, 10vw, 52px); gap: .1em; align-items: center; }
.syl { font-size: 1em; font-family: var(--serif); padding: .1em .25em; line-height: 1.2; }
.syl:disabled { opacity: 1; }
.dot { color: var(--muted); font-size: .6em; }
.picker { position: absolute; display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--gold); padding: 6px; border-radius: 16px; box-shadow: 0 10px 28px #0009; z-index: 2; }
.picker[hidden] { display: none; }
.picker button, .markbar button { font-family: var(--serif); min-width: 58px; padding: 2px 8px 4px; background: var(--bg); display: grid; justify-items: center; line-height: 1.1; }
.picker .glyph { font-size: 34px; }
.picker kbd, .markbar kbd { border: 0; padding: 0; }
@media (hover: none) { .picker kbd { display: none; } }
.meaning { margin: 22px 4px 0; display: grid; gap: 8px; }
.def { color: var(--soft); font-family: var(--serif); font-size: 19px; line-height: 1.4; margin: 0; }
.def.en { color: var(--muted); font-size: 17px; font-style: italic; }
.def .tag { font-family: var(--sans); font-style: normal; font-size: 10.5px; letter-spacing: .05em; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-right: 8px; vertical-align: 2px; }
.def.dict { font-family: var(--sans); font-size: 15px; }
.feedback { margin-top: auto; padding-top: 24px; min-height: 140px; }
.hint { color: var(--muted); text-align: center; font-size: 15px; margin: 0 0 14px; }
.markbar { display: flex; justify-content: center; gap: 10px; }
.markbar .glyph { font-size: 30px; }
.markbar button.on { border-color: var(--gold); background: var(--panel-2); }
.card { background: var(--panel); border-radius: var(--radius); padding: 14px 18px 6px; }
.verdict { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.verdict .v { font-weight: 700; font-size: 16px; }
.verdict b { font-family: var(--serif); font-weight: 500; font-size: 28px; color: var(--gold); }
.answered.exact .v { color: var(--good); }
.answered.syllable .v { color: var(--gold); }
.answered.miss .v { color: var(--bad); }
.cls { color: var(--muted); font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.why { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--soft); border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
.why p { margin: 8px 0; }
.why .link { font-family: var(--sans); font-size: 14px; }
.card > .link { display: block; margin: 4px 0 12px; font-size: 15px; }
.feedback .primary { width: 100%; padding: 14px; font-size: 17px; margin-top: 12px; }
.feedback .primary kbd { color: #1a140699; border-color: #1a140640; margin-left: 6px; }

/* end */
.end { text-align: center; }
.end h2 { font-family: var(--serif); font-weight: 500; font-size: 32px; margin: 32px 0 0; }
.big { font-family: var(--serif); font-size: 72px; margin: 4px 0; color: var(--gold); font-variant-numeric: lining-nums tabular-nums; line-height: 1.1; }
.big small { font-size: 32px; color: var(--muted); }
.tally { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0; margin: 20px auto 6px; max-width: 360px; }
.tally li { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.tally .exact { background: var(--good); border-color: var(--good); }
.tally .syllable { background: linear-gradient(90deg, var(--gold) 50%, transparent 50%); border-color: var(--gold); }
.tally .miss { border-color: var(--bad); }
.counts { font-variant-numeric: lining-nums; color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.end h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 28px 0 10px; }
.misses { text-align: left; list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.misses li { border-bottom: 1px solid var(--line); padding: 10px 4px; }
.misses b { font-family: var(--serif); font-weight: 500; font-size: 22px; color: var(--gold); margin-right: 8px; }
.misses span { color: var(--muted); font-size: 15px; }
.end .row { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }
.end .row button { min-width: 120px; }

/* guide */
.guide h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 0; }
.guide .note { color: var(--muted); font-size: 15px; }
.guide article { border-bottom: 1px solid var(--line); padding: 6px 2px 14px; }
.guide article.focus { background: var(--panel); border-radius: var(--radius); padding: 6px 14px 14px; border-bottom-color: transparent; }
.guide h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; margin: 14px 0 4px; }
.guide p { font-family: var(--serif); font-size: 18px; line-height: 1.55; margin: 6px 0; color: var(--soft); }
.guide .ex { color: var(--gold); font-size: 20px; }

/* after answering: a soft glow of the verdict's colour behind the word, fading out */
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; animation: flash 1.1s ease-out; }
.flash.exact { background: radial-gradient(ellipse 80% 45% at 50% 28%, #8fcf9b55, transparent 70%); }
.flash.syllable { background: radial-gradient(ellipse 80% 45% at 50% 28%, #e6b45050, transparent 70%); }
.flash.miss { background: radial-gradient(ellipse 80% 45% at 50% 28%, #e8806f5c, transparent 70%); }
@keyframes flash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
.play > :not(.flash) { position: relative; z-index: 1; }
.answered .word { animation: settle .35s ease-out; }
.answered.miss .word { animation: shake .4s ease-out; }
@keyframes settle { from { transform: scale(.97); } to { transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .flash, .answered .word { animation: none; } .flash { opacity: .6; } }

/* report a mistake */
.report { margin: 2px 0 10px; }
.link.quiet { color: var(--muted); font-size: 14px; text-decoration-color: var(--line); }
.report-reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.report-reasons .chip { font-size: 14px; padding: 3px 10px; }
.report-done { color: var(--muted); font-size: 14px; margin: 2px 0 10px; }
.bad { color: var(--bad); }

/* Dvikova */
.review { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 14px; background: none; border: 1px dashed var(--line); color: var(--soft); }
.review b { color: var(--bad); font-variant-numeric: lining-nums; }
.review:hover { border-color: var(--muted); }
.duel h2 { font-family: var(--serif); font-weight: 500; font-size: 34px; margin: 18px 0 6px; }
.duel h3 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 22px 0 8px; }
.duel form { display: grid; gap: 10px; margin: 18px 0; }
.duel label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.duel input { font: inherit; font-size: 18px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.duel input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.duel input.need { border-color: var(--bad); }
.duel input[name=code] { text-transform: uppercase; letter-spacing: .2em; font-variant-numeric: lining-nums; }
.joinbox { grid-template-columns: 1fr auto; align-items: end; border-top: 1px solid var(--line); padding-top: 18px; }
.duel .error { color: var(--bad); }
.code { text-align: center; background: var(--panel); border-radius: var(--radius); padding: 14px 16px 12px; margin-top: 12px; }
.code b { display: block; font-family: var(--serif); font-weight: 500; font-size: 52px; letter-spacing: .14em; color: var(--gold); line-height: 1.15; }
.share { display: flex; gap: 8px; justify-content: center; margin: 8px 0 6px; }
.link-text { color: var(--muted); font-size: 12px; word-break: break-all; }
.players ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.players li { background: var(--panel); border-radius: 999px; padding: 5px 12px; font-size: 16px; }
.players li.me { outline: 1px solid var(--gold); }
.players .tag, .board .tag { color: var(--gold); font-size: 12px; }
.room-settings .row { display: grid; gap: 6px; margin: 10px 0; }
.room-settings .chip:disabled { opacity: 1; cursor: default; }
.room-settings .chip:disabled:not(.on) { opacity: .45; }
.go { margin: 22px 0 8px; text-align: center; }
.go .primary { width: 100%; padding: 14px; font-size: 18px; }
.go .hint { margin-top: 10px; }
.timebar { height: 4px; background: var(--panel); border-radius: 2px; overflow: hidden; margin: 6px 0 0; }
.timebar i { display: block; height: 100%; background: var(--gold); transform-origin: left; transition: transform .1s linear; }
.timebar.late i { background: var(--bad); }
.timebar.next i { background: var(--muted); }
.duel.play .stage { padding-top: 96px; }
.gain { color: var(--good); font-variant-numeric: lining-nums tabular-nums; font-size: 15px; }
.board { list-style: none; padding: 0; margin: 12px 0 0; }
.board li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: lining-nums tabular-nums; }
.board li.me { color: var(--gold); }
.board li.away { opacity: .45; }
.board .place { width: 1.4em; color: var(--muted); text-align: right; }
.board .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .pts { min-width: 3em; text-align: right; font-weight: 700; }
.res { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.res.done { background: var(--muted); border-color: var(--muted); }
.res.exact { background: var(--good); border-color: var(--good); }
.res.syllable { background: linear-gradient(90deg, var(--gold) 50%, transparent 50%); border-color: var(--gold); }
.res.miss { border-color: var(--bad); }
.board.final li { font-size: 18px; padding: 10px 4px; }
.duel.end { text-align: center; }
.duel.end .board { text-align: left; }

/* the logo: kir̃tis, the tilde drops in spinning, squashes the r, then wiggles now and then */
.logo { font-family: var(--serif); font-weight: 500; font-size: 64px; line-height: 1.1; margin: 14px 0 4px; letter-spacing: .01em; cursor: default; user-select: none; }
h2.logo { font-size: 52px; margin: 10px 0 14px; }
.lr { position: relative; display: inline-block; color: var(--gold); transform-origin: 50% 100%; animation: rpress .5s .75s ease-out both; }
.lm { position: absolute; left: 50%; top: -.1em; font-size: .9em; color: var(--gold); transform: translateX(-50%);
  animation: logodrop 1.1s .15s cubic-bezier(.2, .9, .3, 1.2) both, logowiggle 6s 2.5s ease-in-out infinite; }
@keyframes logodrop {
  0% { transform: translate(-50%, -3em) rotate(-720deg) scale(3); opacity: 0; }
  45% { opacity: 1; }
  60% { transform: translate(-50%, .12em) rotate(25deg) scale(1.25, .6); }
  75% { transform: translate(-50%, -.35em) rotate(-12deg) scale(.85, 1.2); }
  88% { transform: translate(-50%, .03em) rotate(4deg) scale(1.08, .92); }
  100% { transform: translate(-50%, 0) rotate(0) scale(1); }
}
@keyframes logowiggle {
  0%, 86%, 100% { transform: translate(-50%, 0) rotate(0); }
  89% { transform: translate(-50%, -.45em) rotate(-25deg) scale(1.15); }
  92% { transform: translate(-50%, .05em) rotate(14deg) scale(1.1, .8); }
  95% { transform: translate(-50%, -.08em) rotate(-6deg); }
}
@keyframes rpress { 0%, 100% { transform: none; } 30% { transform: scale(1.12, .8); } 60% { transform: scale(.94, 1.08); } }

/* after an answer: the right mark flies in, spins, lands on the letter, which bounces; a ring flashes when you got it */
.letter, .syl { position: relative; }
.markfx { position: absolute; left: 50%; top: -.12em; font-size: .9em; line-height: 1; color: var(--gold); pointer-events: none;
  animation: markdrop .85s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes markdrop {
  0% { transform: translate(-50%, -2.4em) rotate(-540deg) scale(2.4); opacity: 0; }
  40% { opacity: 1; }
  70% { transform: translate(-50%, .1em) rotate(18deg) scale(1.2, .7); opacity: 1; }
  85% { transform: translate(-50%, -.1em) rotate(-6deg) scale(.9, 1.1); opacity: .8; }
  100% { transform: translate(-50%, 0) rotate(0) scale(1); opacity: 0; }
}
.answered .letter.right, .answered .syl.right { animation: letterpop .6s .55s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes letterpop { 0% { transform: none; } 35% { transform: translateY(.06em) scale(1.25, .8); } 70% { transform: translateY(-.12em) scale(.92, 1.12); } 100% { transform: none; } }
.answered.exact .letter.right::after, .answered.exact .syl.right::after { content: ''; position: absolute; left: 50%; top: 45%; width: 1.4em; height: 1.4em; border: .06em solid var(--gold); border-radius: 50%; pointer-events: none; animation: ring .7s .6s ease-out both; }
@keyframes ring { 0% { transform: translate(-50%, -50%) scale(.2); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }

/* about */
.about p { font-family: var(--serif); font-size: 19px; line-height: 1.55; color: var(--soft); margin: 10px 0; }
.about .social { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.about .social a { border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; text-decoration: none; color: var(--text); font-size: 15px; }
.about .social a:hover { border-color: var(--gold); color: var(--gold); }
.about p.credits { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 28px; }
.foot { display: flex; gap: 22px; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { .lm, .lr, .markfx, .answered .letter.right, .answered .syl.right, .answered.exact .letter.right::after { animation: none; } .markfx { display: none; } }
