* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #17211f;
  background:
    radial-gradient(circle at 20% 12%, rgba(78, 142, 126, 0.18), transparent 28%),
    linear-gradient(135deg, #f5f1e8 0%, #e8eee9 48%, #f7f5ef 100%);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: rgba(18, 48, 43, 0.94);
  color: #f8f3e7;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #10362f;
  background: #e9d18b;
  font-weight: 900;
  font-size: 24px;
  font-family: Georgia, serif;
}

.brand h1,
.hero-panel h2,
.section-head h3,
.question-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 7px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(233, 209, 139, 0.9);
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-button,
.primary-action,
.ghost-action {
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-button {
  text-align: left;
  padding: 12px 14px;
  color: rgba(248, 243, 231, 0.78);
  background: transparent;
}

.nav-button:hover,
.nav-button.active {
  color: #12302b;
  background: #f8f3e7;
}

.side-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 12px;
  color: rgba(248, 243, 231, 0.82);
  background: rgba(255, 255, 255, 0.08);
  line-height: 1.75;
  font-size: 13px;
}

.auth-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  color: #f8f3e7;
  background: rgba(255, 255, 255, 0.1);
}

.auth-status {
  margin: 0;
  font-weight: 900;
}

.auth-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(248, 243, 231, 0.26);
  border-radius: 10px;
  padding: 0 12px;
  color: #f8f3e7;
  background: rgba(8, 20, 17, 0.28);
}

.auth-panel input::placeholder {
  color: rgba(248, 243, 231, 0.62);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.auth-panel .ghost-action {
  color: #f8f3e7;
  background: rgba(255, 255, 255, 0.12);
}

.auth-panel small {
  color: rgba(248, 243, 231, 0.72);
  line-height: 1.55;
}

.main {
  padding: 28px;
  display: grid;
  gap: 18px;
}

.hero-panel {
  min-height: 0;
  padding: clamp(22px, 3vw, 34px);
  border-radius: 20px;
  background: rgba(255, 252, 244, 0.82);
  box-shadow: 0 22px 70px rgba(29, 62, 55, 0.14);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  align-items: center;
  gap: 24px;
  overflow: hidden;
}

.hero-panel h2 {
  max-width: 720px;
  font-size: clamp(30px, 4.2vw, 56px);
  line-height: 1.04;
  color: #143c35;
  font-weight: 900;
}

.hero-copy p:not(.eyebrow) {
  max-width: 620px;
  margin: 14px 0 0;
  color: rgba(23, 33, 31, 0.68);
  font-weight: 800;
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 112px;
  padding: 16px;
  border-radius: 16px;
  background: #143c35;
  color: #f8f3e7;
  display: grid;
  align-content: space-between;
}

.stat-card.primary {
  background: #102f2a;
}

.ring-card {
  place-items: center;
  text-align: center;
}

.hero-stats span {
  display: block;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 900;
  font-family: Georgia, serif;
  line-height: 1;
}

.hero-stats small {
  color: rgba(248, 243, 231, 0.72);
  font-weight: 900;
}

.accuracy-ring {
  --value: 0;
  width: 74px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, #143c35 55%, transparent 57%),
    conic-gradient(#e8c767 calc(var(--value) * 1%), rgba(248, 243, 231, 0.18) 0);
}

.accuracy-ring span {
  font-size: 20px;
}

.view {
  display: none;
  padding: 22px;
  border-radius: 20px;
  background: rgba(255, 252, 244, 0.78);
  box-shadow: 0 16px 50px rgba(29, 62, 55, 0.08);
}

.view.active {
  display: block;
}

.section-head,
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h3 {
  font-size: clamp(24px, 3vw, 38px);
  color: #143c35;
}

.primary-action {
  padding: 0 18px;
  color: #102f2a;
  background: #e8c767;
  font-weight: 900;
}

.ghost-action {
  padding: 0 16px;
  color: #143c35;
  background: rgba(20, 60, 53, 0.09);
  font-weight: 800;
}

.primary-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.category-grid,
.weakness-grid,
.dashboard-grid,
.course-entry-grid,
.progress-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.category-card,
.weak-card,
.review-card,
.source-card,
.compact-item,
.dashboard-card,
.course-entry,
.roadmap-card,
.progress-card {
  border-radius: 16px;
  background: #fffaf0;
  border: 1px solid rgba(20, 60, 53, 0.12);
  box-shadow: 0 10px 30px rgba(21, 60, 53, 0.07);
}

.category-card,
.course-entry,
.roadmap-card {
  padding: 18px;
  cursor: pointer;
}

.category-card strong,
.weak-card strong,
.review-card strong,
.source-card strong,
.compact-item strong,
.dashboard-card strong,
.course-entry strong,
.roadmap-card strong,
.progress-card strong {
  display: block;
  color: #143c35;
  font-size: 18px;
  line-height: 1.45;
}

.category-card p,
.weak-card p,
.review-card p,
.source-card p,
.compact-item p,
.source-copy p,
.dashboard-card p,
.course-entry p,
.roadmap-card p,
.progress-card p {
  margin: 8px 0 0;
  color: rgba(23, 33, 31, 0.74);
  line-height: 1.65;
}

.dashboard-card,
.progress-card {
  padding: 18px;
}

.dashboard-card span {
  display: block;
  margin-bottom: 8px;
  color: #143c35;
  font-size: 34px;
  font-weight: 900;
  font-family: Georgia, serif;
}

.course-entry {
  min-height: 150px;
  text-align: left;
}

.course-entry span,
.roadmap-card span,
.progress-card span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  color: #143c35;
  background: rgba(232, 199, 103, 0.34);
  font-size: 12px;
  font-weight: 900;
}

.course-entry strong {
  margin-top: 12px;
  font-size: 24px;
}

.progress-overview {
  margin-top: 18px;
}

.progress-bar,
.quest-bar {
  height: 11px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(20, 60, 53, 0.12);
}

.progress-bar span,
.quest-bar span {
  display: block;
  height: 100%;
  background: #e8c767;
}

.compact-head {
  margin-top: 26px;
}

.roadmap-list {
  display: grid;
  gap: 18px;
}

.roadmap-section {
  display: grid;
  gap: 12px;
}

.roadmap-section h4 {
  margin: 0;
  color: #143c35;
  font-size: 24px;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.roadmap-card {
  text-align: left;
  min-height: 150px;
}

.roadmap-card.next {
  border-color: rgba(232, 199, 103, 0.9);
  box-shadow: 0 0 0 3px rgba(232, 199, 103, 0.24), 0 10px 30px rgba(21, 60, 53, 0.07);
}

.roadmap-meta,
.review-tabs,
.session-pacing,
.pacing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.roadmap-meta {
  margin-top: 12px;
}

.roadmap-meta small,
.pacing-row span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: #143c35;
  background: rgba(20, 60, 53, 0.09);
  font-weight: 800;
}

.compact-list,
.review-list,
.source-list {
  display: grid;
  gap: 12px;
}

.compact-list {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.start-preview {
  background: rgba(232, 199, 103, 0.18);
}

.compact-item,
.review-card,
.source-card,
.weak-card {
  padding: 16px;
}

.question-card {
  padding: clamp(22px, 4vw, 38px);
  border-radius: 22px;
  background: #fffaf0;
  border: 1px solid rgba(20, 60, 53, 0.12);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.question-meta span,
.review-tag,
.review-tab {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #143c35;
  background: rgba(20, 60, 53, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.review-tabs {
  margin-bottom: 18px;
}

.review-tab {
  border: 0;
  cursor: pointer;
}

.review-tab.active {
  color: #fffaf0;
  background: #143c35;
}

.session-pacing {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  color: #143c35;
  background: rgba(20, 60, 53, 0.07);
  font-weight: 800;
}

.question-card h3 {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.45;
  color: #17211f;
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.choice-button {
  min-height: 54px;
  padding: 12px 16px;
  text-align: left;
  border: 1px solid rgba(20, 60, 53, 0.16);
  border-radius: 14px;
  background: #ffffff;
  color: #17211f;
  cursor: pointer;
  font-weight: 800;
}

.choice-button.correct {
  border-color: #23795e;
  background: #dff3e7;
}

.choice-button.wrong {
  border-color: #a63f3f;
  background: #f8dddd;
}

.feedback {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(20, 60, 53, 0.09);
  line-height: 1.75;
}

.reason-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: #f2eadb;
}

.ai-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(20, 60, 53, 0.06);
}

.ai-box label {
  display: block;
  margin-bottom: 10px;
  color: #143c35;
  font-weight: 900;
}

.ai-box textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  padding: 14px;
  border: 1px solid rgba(20, 60, 53, 0.18);
  border-radius: 12px;
  color: #17211f;
  background: #ffffff;
  font: inherit;
  line-height: 1.65;
}

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

.ai-answer {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #fffaf0;
  color: #17211f;
  line-height: 1.75;
  white-space: pre-wrap;
}

.reason-box p {
  margin: 0 0 10px;
  font-weight: 900;
  color: #143c35;
}

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

.reason-buttons button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid rgba(20, 60, 53, 0.14);
  border-radius: 999px;
  background: #fffaf0;
  color: #143c35;
  cursor: pointer;
  font-weight: 800;
}

.reason-buttons button.selected {
  color: #fffaf0;
  background: #143c35;
}

.quiz-actions {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.meter {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #143c35;
  font-weight: 900;
}

.data-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(20, 60, 53, 0.1);
  text-align: right;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  color: #fffaf0;
  background: #143c35;
}

.hidden {
  display: none;
}

.review-card {
  display: grid;
  gap: 10px;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-card a {
  color: #143c35;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.weak-bar {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(20, 60, 53, 0.12);
}

.weak-bar span {
  display: block;
  height: 100%;
  background: #e8c767;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 20, 17, 0.42);
}

.modal {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: #fffaf0;
  box-shadow: 0 24px 80px rgba(8, 20, 17, 0.28);
}

.modal h3 {
  margin: 0;
  color: #143c35;
  font-size: 26px;
}

.modal p {
  color: rgba(23, 33, 31, 0.78);
  line-height: 1.7;
}

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

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    gap: 14px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .nav {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .nav-button {
    text-align: center;
    padding: 10px 6px;
    font-size: 13px;
  }

  .side-note {
    display: none;
  }

  .auth-panel {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 220px) auto;
    align-items: center;
    gap: 8px;
    padding: 10px;
  }

  .auth-status,
  .auth-panel small {
    grid-column: 1 / -1;
  }

  .main {
    padding: 14px;
    gap: 14px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-panel h2 {
    font-size: 32px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    min-height: 96px;
    padding: 13px;
    border-radius: 14px;
  }

  .accuracy-ring {
    width: 64px;
  }

  .dashboard-grid,
  .course-entry-grid,
  .progress-overview,
  .compact-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-card,
  .course-entry,
  .progress-card,
  .compact-item {
    min-height: auto;
    padding: 13px;
    border-radius: 14px;
  }

  .dashboard-card span {
    margin-bottom: 4px;
    font-size: 28px;
  }

  .dashboard-card strong,
  .course-entry strong,
  .progress-card strong,
  .compact-item strong {
    font-size: 15px;
    line-height: 1.35;
  }

  .dashboard-card p,
  .course-entry p,
  .progress-card p,
  .compact-item p {
    font-size: 12px;
    line-height: 1.55;
  }

  .course-entry span,
  .progress-card span {
    min-height: 22px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .section-head,
  .quiz-top,
  .quiz-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
