:root {
  --ink: #16363e;
  --ink-soft: #49636a;
  --teal: #176c72;
  --teal-deep: #0c5057;
  --mint: #dceee7;
  --mint-light: #f2f8f5;
  --sun: #f0bd53;
  --cream: #fffdf8;
  --paper: #ffffff;
  --line: #d6e4de;
  --correct: #14744c;
  --wrong: #bd4d3c;
  --shadow: 0 16px 38px rgba(22, 54, 62, 0.1);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--cream);
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", sans-serif;
  line-height: 1.7;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 20;
  padding: 8px 16px;
  color: var(--paper);
  background: var(--teal-deep);
  border-radius: 0 0 10px 10px;
}

.skip-link:focus {
  top: 0;
}

.site-header {
  overflow: hidden;
  padding: 24px max(20px, calc((100% - 1120px) / 2)) 74px;
  color: var(--paper);
  background:
    radial-gradient(circle at 90% 22%, rgba(240, 189, 83, 0.28) 0 120px, transparent 121px),
    radial-gradient(circle at 8% 88%, rgba(135, 207, 189, 0.2) 0 150px, transparent 151px),
    var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.nav-link {
  color: var(--paper);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-dot {
  width: 13px;
  height: 13px;
  background: var(--sun);
  border-radius: 50%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-link {
  font-size: 0.95rem;
}

.nav-link:hover {
  text-decoration: underline;
}

.language-link {
  padding: 7px 13px;
  border: 1px solid rgba(251, 253, 251, 0.5);
  border-radius: 999px;
  font-weight: 700;
}

.language-link:hover {
  background: rgba(251, 253, 251, 0.12);
  text-decoration: none;
}

.share-button {
  padding: 8px 20px;
  color: var(--paper);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
}

.share-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hero {
  max-width: 720px;
  padding-top: clamp(60px, 9vw, 106px);
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  color: var(--sun);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 22px;
  font-family: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(2.55rem, 5.8vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.28;
}

.lead {
  max-width: 635px;
  margin: 0;
  color: #dbe7e7;
  font-size: clamp(1rem, 2vw, 1.08rem);
}

.sp-only {
  display: none;
}

.main {
  max-width: 1120px;
  margin: -39px auto 0;
  padding: 0 20px 70px;
}

.quiz-panel {
  min-width: 0;
  padding: clamp(22px, 4vw, 42px);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 26px;
  padding: 4px;
  background: var(--mint-light);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.mode-switch a {
  min-width: 104px;
  padding: 8px 18px;
  color: var(--teal-deep);
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.mode-switch a[aria-current="page"] {
  color: var(--paper);
  background: var(--teal);
}

.mode-switch a:hover:not([aria-current="page"]) {
  background: var(--mint);
}

.header-mode-switch {
  margin-top: 34px;
  margin-bottom: 0;
}

.header-mode-switch + .hero {
  padding-top: clamp(34px, 6vw, 62px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.panel-heading .section-label,
.guide-card .section-label {
  color: var(--teal);
}

.panel-heading .section-label {
  margin: 0;
  padding-top: 8px;
}

h2,
h3 {
  margin: 0;
  line-height: 1.35;
}

.dataset-badge {
  margin: 5px 0 0;
  padding: 7px 14px;
  color: var(--teal-deep);
  background: var(--mint);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: var(--mint-light);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.difficulty-control {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 18px;
  font-size: 0.92rem;
}

.difficulty-control strong {
  justify-self: end;
  color: var(--teal-deep);
}

.difficulty-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.difficulty-title input {
  margin: 0;
  accent-color: var(--teal);
}

.difficulty-control input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 7px;
  accent-color: var(--teal);
}

.difficulty-control input[type="range"]:disabled {
  opacity: 0.45;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.switch {
  position: relative;
  display: inline-flex;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  display: block;
  width: 48px;
  height: 28px;
  background: #92aaa6;
  border-radius: 99px;
  transition: background 180ms ease;
}

.switch-track::after {
  display: block;
  width: 22px;
  height: 22px;
  margin: 3px;
  content: "";
  background: var(--paper);
  border-radius: 50%;
  transition: transform 180ms ease;
}

.switch input:checked + .switch-track {
  background: var(--teal);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 10px 21px;
  border-radius: 12px;
  font-weight: 700;
}

.primary-button {
  color: var(--paper);
  background: var(--teal);
  border: 1px solid var(--teal);
}

.primary-button:hover:not(:disabled) {
  background: var(--teal-deep);
}

.secondary-button {
  color: var(--teal-deep);
  background: var(--paper);
  border: 1px solid var(--line);
}

.secondary-button:hover:not(:disabled) {
  background: #eaf4f0;
}

.score {
  display: flex;
  gap: clamp(22px, 7vw, 70px);
  margin: 28px 0;
  padding: 0;
}

.score div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.score dt {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.score dd {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.question-card {
  min-width: 0;
  padding: clamp(20px, 4vw, 34px);
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.sentence {
  min-height: 2.8rem;
  margin: 0 0 25px;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: opacity 180ms ease, transform 180ms ease;
}

.sentence.is-analyzing {
  opacity: 0.46;
  transform: translateY(3px);
}

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 108px;
  margin-bottom: 27px;
}

.slots.is-entering .token-slot {
  animation: lift-in 360ms both;
  animation-delay: calc(var(--slot-index) * 26ms);
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.token-slot {
  display: grid;
  align-content: start;
  min-width: 86px;
  min-height: 106px;
  padding: 9px 8px 8px;
  background: var(--paper);
  border: 1px dashed #b0c8c1;
  border-radius: 13px;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
}

.token-slot:hover,
.token-slot.is-over {
  background: var(--mint-light);
  border-color: var(--teal);
}

.token-slot.is-correct {
  background: #eaf8f0;
  border-color: var(--correct);
}

.token-slot.is-wrong {
  background: #fff1ee;
  border-color: var(--wrong);
}

.surface {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.42;
}

.reading {
  display: block;
  min-height: 1.25em;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.4;
}

.slots.hide-reading .reading {
  visibility: hidden;
}

.slot-card {
  min-height: 40px;
  margin-top: 7px;
}

.slot-placeholder {
  display: block;
  padding: 7px 5px;
  color: #819592;
  border: 1px dashed transparent;
  font-size: 0.76rem;
}

.card-bank {
  padding: 18px;
  background: #f3f8f6;
  border-radius: 16px;
}

.bank-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.bank-header h3 {
  font-size: 1rem;
}

.text-button {
  padding: 0;
  color: var(--teal);
  background: transparent;
  border: 0;
  font-size: 0.85rem;
  text-decoration: underline;
}

.interaction-help {
  margin: 3px 0 12px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.bank-dropzone {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 53px;
  padding: 7px;
  border: 1px dashed transparent;
  border-radius: 10px;
}

.bank-dropzone.is-over {
  border-color: var(--teal);
  background: #e8f3ee;
}

.pos-card {
  min-height: 40px;
  padding: 6px 13px;
  color: var(--teal-deep);
  background: var(--paper);
  border: 1px solid #a8c5bf;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 2px 3px rgba(15, 65, 72, 0.05);
}

.pos-card:hover:not(:disabled),
.pos-card[aria-pressed="true"] {
  border-color: var(--teal);
  background: #e8f5ef;
}

.pos-card[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--teal);
}

.answer-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}

.status {
  min-height: 1.7em;
  margin: 17px 0 0;
  color: var(--ink-soft);
  text-align: center;
  font-weight: 700;
}

.status.success {
  color: var(--correct);
}

.status.error {
  color: var(--wrong);
}

.guide-grid {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 18px;
  margin-top: 23px;
}

.term-reference {
  margin-top: 23px;
  padding: clamp(21px, 4vw, 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.term-reference h2 {
  margin: 6px 0 18px;
  font-size: 1.28rem;
}

.term-reference h2 span {
  color: var(--ink-soft);
  font-weight: 500;
}

.classification-chart {
  margin-top: 23px;
  padding: clamp(21px, 4vw, 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.classification-chart h2 {
  margin: 6px 0 18px;
  font-size: 1.28rem;
}

.classification-chart h2 span {
  color: var(--ink-soft);
  font-weight: 500;
}

.classification-chart a {
  display: block;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.classification-chart img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 720px;
}

.term-table-wrap {
  overflow-x: auto;
}

.term-table {
  width: 100%;
  border-collapse: collapse;
}

.term-table th,
.term-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.term-table th {
  color: var(--teal-deep);
  background: var(--mint-light);
  font-size: 0.9rem;
}

.term-table td:first-child {
  font-weight: 700;
}

.term-table tbody tr:last-child td {
  border-bottom: 0;
}

.guide-card {
  padding: clamp(21px, 4vw, 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.guide-card h2 {
  margin-bottom: 12px;
  font-size: 1.28rem;
}

.guide-card p,
.guide-card ol {
  margin: 0;
  color: var(--ink-soft);
}

.guide-card p + p {
  margin-top: 13px;
}

.info-link {
  color: var(--teal-deep);
}

.guide-card ol {
  padding-left: 1.45rem;
}

.site-footer {
  padding: 42px 20px 54px;
  background: #eef5f2;
  text-align: center;
}

.footer-inner {
  max-width: 820px;
  margin: 0 auto;
}

.powered-label {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.knctt-logo-link {
  display: block;
  width: min(360px, 88%);
  margin: 0 auto 15px;
}

.knctt-logo {
  display: block;
  width: 100%;
  height: auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 22px;
  font-size: 0.9rem;
}

.footer-links a {
  color: var(--teal-deep);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.content-page {
  padding-top: clamp(28px, 5vw, 48px);
}

.content-card {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.content-card h2 {
  margin: 2.2rem 0 0.7rem;
  color: var(--teal-deep);
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
}

.content-card h2:first-child {
  margin-top: 0;
}

.content-card h3 {
  margin: 1.45rem 0 0.6rem;
  color: var(--teal-deep);
  font-size: 1.05rem;
}

.content-card p,
.content-card li {
  color: var(--ink-soft);
  line-height: 1.85;
}

.content-card p {
  margin: 0.65rem 0;
}

.content-card ul {
  padding-left: 1.4rem;
}

.content-card .policy-date {
  margin-top: 2.4rem;
  color: var(--ink-soft);
  text-align: right;
}

.contact-frame {
  display: block;
  width: 100%;
  min-height: 824px;
  border: 0;
}

noscript {
  display: block;
  padding: 14px;
  color: var(--paper);
  background: var(--wrong);
  text-align: center;
}

@media (max-width: 760px) {
  .site-header {
    padding-top: 18px;
    padding-bottom: 58px;
  }

  .nav-links .nav-link {
    display: none;
  }

  .nav {
    gap: 12px;
  }

  .brand {
    font-size: 0.92rem;
  }

  .share-button {
    padding-inline: 15px;
  }

  .hero {
    padding-top: 52px;
  }

  .header-mode-switch {
    margin-top: 22px;
  }

  .header-mode-switch + .hero {
    padding-top: 38px;
  }

  .sp-only {
    display: inline;
  }

  .main {
    margin-top: -27px;
    padding-inline: 12px;
  }

  .panel-heading {
    display: block;
    margin-bottom: 20px;
  }

  .mode-switch {
    display: flex;
  }

  .mode-switch a {
    flex: 1 1 50%;
    min-width: 0;
    padding-inline: 9px;
  }

  .dataset-badge {
    display: inline-block;
    margin-top: 14px;
    white-space: normal;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .toggle-control {
    justify-content: space-between;
  }

  .score {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .score div {
    display: block;
  }

  .slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .token-slot {
    min-width: 0;
  }

  .bank-header {
    display: block;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }
}
