:root {
  --ink: #11203a;
  --muted: #66748a;
  --teal: #086f68;
  --teal-dark: #075650;
  --teal-soft: #eaf7f4;
  --gold: #c98500;
  --gold-soft: #fff3d2;
  --blue: #2563eb;
  --blue-soft: #eef5ff;
  --line: #dbe5e4;
  --paper: #ffffff;
  --page: #edf3f2;
  --shadow: 0 18px 55px rgba(19, 59, 55, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-size: 17px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(29, 150, 139, .10), transparent 24rem),
    linear-gradient(180deg, #f7faf9 0%, var(--page) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }

.page-shell {
  width: min(1350px, calc(100% - 28px));
  margin: 18px auto 48px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 30px 34px;
  overflow: hidden;
  color: #fff;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 255, 255, .15), transparent 16rem),
    linear-gradient(135deg, #075e59, #0b8278);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #c9fff6;
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .08em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  line-height: 1.1;
}

.hero p {
  max-width: 720px;
  margin: 12px 0 0;
  color: #e3fffa;
  font-size: 1.05rem;
}

.hero-count {
  display: grid;
  min-width: 116px;
  min-height: 116px;
  place-content: center;
  text-align: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 50%;
  background: rgba(255,255,255,.11);
  box-shadow: inset 0 0 25px rgba(255,255,255,.08);
}

.hero-count strong {
  font-size: 2.6rem;
  line-height: .9;
}

.hero-count span {
  margin-top: 6px;
  color: #dffcf7;
  font-size: .9rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 10px 30px rgba(25, 73, 68, .06);
}

.group-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(145px, 1fr));
  gap: 10px;
}

.group-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  padding: 9px 15px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  cursor: pointer;
  transition: .2s ease;
}

.group-button span { font-size: .88rem; }
.group-button strong { color: var(--ink); }

.group-button:hover {
  border-color: #90cbc5;
  transform: translateY(-1px);
}

.group-button.is-active {
  color: #d7fff9;
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: 0 8px 18px rgba(8, 111, 104, .18);
}

.group-button.is-active strong { color: #fff; }

.progress-copy {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-right: 10px;
  color: var(--muted);
  font-size: .93rem;
}

.progress-copy .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #91a7a4;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 18px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 13px 18px;
  text-align: left;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.78);
  cursor: pointer;
  transition: .2s ease;
}

.tab:hover { border-color: #98cec9; }

.tab.is-active {
  color: var(--ink);
  border-color: #7fbfb9;
  background: #fff;
  box-shadow: 0 10px 28px rgba(25, 73, 68, .08);
}

.tab-number {
  display: grid;
  flex: 0 0 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: #9eb2af;
  font-weight: 850;
}

.tab.is-active .tab-number { background: var(--teal); }
.tab span:last-child { display: grid; gap: 2px; }
.tab strong { font-size: 1.03rem; }
.tab small { font-size: .82rem; }

.panel {
  padding: 30px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel[hidden] { display: none; }

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

.step-label {
  color: var(--teal);
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.section-heading h2 {
  margin: 7px 0 0;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  line-height: 1.12;
}

.section-heading p {
  max-width: 420px;
  margin: 0;
  text-align: right;
  color: var(--muted);
  line-height: 1.45;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.word-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 78px minmax(0,1fr) 48px;
  align-items: center;
  gap: 11px;
  min-height: 154px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(150deg, #fff, #fbfdfc);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.word-card:hover {
  border-color: #a8d3cf;
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(20, 76, 70, .08);
}

.word-number {
  align-self: start;
  padding-top: 4px;
  color: #879b99;
  font-size: .8rem;
  font-weight: 850;
}

.visual {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 13px;
  background: var(--visual-bg, #e4f4f1);
  box-shadow: 0 5px 12px rgba(37, 65, 61, .15);
  cursor: zoom-in;
}

.visual img,
.head-visual img,
.large-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.word-copy {
  min-width: 0;
  align-self: center;
}

.word-copy h3 {
  margin: 0 0 5px;
  overflow-wrap: anywhere;
  color: #005c57;
  font-size: 1.58rem;
  line-height: 1.05;
}

.word-copy .meaning {
  display: block;
  color: var(--ink);
  font-weight: 750;
  font-size: 1.06rem;
}

.pronunciation {
  display: block;
  margin-top: 5px;
  color: #3d6e69;
  font-size: 1rem;
}

.mini-example {
  grid-column: 2 / -1;
  margin: -3px 0 0;
  padding: 9px 11px;
  color: #526a67;
  border-radius: 10px;
  background: #f2f8f6;
  font-size: .96rem;
  line-height: 1.35;
}

.mini-example strong {
  color: var(--ink);
  font-weight: 720;
}

.audio-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--teal);
  border: 1px solid #b8dbd7;
  border-radius: 50%;
  background: #eaf8f5;
  cursor: pointer;
  transition: .2s ease;
}

.audio-button:hover {
  color: #fff;
  background: var(--teal);
  transform: scale(1.05);
}

.audio-button.is-speaking {
  color: #fff;
  background: #d28200;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 7px rgba(210, 130, 0, .15); }
}

.tip {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: -5px 0 20px;
  padding: 12px 15px;
  color: #405b57;
  border: 1px solid #cfe4e1;
  border-radius: 13px;
  background: #f0f8f6;
}

.tip p { margin: 0; }

.example-list {
  display: grid;
  gap: 15px;
}

.example-card {
  overflow: hidden;
  border: 1px solid #d5e2e0;
  border-radius: 17px;
  background: #fff;
}

.example-head {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #dce8e6;
  background: linear-gradient(90deg, #eef8f5, #f7fbfa);
}

.example-index {
  display: grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  color: var(--teal);
  border-radius: 9px;
  background: #dbf1ed;
  font-size: .76rem;
  font-weight: 900;
}

.example-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.example-title strong {
  color: #005f59;
  font-size: 1.2rem;
}

.example-title span {
  color: var(--muted);
  font-size: .96rem;
}

.head-visual {
  display: block;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 11px;
  background: var(--visual-bg, #e4f4f1);
  box-shadow: 0 4px 10px rgba(37, 65, 61, .13);
}

.sentence-row {
  position: relative;
  padding: 13px 62px 13px 50px;
  border-top: 1px solid #e8eeee;
  cursor: pointer;
  transition: background .15s ease;
}

.sentence-row:first-child { border-top: 0; }
.sentence-row:hover { background: #fbfdfd; }
.sentence-row.is-open { background: #fbfdff; }

.sentence-number {
  position: absolute;
  top: 16px;
  left: 14px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #647b78;
  border-radius: 50%;
  background: #f0f4f3;
  font-size: .76rem;
  font-weight: 850;
}

.usage-tag {
  display: inline-block;
  margin-bottom: 5px;
  padding: 3px 7px;
  color: #9a6100;
  border-radius: 999px;
  background: var(--gold-soft);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
}

.sentence-main {
  margin: 0;
  color: #111;
  font-size: 1.12rem;
  font-weight: 620;
  line-height: 1.5;
}

.sentence-main mark {
  padding: 3px 5px;
  color: #004e49;
  border-radius: 6px;
  background: #def3ef;
}

.row-audio {
  position: absolute;
  top: 25px;
  right: 14px;
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: var(--teal);
  border: 1px solid #b9dcd7;
  border-radius: 50%;
  background: #edf9f7;
  cursor: pointer;
}

.sentence-tools {
  display: none;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed #cbdcda;
}

.sentence-row.is-open .sentence-tools { display: block; }

.translation-line,
.reading-line {
  margin: 0 0 7px;
  color: #526763;
  line-height: 1.45;
}

.reading-line strong { color: #275d58; }

.token-label {
  display: block;
  margin: 11px 0 7px;
  color: #1d4ed8;
  font-size: .84rem;
  font-weight: 800;
}

.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.token {
  padding: 5px 9px;
  color: #174f9a;
  border: 1px solid #78a7ff;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.token:hover,
.token.is-target {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.word-detail {
  position: relative;
  margin-top: 12px;
  padding: 16px;
  color: #14233a;
  border-left: 5px solid var(--blue);
  border-radius: 12px;
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px #d9e6ff;
}

.word-detail p {
  margin: 4px 0;
  line-height: 1.42;
}

.detail-title {
  margin-bottom: 9px;
  color: #1755bd;
  font-weight: 900;
}

.detail-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 28px;
  height: 28px;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background: #d94f4f;
  cursor: pointer;
}

.similar {
  display: grid;
  gap: 4px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed #9ebce9;
}

.similar span:last-child { color: #48617d; }

.visual-dialog {
  width: min(440px, calc(100% - 30px));
  padding: 25px;
  text-align: center;
  color: var(--ink);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}

.visual-dialog::backdrop {
  background: rgba(3, 24, 22, .65);
  backdrop-filter: blur(4px);
}

.large-visual {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  margin-bottom: 18px;
  border-radius: 18px;
  background: var(--visual-bg, #e4f4f1);
}

.visual-dialog > strong {
  display: block;
  color: var(--teal);
  font-size: 2rem;
}

.visual-dialog > span { color: var(--muted); }

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background: #d94f4f;
  cursor: pointer;
}

@media (max-width: 1050px) {
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 680px);
    margin-top: 8px;
  }

  .hero {
    align-items: flex-start;
    padding: 24px 21px;
  }

  .hero-count {
    min-width: 78px;
    min-height: 78px;
  }

  .hero-count strong { font-size: 1.8rem; }

  .toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-copy { padding-left: 4px; }
  .tabs { gap: 8px; }

  .tab {
    align-items: flex-start;
    min-height: 94px;
    padding: 12px;
  }

  .tab-number {
    flex-basis: 31px;
    height: 31px;
  }

  .tab small { display: none; }

  .panel { padding: 23px 15px; }

  .section-heading p { text-align: left; }
  .word-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .hero-count { display: none; }
  .hero p { font-size: .94rem; }
  .group-switch { width: 100%; }

  .group-button {
    min-width: 0;
    padding: 9px 11px;
  }

  .group-button span { display: none; }

  .word-card {
    grid-template-columns: 26px 68px minmax(0,1fr) 42px;
    padding: 12px 10px;
  }

  .visual {
    width: 68px;
    height: 68px;
  }

  .word-copy h3 { font-size: 1.25rem; }
  .mini-example { grid-column: 2 / -1; }

  .sentence-row {
    padding-right: 50px;
    padding-left: 43px;
  }

  .sentence-number { left: 9px; }
  .row-audio { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
