:root {
  --paper: #f4f1e8;
  --paper-strong: #ebe5d6;
  --ink: #142b3a;
  --ink-soft: #5c6b73;
  --navy: #16354a;
  --blue: #2e6f95;
  --blue-soft: #dcebf1;
  --orange: #ef8d32;
  --orange-soft: #fff0df;
  --green: #23644f;
  --green-soft: #e4f2eb;
  --red: #9f3434;
  --red-soft: #fae8e5;
  --white: #fffdf8;
  --line: rgba(20, 43, 58, 0.14);
  --shadow: 0 18px 50px rgba(23, 53, 74, 0.1);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 8%, rgba(239, 141, 50, 0.13), transparent 24rem),
    radial-gradient(circle at 8% 36%, rgba(46, 111, 149, 0.1), transparent 26rem),
    var(--paper);
  color: var(--ink);
  font-family:
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--navy);
}

.app-root {
  min-height: 100vh;
}

.site-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand-button,
.brand-static {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.brand-static {
  cursor: default;
}

.brand-mark,
.loading-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 12px 12px 12px 4px;
  background: var(--navy);
  color: var(--white);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: -0.04em;
  box-shadow: 4px 4px 0 var(--orange);
}

.edition-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.65);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.edition-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  align-items: end;
  gap: 56px;
  padding: 74px 0 62px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 29px;
  height: 3px;
  border-radius: 999px;
  background: var(--orange);
  content: "";
}

.hero h1 {
  max-width: 740px;
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 1.03;
}

.hero h1 span {
  color: var(--blue);
}

.hero-copy {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.13rem);
  font-weight: 600;
  line-height: 1.9;
}

.hero-note {
  position: relative;
  padding: 26px;
  overflow: hidden;
  border: 1px solid rgba(22, 53, 74, 0.1);
  border-radius: var(--radius-lg);
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow);
}

.hero-note::after {
  position: absolute;
  right: -35px;
  bottom: -42px;
  width: 130px;
  height: 130px;
  border: 28px solid rgba(239, 141, 50, 0.36);
  border-radius: 50%;
  content: "";
}

.hero-note-label {
  margin: 0 0 18px;
  color: #a9ccdc;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.hero-stat strong {
  display: block;
  font-size: 1.72rem;
  line-height: 1;
}

.hero-stat span {
  display: block;
  margin-top: 7px;
  color: #c6d8e1;
  font-size: 0.76rem;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
}

.section-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 76px;
}

.unit-card {
  position: relative;
  min-height: 210px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.84);
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.unit-card:hover {
  transform: translateY(-4px);
  border-color: rgba(46, 111, 149, 0.45);
  box-shadow: 0 16px 34px rgba(22, 53, 74, 0.1);
}

.unit-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 31px;
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.unit-arrow {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--blue-soft);
  font-size: 1rem;
  transition: transform 180ms ease;
}

.unit-card:hover .unit-arrow {
  transform: translateX(3px);
}

.unit-card h3 {
  min-height: 50px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.22;
}

.unit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.progress-chip {
  color: var(--green);
}

.progress-chip.is-new {
  color: var(--ink-soft);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.7;
}

.site-footer p {
  max-width: 720px;
  margin: 0;
}

.footer-label {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.focus-shell {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr;
}

.focus-stage {
  display: grid;
  place-items: center;
  padding: 44px 0 72px;
}

.focus-panel {
  width: min(780px, 100%);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.setup-card,
.quiz-card,
.result-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.setup-card {
  padding: clamp(30px, 6vw, 58px);
}

.unit-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.setup-card h1,
.result-card h1 {
  margin: 18px 0 10px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.setup-title {
  font-family: Georgia, "Times New Roman", serif;
}

.setup-lead,
.result-lead {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.8;
}

.round-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.round-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 104px;
  padding: 20px 22px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.round-option:hover {
  transform: translateY(-2px);
  border-color: rgba(46, 111, 149, 0.35);
  background: var(--blue-soft);
}

.round-option strong {
  display: block;
  font-size: 1.18rem;
}

.round-option span {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.round-option b {
  color: #a54808;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem;
}

.quiz-card {
  overflow: hidden;
}

.quiz-head {
  padding: 22px 28px 0;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 7px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-strong);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #4d9bb4);
  transition: width 260ms ease;
}

.word-area {
  padding: clamp(38px, 7vw, 68px) 30px 34px;
  text-align: center;
}

.word-label {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.word-area h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 8vw, 5.3rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.word-hint {
  margin: 17px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.choice-list {
  display: grid;
  gap: 11px;
  padding: 0 28px 28px;
}

.choice-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 65px;
  padding: 12px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  text-align: left;
  font-weight: 750;
  line-height: 1.5;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.choice-button:not(:disabled):hover {
  transform: translateX(3px);
  border-color: rgba(46, 111, 149, 0.5);
  background: #f4fafc;
}

.choice-button:disabled {
  cursor: default;
  opacity: 1;
}

.choice-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 900;
}

.choice-icon {
  width: 25px;
  color: transparent;
  text-align: center;
}

.choice-button.is-correct {
  border-color: rgba(47, 128, 102, 0.56);
  background: var(--green-soft);
}

.choice-button.is-correct .choice-number {
  background: var(--green);
  color: var(--white);
}

.choice-button.is-correct .choice-icon {
  color: var(--green);
}

.choice-button.is-wrong {
  border-color: rgba(185, 75, 75, 0.5);
  background: var(--red-soft);
}

.choice-button.is-wrong .choice-number {
  background: var(--red);
  color: var(--white);
}

.choice-button.is-wrong .choice-icon {
  color: var(--red);
}

.feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  padding: 17px 28px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.feedback-message {
  margin: 0;
  font-weight: 900;
}

.feedback-message.is-correct {
  color: var(--green);
}

.feedback-message.is-wrong {
  color: var(--red);
}

.feedback-detail {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 21px;
  border-radius: 13px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(22, 53, 74, 0.16);
}

.primary-button:hover {
  background: #214c64;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--white);
}

.secondary-button:hover {
  border-color: rgba(46, 111, 149, 0.45);
  background: var(--blue-soft);
}

.ghost-button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
}

.keyboard-note {
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
  text-align: center;
}

.result-card {
  padding: clamp(28px, 5vw, 54px);
}

.result-top {
  display: grid;
  grid-template-columns: 156px 1fr;
  align-items: center;
  gap: 38px;
}

.score-ring {
  display: grid;
  width: 156px;
  height: 156px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), var(--paper-strong) 0);
}

.score-ring-inner {
  display: grid;
  width: 124px;
  height: 124px;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  text-align: center;
}

.score-ring strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.45rem;
  line-height: 0.9;
}

.score-ring span {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.mistake-panel {
  margin-top: 36px;
  padding-top: 27px;
  border-top: 1px solid var(--line);
}

.mistake-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.mistake-heading h2 {
  margin: 0;
  font-size: 1.12rem;
}

.mistake-heading span {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
}

.mistake-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mistake-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper);
}

.mistake-item strong {
  font-family: Georgia, "Times New Roman", serif;
}

.mistake-item span {
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 650;
}

.perfect-panel {
  margin-top: 32px;
  padding: 20px;
  border-radius: 15px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
  text-align: center;
}

.error-screen,
.loading-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  justify-items: center;
  padding: 32px;
  text-align: center;
}

.loading-screen h1,
.error-screen h1 {
  margin: 22px 0 8px;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
}

.loading-screen p,
.error-screen p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 650;
}

.loading-brand {
  margin-top: 22px !important;
  color: var(--ink) !important;
  font-size: 0.72rem;
  font-weight: 900 !important;
  letter-spacing: 0.13em;
}

.loading-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px 16px 16px 5px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 34px;
    padding-top: 54px;
  }

  .hero-note {
    max-width: 520px;
  }

  .unit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-shell {
    width: min(100% - 24px, 1120px);
  }

  .topbar {
    min-height: 66px;
    gap: 10px;
  }

  .brand-text {
    font-size: 0.8rem;
  }

  .edition-badge {
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  .hero {
    padding: 43px 0 46px;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 15vw, 4rem);
  }

  .hero-copy {
    font-size: 0.95rem;
  }

  .hero-note {
    padding: 22px;
  }

  .hero-stat strong {
    font-size: 1.48rem;
  }

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

  .unit-grid {
    grid-template-columns: 1fr;
    gap: 11px;
    padding-bottom: 52px;
  }

  .unit-card {
    min-height: 155px;
    padding: 19px;
  }

  .unit-number {
    margin-bottom: 20px;
  }

  .unit-card h3 {
    min-height: auto;
    font-size: 1.15rem;
  }

  .unit-meta {
    margin-top: 18px;
  }

  .site-footer {
    flex-direction: column;
    gap: 8px;
  }

  .focus-stage {
    align-items: start;
    padding: 20px 0 46px;
  }

  .setup-card,
  .quiz-card,
  .result-card {
    margin-top: 8px;
    border-radius: 21px;
  }

  .round-options {
    grid-template-columns: 1fr;
  }

  .quiz-head {
    padding: 17px 18px 0;
  }

  .word-area {
    padding: 34px 20px 26px;
  }

  .word-area h1 {
    font-size: clamp(2.35rem, 14vw, 3.7rem);
  }

  .choice-list {
    gap: 9px;
    padding: 0 14px 17px;
  }

  .choice-button {
    grid-template-columns: 35px 1fr auto;
    min-height: 62px;
    padding: 10px 12px;
  }

  .feedback-row {
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
    padding: 16px 18px 18px;
  }

  .feedback-row .primary-button {
    width: 100%;
  }

  .keyboard-note {
    display: none;
  }

  .result-top {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 24px;
    text-align: center;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mistake-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (max-width: 380px) {
  .brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .edition-badge {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
