:root {
  --primary: #4c51bf;
  --primary-dark: #1f2937;
  --primary-light: #c7d2fe;
  --accent: #0ea5e9;
  --accent-bright: #22d3ee;
  --bg: #f3f4f6;
  --bg-alt: #e5e7eb;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(76, 81, 191, 0.22);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --success: #0f9d58;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 120% at 0% 0%, rgba(76, 81, 191, 0.15) 0%, transparent 55%),
    radial-gradient(120% 120% at 100% 8%, rgba(14, 165, 233, 0.18) 0%, transparent 60%),
    radial-gradient(140% 130% at 50% 100%, rgba(13, 148, 136, 0.16) 0%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(243, 244, 246, 0.85) 100%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  line-height: 1.6;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 56px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.85) 45%, rgba(236, 240, 247, 0.82) 100%);
  border-radius: 32px;
  border: 1px solid rgba(76, 81, 191, 0.16);
  box-shadow: 0 45px 90px -60px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(18px);
  position: relative;
}

.layout {
  display: flex;
  gap: 24px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.landing-hero {
  background: linear-gradient(135deg, rgba(76, 81, 191, 0.22) 0%, rgba(14, 165, 233, 0.22) 45%, rgba(13, 148, 136, 0.16) 100%);
  border-radius: 28px;
  padding: 40px;
  border: 1px solid rgba(76, 81, 191, 0.28);
  box-shadow: 0 40px 75px -45px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(22px);
}

.landing-hero::before,
.landing-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.85;
  filter: blur(0);
}

.landing-hero::before {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(76, 81, 191, 0.35) 0%, transparent 65%);
  top: -160px;
  right: -80px;
}

.landing-hero::after {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.28) 0%, transparent 62%);
  bottom: -120px;
  left: -70px;
}

.landing-hero > * {
  position: relative;
  z-index: 1;
}

.landing-hero h2 {
  margin: 0;
  font-size: 2.15rem;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
  text-shadow: 0 18px 36px rgba(31, 41, 55, 0.18);
}

.landing-lead {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 720px;
}

.landing-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.landing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.landing-button.primary {
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 55px -28px rgba(76, 81, 191, 0.55);
}

.landing-button.primary:hover,
.landing-button.primary:focus-visible {
  background: linear-gradient(120deg, var(--primary-dark) 0%, var(--accent) 95%);
  color: #fff;
  outline: none;
  box-shadow: 0 30px 65px -28px rgba(31, 41, 55, 0.45);
  transform: translateY(-1px);
}

.landing-button.secondary {
  border: 1px solid rgba(76, 81, 191, 0.35);
  color: var(--text);
  background: rgba(248, 250, 252, 0.8);
  box-shadow: 0 18px 40px -30px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(16px);
}

.landing-button.secondary:hover,
.landing-button.secondary:focus-visible {
  background: linear-gradient(120deg, var(--bg-alt) 0%, rgba(14, 165, 233, 0.18) 100%);
  color: var(--primary-dark);
  outline: none;
  box-shadow: 0 22px 50px -30px rgba(31, 41, 55, 0.35);
  transform: translateY(-1px);
}

.landing-button.disabled {
  border: 1px dashed rgba(148, 163, 184, 0.4);
  background: rgba(226, 232, 240, 0.6);
  color: rgba(100, 116, 139, 0.65);
  cursor: not-allowed;
  pointer-events: none;
}

.landing-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.landing-card {
  background: var(--surface-strong);
  border: 1px solid rgba(76, 81, 191, 0.16);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 40px 70px -50px rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.landing-card::after {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(76, 81, 191, 0.22) 0%, transparent 70%);
  pointer-events: none;
}

.landing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 55px 90px -48px rgba(15, 23, 42, 0.4);
}

.landing-card h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-dark);
  letter-spacing: 0.01em;
}

.landing-metric {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.landing-steps,
.landing-search {
  background: var(--surface);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 40px 70px -48px rgba(15, 23, 42, 0.55);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.landing-steps::before,
.landing-search::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(at 10% 0%, rgba(76, 81, 191, 0.16), transparent 60%),
    radial-gradient(at 90% 100%, rgba(56, 189, 248, 0.14), transparent 60%);
  pointer-events: none;
}

.landing-steps h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.landing-step-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.landing-step-list li {
  line-height: 1.6;
}

.landing-step-list strong {
  color: var(--primary-dark);
}

.landing-search {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 36px 0;
}

.landing-search h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.landing-search-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.landing-search-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.landing-search-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.landing-search-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.landing-search-controls input[type="search"] {
  flex: 1 1 260px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(76, 81, 191, 0.25);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.landing-search-controls input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(76, 81, 191, 0.2);
}

.landing-search-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.landing-search-summary-text {
  margin: 0;
}

.landing-search-summary strong {
  color: var(--primary);
}

.landing-search-summary .link-button {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.search-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.search-result-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 60%, rgba(14, 165, 233, 0.12) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  box-shadow: 0 30px 55px -45px rgba(15, 23, 42, 0.5);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.search-result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 42px 75px -48px rgba(15, 23, 42, 0.55);
}

.search-result-card h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.search-result-meta {
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.search-result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(76, 81, 191, 0.12);
  color: var(--primary-dark);
  line-height: 1.4;
}

.search-result-category {
  background: rgba(14, 165, 233, 0.18);
  color: #0f766e;
}

.search-result-version {
  background: rgba(56, 189, 248, 0.16);
  color: #0f766e;
}

.search-result-description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.search-result-form {
  margin: auto 0 0;
}

.search-result-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  pointer-events: none;
  z-index: 900;
}

.category-sidebar {
  flex-shrink: 0;
  width: 260px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 242, 255, 0.82) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 24px;
  padding: 24px;
  padding-bottom: calc(24px + 32px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 35px 70px -50px rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(18px);
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 24px);
  max-height: calc(100vh - 48px - env(safe-area-inset-top, 0px));
  overflow-y: auto;
}

.category-sidebar:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(76, 81, 191, 0.25);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px 0 0;
}

.sidebar-nav-link {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.65) 0%, rgba(238, 242, 255, 0.65) 100%);
  border: 1px solid rgba(76, 81, 191, 0.12);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-nav-link:hover,
.sidebar-nav-link:focus-visible {
  color: var(--primary-dark);
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.18) 0%, rgba(14, 165, 233, 0.12) 100%);
  border-color: rgba(76, 81, 191, 0.35);
  outline: none;
  box-shadow: 0 24px 55px -35px rgba(31, 41, 55, 0.45);
  transform: translateY(-2px);
}

.sidebar-nav-link.active {
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 28px 60px -32px rgba(76, 81, 191, 0.75);
  transform: translateY(-2px);
}

.sidebar-section-title {
  margin: 32px 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  position: relative;
  padding-bottom: 6px;
}

.sidebar-section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  border-radius: 999px;
}

.sidebar-hint {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.08) 0%, rgba(56, 189, 248, 0.08) 100%);
  border: 1px dashed rgba(76, 81, 191, 0.25);
  border-radius: 14px;
  padding: 14px;
  backdrop-filter: blur(14px);
}

.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.sidebar-close:hover {
  color: var(--primary);
}

.category-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-item {
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.75) 0%, rgba(238, 242, 255, 0.75) 100%);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}

.category-item[open] {
  border-color: rgba(76, 81, 191, 0.45);
  background: var(--surface-strong);
  box-shadow: 0 28px 60px -40px rgba(15, 23, 42, 0.55);
  transform: translateY(-2px);
}

.category-summary {
  margin: 0;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}

.category-summary::-webkit-details-marker {
  display: none;
}

.category-summary:hover {
  background: rgba(76, 81, 191, 0.12);
}

.category-summary:focus-visible {
  outline: 2px solid rgba(76, 81, 191, 0.55);
  outline-offset: 2px;
}

.category-item[open] .category-summary {
  color: var(--primary-dark);
  background: rgba(76, 81, 191, 0.12);
}

.category-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.category-counts {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(76, 81, 191, 0.12);
  color: var(--primary-dark);
  box-shadow: 0 12px 24px -18px rgba(15, 23, 42, 0.35);
  flex-shrink: 0;
}

.category-item[open] .category-count {
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
}

.accordion-icon {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}

.category-item[open] .accordion-icon {
  transform: rotate(-135deg);
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.exam-select-form {
  margin: 0;
}

.exam-button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-button:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.exam-button:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.exam-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.exam-button.active:hover {
  color: #fff;
}

.exam-button .exam-title {
  flex: 1;
  min-width: 0;
}

.exam-button .exam-question-count {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: rgba(76, 81, 191, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.2;
}

.exam-button:hover .exam-question-count,
.exam-button:focus .exam-question-count,
.exam-button.active .exam-question-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.accordion-empty {
  margin: 0;
  padding: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  border-top: 1px solid rgba(76, 81, 191, 0.15);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
}

.empty-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 0px);
  z-index: 950;
  padding: 16px 20px;
  background: var(--surface-strong);
  border: 1px solid rgba(76, 81, 191, 0.16);
  border-radius: 24px;
  box-shadow: 0 32px 70px -48px rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(18px);
}

header h1 {
  margin: 0;
  font-size: 1.9rem;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
  text-shadow: 0 18px 32px rgba(31, 41, 55, 0.25);
}

header h1 a {
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
  display: inline-block;
  padding: 4px 6px;
}

header h1 a:focus-visible,
header h1 a:hover {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

header p {
  margin: 0;
  color: var(--muted);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

.header-top h1 {
  width: 100%;
  text-align: center;
}

.app[data-view="landing"] header {
  align-items: stretch;
}

.app[data-view="landing"] .header-top {
  justify-content: center;
  width: 100%;
}

.app[data-view="landing"] header h1 {
  width: 100%;
  text-align: center;
}

.header-top .sidebar-toggle {
  position: absolute;
  top: 0;
  left: 0;
  transform: none;
  z-index: 1100;
}

.js-enabled.sidebar-open .sidebar-toggle {
  display: none;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--primary-dark);
  border: 1px solid rgba(76, 81, 191, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 20px 45px -30px rgba(15, 23, 42, 0.5);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.sidebar-toggle:hover {
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.18) 0%, rgba(56, 189, 248, 0.12) 100%);
  color: var(--primary-dark);
  border-color: rgba(76, 81, 191, 0.35);
  transform: translateY(-1px);
}

.sidebar-toggle .hamburger {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-toggle .hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  background: currentColor;
  border-radius: 999px;
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert.error {
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.3);
  background: rgba(248, 113, 113, 0.15);
}

.alert.success {
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.3);
  background: rgba(134, 239, 172, 0.15);
}

.form-card,
.section-card,
.question-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 242, 255, 0.82) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: 0 35px 70px -48px rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.form-card::before,
.section-card::before,
.question-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(at 85% 0%, rgba(76, 81, 191, 0.12), transparent 60%),
    radial-gradient(at 10% 100%, rgba(14, 165, 233, 0.12), transparent 60%);
  pointer-events: none;
}

.form-card:hover,
.section-card:hover,
.question-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 45px 85px -50px rgba(15, 23, 42, 0.6);
}

.form-card h2,
.section-card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-field label {
  font-weight: 600;
  color: var(--primary-dark);
}

.static-field .selected-category-display {
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.8) 0%, rgba(238, 242, 255, 0.8) 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.static-field .selected-exam-display {
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.exam-meta-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  text-align: left;
  table-layout: fixed;
}

.exam-meta-table td {
  padding: 6px 10px;
}

.exam-meta-table .exam-meta-label {
  width: 160px;
  min-width: 150px;
  font-weight: 700;
  color: var(--muted);
  text-align: left;
  vertical-align: top;
  padding: 6px 10px 6px 0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .exam-meta-table {
    border-spacing: 0;
  }

  .exam-meta-table tr {
    display: block;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 14px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 242, 255, 0.92) 100%);
    border: 1px solid rgba(76, 81, 191, 0.12);
  }

  .exam-meta-table tr:last-child {
    margin-bottom: 0;
  }

  .exam-meta-table td {
    display: block;
    width: 100%;
    padding: 4px 0;
  }

  .exam-meta-table .exam-meta-label {
    width: auto;
    min-width: 0;
    white-space: normal;
    padding: 0 0 6px;
    color: var(--primary-dark);
  }
}

.selected-category-name {
  font-weight: 600;
}

.selected-category-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.selected-exam-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.selected-exam-placeholder {
  font-size: 0.9rem;
  color: var(--muted);
}

.exam-meta-description {
  display: block;
  line-height: 1.6;
  word-break: break-word;
}

.form-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}

.open-sidebar-button {
  background: rgba(255, 255, 255, 0.85);
  color: var(--primary-dark);
  border: 1px solid rgba(76, 81, 191, 0.35);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.open-sidebar-button:hover {
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.18) 0%, rgba(14, 165, 233, 0.14) 100%);
  color: var(--primary-dark);
  border-color: rgba(76, 81, 191, 0.45);
  transform: translateY(-1px);
}

.open-sidebar-button:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(76, 81, 191, 0.25);
}

.open-sidebar-button:disabled,
.open-sidebar-button:disabled:hover {
  background: rgba(226, 232, 240, 0.5);
  color: rgba(76, 79, 117, 0.55);
  border-color: rgba(148, 163, 184, 0.35);
  cursor: not-allowed;
  transform: none;
}

.field-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.field-hint.error {
  color: var(--danger);
}

select,
input[type="number"],
button {
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(76, 81, 191, 0.25);
  font-family: inherit;
}

select,
input[type="number"] {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.4);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(76, 81, 191, 0.2);
}

button {
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 24px 55px -28px rgba(76, 81, 191, 0.7);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 30px 70px -32px rgba(31, 41, 55, 0.7);
  filter: brightness(1.03);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(76, 81, 191, 0.25), 0 30px 70px -30px rgba(31, 41, 55, 0.75);
}

button:disabled,
button:disabled:hover {
  background: rgba(148, 163, 184, 0.4);
  color: rgba(249, 250, 251, 0.9);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.85);
  color: var(--primary-dark);
  border: 1px solid rgba(76, 81, 191, 0.35);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
}

button.secondary:hover {
  color: var(--primary-dark);
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.18) 0%, rgba(56, 189, 248, 0.14) 100%);
  border-color: rgba(76, 81, 191, 0.45);
}

button.secondary:disabled,
button.secondary:disabled:hover {
  background: rgba(226, 232, 240, 0.5);
  color: rgba(76, 79, 117, 0.55);
  border-color: rgba(148, 163, 184, 0.35);
  cursor: not-allowed;
}

button.danger-action {
  border-color: rgba(248, 113, 113, 0.6);
  color: #be123c;
}

button.danger-action:hover {
  background: linear-gradient(120deg, rgba(248, 113, 113, 0.3) 0%, rgba(14, 165, 233, 0.28) 100%);
  border-color: rgba(248, 113, 113, 0.75);
  color: #fff;
}

button.danger-action:disabled,
button.danger-action:disabled:hover {
  background: rgba(248, 113, 113, 0.12);
  color: rgba(190, 18, 60, 0.5);
  border-color: rgba(248, 113, 113, 0.25);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(76, 81, 191, 0.35);
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.link-button:hover,
.link-button:focus-visible {
  color: var(--primary-dark);
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.18) 0%, rgba(14, 165, 233, 0.14) 100%);
  border-color: rgba(76, 81, 191, 0.45);
  box-shadow: 0 24px 55px -35px rgba(31, 41, 55, 0.45);
  outline: none;
  transform: translateY(-1px);
}

.link-button:visited {
  color: var(--primary-dark);
}

.exam-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.95rem;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(76, 81, 191, 0.18);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
}

.exam-meta span strong {
  font-weight: 600;
}

.category-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.category-group {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
  box-shadow: 0 22px 48px -35px rgba(15, 23, 42, 0.45);
}

.category-group:last-child {
  margin-bottom: 0;
}

.category-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.exam-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exam-list li {
  padding: 14px 18px;
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.88) 0%, rgba(238, 242, 255, 0.85) 100%);
  box-shadow: 0 20px 45px -32px rgba(15, 23, 42, 0.45);
}

.exam-list li h3,
.exam-list li h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.exam-list li p {
  margin: 0;
  font-size: 0.95rem;
}

.exam-list li .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.quiz-header {
  margin-bottom: 24px;
}

.quiz-header h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  color: var(--primary-dark);
}

.quiz-header p {
  margin: 0;
}

.quiz-header .quiz-category {
  margin: 0 0 8px;
}

.quiz-category,
.results-category {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.quiz-difficulty,
.results-difficulty {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.quiz-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-form .actions {
  margin-top: 8px;
}

.no-answer {
  margin: -6px 0 12px;
  color: var(--danger);
  font-size: 0.9rem;
}

.question-card {
  border-left: 6px solid rgba(76, 81, 191, 0.4);
}

.question-card.correct {
  border-left-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 38px 72px -48px rgba(16, 185, 129, 0.35);
}

.question-card.incorrect {
  border-left-color: rgba(248, 113, 113, 0.8);
  box-shadow: 0 38px 72px -48px rgba(248, 113, 113, 0.3);
}

.question-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.difficulty-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e5e7eb;
  color: #111827;
}

.difficulty-easy {
  background: #dcfce7;
  color: #166534;
}

.difficulty-normal {
  background: #e0f2fe;
  color: #075985;
}

.difficulty-hard {
  background: #fee2e2;
  color: #b91c1c;
}

.difficulty-random {
  background: #ede9fe;
  color: #5b21b6;
}

.choice-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.choice-item input[type="radio"] {
  margin-top: 4px;
}

.choice-item input[type="checkbox"] {
  margin-top: 4px;
}

.multi-answer-hint {
  margin: -4px 0 12px;
  font-size: 0.9rem;
  color: var(--primary-dark);
}

.choice-item label {
  font-weight: 500;
  cursor: pointer;
}

.choice-item.correct span.option-key,
.choice-item.selected span.option-key {
  font-weight: 700;
}

.choice-item.correct {
  color: var(--success);
}

.choice-item.incorrect.selected {
  color: var(--danger);
}

.choice-item .option-key {
  display: inline-block;
  min-width: 20px;
}

.explanation {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 242, 255, 0.82) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.explanation-block h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--primary-dark);
}

.explanation-block p {
  margin: 0 0 8px;
}

.explanation-block p:last-child {
  margin-bottom: 0;
}

.explanation-reference {
  margin: 0;
  font-size: 0.9rem;
}

.explanation-reference a {
  color: var(--primary-dark);
  text-decoration: underline;
}

.choice-explanations-toggle {
  display: block;
}

.choice-explanations-toggle summary {
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.choice-explanations-toggle summary:hover {
  background: rgba(29, 78, 216, 0.08);
}

.choice-explanations-toggle summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.choice-explanations-toggle summary::-webkit-details-marker {
  display: none;
}

.choice-explanations-toggle summary::before {
  content: "\25B6";
  font-size: 0.9rem;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.choice-explanations-toggle[open] summary::before {
  transform: rotate(90deg);
}

.choice-explanations-toggle[open] summary {
  margin-bottom: 12px;
}

.choice-explanations {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-explanation-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.choice-explanation-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-statement {
  margin: 0;
  font-weight: 600;
}

.choice-explanation-body p {
  margin: 0;
}

.choice-explanation-body p + p {
  margin-top: 4px;
}

.results-summary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 242, 255, 0.82) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: 0 35px 70px -48px rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(12px);
}

.results-summary h2 {
  margin: 0 0 8px;
}

.results-summary p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.results-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}

.results-filter-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.results-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-toggle {
  border: 1px solid rgba(76, 81, 191, 0.25);
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.filter-toggle:hover,
.filter-toggle:focus-visible {
  border-color: rgba(76, 81, 191, 0.45);
  color: var(--primary-dark);
  outline: none;
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.18) 0%, rgba(14, 165, 233, 0.14) 100%);
  box-shadow: 0 24px 55px -35px rgba(31, 41, 55, 0.45);
  transform: translateY(-1px);
}

.filter-toggle.is-active {
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 26px 60px -32px rgba(76, 81, 191, 0.75);
}

.filter-toggle.is-active:hover,
.filter-toggle.is-active:focus-visible {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, var(--primary-dark) 0%, var(--accent) 90%);
  box-shadow: 0 30px 70px -32px rgba(31, 41, 55, 0.75);
}


.history-card {
  margin-top: 0;
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.history-header-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-header-text h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--primary-dark);
}

.history-description {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0 12px;
}

.history-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  flex: 1 1 220px;
}

.history-filter-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.history-filter-group input[type="search"],
.history-filter-group select {
  padding: 12px 14px;
  border: 1px solid rgba(76, 81, 191, 0.25);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.history-filter-group input[type="search"]:focus,
.history-filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(76, 81, 191, 0.2);
}

.history-status {
  min-height: 1.25rem;
  margin: 8px 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.history-status.status-success {
  color: var(--success);
}

.history-status.status-error {
  color: var(--danger);
}

.history-status.status-info {
  color: var(--primary);
}

.history-count {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.history-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed rgba(76, 81, 191, 0.25);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.08) 0%, rgba(56, 189, 248, 0.08) 100%);
  color: var(--muted);
  backdrop-filter: blur(12px);
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.history-page-info {
  font-weight: 600;
  color: var(--primary-dark);
}

.history-entry {
  border: none;
}

.history-summary {
  margin: 0;
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.history-summary-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.history-summary-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.history-summary-timestamp {
  font-size: 0.85rem;
  color: var(--muted);
}

.history-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(76, 81, 191, 0.12);
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 600;
}

.history-summary-score {
  font-size: 0.95rem;
  color: var(--primary-dark);
  font-weight: 600;
  text-align: right;
}

.history-summary-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.history-view-button {
  font-size: 0.85rem;
  padding: 6px 12px;
}

.history-entry[open] .history-summary-title {
  color: var(--primary);
}

.history-entry[open] .history-summary-score {
  color: var(--primary);
}

.history-details {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-detail-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0;
}

.history-detail-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-detail-item dt {
  margin: 0;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary-dark);
}

.history-detail-item dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.history-detail-section {
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-detail-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.history-detail-note {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--success);
}

.history-incorrect-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-incorrect-item {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
}

.history-incorrect-question {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.history-incorrect-answer {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.history-card .saved-results-list {
  margin-top: 0;
}

.history-card .saved-result-item {
  padding: 18px 20px;
}

.saved-results-card {
  margin-top: 24px;
}

.saved-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.saved-results-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.saved-results-note {
  margin: 8px 0 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

.saved-results-status {
  min-height: 1.25rem;
  margin: 8px 0 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.saved-results-status.status-success {
  color: var(--success);
}

.saved-results-status.status-error {
  color: var(--danger);
}

.saved-results-status.status-info {
  color: var(--primary);
}

.saved-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-result-item {
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  padding: 18px 20px;
  box-shadow: 0 20px 48px -35px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.saved-result-title {
  font-weight: 600;
  color: var(--primary-dark);
}

.saved-result-header .saved-result-timestamp {
  margin-left: auto;
}

.saved-result-summary,
.saved-result-meta,
.saved-result-timestamp {
  margin: 0;
  font-size: 0.9rem;
}

.saved-result-summary {
  color: var(--primary-dark);
  font-weight: 600;
}

.saved-result-meta {
  color: var(--muted);
}

.saved-result-timestamp {
  font-size: 0.85rem;
  color: var(--muted);
}

.saved-result-mistakes {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saved-result-subtitle {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.saved-result-no-mistakes {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--success);
}

.incorrect-question-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.incorrect-question-item {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.45);
}

.incorrect-question-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.incorrect-question-answer {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.saved-results-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed rgba(76, 81, 191, 0.25);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(76, 81, 191, 0.08) 0%, rgba(56, 189, 248, 0.08) 100%);
  text-align: center;
  color: var(--muted);
  backdrop-filter: blur(12px);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.manual-hero {
  background: linear-gradient(135deg, #f1f5ff 0%, #eef2ff 100%);
  border-radius: 18px;
  padding: 32px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 24px 60px -30px rgba(30, 64, 175, 0.45);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.manual-hero h2 {
  margin: 0;
  font-size: 1.9rem;
  color: var(--primary-dark);
}

.manual-hero p {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1rem;
  max-width: 760px;
}

.manual-hero-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.manual-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.manual-hero-actions .landing-button {
  font-size: 0.95rem;
}

.manual-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 4px;
}

.manual-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(76, 81, 191, 0.15);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 32px -26px rgba(29, 78, 216, 0.55);
}

.manual-hero-badge.is-accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 18px 40px -30px rgba(37, 99, 235, 0.65);
}

.manual-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.82) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 24px;
  padding: 32px;
  margin: 36px 0;
  box-shadow: 0 35px 70px -48px rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(12px);
}

.manual-toc {
  margin: 32px 0;
}

.manual-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.manual-toc-link {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(238, 242, 255, 0.85) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 20px;
  padding: 20px 22px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  color: var(--primary-dark);
  box-shadow: 0 24px 55px -35px rgba(15, 23, 42, 0.45);
}

.manual-toc-link:hover,
.manual-toc-link:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(76, 81, 191, 0.45);
  box-shadow: 0 30px 70px -32px rgba(31, 41, 55, 0.55);
}

.manual-toc-link:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.55);
  outline-offset: 3px;
}

.manual-toc-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-toc-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22) 0%, rgba(29, 78, 216, 0.32) 100%);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.95rem;
}

.manual-toc-icon {
  font-size: 1.3rem;
}

.manual-toc-title {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 1rem;
}

.manual-toc-description {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.manual-section-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.manual-section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 26px 58px -34px rgba(29, 78, 216, 0.55);
}

.manual-section-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-section-header h3 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary-dark);
}

.manual-section-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.manual-section h3 {
  margin: 0 0 18px;
  font-size: 1.35rem;
  color: var(--primary-dark);
}

.manual-section h4 {
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.manual-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.manual-step-list li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  box-shadow: 0 24px 55px -35px rgba(15, 23, 42, 0.45);
}

.manual-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.manual-step-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-step-content h4 {
  margin: 0;
}

.manual-step-content p {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.manual-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.manual-list li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.manual-list li:last-child {
  margin-bottom: 0;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.manual-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 24px 55px -35px rgba(15, 23, 42, 0.45);
}

.manual-card h4 {
  margin: 0;
}

.manual-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.manual-subsection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.manual-subsection:last-of-type {
  margin-bottom: 0;
}

.manual-subsection p {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.manual-callout {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.65) 0%, rgba(226, 232, 240, 0.6) 100%);
  border-radius: 12px;
  padding: 18px 22px;
  color: var(--primary-dark);
  box-shadow: 0 18px 40px -36px rgba(29, 78, 216, 0.45);
}

.manual-callout h4 {
  margin: 0 0 8px;
}

.manual-callout p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.manual-faq {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-faq-item {
  border: 1px solid rgba(76, 81, 191, 0.18);
  border-radius: 18px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  box-shadow: 0 18px 36px -34px rgba(15, 23, 42, 0.45);
}

.manual-faq-item[open] {
  border-color: rgba(76, 81, 191, 0.45);
  background: linear-gradient(135deg, rgba(76, 81, 191, 0.15) 0%, rgba(14, 165, 233, 0.12) 100%);
  box-shadow: 0 24px 55px -32px rgba(31, 41, 55, 0.45);
}

.manual-faq-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-dark);
  outline: none;
  list-style: none;
}

.manual-faq-item summary::-webkit-details-marker {
  display: none;
}

.manual-faq-item summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.manual-faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.manual-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.manual-cta .landing-button {
  min-width: 220px;
  justify-content: center;
}

.manual-next p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.notice-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.notice-hero {
  background: linear-gradient(135deg, rgba(76, 81, 191, 0.2) 0%, rgba(14, 165, 233, 0.18) 50%, rgba(13, 148, 136, 0.18) 100%);
  border-radius: 24px;
  padding: 36px;
  border: 1px solid rgba(76, 81, 191, 0.25);
  box-shadow: 0 36px 75px -45px rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice-hero h2 {
  margin: 0;
  font-size: 1.9rem;
  color: var(--primary-dark);
}

.notice-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 780px;
}

.notice-section {
  background: var(--surface-strong);
  border: 1px solid rgba(76, 81, 191, 0.16);
  border-radius: 22px;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 32px 60px -40px rgba(15, 23, 42, 0.35);
}

.notice-section-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notice-section h3 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary-dark);
}

.notice-section-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.notice-section p {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.98rem;
}

.notice-section p + p {
  margin-top: 6px;
}

.notice-muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.notice-list {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

.notice-list li::marker {
  color: var(--accent);
  font-weight: 600;
}

.notice-callout {
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.75) 0%, rgba(219, 234, 254, 0.7) 100%);
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 22px 48px -36px rgba(15, 23, 42, 0.35);
}

.notice-callout h4 {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.notice-callout p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.notice-actions .landing-button {
  min-width: 200px;
  justify-content: center;
}

@media (max-width: 1100px) {
  .layout {
    gap: 20px;
  }

  .category-sidebar {
    width: 240px;
  }
}

@media (max-width: 900px) {
  .app {
    padding: 20px 16px 40px;
  }

  .landing-hero {
    padding: 28px;
  }

  .manual-hero {
    padding: 28px;
  }

  .notice-hero {
    padding: 28px;
  }

  .manual-toc {
    margin: 24px 0;
  }

  .manual-toc-link {
    padding: 16px 18px;
  }

  .manual-section {
    padding: 24px;
    margin: 28px 0;
  }

  .notice-section {
    padding: 24px;
  }

  .manual-section-header {
    flex-direction: column;
    gap: 12px;
  }

  .manual-section-number {
    width: 48px;
    height: 48px;
  }

  .manual-grid {
    gap: 16px;
  }

  .landing-highlights {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .layout {
    flex-direction: column;
    gap: 16px;
  }

  .header-top,
  .app[data-view="landing"] .header-top {
    justify-content: center;
  }

  .header-top h1,
  .app[data-view="landing"] header h1 {
    width: 100%;
    flex: none;
    text-align: center;
  }

  .header-top .sidebar-toggle {
    position: fixed;
    top: 16px;
    top: calc(env(safe-area-inset-top) + 16px);
    left: 16px;
    left: calc(env(safe-area-inset-left) + 16px);
    transform: none;
    box-shadow: 0 12px 32px -20px rgba(15, 23, 42, 0.45);
  }

  .category-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    max-height: none;
    box-shadow: none;
  }

  .history-header {
    flex-direction: column;
    align-items: stretch;
  }

  .history-summary {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    justify-content: flex-start;
  }

  .history-summary-score {
    text-align: left;
    align-self: flex-start;
  }

  .history-summary-aside {
    align-items: stretch;
    width: 100%;
  }

  .history-pagination {
    justify-content: center;
  }

  .main-content {
    width: 100%;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .js-enabled .category-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    bottom: 0;
    height: 100vh;
    max-width: 280px;
    width: 80%;
    transform: translateX(-100%);
    border-radius: 0;
    border: none;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
    padding: 24px 20px;
    padding-bottom: calc(24px + 32px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    z-index: 1000;
  }

  .js-enabled .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    padding: 6px 10px;
  }

  .js-enabled.sidebar-open .category-sidebar {
    transform: translateX(0);
  }

  .js-enabled .sidebar-backdrop {
    display: none;
  }

  .js-enabled.sidebar-open .sidebar-backdrop {
    display: block;
    pointer-events: auto;
  }

  html.js-enabled.sidebar-open {
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  header {
    padding: 14px 16px;
    border-radius: 20px;
  }

  .app {
    padding: 16px 12px 32px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .landing-hero {
    padding: 24px;
  }

  .manual-hero {
    padding: 24px;
  }

  .notice-page {
    gap: 20px;
  }

  .notice-hero {
    padding: 22px;
  }

  .manual-hero h2 {
    font-size: 1.6rem;
  }

  .notice-hero h2 {
    font-size: 1.55rem;
  }

  .manual-toc-list {
    grid-template-columns: 1fr;
  }

  .manual-toc-head {
    align-items: flex-start;
  }

  .manual-toc-link {
    padding: 14px 16px;
  }

  .manual-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-hero-actions .landing-button,
  .manual-cta .landing-button {
    width: 100%;
  }

  .landing-hero h2 {
    font-size: 1.6rem;
  }

  .landing-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-button {
    width: 100%;
  }

  .manual-section {
    padding: 22px 18px;
    margin: 24px 0;
  }

  .notice-section {
    padding: 20px;
  }

  .manual-section-number {
    width: 44px;
    height: 44px;
  }

  .manual-step-list li {
    flex-direction: column;
  }

  .manual-step-number {
    margin-bottom: 8px;
  }

  .manual-grid {
    grid-template-columns: 1fr;
  }

  .manual-card {
    padding: 18px;
  }

  .manual-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .notice-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .notice-actions .landing-button {
    width: 100%;
  }

  .landing-highlights {
    margin: 24px 0;
  }

  .header-top .sidebar-toggle {
    left: 12px;
    left: calc(env(safe-area-inset-left) + 12px);
  }

  .landing-search {
    padding: 20px;
    margin: 24px 0;
  }

  .landing-search-controls {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .landing-search-controls input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
  }

  .landing-search-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-search-summary .link-button {
    width: 100%;
  }

  .search-result-list {
    grid-template-columns: 1fr;
  }

  button:not(.sidebar-toggle):not(.sidebar-close) {
    width: 100%;
  }

  .landing-search-controls button:not(.sidebar-toggle):not(.sidebar-close) {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .open-sidebar-button {
    width: auto;
  }

  .actions {
    flex-direction: column;
  }

  .save-result-button,
  .saved-result-delete {
    width: auto;
  }

  .history-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .history-filter-group {
    width: 100%;
    min-width: 0;
    flex: none;
  }
}
