:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-dark: #94a3b8;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #86efac;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

button, a { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: min(100% - 32px, 760px);
  min-height: 62px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand, .back-button, footer button {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.brand {
  padding: 10px 0;
  font-size: 1rem;
  font-weight: 700;
}

.back-button {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--primary);
  font-weight: 650;
}

.back-button:hover { background: #eff6ff; }

main {
  flex: 1;
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: 42px 0 40px;
}

main:focus { outline: none; }

.screen {
  width: 100%;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.screen-note {
  width: fit-content;
  margin: 14px auto 28px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: #dbeafe;
  font-weight: 700;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  text-align: left;
}

.choice {
  position: relative;
  width: 100%;
  min-height: 132px;
  padding: 18px 48px 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.choice::after {
  content: "→";
  position: absolute;
  right: 20px;
  top: 50%;
  color: var(--border-dark);
  font-size: 1.35rem;
  transform: translateY(-50%);
}

.choice:hover {
  border-color: #93c5fd;
  box-shadow: 0 5px 18px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.choice:focus-visible, .brand:focus-visible, .back-button:focus-visible, footer button:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 3px;
}

.choice-title {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.25;
}

.choice-meta {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.choice-meta:empty { display: none; }

.choice-symbol {
  color: var(--primary);
  font-size: clamp(1.65rem, 6vw, 2.35rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.04em;
  white-space: pre-line;
}

.grade-choices {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grade-choices .choice {
  min-height: 145px;
  padding: 16px;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.grade-choices .choice::after { display: none; }

.grade-choices .choice-symbol {
  font-size: clamp(3rem, 8vw, 4.6rem);
  line-height: 0.9;
}

.grade-choices .choice-title {
  color: var(--muted);
  font-size: 0.82rem;
}

.set-choices {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: center;
}

.set-choices .choice {
  min-height: 210px;
  align-items: center;
  padding: 24px;
  text-align: center;
}

.set-choices .choice::after { display: none; }

.set-choices .choice-symbol {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--primary);
  font-size: 2rem;
  padding-left: 5px;
}

.choice-status {
  width: fit-content;
  margin-top: 3px;
  padding: 4px 8px;
  border: 1px solid var(--success-border);
  border-radius: 999px;
  color: var(--success);
  background: var(--success-bg);
  font-size: 0.78rem;
  font-weight: 700;
}

.empty {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: var(--card);
  text-align: center;
}

footer {
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: 18px 0 28px;
  border-top: 1px solid var(--border);
  text-align: center;
}

footer button {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 580px) {
  main { padding-top: 34px; }
  .choices { grid-template-columns: 1fr; }
  .grade-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-choices .choice { min-height: 128px; }
  .subtest-choices .choice { min-height: 118px; }
  .set-choices .choice { min-height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
