:root {
  --header-height: 56px;
  --tester-width: 340px;
  font-family: system-ui, sans-serif;
  color: #172033;
  background: #f5f7fb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: var(--header-height); }
body { margin: 0; padding-top: var(--header-height); }
body.is-resizing-tester { cursor: col-resize; user-select: none; }
header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--header-height);
  padding: 1rem 5%;
  background: #172033;
}
header a { color: white; text-decoration: none; font-weight: 700; }
main { max-width: 1280px; margin: auto; padding: 3rem 5%; }
body.has-tester main { max-width: none; margin: 0; padding-right: calc(var(--tester-width) + 5%); }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card, article, .lesson {
  display: block;
  padding: 1.5rem;
  background: white;
  border: 1px solid #dfe4ee;
  border-radius: 12px;
  box-shadow: 0 4px 16px #1720330d;
}
.card { color: inherit; text-decoration: none; }
.card strong, .card span { display: block; }
.card strong { margin-bottom: .5rem; font-size: 1.25rem; }
.layout { display: block; }
.curriculum { min-width: 0; }
.lesson, article { margin-bottom: 1rem; }

.question-pattern {
  display: inline-block;
  padding: .22em .45em;
  color: #18213a;
  background: #edf0f6;
  border: 1px solid #d7dce7;
  border-radius: 5px;
  font-size: 1.2rem;
  font-weight: 750;
}
.answer-area { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: end; }
.choices { display: grid; gap: .2rem; }
.choice {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  width: 100%;
  margin: 0;
  padding: .35rem .5rem;
  border-radius: 6px;
}
.choice:hover { background: #f4f6fb; }
.choice input { flex: 0 0 auto; width: auto; margin: 0; }
.choice-text { overflow-wrap: anywhere; }
.choice.is-correct { color: #0d6038; background: #eef9f3; }
.answer-details { margin-left: auto; color: #0d6038; font-weight: 700; }
.answer-toggle {
  min-width: 7.5rem;
  padding: .7rem 1rem;
  color: white;
  background: #3157d5;
  border: 0;
  border-radius: 7px;
}
mark { padding: .08em .15em; color: inherit; background: #ffdc73; border-radius: 3px; }
mark.zero-width { padding: 0; border-left: 3px solid #e29f00; }

.tester {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: var(--tester-width);
  padding: 1.5rem;
  overflow-y: auto;
  color: #eef3ff;
  background: #202b43;
  border-left: 1px solid #10192c;
  box-shadow: -10px 0 30px #17203316;
}
.tester-resizer {
  position: absolute;
  inset: 0 auto 0 -5px;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
}
.tester-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  content: '';
  background: transparent;
}
.tester-resizer:hover::after { background: #86a2ff; }
.tester-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tester-heading h2 { margin: 0 0 1.5rem; }
.tester-close, .tester-launcher { display: none; }
.tester label { display: block; width: 100%; margin: 1rem 0; font-weight: 650; }
.tester input, .tester textarea {
  display: block;
  width: 100%;
  margin-top: .45rem;
  padding: .7rem;
  color: #172033;
  background: white;
  border: 2px solid transparent;
  border-radius: 6px;
}
.tester input:focus, .tester textarea:focus { outline: none; border-color: #86a2ff; }
.tester textarea { height: 12rem; resize: none; }
.tester-result-label { margin-bottom: .45rem; font-weight: 650; }
#result {
  display: block;
  height: 12rem;
  padding: .8rem;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: #c8d1e4;
  background: #111a2d;
  border-radius: 6px;
}
#result.has-match { color: #f4f7ff; }
#result.has-error { color: #ffb8b8; }
.notice { padding: 1rem; background: white; border-radius: 8px; }
.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 0 0;
  border-top: 1px solid #d7dce7;
}
.back-button {
  display: inline-block;
  padding: .7rem 1rem;
  color: white;
  background: #172033;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 760px) {
  body.has-tester main { padding: 2rem 5% 6rem; }
  .answer-area { grid-template-columns: 1fr; gap: .75rem; }
  .answer-toggle { justify-self: end; }
  .tester-launcher {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 45;
    display: block;
    padding: .8rem 1rem;
    color: white;
    background: #202b43;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 6px 24px #10192c55;
  }
  .tester {
    inset: auto 0 0;
    display: none;
    width: 100%;
    max-height: 88vh;
    border: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px #10192c66;
  }
  .tester.is-open { display: block; }
  .tester-resizer { display: none; }
  .tester-heading h2 { margin-bottom: 0; }
  .tester-close {
    display: block;
    padding: .25rem .6rem;
    color: white;
    background: transparent;
    border: 1px solid #7c8ba9;
    border-radius: 6px;
    font-size: 1.2rem;
  }
}
