:root {
  color-scheme: light;
  --navy: #35104f;
  --navy-2: #551268;
  --teal: #db176d;
  --teal-dark: #a80d5d;
  --teal-soft: #fff0f7;
  --gold: #f3ad2b;
  --ink: #2c183c;
  --muted: #71657c;
  --line: #e3d9e8;
  --surface: #ffffff;
  --page: #f8f4fa;
  --correct: #177245;
  --correct-soft: #e9f7ef;
  --wrong: #b42318;
  --wrong-soft: #fdefed;
  --shadow: 0 20px 55px rgba(53, 16, 79, 0.13);
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(219, 23, 109, 0.09), transparent 24rem),
    radial-gradient(circle at 92% 18%, rgba(243, 173, 43, 0.08), transparent 20rem),
    linear-gradient(180deg, #fdfbfe 0%, var(--page) 100%);
  min-height: 100vh;
}

button, select { font: inherit; }
button { touch-action: manipulation; }

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.7rem 1rem;
  background: white;
  color: var(--navy);
  border-radius: 0.6rem;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  min-height: 7.4rem;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto minmax(9rem, 1fr);
  align-items: center;
  gap: 1rem;
  background: linear-gradient(118deg, #ffd9ec 0%, #f2dcff 50%, #dfd2ff 100%);
  color: var(--navy);
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, #f3ad2b, #db176d, #7e43a7) 1;
  box-shadow: 0 7px 24px rgba(83, 34, 112, 0.14);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  text-decoration: none;
}
.brand-logo {
  width: 6.15rem;
  height: 6.15rem;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(64, 12, 83, 0.16));
}

.header-date {
  margin: 0;
  color: #54116f;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.4;
}

.topbar-stats {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.menu-button {
  min-height: 2.55rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid rgba(83,18,104,0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-weight: 850;
  cursor: pointer;
}
.account-menu {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: 50;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: white;
  box-shadow: var(--shadow);
}
.account-menu p { margin: 0; padding: 0.6rem 0.7rem; color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; }
.account-menu a, .account-menu button {
  width: 100%; display: block; padding: 0.72rem; border: 0; border-radius: 0.65rem; background: transparent;
  color: var(--ink); text-align: left; text-decoration: none; font-weight: 750; cursor: pointer;
}
.account-menu a:hover, .account-menu button:hover { background: var(--teal-soft); color: var(--teal-dark); }

.visitor-chip {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(83,18,104,0.16);
  border-radius: 999px;
  background: rgba(255,255,255,0.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  white-space: nowrap;
}
.visitor-chip strong { font-size: 0.83rem; }
.visitor-chip span, .visitor-chip small { color: #704d7d; font-size: 0.75rem; }

.score-chip {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(83,18,104,0.16);
  border-radius: 999px;
  background: rgba(255,255,255,0.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.score-chip span { font-size: 0.78rem; color: #704d7d; }
.score-chip strong { font-size: 1rem; }

.shell {
  width: min(100% - 2rem, 1040px);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) 0 3rem;
}

.personal-greeting {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e4c5df;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, #ffe7f2, #eee2ff);
  color: var(--navy);
  font-size: 1rem;
  font-weight: 850;
  text-align: center;
}
.level-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-bottom: 1.45rem;
}
.level-tab {
  min-height: 3.25rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #d9cbe1;
  border-radius: 0.85rem;
  background: white;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}
.level-tab.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, #ffdaeb, #e9d9ff);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px var(--teal), 0 8px 20px rgba(83,18,104,0.1);
}

.practice-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin: -0.8rem 0 1.75rem;
}
.practice-overview div {
  display: grid;
  gap: 0.2rem;
  min-height: 5.25rem;
  align-content: center;
  padding: 0.85rem 1rem;
  border: 1px solid #e1d3e8;
  border-radius: 0.85rem;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 8px 22px rgba(53,16,79,0.06);
}
.practice-overview strong { color: var(--navy); font-size: 0.92rem; }
.practice-overview span { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }

.study-materials {
  margin: 0 0 2.2rem;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  border: 1px solid #dfcbe9;
  border-radius: 1.2rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(249,235,255,0.92));
  box-shadow: 0 14px 34px rgba(53,16,79,0.09);
}
.materials-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.materials-heading h2 { margin: 0; color: var(--navy); font-size: clamp(1.3rem, 3vw, 1.75rem); }
.materials-badge { padding: 0.45rem 0.75rem; border-radius: 999px; background: var(--navy); color: white; font-size: 0.78rem; font-weight: 850; white-space: nowrap; }
.materials-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
.material-card { display: grid; grid-template-columns: 3.4rem 1fr; gap: 0.9rem; min-width: 0; padding: 1rem; border: 1px solid #e6d9ec; border-radius: 0.95rem; background: white; }
.material-icon { width: 3.4rem; height: 3.4rem; display: grid; place-items: center; border-radius: 0.8rem; background: #ffe2ef; color: var(--teal-dark); font-size: 0.85rem; font-weight: 950; }
.cards-icon { background: #eee1ff; color: var(--navy-2); font-size: 1.65rem; }
.material-card h3 { margin: 0; color: var(--navy); font-size: 1rem; line-height: 1.35; }
.material-card p { margin: 0.4rem 0 0.85rem; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.material-link { width: fit-content; min-height: 2.65rem; display: inline-flex; align-items: center; justify-content: center; padding: 0.58rem 0.9rem; text-decoration: none; font-size: 0.86rem; }
.locked-button { border: 1px solid #d5c8dc; border-radius: 0.7rem; background: #f2edf4; color: #6e6174; font-weight: 800; cursor: not-allowed; }
.materials-note { margin: 0.9rem 0 0; color: #644b70; font-size: 0.8rem; line-height: 1.5; }

.exam-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}
h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.45rem); line-height: 1.16; }
.exam-meta { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.95rem; }

.day-picker { display: grid; gap: 0.35rem; min-width: 10rem; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.day-picker select {
  width: 100%;
  min-height: 2.8rem;
  padding: 0 2.3rem 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: white;
  color: var(--ink);
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin: -0.25rem 0 1.15rem;
}
.category-tab {
  min-height: 2.8rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d9cbe1;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.86);
  color: var(--navy);
  font-weight: 850;
  cursor: pointer;
}
.category-tab.active { border-color: var(--teal); background: linear-gradient(135deg, #ffe5f1, #efe1ff); color: var(--teal-dark); box-shadow: inset 0 0 0 1px var(--teal); }

.share-panel {
  margin: -0.35rem 0 1.4rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255,255,255,0.78);
}
.share-panel summary {
  padding: 0.85rem 1rem;
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
}
.share-panel summary span {
  margin-left: 0.45rem;
  color: var(--teal-dark);
  font-size: 0.85rem;
  font-weight: 650;
}
.share-content {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.25rem;
  align-items: center;
  padding: 0 1rem 1rem;
}
.share-content img {
  width: 10rem;
  height: 10rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: white;
}
.share-content a { color: var(--teal-dark); overflow-wrap: anywhere; }
.share-note { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.share-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.9rem; }
.secondary-link {
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: white;
  color: var(--ink) !important;
  font-weight: 800;
  text-decoration: none;
}
.share-status { min-height: 1.2rem; margin: 0.5rem 0 0; color: var(--teal-dark); font-size: 0.82rem; }

.security-strip {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: -0.35rem 0 1.35rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid #edc8d9;
  border-radius: 0.8rem;
  background: #fff5f9;
  color: #6b1744;
  font-size: 0.84rem;
  line-height: 1.45;
}
.security-icon { color: var(--gold); font-size: 0.75rem; }
.welcome-security { margin: 1rem 0 0.75rem; text-align: left; }
.daily-bank-note { margin: 0.75rem 0; padding: 0.75rem 0.85rem; border-radius: 0.7rem; background: #f4eaff; color: #4d2a61; text-align: left; font-size: 0.88rem; }

.security-notice {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  width: min(26rem, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border: 1px solid #ff9fc4;
  border-left: 4px solid var(--teal);
  border-radius: 0.8rem;
  background: #35104f;
  color: white;
  box-shadow: 0 14px 35px rgba(53, 16, 79, 0.28);
  font-size: 0.88rem;
  line-height: 1.45;
}

.progress-panel { margin-bottom: 1rem; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.progress-track { height: 0.55rem; overflow: hidden; border-radius: 99px; background: #dce6ed; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy-2), var(--teal), var(--gold)); transition: width 240ms ease; }
.mistake-review-button { margin: 0.75rem 0 0 auto; display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.8rem; border: 1px solid #d8c6e3; border-radius: 999px; background: #fff; color: var(--navy); font-size: 0.82rem; font-weight: 850; cursor: pointer; }
.mistake-review-button[hidden] { display: none; }
.mistake-review-button span { min-width: 1.45rem; height: 1.45rem; display: grid; place-items: center; border-radius: 50%; background: var(--wrong); color: #fff; font-size: 0.72rem; }
.mistake-review-button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.quiz-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.25rem, 4vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.quiz-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.35rem;
  background: linear-gradient(var(--teal), var(--gold));
  z-index: 2;
}
.quiz-card::after {
  content: "JDEE JAPAN";
  position: absolute;
  right: -1.6rem;
  bottom: 2.5rem;
  z-index: 0;
  color: var(--navy);
  font-size: clamp(2.4rem, 9vw, 5rem);
  font-weight: 950;
  letter-spacing: 0.08em;
  opacity: 0.035;
  transform: rotate(-16deg);
  pointer-events: none;
  white-space: nowrap;
}
.quiz-card > * { position: relative; z-index: 1; }
.quiz-card h2,
.quiz-card .option-label,
.quiz-card .hint-panel,
.quiz-card .feedback {
  -webkit-user-select: none;
  user-select: none;
}
.question-topline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.category-pill { display: inline-flex; padding: 0.4rem 0.7rem; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); font-size: 0.75rem; font-weight: 900; letter-spacing: 0.09em; }
.text-button { padding: 0.45rem 0; border: 0; background: transparent; color: var(--teal-dark); font-size: 0.86rem; font-weight: 750; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2rem; }
.question-banner { width: min(30rem, 90%); min-height: 3.25rem; margin: 1rem auto -1.15rem; position: relative; z-index: 2; display: grid; grid-template-columns: 2.5rem 1fr 2.5rem; align-items: center; gap: 0.4rem; color: var(--teal); text-align: center; }
.question-banner strong { display: grid; place-items: center; min-height: 3.25rem; padding: 0.55rem 1rem; border-radius: 999px; background: linear-gradient(135deg, var(--navy), #111b4d); color: #fff; font-size: clamp(1rem, 2.5vw, 1.35rem); letter-spacing: 0.02em; box-shadow: 0 8px 18px rgba(53,16,79,0.2); }
.question-banner span { font-size: 1.8rem; line-height: 1; }
.question-frame { min-height: 13rem; display: grid; align-content: center; padding: 2.5rem clamp(1rem, 4vw, 2.25rem) 1.6rem; border: 2px solid var(--navy); border-radius: 1.15rem; background: linear-gradient(145deg, #fff, #f8fdff); text-align: center; }
.question-number { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.12em; }
h2 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.65rem); line-height: 1.7; font-weight: 750; }

.hint-panel {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--gold);
  background: #fff9e9;
  color: #68501a;
  border-radius: 0 0.65rem 0.65rem 0;
  font-size: 0.94rem;
  line-height: 1.55;
}

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.option {
  width: 100%;
  min-height: 3.5rem;
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 0.85rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.option:hover:not(:disabled) { border-color: var(--teal); transform: translateY(-1px); }
.option:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid rgba(219,23,109,0.3); outline-offset: 2px; }
.option:disabled { cursor: default; opacity: 1; }
.option-letter { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 850; }
.option-label { font-size: 1rem; line-height: 1.5; }
.option-reading { display: block; margin-top: 0.12rem; color: #6d4c7d; font-size: 0.78rem; font-weight: 650; }
.option-status { font-size: 0.78rem; font-weight: 800; }
.option.correct { border-color: var(--correct); background: var(--correct-soft); }
.option.correct .option-letter { background: var(--correct); color: white; }
.option.wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.option.wrong .option-letter { background: var(--wrong); color: white; }

.feedback {
  margin-top: 1.25rem;
  padding: 1.15rem;
  border-radius: 0.9rem;
  border: 1px solid;
  line-height: 1.6;
}
.feedback.correct-feedback { background: var(--correct-soft); border-color: #9ad2b3; }
.feedback.wrong-feedback { background: var(--wrong-soft); border-color: #e8aaa3; }
.feedback h3 { margin: 0 0 0.45rem; font-size: 1.05rem; }
.feedback p { margin: 0.3rem 0; }
.feedback .correct-answer { font-weight: 800; }
.feedback .selected-note { color: var(--muted); font-size: 0.9rem; }
.review-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin: 0.8rem 0; }
.review-detail p { padding: 0.75rem; border: 1px solid #dfd0e8; border-radius: 0.65rem; background: #fff; }
.option-analysis { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid #dfd0e8; }
.option-analysis > p { margin-top: 0.6rem; padding: 0.65rem 0.75rem; border-left: 3px solid #cdbbd8; border-radius: 0 0.5rem 0.5rem 0; background: #fff; }
.option-analysis > p.analysis-correct { border-left-color: var(--correct); background: #effbf4; }
.translation { margin: 0.75rem 0; padding: 0.75rem 0.85rem; border-radius: 0.7rem; background: rgba(255,255,255,0.72); }
.translation strong { color: var(--teal-dark); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; }
.translation p { margin: 0.25rem 0 0; }
.translation-tabs { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.7rem; }
.translation-tab { padding: 0.45rem 0.7rem; border: 1px solid #d7c2e3; border-radius: 999px; background: #fff; color: var(--navy); font-size: 0.78rem; font-weight: 850; cursor: pointer; }
.translation-tab.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.translation-link { display: inline-flex; margin-top: 0.55rem; color: var(--teal-dark); font-weight: 800; }
.answer-reading { color: #6d4c7d; font-weight: 650; }

.modal {
  width: min(36rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid #d7c2e3;
  border-radius: 1.15rem;
  background: linear-gradient(145deg, #fff, #fff7fb);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(53,16,79,0.28);
}
.modal::backdrop { background: rgba(35,15,47,0.58); backdrop-filter: blur(3px); }
.modal h1, .modal h2 { margin: 0 2rem 0.7rem 0; }
.modal p, .modal li { line-height: 1.6; }
.modal-close { position: absolute; top: 0.7rem; right: 0.8rem; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: #f2e5fa; color: var(--navy); font-size: 1.5rem; cursor: pointer; }
.welcome-modal { text-align: center; }
.welcome-modal ol { display: inline-block; margin: 0.5rem auto; padding-left: 1.35rem; text-align: left; }
.welcome-logo { width: 6rem; height: 6rem; object-fit: contain; }
.modal-note { color: var(--muted); font-size: 0.88rem; }
.modal-action { width: 100%; margin-top: 0.75rem; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; }
.setting-row span, .setting-row small { display: block; }
.setting-row small { margin-top: 0.3rem; color: var(--muted); line-height: 1.4; }
.setting-row input { width: 2.8rem; height: 1.5rem; accent-color: var(--teal); }
#report-form { display: grid; gap: 1rem; }
#report-form label { display: grid; gap: 0.35rem; font-weight: 750; }
#report-form select, #report-form textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.7rem; background: white; color: var(--ink); }

.quiz-actions { display: flex; justify-content: space-between; gap: 0.8rem; margin-top: 1.6rem; }
.study-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eadff0; }
.study-control { min-height: 3.1rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.55rem 0.65rem; border: 1px solid #d9c7e4; border-radius: 0.72rem; background: #fff8fc; color: var(--navy); font-size: 0.82rem; font-weight: 850; cursor: pointer; }
.study-control:hover { border-color: var(--teal); background: #f4fbff; }
.study-control[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.study-control > span:first-child { font-size: 1rem; }
.study-tool-status { min-height: 1.2rem; margin: 0.55rem 0 0; color: var(--muted); font-size: 0.78rem; text-align: center; }
.quiz-card:fullscreen { overflow: auto; padding: clamp(1.25rem, 4vw, 3rem); border-radius: 0; background: #fff; }
.primary-button, .secondary-button {
  min-height: 3rem;
  padding: 0.65rem 1.15rem;
  border-radius: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--teal); background: var(--teal); color: white; }
.primary-button:hover:not(:disabled) { background: var(--teal-dark); }
.primary-button:disabled { border-color: #cbd7df; background: #dfe7ec; color: #8292a0; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary-button:disabled { opacity: 0.45; cursor: not-allowed; }
.keyboard-note { margin: 1rem 0 0; color: var(--muted); font-size: 0.8rem; text-align: center; }

.chatbot-launcher { position: fixed; right: 1rem; bottom: 1rem; z-index: 24; min-height: 3rem; padding: 0.7rem 1rem; border: 1px solid #ffd36e; border-radius: 999px; background: linear-gradient(135deg, var(--navy), #8d1f82); color: #fff; font-weight: 900; cursor: pointer; box-shadow: 0 12px 30px rgba(53,16,79,0.28); }
.chatbot-launcher span { color: #ffd36e; }
.chatbot-modal { width: min(42rem, calc(100% - 1.25rem)); }
.chatbot-messages { min-height: 12rem; max-height: 46vh; display: grid; align-content: start; gap: 0.7rem; overflow: auto; padding: 0.85rem; border: 1px solid #dfd0e8; border-radius: 0.85rem; background: #faf7fc; }
.chat-message { max-width: 88%; padding: 0.72rem 0.85rem; border-radius: 0.85rem; line-height: 1.5; white-space: pre-wrap; }
.assistant-message { justify-self: start; border: 1px solid #dfd0e8; background: #fff; }
.user-message { justify-self: end; background: var(--navy); color: #fff; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
.chat-suggestions button { padding: 0.45rem 0.65rem; border: 1px solid #d7c2e3; border-radius: 999px; background: #fff; color: var(--navy); font-weight: 750; cursor: pointer; }
.chatbot-form { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; margin-top: 0.75rem; }
.chatbot-form input { min-width: 0; padding: 0.78rem 0.85rem; border: 1px solid var(--line); border-radius: 0.72rem; font: inherit; }
.chatbot-note { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.78rem; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.premium-funnel {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(15rem, 0.85fr);
  gap: 1.4rem 2rem;
  margin-top: 3rem;
  padding: clamp(1.4rem, 4vw, 2.4rem);
  overflow: hidden;
  border: 1px solid #cfa8e7;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 92% 8%, rgba(243, 173, 43, 0.2), transparent 15rem),
    linear-gradient(135deg, #35104f 0%, #65186f 55%, #a80d5d 100%);
  color: white;
  box-shadow: 0 24px 65px rgba(53, 16, 79, 0.24);
}
.premium-funnel::before {
  content: "N3";
  position: absolute;
  left: -0.05em;
  bottom: -0.32em;
  z-index: -1;
  color: white;
  font-size: clamp(8rem, 22vw, 15rem);
  font-weight: 950;
  line-height: 1;
  opacity: 0.035;
}
.premium-copy { align-self: center; }
.premium-kicker { margin: 0 0 0.55rem; color: #ffd36e; font-size: 0.76rem; font-weight: 900; letter-spacing: 0.14em; }
.premium-copy h2 { max-width: 15em; font-size: clamp(1.65rem, 4vw, 2.55rem); line-height: 1.18; }
.premium-copy > p:not(.premium-kicker) { max-width: 38rem; margin: 0.85rem 0 0; color: #f4eafa; line-height: 1.65; }
.premium-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1rem; margin-top: 1.25rem; }
.premium-button { min-height: 3.15rem; padding: 0.7rem 1.15rem; border: 1px solid #ffd36e; border-radius: 0.78rem; background: #ffd36e; color: #35104f; font-weight: 900; cursor: pointer; box-shadow: 0 10px 24px rgba(0,0,0,0.15); }
.premium-button:hover { background: white; border-color: white; }
.premium-status { max-width: 18rem; color: #eadcf3; font-size: 0.78rem; line-height: 1.45; }
.bundle-mock { position: relative; min-height: 17rem; display: grid; place-items: center; }
.mock-sheet { position: absolute; width: 12rem; height: 15.2rem; border-radius: 0.85rem; box-shadow: 0 18px 40px rgba(18,2,29,0.3); }
.mock-sheet-back { background: #f7c34e; transform: translate(2rem, 0.35rem) rotate(8deg); }
.mock-sheet-middle { background: #f6b9da; transform: translate(-1.5rem, 0.3rem) rotate(-7deg); }
.mock-sheet-front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding: 1rem; background: linear-gradient(160deg, #fff 0%, #f8eafa 100%); color: #35104f; text-align: center; }
.mock-sheet-front img { width: 4.4rem; height: 4.4rem; object-fit: contain; }
.mock-sheet-front small { margin-top: 0.3rem; color: #a80d5d; font-size: 0.6rem; font-weight: 900; letter-spacing: 0.11em; }
.mock-sheet-front strong { font-size: 2.15rem; line-height: 1; }
.mock-sheet-front span { color: #71527e; font-size: 0.73rem; }
.mock-levels { display: flex; gap: 0.35rem; margin: 0.2rem 0; }
.mock-levels span { padding: 0.25rem 0.45rem; border-radius: 999px; background: #35104f; color: white; font-size: 0.68rem; font-weight: 900; }
.bundle-badge { position: absolute; right: 0; bottom: 1.1rem; z-index: 2; padding: 0.5rem 0.7rem; border: 2px solid white; border-radius: 999px; background: #db176d; color: white; font-size: 0.68rem; font-weight: 950; letter-spacing: 0.08em; transform: rotate(-4deg); }
.premium-levels { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.premium-levels article { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: center; padding: 0.9rem; border: 1px solid rgba(255,255,255,0.2); border-radius: 0.9rem; background: rgba(255,255,255,0.1); }
.level-mark { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 0.72rem; background: #ffd36e; color: #35104f; font-weight: 950; }
.premium-levels strong, .premium-levels small, .premium-levels em { display: block; }
.premium-levels strong { font-size: 0.9rem; }
.premium-levels small { margin-top: 0.25rem; color: #ebdef1; line-height: 1.4; }
.premium-levels em { grid-column: 2; color: #ffd36e; font-size: 0.72rem; font-style: normal; font-weight: 850; }
.bundle-benefits { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; margin: 0.2rem 0 0; padding: 0; list-style: none; }
.bundle-benefits li { padding: 0.85rem; border: 1px solid rgba(255,255,255,0.18); border-radius: 0.85rem; background: rgba(255,255,255,0.08); }
.bundle-benefits strong, .bundle-benefits span { display: block; }
.bundle-benefits strong { color: #fff; font-size: 0.88rem; }
.bundle-benefits span { margin-top: 0.3rem; color: #e9d9f1; font-size: 0.76rem; line-height: 1.45; }
.academy-partner { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,0.18); }
.academy-partner > span { color: #ddcfe7; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; }
.academy-partner > strong { text-align: right; font-size: 0.88rem; }
.partner-logos { display: flex; align-items: center; gap: 0.55rem; }
.partner-logos img { width: 3.8rem; height: 3.8rem; padding: 0.25rem; object-fit: contain; border-radius: 50%; background: rgba(255,255,255,0.95); }
.partner-logos span { color: #ffd36e; font-weight: 950; }
.academy-banner { grid-column: 1 / -1; margin: 0.25rem 0 0; overflow: hidden; border: 1px solid rgba(255,255,255,0.25); border-radius: 1rem; background: white; box-shadow: 0 16px 36px rgba(18,2,29,0.22); }
.academy-banner img { display: block; width: 100%; height: auto; aspect-ratio: 1942 / 809; object-fit: cover; }
.academy-banner figcaption { margin: 0; padding: 0.75rem 1rem; background: linear-gradient(90deg, #f7efff, #fff2f8); color: #4d2a61; font-size: 0.78rem; font-weight: 750; line-height: 1.45; text-align: center; }

.premium-modal { width: min(42rem, calc(100% - 2rem)); background: linear-gradient(145deg, #fff 0%, #f9ecff 100%); }
.premium-modal h2 { color: var(--navy); font-size: clamp(1.6rem, 5vw, 2.35rem); line-height: 1.2; }
.premium-lead { color: var(--muted); }
.modal-partner-logos { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1rem; }
.modal-partner-logos img { width: 4.2rem; height: 4.2rem; padding: 0.25rem; object-fit: contain; border: 1px solid #eadced; border-radius: 50%; background: white; }
.modal-partner-logos span { color: var(--teal-dark); font-size: 1.2rem; font-weight: 950; }
.modal-levels { display: flex; gap: 0.5rem; margin: 1rem 0 0; }
.modal-levels span { padding: 0.42rem 0.75rem; border-radius: 999px; background: var(--navy); color: white; font-weight: 900; }
.funnel-path { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; margin: 1.35rem 0; }
.funnel-path div { padding: 1rem 0.8rem; border: 1px solid #dfc9ec; border-radius: 0.9rem; background: white; }
.funnel-path span { width: 1.8rem; height: 1.8rem; display: grid; place-items: center; margin-bottom: 0.7rem; border-radius: 50%; background: var(--teal); color: white; font-size: 0.78rem; font-weight: 900; }
.funnel-path strong, .funnel-path small { display: block; }
.funnel-path small { margin-top: 0.3rem; color: var(--muted); line-height: 1.4; }
.launch-note { padding: 1rem; border-left: 4px solid var(--gold); border-radius: 0.75rem; background: #fff8e5; color: #654b14; }
.launch-note p { margin: 0.3rem 0 0; }

.mobile-dock { display: none; }

.summary { text-align: center; }
.summary-score { width: 8rem; height: 8rem; margin: 1rem auto 1.3rem; display: grid; place-items: center; border: 0.65rem solid var(--teal-soft); outline: 0.2rem solid var(--teal); border-radius: 50%; color: var(--navy); }
.summary-score strong { display: block; font-size: 2rem; }
.summary-score span { display: block; color: var(--muted); font-size: 0.78rem; }
.breakdown { width: min(100%, 32rem); margin: 1.5rem auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.breakdown div { padding: 0.8rem 0.5rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--page); }
.breakdown strong, .breakdown span { display: block; }
.breakdown span { margin-top: 0.2rem; color: var(--muted); font-size: 0.78rem; }
.study-advice {
  width: min(100%, 38rem);
  margin: 1.35rem auto 0;
  padding: 1rem 1.1rem;
  border: 1px solid #ddc5eb;
  border-left: 4px solid var(--teal);
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #fff5fa, #f5ebff);
  text-align: left;
}
.study-advice h3 { margin: 0 0 0.55rem; color: var(--navy); font-size: 1.08rem; }
.study-advice p { margin: 0.35rem 0; line-height: 1.55; }
.summary-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.3rem; }

footer { width: min(100% - 2rem, 900px); margin: 0 auto; padding: 0 0 2rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: 0.76rem; }

@media (min-width: 821px) {
  .exam-header { padding: 0 0.2rem; }
  .category-tabs { max-width: 46rem; }
  .quiz-card { min-height: 31rem; }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 6.5rem;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.45rem;
    padding-inline: 0.7rem;
  }
  .brand-logo { width: 5rem; height: 5rem; }
  .header-date { font-size: 0.68rem; }
  .score-chip span { display: none; }
  .score-chip { display: none; }
  .visitor-chip { display: grid; gap: 0; padding: 0.42rem 0.65rem; }
  .visitor-chip span { display: none; }
  .visitor-chip strong, .visitor-chip small { font-size: 0.68rem; }
  .exam-header { display: grid; gap: 1.2rem; }
  .day-picker { width: 100%; }
  .menu-button { padding-inline: 0.65rem; font-size: 0.78rem; }
  .category-tabs { grid-template-columns: repeat(2, 1fr); }
  .level-tabs { gap: 0.45rem; }
  .level-tab { min-height: 2.9rem; padding-inline: 0.45rem; font-size: 0.88rem; }
  .quiz-card { border-radius: 1rem; }
  .keyboard-note { display: none; }
  .study-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .premium-funnel { grid-template-columns: 1fr; padding: 1.35rem; }
  .bundle-mock { min-height: 15rem; }
  .premium-levels { grid-template-columns: 1fr; }
  .bundle-benefits { grid-template-columns: repeat(2, 1fr); }
  .academy-partner { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .academy-partner > strong { text-align: center; }
  .academy-banner { border-radius: 0.75rem; }
  .funnel-path { grid-template-columns: 1fr; }
  .mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0.45rem max(0.45rem, env(safe-area-inset-right)) calc(0.45rem + env(safe-area-inset-bottom)) max(0.45rem, env(safe-area-inset-left));
    border-top: 1px solid #decfe6;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 -8px 28px rgba(53,16,79,0.14);
    backdrop-filter: blur(14px);
  }
  .chatbot-launcher { bottom: 5.15rem; }
  .mobile-dock button { min-height: 3.2rem; display: grid; place-items: center; gap: 0.05rem; border: 0; background: transparent; color: #5b4367; font-size: 0.68rem; font-weight: 800; cursor: pointer; }
  .mobile-dock button span { color: var(--teal-dark); font-size: 1rem; font-weight: 950; }
  footer { display: grid; padding-bottom: 6rem; text-align: center; justify-content: center; }
}

@media (max-width: 480px) {
  .shell { width: min(100% - 1rem, 1040px); padding-top: 1.25rem; }
  .level-tabs { position: sticky; top: 0; z-index: 8; padding: 0.45rem; margin-inline: -0.15rem; border: 1px solid #e2d4e9; border-radius: 0.9rem; background: rgba(255,255,255,0.94); box-shadow: 0 8px 22px rgba(53,16,79,0.09); backdrop-filter: blur(12px); }
  .exam-header { gap: 0.8rem; }
  .exam-header h1 { font-size: 1.55rem; }
  .category-tabs { gap: 0.4rem; }
  .category-tab { min-height: 3rem; padding-inline: 0.45rem; font-size: 0.82rem; }
  .quiz-card { padding: 1rem; }
  .question-banner { width: 100%; grid-template-columns: 1.8rem 1fr 1.8rem; }
  .question-banner span { font-size: 1.35rem; }
  .question-frame { min-height: 11rem; padding-inline: 0.85rem; }
  .options { grid-template-columns: 1fr; }
  .option { min-height: 3.8rem; grid-template-columns: 2.2rem 1fr; padding: 0.7rem; }
  .option-status { grid-column: 2; }
  .quiz-actions { position: sticky; bottom: 4.45rem; z-index: 5; padding: 0.7rem; margin: 1.2rem -0.25rem -0.25rem; border: 1px solid #eadff0; border-radius: 0.85rem; background: rgba(255,255,255,0.96); box-shadow: 0 10px 24px rgba(53,16,79,0.12); backdrop-filter: blur(10px); }
  .quiz-actions button { flex: 1; }
  .review-detail { grid-template-columns: 1fr; }
  .study-control { min-height: 3.3rem; }
  .chatbot-launcher { right: 0.65rem; padding-inline: 0.85rem; font-size: 0.78rem; }
  .chatbot-form { grid-template-columns: 1fr; }
  .premium-funnel { margin-top: 2rem; border-radius: 1rem; }
  .premium-copy h2 { font-size: 1.65rem; }
  .premium-actions { align-items: stretch; }
  .premium-button { width: 100%; }
  .premium-status { max-width: none; text-align: center; }
  .bundle-benefits { grid-template-columns: 1fr; }
}

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

@media print {
  body * { visibility: hidden !important; }
  body::before {
    content: "Jdee Japan exam content is protected and cannot be printed.";
    visibility: visible !important;
    position: fixed;
    inset: 2rem;
    display: grid;
    place-items: center;
    color: #35104f;
    font: 800 18pt/1.5 system-ui, sans-serif;
    text-align: center;
  }
}
