:root {
  color-scheme: light;
  --ink-950: #102a43;
  --ink-800: #243b53;
  --ink-600: #52677a;
  --paper: #ffffff;
  --canvas: #edf3f6;
  --line: #d3dfe5;
  --teal: #0b8a7c;
  --teal-dark: #07655d;
  --teal-soft: #dff5f1;
  --violet: #6840d5;
  --violet-dark: #3f218e;
  --violet-soft: #eee9ff;
  --wrong: #c44259;
  --wrong-soft: #fff0f3;
  --unseen: #9babb4;
  --unseen-soft: #edf2f4;
  --shadow: 0 18px 50px rgba(16, 42, 67, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-950);
  background:
    radial-gradient(circle at 8% 0, rgba(11, 138, 124, 0.12), transparent 28rem),
    radial-gradient(circle at 100% 12%, rgba(104, 64, 213, 0.11), transparent 27rem),
    linear-gradient(180deg, #f9fbfc 0, var(--canvas) 32rem);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid rgba(11, 138, 124, 0.3);
  outline-offset: 3px;
}

.site-shell {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 calc(34px + env(safe-area-inset-bottom));
}

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

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px 5px 14px 5px;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), var(--violet-dark));
  box-shadow: 0 9px 24px rgba(57, 42, 120, 0.2);
  font-size: 1.2rem;
  font-weight: 900;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand b {
  color: var(--teal-dark);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
}

.brand strong {
  font-size: 1.12rem;
}

.site-nav {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(211, 223, 229, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.site-nav a {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--ink-600);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.site-nav a.is-active {
  color: #fff;
  background: var(--ink-950);
}

.today-panel {
  position: relative;
  display: flex;
  min-height: 176px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: 28px 30px;
  border-radius: 26px 26px 9px 26px;
  color: #fff;
  background:
    linear-gradient(90deg, transparent 0 70%, rgba(255, 255, 255, 0.045) 70% 70.4%, transparent 70.4%),
    linear-gradient(135deg, #173e49, var(--ink-950));
  box-shadow: var(--shadow);
}

.today-panel::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 42%;
  height: 6px;
  background: linear-gradient(90deg, var(--teal), #6fd7ca);
  content: "";
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.today-panel .eyebrow {
  color: #83ded3;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(1.65rem, 6vw, 2.45rem);
}

h2 {
  font-size: clamp(1.3rem, 4vw, 1.65rem);
}

.sync-status {
  margin: 9px 0 0;
  color: var(--ink-600);
  line-height: 1.6;
}

.today-panel .sync-status {
  max-width: 34rem;
  color: #cbdde3;
}

.today-score {
  display: grid;
  min-width: 150px;
  grid-template-columns: auto auto;
  align-items: end;
  justify-content: center;
  column-gap: 5px;
  padding: 17px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px 20px 7px 20px;
  background: rgba(255, 255, 255, 0.08);
}

.today-score strong {
  font-size: 3rem;
  line-height: 0.95;
}

.today-score span {
  padding-bottom: 4px;
  font-weight: 800;
}

.today-score small {
  grid-column: 1 / -1;
  margin-top: 9px;
  color: #bcd1d8;
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 14px 0 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--line);
  box-shadow: 0 9px 24px rgba(16, 42, 67, 0.05);
}

.quick-stats article {
  display: grid;
  gap: 4px;
  padding: 15px 17px;
  background: rgba(255, 255, 255, 0.94);
}

.quick-stats span {
  color: var(--ink-600);
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-stats strong {
  font-size: 1.28rem;
}

.question-state-summary .state-unseen strong {
  color: #60737e;
}

.question-state-summary .state-correct strong {
  color: var(--teal-dark);
}

.question-state-summary .state-wrong strong {
  color: var(--wrong);
}

.section-heading,
.card-heading,
.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin: 0 2px 13px;
}

.text-link {
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 800;
  text-underline-offset: 3px;
}

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

.subject-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 23px 23px 8px 23px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 34px rgba(16, 42, 67, 0.08);
}

.subject-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  content: "";
}

.accounting-card::before {
  background: var(--teal);
}

.investment-card::before {
  background: var(--violet);
}

.subject-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.subject-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px 13px 4px 13px;
  font-size: 1rem;
  font-weight: 900;
}

.accounting-card .subject-icon {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.investment-card .subject-icon {
  color: var(--violet-dark);
  background: var(--violet-soft);
}

.subject-label {
  color: var(--ink-600);
  font-size: 0.8rem;
  font-weight: 700;
}

.subject-card h3 {
  font-size: 1.55rem;
}

.subject-card > p {
  min-height: 3.5em;
  margin: 8px 0 18px;
  color: var(--ink-600);
  line-height: 1.7;
}

.subject-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 17px;
}

.subject-stats div {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: #f3f7f9;
}

.subject-stats dt {
  color: var(--ink-600);
  font-size: 0.72rem;
  font-weight: 700;
}

.subject-stats dd {
  margin: 4px 0 0;
  font-size: 0.93rem;
  font-weight: 900;
  white-space: nowrap;
}

.subject-stats .state-unseen dd {
  color: #60737e;
}

.subject-stats .state-correct dd {
  color: var(--teal-dark);
}

.subject-stats .state-wrong dd {
  color: var(--wrong);
}

.subject-button,
.outline-button {
  display: inline-flex;
  min-height: 47px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  font-weight: 900;
  text-decoration: none;
}

.subject-button {
  width: 100%;
  color: #fff;
}

.accounting-button {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
}

.investment-button {
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
}

.progress-banner {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 19px 22px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 6px 18px;
  background: rgba(255, 255, 255, 0.82);
  text-decoration: none;
}

.progress-banner small {
  display: block;
  margin-bottom: 4px;
  color: var(--violet);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.progress-banner strong {
  font-size: 1.03rem;
}

.banner-arrow {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ink-950);
  font-size: 1.25rem;
}

.page-intro {
  align-items: center;
  margin: 22px 0 14px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 22px 22px 7px 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(16, 42, 67, 0.06);
}

.outline-button {
  flex: 0 0 auto;
  padding: 11px 16px;
  border: 1px solid var(--line);
  color: var(--ink-800);
  background: #fff;
}

.progress-summary {
  margin-bottom: 10px;
}

.question-status-overview {
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 9px 24px rgba(16, 42, 67, 0.04);
}

.question-status-track {
  display: flex;
  width: 100%;
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--unseen-soft);
}

.question-status-track > span {
  display: block;
  height: 100%;
}

.status-correct {
  background: var(--teal);
}

.status-wrong {
  background: var(--wrong);
}

.status-unseen {
  background: var(--unseen);
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  color: var(--ink-600);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-legend i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.status-note {
  margin: 8px 0 0;
  color: var(--ink-600);
  font-size: 0.78rem;
  line-height: 1.55;
}

.dashboard-card {
  margin-top: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px 22px 7px 22px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 12px 36px rgba(16, 42, 67, 0.07);
}

.card-heading {
  align-items: center;
  margin-bottom: 20px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  color: var(--ink-600);
  font-size: 0.78rem;
  font-weight: 700;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.legend-correct {
  background: var(--teal);
}

.legend-wrong {
  background: var(--wrong);
}

.daily-chart {
  display: grid;
  min-width: 650px;
  height: 236px;
  grid-template-columns: repeat(14, minmax(36px, 1fr));
  gap: 8px;
  align-items: end;
  overflow: hidden;
  padding: 8px 2px 0;
  border-bottom: 1px solid var(--line);
}

.daily-card {
  overflow-x: auto;
}

.daily-column {
  display: grid;
  height: 100%;
  grid-template-rows: 22px 1fr 28px;
  gap: 5px;
  align-items: end;
  text-align: center;
}

.daily-count,
.daily-label {
  color: var(--ink-600);
  font-size: 0.7rem;
  font-weight: 700;
}

.daily-bar-area {
  display: flex;
  height: 100%;
  align-items: end;
  justify-content: center;
}

.daily-stack {
  display: flex;
  width: min(100%, 30px);
  min-height: 2px;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 7px 7px 2px 2px;
  background: var(--teal);
}

.daily-stack.is-empty {
  background: #d9e3e8;
}

.daily-wrong {
  display: block;
  min-height: 0;
  background: var(--wrong);
}

.daily-correct {
  display: block;
  min-height: 0;
  background: var(--teal);
}

.data-note {
  margin: 13px 0 0;
  color: var(--ink-600);
  font-size: 0.8rem;
  line-height: 1.6;
}

.subject-progress + .subject-progress {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.subject-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.subject-progress-heading h3 {
  font-size: 1.16rem;
}

.subject-progress-heading span {
  color: var(--ink-600);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-scroller {
  overflow-x: auto;
}

.chapter-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.chapter-table th,
.chapter-table td {
  padding: 13px 10px;
  border-bottom: 1px solid #e3eaee;
  text-align: right;
  white-space: nowrap;
}

.chapter-table thead th {
  color: var(--ink-600);
  background: #f4f7f9;
  font-size: 0.76rem;
}

.chapter-table thead th:first-child {
  border-radius: 10px 0 0;
}

.chapter-table thead th:last-child {
  border-radius: 0 10px 0 0;
}

.chapter-table th:first-child {
  min-width: 245px;
  text-align: left;
}

.chapter-table tbody th span {
  display: block;
  color: var(--ink-600);
  font-size: 0.72rem;
}

.chapter-table tbody th strong {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
}

.chapter-table td {
  font-size: 0.86rem;
  font-weight: 700;
}

.rate-cell {
  color: var(--teal-dark);
  font-weight: 900 !important;
}

.unseen-cell {
  color: #60737e;
}

.correct-cell {
  color: var(--teal-dark);
}

.wrong-cell {
  color: var(--wrong);
}

.coverage-value {
  display: grid;
  min-width: 112px;
  gap: 5px;
  text-align: right;
}

.coverage-track {
  display: flex;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8ec;
}

.coverage-track i {
  display: block;
  height: 100%;
  flex: 0 0 auto;
}

.coverage-track .coverage-correct {
  background: var(--teal);
}

.coverage-track .coverage-wrong {
  background: var(--wrong);
}

.coverage-track .coverage-unseen {
  background: var(--unseen);
}

.loading-copy {
  margin: 0;
  padding: 22px;
  border-radius: 14px;
  color: var(--ink-600);
  background: #f4f7f9;
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 3px 0;
  color: var(--ink-600);
  font-size: 0.76rem;
}

.progress-bridges {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.progress-bridges iframe {
  width: 1px;
  height: 1px;
  border: 0;
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 22px, 980px);
  }

  .today-panel {
    min-height: 158px;
    padding: 23px 20px;
  }

  .today-score {
    min-width: 126px;
    padding: 14px;
  }

  .today-score strong {
    font-size: 2.45rem;
  }

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

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

  .subject-card > p {
    min-height: 0;
  }

  .page-intro {
    margin-top: 14px;
  }
}

@media (max-width: 500px) {
  .site-header {
    align-items: flex-start;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }

  .brand b {
    font-size: 0.64rem;
  }

  .brand strong {
    font-size: 1rem;
  }

  .site-nav a {
    min-height: 36px;
    padding: 8px 11px;
    font-size: 0.8rem;
  }

  .today-panel {
    align-items: flex-end;
    gap: 12px;
  }

  .today-panel .sync-status {
    font-size: 0.84rem;
  }

  .today-score {
    min-width: 102px;
  }

  .today-score strong {
    font-size: 2rem;
  }

  .today-score small {
    font-size: 0.68rem;
  }

  .section-heading,
  .page-intro,
  .card-heading {
    align-items: flex-start;
  }

  .section-heading {
    flex-direction: column;
    gap: 7px;
  }

  .page-intro {
    padding: 19px;
  }

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

  .subject-stats div {
    padding: 9px 7px;
  }

  .chart-legend {
    flex-direction: column;
    gap: 5px;
  }

  footer {
    flex-direction: column;
    gap: 5px;
  }
}

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