:root {
  --paper: #fffdf8;
  --surface: #ffffff;
  --ink: #17313b;
  --muted: #587078;
  --border: #dce6e3;
  --green: #176346;
  --green-dark: #0c4d36;
  --mint: #bfe8d2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "DejaVu Sans", Arial, sans-serif;
}

.site-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 42px 28px 64px;
}

.site-header {
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.eyebrow,
.label,
.article {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow { margin: 0; color: var(--green); letter-spacing: 0.12em; }

h1,
h2,
p { margin-top: 0; }

h1 {
  margin: 10px 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2 {
  margin: 5px 0 18px;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}

.intro { margin-bottom: 0; color: var(--muted); font-size: 1.05rem; }
.learning-signature { margin: 14px 0 0; color: var(--green); font-weight: 800; }

.voice-note {
  margin: 26px 0;
  padding: 13px 16px;
  border-radius: 14px;
  color: #245c46;
  background: #e9f6ee;
}

.search-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 28px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}

.search-panel .eyebrow { margin-bottom: 6px; }
.search-label { color: var(--ink); font-size: 1.05rem; font-weight: 800; }

.search-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #9cb5ac;
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}

.search-input::placeholder { color: #718087; }
.search-input:focus-visible { outline: 3px solid #111827; outline-offset: 2px; }
.search-status { min-height: 1.2em; margin: 0; color: var(--muted); font-size: 0.92rem; }
.no-script-message { padding: 16px; border-radius: 12px; color: #7a2e22; background: #fff0ec; }

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

.vocabulary-card {
  position: relative;
  min-height: 290px;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

.vocabulary-card::after {
  position: absolute;
  top: -43px;
  right: -43px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: var(--mint);
  content: "";
  opacity: 0.65;
}

.card-number {
  display: inline-grid;
  width: 34px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
}

.article { margin: 14px 0 0; color: var(--muted); }
.label { margin-bottom: 5px; color: var(--muted); }

.pronunciation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 5px 0 8px;
}

.ipa { color: var(--green); font-size: 1.15rem; font-weight: 800; }

.audio-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-dark);
  transition: transform 0.15s, background 0.15s;
}

.audio-button:hover { background: #0c4d36; transform: translateY(-1px); }
.audio-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #111827;
}
.audio-button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
.audio-button svg { width: 23px; height: 23px; fill: currentColor; }

.playback-status { min-height: 1.2em; margin: -4px 0 12px; color: var(--green); font-size: 0.82rem; font-weight: 800; }
.sentence-row {
  display: inline-flex;
  max-width: calc(100% - 174px);
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.sentence-row .sentence { flex: 0 1 auto; margin-bottom: 0; }
.audio-button--small { width: 36px; height: 36px; box-shadow: 0 2px 0 var(--green-dark); }
.audio-button--small svg { width: 18px; height: 18px; }
.sentence { margin-bottom: 18px; font-size: 1.05rem; }
.rule { margin-bottom: 0; color: var(--muted); }

.scene {
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: 156px;
  height: 142px;
  border: 1px solid #d4e2dc;
  border-radius: 18px;
  object-fit: contain;
  object-position: center;
  background: var(--mint);
}

.site-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (min-width: 1180px) {
  .vocabulary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .site-shell { padding: 36px 24px 56px; }
  .vocabulary-grid { grid-template-columns: 1fr; }
  .vocabulary-card { min-height: 300px; }
}

@media (max-width: 520px) {
  body { min-width: 0; }
  .site-shell { padding: 24px 14px 40px; }
  .site-header { margin-bottom: 20px; padding-bottom: 20px; }
  h1 { font-size: clamp(2rem, 12vw, 2.8rem); }
  h2 { font-size: 2rem; }
  .intro { font-size: 1rem; }
  .voice-note { margin: 20px 0; padding: 12px 14px; }
  .search-panel { margin-bottom: 20px; padding: 16px; border-radius: 16px; }
  .search-label { font-size: 1rem; }
  .vocabulary-grid { gap: 16px; }
  .vocabulary-card { min-height: 0; padding: 20px; border-radius: 20px; }
  .sentence-row { max-width: 100%; }
  .scene { position: static; width: min(100%, 260px); height: auto; aspect-ratio: 11 / 10; margin: 18px auto 0; display: block; }
  .site-footer { margin-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .audio-button { transition: none; }
}
