:root {
  font-family:Inter,ui-sans-serif,system-ui,sans-serif;
  color:#182d29;
  background:#eff3f4;
  font-size:16px
}
* {
  box-sizing:border-box
}
body {
  margin:0
}
header {
  background:#102d29;
  color:white;
  padding:24px max(24px,calc((100vw - 1120px)/2));
  display:flex;
  justify-content:space-between;
  align-items:center
}
.brand {
  color:white;
  text-decoration:none;
  letter-spacing:.08em;
  font-size:15px;
  font-weight:750;
  display:flex;
  gap:12px;
  align-items:center
}
.brand span {
  font-size:27px;
  color:#83ddba
}
.tag {
  font-size:14px;
  color:#b5c8c3
}
main {
  max-width:1120px;
  margin:32px auto;
  padding:0 24px
}
nav {
  display:flex;
  border-bottom:1px solid #cad5d2;
  margin-bottom:28px;
  gap:20px
}
button {
  cursor:pointer;
  font:inherit;
  border:0;
  border-radius:7px;
  padding:12px 20px;
  background:#116a53;
  color:white;
  font-weight:650;
  min-height:46px
}
button:hover {
  filter:brightness(.95)
}
button:disabled {
  cursor:default;
  opacity:.5
}
nav button {
  background:none;
  color:#5a6e67;
  border-radius:0;
  border-bottom:3px solid transparent;
  padding:12px 4px
}
nav button.active {
  color:#0c624a;
  border-bottom-color:#0c624a
}
.toolbar {
  display:flex;
  gap:16px;
  align-items:end;
  flex-wrap:wrap
}
.toolbar label:first-child {
  flex:1;
  min-width:240px
}
label {
  font-size:14px;
  font-weight:600;
  display:block
}
select,input:not([type=checkbox]) {
  display:block;
  width:100%;
  margin-top:8px;
  border:1px solid #bacbc5;
  border-radius:6px;
  background:white;
  color:#182d29;
  font:inherit;
  padding:12px;
  min-height:46px
}
select {
  max-width:100%
}
.secondary {
  background:white;
  color:#1f5142;
  border:1px solid #bdcec7
}
.status {
  display:flex;
  justify-content:space-between;
  gap:16px;
  margin:24px 0 12px;
  font-size:14px;
  color:#536a60
}
.practice {
  background:white;
  border:1px solid #d4dfdb;
  border-radius:12px;
  padding:32px;
  box-shadow:0 8px 32px #17372b07
}
.question-head {
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:start
}
.eyebrow {
  letter-spacing:.12em;
  font-size:12px;
  font-weight:750;
  color:#497769
}
h1 {
  font-size:32px;
  margin:10px 0 24px;
  letter-spacing:-.02em
}
#timer {
  font-variant-numeric:tabular-nums;
  font-size:18px;
  color:#647a71;
  border:1px solid #dde6e1;
  border-radius:6px;
  padding:8px 12px
}
#context {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:16px
}
.chip {
  background:#edf4f1;
  border-radius:5px;
  padding:7px 11px;
  font-size:14px
}
.rack {
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  align-items:end;
  margin:8px 0 20px
}
.tile {
  width:48px;
  height:65px;
  object-fit:contain;
  filter:drop-shadow(0 2px 1px #0002)
}
.winning {
  margin-left:15px;
  outline:2px solid #d8a946;
  outline-offset:3px;
  border-radius:4px
}
.group {
  display:inline-block;
  margin-right:18px
}
.group .rack {
  gap:3px;
  margin-bottom:5px
}
.group small {
  font-size:13px;
  color:#5a6e65
}
.indicators .tile {
  width:32px;
  height:43px
}
.indicators {
  margin-top:16px
}
.indicators span {
  font-size:14px;
  font-weight:600
}
.indicators .rack {
  margin-top:5px
}
#prompt {
  font-size:20px;
  font-weight:600;
  margin:14px 0 24px
}
#inputs {
  display:flex;
  gap:14px;
  align-items:end;
  flex-wrap:wrap
}
#inputs label {
  max-width:210px
}
#inputs input {
  font-size:22px;
  font-variant-numeric:tabular-nums
}
.slash {
  font-size:26px;
  padding-bottom:12px
}
.actions {
  display:flex;
  gap:12px;
  margin-top:24px
}
#feedback {
  margin-top:22px;
  border-radius:6px;
  font-size:17px;
  line-height:1.6
}
#feedback:not(:empty) {
  padding:14px 18px;
  background:#edf5f1
}
#feedback.bad {
  background:#fff0ed;
  color:#8f3929
}
.grid {
  display:grid;
  grid-template-columns:repeat(3,64px);
  gap:10px
}
.grid button {
  background:white;
  color:#173c30;
  border:1px solid #b4c9bf;
  font-size:24px;
  padding:12px
}
.grid button.selected {
  background:#116a53;
  color:white;
  border-color:#116a53
}
.footnote,footer {
  font-size:14px;
  color:#61756c;
  line-height:1.6
}
footer {
  margin-top:26px
}
a {
  color:#19694e
}
dialog {
  width:min(820px,95vw);
  max-height:90vh;
  border:1px solid #bbd0c6;
  border-radius:12px;
  padding:28px;
  color:#182d29
}
dialog::backdrop {
  background:#102d2980
}
.dialog-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:15px
}
h2 {
  font-size:24px
}
.bulk {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:18px 0
}
.bulk button {
  font-size:14px
}
fieldset {
  border:1px solid #d5e1da;
  border-radius:6px;
  margin-top:16px;
  display:flex;
  gap:24px
}
fieldset label {
  padding:8px
}
input[type=checkbox] {
  accent-color:#12694f;
  width:18px;
  height:18px;
  vertical-align:middle;
  margin-right:5px
}
table {
  border-collapse:collapse;
  width:100%;
  font-size:14px
}
th,td {
  text-align:center;
  padding:8px 3px;
  border-bottom:1px solid #e2e9e5
}
th:first-child {
  white-space:nowrap
}
td input {
  margin:0!important
}
#matrix {
  overflow:auto
}
#customError {
  color:#9a3528
}
[hidden] {
  display:none!important
}
@media(max-width:650px) {
  header {
    padding:18px
  }
  .tag {
    display:none
  }
  main {
    padding:0 16px;
    margin-top:20px
  }
  .practice {
    padding:20px 16px
  }
  .toolbar>label {
    width:100%
  }
  .toolbar>button {
    width:100%
  }
  h1 {
    font-size:25px
  }
  .tile {
    width:35px;
    height:48px
  }
  .status {
    font-size:12px
  }
  .question-head {
    gap:8px
  }
  #timer {
    font-size:14px;
    padding:6px
  }
  dialog {
    padding:16px
  }
  th,td {
    padding:8px 2px
  }
  fieldset {
    gap:8px
  }
  .actions button {
    padding:12px 16px
  }
}
.brand {
  letter-spacing:0;
  text-transform:none;
  font-size:20px;
  line-height:1.3
}
.brand .logo {
  width:48px;
  height:48px;
  object-fit:contain;
  flex-shrink:0
}
.brand .brand-name {
  font-size:20px;
  color:white
}
.tile {
  border:1px solid #a6b4ad;
  border-radius:4px;
  background:#fff;
  padding:2px;
  box-shadow:0 2px 0 #bcc9c2;
  filter:none
}
@media(max-width:650px) {
  .brand .brand-name {
    font-size:17px
  }
  .brand .logo {
    width:40px;
    height:40px
  }
}
#matrix fieldset {
  flex-wrap:wrap;
  gap:8px 16px
}
.exam-row {
  display:flex;
  align-items:center;
  gap:22px;
  flex-wrap:wrap;
  margin:16px 0 30px
}
.exam-tiles {
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap
}
.exam-concealed,.exam-meld {
  display:flex;
  align-items:center;
  gap:2px
}
.exam-row .tile {
  width:42px;
  height:58px;
  padding:1px;
  box-shadow:none
}
.exam-winning {
  display:flex;
  margin-left:8px
}
.exam-context {
  font-size:16px;
  font-weight:700;
  line-height:1.5;
  flex:1;
  min-width:180px
}
.exam-meld .sideways {
  transform:rotate(90deg);
  margin:0 8px
}
.practice:has(.exam-row) #context {
  margin:0
}
.practice:has(.exam-row) h1:empty {
  margin:0
}
.practice:has(.exam-row) #prompt:empty {
  display:none
}
@media(max-width:650px) {
  .exam-row {
    gap:16px
  }
  .exam-tiles {
    gap:10px
  }
  .exam-row .tile {
    width:29px;
    height:40px
  }
  .exam-concealed,.exam-meld {
    gap:1px
  }
  .exam-context {
    flex-basis:100%;
    font-size:14px
  }
  .exam-winning {
    margin-left:4px
  }
}

/* Citrus Dojo visual system */
:root {
  --dojo-ink:#2b1712;
  --dojo-muted:#765148;
  --dojo-red:#c73314;
  --dojo-orange:#ff5b2e;
  --dojo-gold:#ffb21c;
  --dojo-cream:#fff7f2;
  --dojo-peach:#ffe3d3;
  color:var(--dojo-ink);
  background:var(--dojo-cream)
}

body {
  background:linear-gradient(180deg,#fffaf6 0%,var(--dojo-cream) 100%)
}

header {
  background:
    radial-gradient(circle at 88% -80%,#ff5b2e 0 42%,transparent 42.5%),
    linear-gradient(120deg,#38150e,#21100c);
  border-bottom:1px solid #71301e;
  box-shadow:0 10px 28px #2b17121f
}

.brand {
  color:#fff;
  letter-spacing:0
}

.brand span,
.brand .brand-name {
  color:#fff
}

.tag {
  color:#ffe0d0
}

main {
  margin-top:38px
}

nav {
  border-bottom-color:#f0c9b9
}

button {
  background:var(--dojo-red);
  border:1px solid var(--dojo-red);
  border-radius:999px;
  box-shadow:0 4px 0 #93220e;
  font-weight:750;
  transition:background .18s ease,box-shadow .18s ease,transform .18s ease
}

button:hover {
  background:#a92610;
  box-shadow:0 2px 0 #7e1b0b;
  transform:translateY(2px);
  filter:none
}

button:disabled {
  background:#c9a79d;
  border-color:#c9a79d;
  box-shadow:none;
  opacity:.7
}

nav button {
  background:none;
  border:0;
  border-bottom:3px solid transparent;
  border-radius:0;
  box-shadow:none;
  color:#81554a
}

nav button:hover {
  background:none;
  box-shadow:none;
  color:var(--dojo-red);
  transform:none
}

nav button.active {
  color:var(--dojo-red);
  border-bottom-color:var(--dojo-red)
}

select,
input:not([type=checkbox]) {
  border-color:#e8bdaa;
  background:#fffdfb;
  color:var(--dojo-ink);
  box-shadow:0 2px 0 #fbe1d6
}

select:focus,
input:not([type=checkbox]):focus {
  border-color:var(--dojo-orange);
  outline:3px solid #ffb21c4d;
  outline-offset:1px
}

.secondary {
  background:#fffaf6;
  border-color:#eab49e;
  box-shadow:none;
  color:var(--dojo-red)
}

.secondary:hover {
  background:var(--dojo-peach);
  box-shadow:none;
  color:#96220e;
  transform:translateY(-1px)
}

.secondary.danger {
  border-color:#e5a695;
  color:#a62e19
}

.secondary.danger:hover {
  background:#ffe4dc;
  color:#8f2413
}

.status {
  color:#754438;
  font-weight:650
}

.practice {
  background:#fffdfb;
  border-color:#f0cabb;
  border-radius:18px;
  box-shadow:0 16px 38px #c7331412
}

.eyebrow {
  color:var(--dojo-red)
}

h1,
h2 {
  color:var(--dojo-ink);
  font-family:Georgia,"Times New Roman",serif
}

#timer {
  color:#754438;
  border-color:#efc5b4;
  background:#fff7f2
}

.chip {
  background:#fff0e4;
  color:#763423;
  border:1px solid #ffd0ba
}

.group small {
  color:#765148
}

.indicators span {
  color:#5c352b
}

#feedback:not(:empty) {
  background:#fff1d8;
  color:#69381b;
  border:1px solid #ffd080
}

#feedback.bad {
  background:#ffe2dc;
  color:#922817;
  border-color:#f4b2a6
}

.grid button {
  background:#fffdfb;
  border-color:#e4b7a3;
  box-shadow:none;
  color:var(--dojo-ink)
}

.grid button:hover {
  background:#fff0e4;
  box-shadow:none;
  transform:translateY(-1px)
}

.grid button.selected {
  background:var(--dojo-red);
  border-color:var(--dojo-red);
  box-shadow:0 3px 0 #93220e;
  color:#fff
}

.tile {
  border-color:#e7b9a5;
  background:#fff;
  box-shadow:0 2px 0 #e4b8a5
}

.winning {
  outline-color:var(--dojo-gold);
  box-shadow:0 0 0 4px #ffb21c33
}

.footnote,
footer {
  color:#77564b
}

a {
  color:var(--dojo-red)
}

dialog {
  background:#fffdfb;
  border-color:#edbda9;
  box-shadow:0 24px 70px #2b171244;
  color:var(--dojo-ink)
}

dialog::backdrop {
  background:#2b1712a8
}

fieldset {
  border-color:#f0cbbb
}

input[type=checkbox] {
  accent-color:var(--dojo-red)
}

input[type=hidden] {
  display:none!important
}

th,
td {
  border-bottom-color:#f2d6ca
}

#customError {
  color:#a62e19
}

[hidden] {
  display:none!important
}

button:focus-visible,
a:focus-visible {
  outline:3px solid var(--dojo-gold);
  outline-offset:3px
}

@media(max-width:650px) {
  header {
    background:
      radial-gradient(circle at 92% -80%,#ff5b2e 0 42%,transparent 42.5%),
      linear-gradient(120deg,#38150e,#21100c)
  }

  .practice {
    border-radius:14px
  }
}

/* Answer-result moment */
#feedback:not(:empty) {
  padding:0;
  overflow:hidden;
  border:1px solid transparent
}

#feedback.success {
  background:linear-gradient(110deg,#e2f7e7,#f4fcf5);
  border-color:#9ed7aa;
  color:#245b35;
  animation:result-pop .32s cubic-bezier(.2,.8,.25,1)
}

.result-copy {
  display:flex;
  align-items:center;
  gap:13px;
  padding:14px 18px
}

.result-mark {
  display:grid;
  flex:0 0 auto;
  width:39px;
  height:39px;
  place-items:center;
  border-radius:50%;
  background:#ffe19b;
  color:#9a4b0b;
  font-size:22px;
  font-weight:900
}

#feedback.success .result-mark {
  background:linear-gradient(145deg,#3ca65b,#248347);
  color:#fff;
  box-shadow:0 4px 0 #176534;
  animation:result-mark-pop .42s .08s both cubic-bezier(.2,.8,.25,1)
}

#feedback.bad .result-mark {
  background:#ffc6ba;
  color:#9d2b17
}

.result-copy strong,
.result-copy span:not(.result-mark) {
  display:block
}

.result-copy strong {
  font-family:Georgia,"Times New Roman",serif;
  font-size:20px;
  line-height:1.15
}

.result-copy span:not(.result-mark) {
  margin-top:3px;
  font-size:14px;
  font-weight:650
}

.grid button.selected.correct-answer {
  background:var(--dojo-gold);
  border-color:var(--dojo-gold);
  box-shadow:0 3px 0 #c76a0d,0 0 0 4px #ffb21c33;
  color:#5a300b;
  animation:tile-celebrate .45s ease-out
}

.actions #next.result-next {
  background:var(--dojo-red);
  border-color:var(--dojo-red);
  box-shadow:0 4px 0 #93220e;
  color:#fff
}

@keyframes result-pop {
  from {
    opacity:0;
    transform:translateY(7px) scale(.98)
  }

  to {
    opacity:1;
    transform:translateY(0) scale(1)
  }
}

@keyframes result-mark-pop {
  0% {
    transform:scale(.5) rotate(-20deg)
  }

  70% {
    transform:scale(1.14) rotate(8deg)
  }

  100% {
    transform:scale(1) rotate(0)
  }
}

@keyframes tile-celebrate {
  50% {
    transform:translateY(-4px) scale(1.05)
  }
}

@media(prefers-reduced-motion:reduce) {
  #feedback.success,
  #feedback.success .result-mark,
  .grid button.selected.correct-answer {
    animation:none
  }
}

/* Timed practice sessions */
#practiceControls[hidden] ~ #practiceStatus {
  margin-top:0
}

.session-results {
  margin-top:24px;
  padding:clamp(24px,4vw,38px);
  background:#fffdfb;
  border:1px solid #f0cabb;
  border-radius:18px;
  box-shadow:0 16px 38px #c7331412
}

.test-intro {
  max-width:700px;
  margin:38px auto 0;
  padding:clamp(30px,6vw,58px) clamp(30px,6vw,58px) clamp(66px,8vw,86px);
  position:relative;
  text-align:center;
  background:
    radial-gradient(circle at 86% 12%,#ffb21c 0 7%,transparent 7.2%),
    linear-gradient(135deg,#fff0e7,#fffaf6);
  border:1px solid #f1c4b0;
  border-radius:22px;
  box-shadow:0 18px 42px #c7331417
}

.test-mode-bar {
  display:flex;
  align-items:center;
  margin:0
}

.practice-status-actions {
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%
}

.test-intro h1 {
  margin-inline:auto
}

.test-intro p:not(.eyebrow) {
  max-width:470px;
  margin:0 auto;
  color:#70483d
}

.test-settings {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:24px;
  text-align:left
}

.test-settings div {
  min-width:0;
  padding:11px 12px;
  border:1px solid #f1cfc1;
  border-radius:10px;
  background:#fffaf7
}

.test-settings span,
.test-settings strong {
  display:block
}

.test-settings span {
  color:#8a584b;
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase
}

.test-settings strong {
  margin-top:4px;
  color:var(--dojo-ink);
  font-size:13px;
  line-height:1.35
}

.test-high-scores {
  max-width:700px;
  margin:18px auto 0;
  padding:clamp(20px,4vw,28px);
  border:1px solid #efc9b9;
  border-radius:12px;
  background:#fffaf7;
  box-shadow:0 12px 28px #c7331410;
  text-align:left
}

.test-high-scores-head {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px
}

.test-high-scores h2 {
  margin:0;
  font-size:17px
}

#testHighScoresList {
  display:grid;
  gap:5px;
  padding:0;
  margin:12px 0 0;
  list-style:none
}

#testHighScoresList li {
  display:grid;
  grid-template-columns:32px 1fr auto;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:7px;
  background:#fff1e8;
  color:#70483d;
  font-size:13px
}

#testHighScoresList li:first-child {
  background:#fff0cf
}

#testHighScoresList strong {
  color:var(--dojo-ink)
}

#testHighScoresList time {
  color:#6d463b;
  font-variant-numeric:tabular-nums;
  font-weight:800
}

#testHighScoresEmpty {
  margin:12px 0 0;
  color:#8a584b;
  font-size:13px;
  text-align:left
}

.test-intro .actions {
  justify-content:center
}

.test-intro .test-disclosure {
  position:absolute;
  right:clamp(20px,4vw,34px);
  bottom:18px;
  margin:0;
  color:#8a584b;
  font-size:12px
}

.session-results h1 {
  margin-bottom:26px
}

.session-summary {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin-bottom:26px
}

.session-summary div {
  padding:14px 12px;
  background:#fff4ed;
  border:1px solid #f2d3c4;
  border-radius:12px
}

.session-summary strong,
.session-summary span {
  display:block
}

.session-summary strong {
  color:var(--dojo-ink);
  font-family:Georgia,"Times New Roman",serif;
  font-size:23px;
  line-height:1.1
}

.session-summary span {
  margin-top:5px;
  color:#77564b;
  font-size:12px;
  font-weight:750;
  line-height:1.25
}

.session-review {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  padding:0;
  margin:0;
  list-style:none
}

.session-review li {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:2px 10px;
  padding:11px 12px;
  border:1px solid #f0d3c8;
  border-left:4px solid #d3a193;
  border-radius:9px;
  background:#fffaf7;
  color:#765148;
  font-size:13px
}

.session-review li.correct {
  border-left-color:#43a85e;
  background:#f3fbf4
}

.session-review li.incorrect {
  border-left-color:#d24a33;
  background:#fff5f2
}

.session-review strong {
  color:var(--dojo-ink);
  font-size:13px
}

.session-review time {
  grid-column:2;
  grid-row:1 / span 2;
  align-self:center;
  color:#6d463b;
  font-variant-numeric:tabular-nums;
  font-weight:800
}

@media(max-width:650px) {
  .session-results {
    padding:22px 16px;
    border-radius:14px
  }

  .test-intro {
    margin-top:22px;
    padding:34px 22px 68px;
    border-radius:16px
  }

  .test-settings {
    grid-template-columns:1fr
  }

  .session-summary {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }

  .session-review {
    grid-template-columns:1fr
  }
}

/* Session review */
.session-review li.correct,
.session-review li.incorrect {
  padding:0
}

.session-review li button {
  display:grid;
  grid-column:1 / -1;
  width:100%;
  min-height:0;
  grid-template-columns:minmax(0,1fr) auto;
  gap:2px 10px;
  padding:11px 12px;
  border:0;
  border-radius:5px;
  background:transparent;
  box-shadow:none;
  color:#765148;
  font-size:13px;
  font-weight:inherit;
  text-align:left
}

.session-review li button:hover {
  background:#ffe8e0;
  box-shadow:none;
  color:#765148;
  transform:none
}

.session-review li.correct button:hover {
  background:#e7f7e9
}

.session-review li button:focus-visible {
  outline:3px solid var(--dojo-gold);
  outline-offset:-3px
}

.session-review li button small {
  grid-column:1;
  margin-top:3px;
  color:#a13a27;
  font-size:11px;
  font-weight:750
}

.session-review li.correct button small {
  color:#27763f
}

#feedback.review-feedback {
  padding:16px 18px;
  background:#fff6ef;
  border-color:#f0c5b4;
  color:var(--dojo-ink)
}

.review-copy {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px
}

.review-copy div {
  padding:12px;
  border:1px solid #f1d1c3;
  border-radius:10px;
  background:#fffdfb
}

.review-copy div:first-child {
  border-color:#a8d7b0;
  background:#eef9f0
}

.review-copy span,
.review-copy strong {
  display:block
}

.review-copy span {
  color:#77564b;
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase
}

.review-copy strong {
  margin-top:5px;
  color:var(--dojo-ink);
  font-family:Georgia,"Times New Roman",serif;
  font-size:20px;
  line-height:1.2
}

.grid button.review-correct {
  border-color:#58a96b;
  background:#e4f6e7;
  box-shadow:none;
  color:#245b35;
  opacity:1
}

.grid button.review-incorrect {
  border-color:#dc806d;
  background:#ffe2dc;
  box-shadow:none;
  color:#922817;
  opacity:1
}

@media(max-width:650px) {
  .review-copy {
    grid-template-columns:1fr
  }
}
