:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #252837;
  background: #f6f7fa;
  --accent: #484b9d;
  --line: #dce0e7;
  --muted: #606675;
}
* { box-sizing: border-box; }
body, h1, h3, p, dd { margin: 0; }
[hidden] { display: none !important; }
header { background: white; border-bottom: 1px solid var(--line); }
.navwrap, main { width: min(100% - 40px, 800px); margin-inline: auto; }
.navwrap, nav, .brand, .toolbar, .deckselect, .entry, .timer, .stats, .stats div, .librow {
  display: flex;
  align-items: center;
}
.navwrap { height: 64px; justify-content: space-between; }
a { color: inherit; text-decoration: none; }
.brand { gap: 12px; font-size: 20px; font-weight: 670; letter-spacing: -.8px; }
.mark {
  width: 19px; height: 22px; border: 1px solid var(--accent); border-radius: 4px;
  background: #e1e2f5; box-shadow: 3px -3px white, 4px -4px var(--accent);
  transform: rotate(-7deg);
}
nav { align-self: stretch; gap: 24px; }
nav a { display: grid; align-items: center; font-size: 14px; color: var(--muted); border-block: 2px solid transparent; }
nav a.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
main { margin-top: clamp(32px, 8vh, 84px); margin-bottom: 40px; }
.toolbar { justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
button, select, input { font: inherit; }
button, .deckselect {
  border-radius: 8px; font-size: 14px; font-weight: 570;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
button { cursor: pointer; background: var(--accent); color: white; border: 0; padding: 11px 16px; }
button:hover { background: #383b83; }
button.secondary { background: transparent; color: var(--muted); }
button.secondary:hover { background: #eaecf2; color: #252837; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid #767ac0; outline-offset: 3px; }
i { display: inline-flex; }
i svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.deckselect { position: relative; min-width: 0; max-width: 100%; }
.deckselect i { position: absolute; left: 12px; pointer-events: none; color: var(--accent); }
.deckselect i:last-child { left: auto; right: 10px; color: var(--muted); }
select { appearance: none; max-width: 100%; background: white; color: inherit; border: 1px solid var(--line); padding: 10px 36px; border-radius: inherit; cursor: pointer; }
#playback::before { content: "Ⅱ"; font-size: 13px; font-weight: 700; }
#playback.paused::before { content: "▶"; font-size: 10px; }
.card, #deckList, #editor { background: white; border: 1px solid var(--line); border-radius: 14px; }
.card { padding: clamp(22px, 5vw, 48px); box-shadow: 0 2px 6px #22263506; }
.timer { gap: 8px; color: var(--muted); font: 13px ui-monospace, monospace; }
.track { width: 92px; height: 4px; background: #e7e8f1; overflow: hidden; border-radius: 4px; }
#bar { height: 100%; background: #777bb9; transition: width .15s linear; }
#prompt { margin: 30px 0 36px; font-size: clamp(28px, 4vw, 44px); line-height: 1.15; font-weight: 510; letter-spacing: -.045em; overflow-wrap: anywhere; }
.entry { gap: 10px; }
input { width: 100%; min-width: 0; height: 46px; padding: 0 13px; color: inherit; background: white; border: 1px solid #bdc2cf; border-radius: 8px; font-size: 16px; }
input:focus-visible { outline: 2px solid #8e91c8; outline-offset: 1px; }
.entry button { min-height: 46px; white-space: nowrap; }
#feedback { min-height: 1.45em; margin-top: 13px; line-height: 1.45; font-size: 15px; }
.stats { gap: 22px; margin: 16px 2px 0; flex-wrap: wrap; }
.stats div { gap: 7px; font-size: 13px; }
.stats dt, small { color: var(--muted); }
.stats dd { font-weight: 600; font-variant-numeric: tabular-nums; }
#library h1 { font-size: 28px; letter-spacing: -.04em; }
.librow { justify-content: space-between; padding: 21px 24px; gap: 12px; flex-wrap: wrap; }
.librow + .librow { border-top: 1px solid var(--line); }
.librow h3, #editor h3 { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.librow small { display: block; margin-top: 4px; }
#editor { padding: 24px; margin-top: 16px; }
#fields label { display: block; margin: 16px 0 6px; font-size: 14px; }
#fields { margin-bottom: 18px; }
@media (max-width: 500px) {
  .navwrap, main { width: calc(100% - 28px); }
  .toolbar { gap: 4px; }
  #playback { font-size: 12px; padding-inline: 5px; }
  .entry { flex-wrap: wrap; }
  .entry button { width: 100%; }
  .stats { gap: 14px; }
}
.track { position: relative; }
#goalMark { position: absolute; top: 0; bottom: 0; width: 2px; background: #474957; transform: translateX(-1px); }
#limits { font: 12px Inter, -apple-system, sans-serif; }
.card[data-result] { animation: result-tint 1.2s ease-out both; }
.card[data-result="green"] { --tint: #c7efd6; }
.card[data-result="yellow"] { --tint: #ffedaa; }
.card[data-result="red"] { --tint: #ffd1d0; }
@keyframes result-tint { 0%, 45% { background-color: var(--tint); } 100% { background-color: white; } }
#timingEditor { padding: 24px; margin-top: 16px; background: white; border: 1px solid var(--line); border-radius: 14px; }
#timingEditor label { display: grid; gap: 6px; margin: 14px 0; font-size: 14px; }
#timingEditor select { padding-inline: 12px; border-radius: 8px; appearance: auto; }
.timing-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
#timingStatus:not(:empty) { margin-top: 12px; }
.timer { flex-wrap: wrap; }
#sources { color: var(--accent); background: white; border: 1px solid var(--line); max-width: 100%; }
#sourceName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#picker { width: min(440px,95vw); max-height: 85vh; overflow: auto; padding: 24px; color: inherit; border: 1px solid var(--line); border-radius: 14px; }
#picker::backdrop { background: #20233252; }
#picker h2 { margin: 0 0 20px; font-size: 22px; }
#picker fieldset { border: 0; padding: 0; margin: 16px 0; }
#picker legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
#deckChoices, #tagChoices { display: flex; flex-wrap: wrap; gap: 6px; }
#picker label { display: flex; gap: 7px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
#picker input { height: 16px; width: 16px; margin: 0; accent-color: var(--accent); }
.picker-footer { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.picker-footer output { margin-right: auto; font-size: 13px; }
#tagEditor { margin-top: 16px; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 14px; }
#tagEditor label { display: grid; gap: 6px; margin: 14px 0; font-size: 14px; }
#tagCard { appearance: auto; padding-inline: 12px; }

#profile { max-width: 500px; margin-inline: auto; }
#profile h1 { font-size: 28px; letter-spacing: -.04em; }
#profileForm { padding: 24px; }
#profileForm label { display: block; margin-bottom: 6px; font-size: 14px; }
#profileForm input { margin-bottom: 20px; }
.profile-actions { display: flex; align-items: center; gap: 8px; }
#profileStatus:not(:empty) { margin-top: 12px; font-size: 14px; }
@media (max-width: 400px) { nav { gap: 12px; } }
