/* JLPTGO v7 premium responsive UI override */
:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #e5eaf2;
  --primary: #086cff;
  --primary-2: #0057e7;
  --good: #15b861;
  --bad: #ff3b3f;
  --warn: #f59e0b;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, .06);
  --shadow-card: 0 14px 34px rgba(15, 23, 42, .08);
  --radius-card: 16px;
}

body {
  background: linear-gradient(180deg, #ffffff 0%, #f5f7fb 40%, #eef3fb 100%);
  color: var(--ink);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  display: block;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: visible;
  backdrop-filter: none;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: 92px;
  padding: 16px clamp(20px, 3vw, 38px);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(15, 23, 42, .04);
  backdrop-filter: blur(18px);
}

.brand { padding: 0; min-width: 300px; }
.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: linear-gradient(180deg, #1477ff, #005bea);
  color: #fff;
  box-shadow: 0 8px 18px rgba(8, 108, 255, .24);
  font-size: 0;
}
.brand-mark::after { content: "N2"; font-size: 24px; font-weight: 900; }
.brand h1 { color: #0b1220; font-size: 26px; letter-spacing: .01em; }
.brand p { color: #7b8798; font-size: 15px; font-weight: 700; }

.level-card, .today-card, .sync-card { display: none; }

.side-nav {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-end;
  gap: 28px;
}
.nav-item {
  position: relative;
  width: auto;
  min-width: 96px;
  padding: 11px 4px 18px;
  border-radius: 0;
  text-align: center;
  background: transparent !important;
  color: #151923;
}
.nav-item b {
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
}
.nav-item span { display: none; }
.nav-item.active, .nav-item:hover { color: var(--primary); }
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 6px 14px rgba(8,108,255,.25);
}

.main {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 42px;
  overflow: visible;
}

.topbar {
  margin-bottom: 14px;
  padding: 0 2px;
  align-items: center;
}
.eyebrow { display: none; }
.topbar h2 { font-size: 22px; font-weight: 900; }
.topbar p { margin-top: 4px; font-size: 14px; color: #7b8798; }
.mode-switch {
  padding: 4px;
  border-radius: 12px;
  border-color: #dbe4f0;
  box-shadow: none;
}
.mode-pill { padding: 9px 14px; border-radius: 10px; font-size: 14px; }
.mode-pill.active { background: var(--primary); }

.dashboard-grid { display: none; }

.collections {
  width: 100%;
  margin: 0 0 16px;
  padding: 2px 2px 16px;
  background: transparent;
  border-bottom: 0;
  gap: 10px;
}
.collection-chip {
  background: #fff;
  border: 1px solid #dfe6ef;
  border-radius: 12px;
  padding: 10px 16px;
  color: #344054;
  box-shadow: var(--shadow-soft);
}
.collection-chip.active {
  background: #eef5ff;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(8,108,255,.18), var(--shadow-soft);
}
.collection-chip small { background: #edf2f7; color: #667085; }
.collection-chip.active small { background: var(--primary); color: #fff; }

.workspace {
  grid-template-columns: minmax(0, 1fr) 374px;
  gap: 22px;
  align-items: start;
}
.question-card,
.explanation-card,
.answer-sheet-card,
.utility-panel {
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow-card);
}
.question-card { padding: 0; overflow: hidden; }

.question-head {
  min-height: 112px;
  padding: 28px 36px 20px;
  align-items: center;
}
.question-progress-wrap {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 28px;
}
.question-head h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}
.question-head h3::first-letter { color: inherit; }
.question-progress {
  width: 100%;
  max-width: none;
  height: 10px;
  background: #e8edf5;
}
.question-progress span { background: var(--primary); }
.level-chip {
  min-width: 56px;
  height: 38px;
  border-radius: 10px;
  background: #eef5ff;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-size: 19px;
}

.result-strip {
  margin: 0;
  padding: 15px 28px;
  border-radius: 0;
  border-left: 0 !important;
  border-right: 0 !important;
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 17px;
}
.result-strip.incorrect { background: linear-gradient(90deg, #fff0f0 0 50%, #f0fff6 50%); border-color: #f2d9d9; }
.result-strip.correct { background: #f0fff6; }

.question-body-label {
  display: inline-flex !important;
  margin: 20px 36px 0;
  padding: 8px 15px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}
.prompt {
  margin: 18px 36px 22px;
  padding: 26px 32px;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: clamp(21px, 1.8vw, 28px);
  line-height: 1.9;
  letter-spacing: .02em;
  font-weight: 650;
}

.options {
  padding: 0 36px 30px;
  gap: 16px;
}
.option-btn {
  min-height: 80px;
  grid-template-columns: 56px 1fr;
  border: 1px solid #dfe6ef;
  border-radius: 12px;
  background: #fff;
  padding: 16px 20px;
  font-size: clamp(18px, 1.55vw, 23px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .025);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.option-btn:hover { transform: translateY(-1px); border-color: #bdd2ff; background: #fbfdff; }
.option-index {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--primary);
  border: 0;
  font-size: 20px;
}
.option-btn.selected { border-color: var(--primary); background: #f4f8ff; }
.option-btn.selected .option-index { background: var(--primary); color: #fff; }
.option-btn.correct { border-color: var(--good); background: #f0fff6; }
.option-btn.correct .option-index { background: var(--good); color: #fff; }
.option-btn.incorrect { border-color: var(--bad); background: #fff6f6; }
.option-btn.incorrect .option-index { background: var(--bad); color: #fff; }
.option-status { border-radius: 999px; padding: 4px 10px; font-size: 14px; }
.right-pick { background: #dcfce7; color: #159447; }
.user-pick { background: #ffe4e6; color: #e11d48; }

.question-actions {
  margin: 0;
  padding: 22px 36px 28px;
  grid-template-columns: minmax(150px, 220px) minmax(150px, 220px) minmax(220px, 1fr) minmax(150px, 220px);
  gap: 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.favorite-btn, .ghost-btn, .secondary-btn, .primary-btn {
  min-height: 58px;
  border-radius: 10px;
  font-size: 18px;
}
.primary-btn { background: var(--primary); border-color: var(--primary); box-shadow: 0 8px 18px rgba(8,108,255,.22); }
.primary-btn:hover { background: var(--primary-2); }
.secondary-btn, .favorite-btn { background: #fff; border-color: #dbe4ef; }

.right-rail { gap: 16px; top: 112px; }
.explanation-card, .answer-sheet-card { padding: 24px 26px; }
.explanation-head h3, .sheet-head h3 { font-size: 20px; margin: 0; }
.info-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef5ff;
  color: var(--primary);
  border: 1px solid #cfe0ff;
}
.explanation-body { font-size: 16px; }
.info-row {
  min-height: 38px;
  margin: 0;
  padding: 11px 0;
  border-bottom: 1px solid #edf1f6;
  justify-content: space-between;
}
.info-row span { min-width: auto; color: #5f6b7a; }
.info-row b { color: #222b3a; }
.stars { color: var(--primary) !important; }
.mini-explain { line-height: 1.8; }
.answer-sheet { grid-template-columns: repeat(5, minmax(38px, 1fr)); gap: 12px; }
.sheet-btn {
  width: 43px;
  height: 43px;
  border-radius: 999px;
  font-weight: 800;
}
.sheet-btn.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.sheet-btn.answered { background: #ecfdf3; color: #13a456; border-color: #bbf7d0; }
.sheet-btn.wrong { background: #fff1f2; color: var(--bad); border-color: #fecdd3; }
.sheet-legend { border-top: 1px solid #edf1f6; padding-top: 16px; }
.wrongbook-link {
  min-height: 68px;
  border-color: #d9e6ff;
  background: #fff;
  color: var(--primary);
}

.prompt.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  border-color: var(--line);
  background: #fff;
}
.prompt-passage-pane {
  padding: 28px 32px;
  max-height: 62vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fff;
  line-height: 2.05;
  font-size: clamp(17px, 1.35vw, 21px);
}
.prompt-question-pane {
  padding: 28px 32px;
  background: #fff;
  line-height: 1.75;
  font-size: clamp(17px, 1.25vw, 21px);
}
.prompt-question-pane .question-body-label {
  display: inline-flex !important;
  margin: 0 0 18px;
  background: transparent;
  color: var(--primary);
  padding: 0;
  font-size: 22px;
}
.prompt.split-layout + .options,
.prompt:has(.prompt-passage-pane) ~ .options {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.panel-grid { display: none; }
.mobile-nav {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
}
.mobile-tab.active { color: var(--primary); }

@media (max-width: 1180px) {
  .main { width: min(100% - 28px, 980px); }
  .workspace { grid-template-columns: 1fr; }
  .right-rail { position: static; grid-template-columns: 1fr 1fr; }
  .prompt.split-layout { grid-template-columns: 1fr; }
  .prompt-passage-pane { max-height: 46vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .question-actions { grid-template-columns: 1fr 1fr 1.4fr 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    min-height: 76px;
    padding: 12px 16px;
  }
  .brand { min-width: 0; }
  .brand-mark { width: 46px; height: 46px; }
  .brand h1 { font-size: 20px; }
  .brand p { font-size: 12px; }
  .side-nav { display: none; }
  .main { width: 100%; padding: 14px 10px 88px; }
  .topbar { display: none; }
  .collections { margin: 0 -10px 10px; padding: 4px 12px 12px; }
  .collection-chip { padding: 9px 13px; font-size: 14px; border-radius: 999px; }
  .workspace { gap: 12px; }
  .question-card, .explanation-card, .answer-sheet-card { border-radius: 14px; }
  .question-head { min-height: auto; padding: 18px 16px 14px; }
  .question-progress-wrap { grid-template-columns: 1fr 92px; gap: 12px; }
  .question-head h3 { grid-column: 1 / -1; font-size: 18px; }
  .question-progress { height: 8px; }
  .level-chip { min-width: 46px; height: 34px; font-size: 16px; }
  .question-body-label { margin: 14px 16px 0; font-size: 15px; padding: 7px 12px; }
  .prompt { margin: 14px 16px 18px; padding: 18px 16px; font-size: 21px; line-height: 1.8; }
  .options { padding: 0 14px 18px; gap: 12px; }
  .option-btn { min-height: 68px; grid-template-columns: 44px 1fr; padding: 13px 14px; font-size: 18px; }
  .option-index { width: 38px; height: 38px; font-size: 17px; }
  .question-actions {
    position: sticky;
    bottom: calc(58px + var(--safe-bottom));
    z-index: 30;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(15,23,42,.06);
  }
  .primary-btn { grid-column: 1 / -1; order: -1; }
  #revealBtn { display: none; }
  .favorite-btn, .secondary-btn, .primary-btn { min-height: 48px; font-size: 15px; }
  .right-rail { grid-template-columns: 1fr; }
  .explanation-card, .answer-sheet-card { padding: 18px 16px; }
  .answer-sheet { grid-template-columns: repeat(5, 1fr); gap: 9px; }
  .sheet-btn { width: 38px; height: 38px; }
  .prompt.split-layout { margin-top: 14px; border-radius: 0; }
  .prompt-passage-pane, .prompt-question-pane { padding: 18px 16px; max-height: none; font-size: 17px; }
  .mobile-nav { display: grid; }
}

@media (max-width: 430px) {
  .brand h1 { font-size: 18px; }
  .brand p { display: none; }
  .brand-mark { width: 42px; height: 42px; }
  .question-progress-wrap { grid-template-columns: 1fr 52px; }
  .prompt { font-size: 19px; padding: 16px 14px; }
  .option-btn { font-size: 17px; }
  .result-strip { grid-template-columns: 1fr; font-size: 14px; padding: 12px 16px; }
}
