:root {
  --pink: #ff8fb1;
  --pink-soft: #ffd9e4;
  --pink-bg: #fff5f8;
  --green: #5a8a6f;
  --ink: #2c2a2e;
  --ink-soft: #6b6770;
  --line: #ece7ea;
  --card: #ffffff;
  --shadow: 0 6px 24px rgba(60, 40, 50, 0.08);
  --radius: 16px;
  --maxw: 960px;
  --accent: var(--pink);
  --accent-soft: var(--pink-soft);
  --accent-bg: var(--pink-bg);
}

body.theme-cats {
  --accent: #c98a4a;
  --accent-soft: #f3dcc2;
  --accent-bg: #fbf5ee;
}
body.theme-dogs {
  --accent: #6b8acb;
  --accent-soft: #d6e0f3;
  --accent-bg: #eef2fa;
}
body.theme-jellyfish {
  --accent: #6fbfd8;
  --accent-soft: #cfeaf3;
  --accent-bg: #edf7fb;
}
body.theme-insects {
  --accent: #8aa84a;
  --accent-soft: #dde6c2;
  --accent-bg: #f5f8ec;
}
body.theme-birds {
  --accent: #d68a4a;
  --accent-soft: #f3d8b8;
  --accent-bg: #fbf3e7;
}
body.theme-penguins {
  --accent: #4a5a78;
  --accent-soft: #c8d2e3;
  --accent-bg: #eef1f6;
}
body.theme-fish {
  --accent: #4ab0c8;
  --accent-soft: #c4e3eb;
  --accent-bg: #ebf6f9;
}
body.theme-places {
  --accent: #c44a6b;
  --accent-soft: #f0c8d3;
  --accent-bg: #fcedf1;
}
body.theme-regional {
  --accent: #9a6a4a;
  --accent-soft: #e6d4c2;
  --accent-bg: #faf4ee;
}
body.theme-stations {
  --accent: #4a8a6a;
  --accent-soft: #c8e0d2;
  --accent-bg: #eef6f0;
}
body.theme-aquariums {
  --accent: #3a8aa8;
  --accent-soft: #b8d8e6;
  --accent-bg: #e8f3f8;
}
body.theme-mammals {
  --accent: #b08040;
  --accent-soft: #e6d4ba;
  --accent-bg: #faf3e8;
}
body.theme-heritage {
  --accent: #8a6a48;
  --accent-soft: #d8c8b0;
  --accent-bg: #f7f1e8;
}
body.theme-space {
  --accent: #7a6bd6;
  --accent-soft: #d8d2f0;
  --accent-bg: #f1effa;
}
body.theme-english {
  --accent: #3a7bd5;
  --accent-soft: #c4d8f2;
  --accent-bg: #ecf3fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--accent-bg);
  line-height: 1.75;
}

/* Category navigation — single-line tab bar with theme-color dots */
.site-nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-nav .container { max-width: 1280px; }
.category-nav {
  display: flex; gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  justify-content: flex-start;
  justify-content: safe center;
}
.category-nav::-webkit-scrollbar { display: none; }
/* Fade hints while the bar can scroll further (classes toggled in JS) */
.category-nav.fade-left {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 36px);
  mask-image: linear-gradient(to right, transparent, #000 36px);
}
.category-nav.fade-right {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
}
.category-nav.fade-left.fade-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}
.nav-link {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; color: var(--ink-soft);
  padding: 13px 13px; border-radius: 0;
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-link::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot, var(--accent));
  opacity: 0.4;
  transition: opacity 0.15s, transform 0.15s;
}
.nav-link::after {
  content: "";
  position: absolute; left: 10px; right: 10px; bottom: 0;
  height: 2.5px; border-radius: 2px 2px 0 0;
  background: var(--dot, var(--accent));
  transform: scaleX(0);
  transition: transform 0.18s ease;
}
.nav-link:hover { color: var(--ink); }
.nav-link:hover::before { opacity: 1; }
.nav-link.active {
  color: var(--ink);
  font-weight: 800;
}
.nav-link.active::before { opacity: 1; transform: scale(1.15); }
.nav-link.active::after { transform: scaleX(1); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header — compact, left-aligned, meta on the right */
.site-header {
  background: linear-gradient(135deg, #fff 30%, var(--accent-bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.site-header .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "eyebrow  meta"
    "title    meta"
    "subtitle meta";
  column-gap: 24px;
  align-items: center;
}
.eyebrow {
  grid-area: eyebrow;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.22em;
  font-size: 10.5px;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 4px;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.site-header h1 {
  grid-area: title;
  font-size: clamp(19px, 2.6vw, 26px);
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.35;
}
.subtitle {
  grid-area: subtitle;
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  max-width: 640px;
}
.subtitle:empty { display: none; }
.header-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.chip {
  display: inline-block;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip-count { border-color: var(--accent); color: var(--accent); font-weight: 700; }
@media (max-width: 640px) {
  .site-header .container {
    grid-template-columns: 1fr;
    grid-template-areas: "eyebrow" "title" "subtitle" "meta";
  }
  .header-meta { flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: 10px; }
}

/* Search + genre controls */
.controls {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin: 24px 0; box-shadow: var(--shadow);
}
.controls[hidden] { display: none; }
.controls-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.search-input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 13px; font-size: 14px; font-family: inherit;
  background: #fafafa; color: var(--ink); outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input:focus { border-color: var(--accent); background: #fff; }
.visible-count { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.facet-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facet-row + .facet-row { margin-top: 8px; }
.facet-label {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  white-space: nowrap; min-width: 58px;
}
.facet-select {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; font-size: 13px; font-family: inherit;
  background: #fafafa; color: var(--ink); outline: none;
  max-width: 300px;
  transition: border-color 0.15s, background 0.15s;
}
.facet-select:focus { border-color: var(--accent); background: #fff; }
.genre-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.g-n { font-weight: 400; opacity: 0.65; font-size: 10.5px; margin-left: 4px; }
.g-chip {
  background: #f6f1f3; border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.g-chip:hover { background: var(--accent-bg); }
.g-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Ranking cards */
.ranking { display: flex; flex-direction: column; gap: 26px; padding-bottom: 60px; }

.card {
  --card-h: 300px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: 320px 1fr;
  border: 1px solid var(--line);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: var(--card-h);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 34px rgba(60, 40, 50, 0.13); }

.card-media { position: relative; background: #f2f4f3; align-self: stretch; min-height: 0; }
.media-wrap { display: flex; flex-direction: column; height: 100%; }
.img-frame { position: relative; flex: 1 1 auto; min-height: 0; background: #eef1ef; }
.img-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-caption {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(20,16,22,0.62); color: #fff;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  backdrop-filter: blur(2px);
}
.img-toggle {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; gap: 0;
  background: rgba(244, 238, 241, 0.92);
  backdrop-filter: blur(2px);
  border-top: 1px solid var(--line);
}
.img-toggle-btn {
  flex: 1; border: none; background: transparent;
  padding: 9px 6px; font-size: 12.5px; font-weight: 700;
  color: var(--ink-soft); cursor: pointer; transition: background 0.15s, color 0.15s;
  border-bottom: 2px solid transparent;
}
.img-toggle-btn + .img-toggle-btn { border-left: 1px solid var(--line); }
.img-toggle-btn:hover { background: #fff; }
.img-toggle-btn.active { color: var(--accent); background: #fff; border-bottom-color: var(--accent); }
.rank-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: var(--accent); color: #fff;
  border-radius: 12px; padding: 4px 12px;
  font-weight: 800; box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  display: flex; align-items: baseline; gap: 3px;
}
.rank-badge .num { font-size: 26px; line-height: 1; }
.rank-badge .label { font-size: 11px; }

/* Location map overlay (place categories) */
.map-flip-btn {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  border: none; border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  background: rgba(255,255,255,0.92); color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2); backdrop-filter: blur(3px);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.map-flip-btn:hover { transform: translateY(-1px); }
.map-flip-btn.active { background: var(--accent); color: #fff; }
.card-map {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; z-index: 3; background: #eef1ef;
}

.card-body { padding: 24px 26px; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; gap: 8px; }
.card-names { flex: none; }
.card-name { font-size: 24px; font-weight: 800; margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; line-height: 1.2; }
.card-kana { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.card-sci { font-size: 13px; font-style: italic; color: var(--green); margin: 4px 0 0; }

.card-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; flex: none; }
.meta-loc {
  font-size: 12.5px; color: var(--ink-soft);
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px;
}
.flower-period {
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
}
.color-dot {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--ink-soft);
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px;
}
.color-dot::before {
  content: ""; width: 11px; height: 11px; border-radius: 50%;
  background: var(--swatch, #ddd); border: 1px solid rgba(0,0,0,0.1);
}

.card-desc {
  color: var(--ink); font-size: 15px; line-height: 1.8; margin: 0;
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  /* Generous last-resort guard only — typical copy now fits without cropping. */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6;
}
/* Compact inline map chip living inside .card-meta (not a bottom-pinned button). */
.map-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  text-decoration: none; white-space: nowrap;
  transition: filter 0.15s, transform 0.15s;
}
.map-link:hover { filter: brightness(1.08); transform: translateY(-1px); }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.tag {
  font-size: 12px; color: var(--green);
  background: #eef5f0; border-radius: 6px; padding: 3px 9px;
}
.where-seen { font-size: 12px; color: var(--ink-soft); margin: 4px 0 0; }

.detail-btn {
  align-self: flex-start;
  margin-top: 16px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 10px;
  padding: 9px 18px; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s;
}
.detail-btn:hover { opacity: 0.85; }

/* Empty / footer */
.empty-state { text-align: center; color: var(--ink-soft); padding: 60px 0; }
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff; padding: 24px 0; text-align: center;
}
.site-footer p { margin: 0; font-size: 13px; color: var(--ink-soft); }

/* Modal */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30,20,28,0.45); }
.modal-dialog {
  position: relative; background: #fff; border-radius: 18px;
  max-width: 720px; width: calc(100% - 40px); max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3); animation: pop 0.2s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: rgba(255,255,255,0.9); border: 1px solid var(--line);
  width: 36px; height: 36px; border-radius: 50%; font-size: 20px;
  cursor: pointer; line-height: 1; z-index: 2;
}
.modal-body img { width: 100%; height: 280px; object-fit: cover; display: block; }
.modal-inner { padding: 24px 28px 30px; }
.modal-inner h2 { margin: 0 0 4px; font-size: 26px; }
.modal-inner .full-desc { font-size: 15px; line-height: 1.9; }
.modal-section { margin-top: 18px; }
.modal-section h3 { font-size: 13px; color: var(--green); margin: 0 0 6px; }

/* Responsive */
@media (max-width: 640px) {
  .card { grid-template-columns: 1fr; height: auto; }
  .card-media { min-height: 220px; }
  .media-wrap { height: 220px; }
  /* スマホでは白い余白 (padding) を詰めて情報密度を上げる */
  .card-body { height: auto; overflow: visible; padding: 15px 16px; }
  .card-phrase .card-body { padding: 13px 15px; }
  .card-desc { -webkit-line-clamp: 99; }
}

/* ---------- English phrase cards (theme-english) ---------- */
/* One phrase per row — single-column list. */
body.theme-english .ranking {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-phrase { grid-template-columns: 1fr; height: auto; }
.card-phrase .card-body { height: auto; overflow: visible; gap: 7px; padding: 16px 22px; }
.card-phrase .card-desc { -webkit-line-clamp: 99; font-size: 13.5px; line-height: 1.7; color: var(--ink-soft); }

/* rank + 再生ボタンだけの行。英文は別行 (並列にしない)。 */
.phrase-row { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.phrase-rank {
  flex: none;
  font-size: 12px; font-weight: 800; color: var(--accent);
  background: var(--accent-bg); border: 1px solid var(--accent-soft);
  border-radius: 999px; min-width: 32px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
}
.phrase-en { font-size: 18px; font-weight: 800; margin: 0; line-height: 1.45; }
.phrase-ja { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.phrase-tag {
  font-size: 12px; color: var(--accent);
  background: var(--accent-bg); border: 1px solid var(--accent-soft);
  border-radius: 999px; padding: 3px 10px;
}

.speak-btn {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--accent-soft);
  background: var(--accent-bg);
  font-size: 17px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.speak-btn:hover { transform: scale(1.08); background: var(--accent-soft); box-shadow: 0 3px 10px rgba(58,123,213,.25); }
.speak-btn:active { transform: scale(.96); }
/* 再生中は同じボタンが停止 (⏹) になる。赤系で表示。 */
.speak-btn.speaking {
  background: #e8595c;
  border-color: #e8595c;
  color: #fff;
  animation: speak-pulse 1s ease-in-out infinite;
}
@keyframes speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,89,92,.45); }
  50%      { box-shadow: 0 0 0 7px rgba(232,89,92,0); }
}

@media (max-width: 820px) {
  body.theme-english .ranking { grid-template-columns: 1fr; }
}

/* ---------- My English: user-registered phrases (theme-myenglish) ---------- */
body.theme-myenglish {
  --accent: #1f9e8f;
  --accent-soft: #bfe6e0;
  --accent-bg: #e9f7f4;
}
body.theme-myenglish .ranking {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-form {
  background: var(--card);
  border: 1px solid var(--accent-soft);
  border-radius: 16px;
  margin: 24px 0 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
  overflow: hidden;
}
.add-form-title {
  margin: 0;
  padding: 15px 20px;
  font-size: 16px; font-weight: 800; color: var(--accent);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  user-select: none;
}
.add-form-title::-webkit-details-marker { display: none; }
.add-form-title::after {
  content: "▼";
  margin-left: auto;
  font-size: 11px; color: var(--ink-soft);
  transition: transform .2s ease;
}
.add-details[open] .add-form-title::after { transform: rotate(180deg); }
.add-form-body {
  padding: 0 20px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.add-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; color: var(--ink); }
.add-field em { color: #d33; font-style: normal; }
.add-field textarea, .add-field input {
  font: inherit; font-weight: 500;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff; color: var(--ink);
  resize: vertical;
}
.add-field textarea:focus, .add-field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.add-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.add-btn {
  font: inherit; font-weight: 800;
  color: #fff; background: var(--accent);
  border: none; border-radius: 999px;
  padding: 10px 24px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.add-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.add-btn:active { transform: translateY(0); }
.add-msg { font-size: 13px; font-weight: 700; color: var(--accent); }

.del-btn {
  flex: none; margin-left: auto;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid #f0c4c4; background: #fbecec;
  font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, background .12s ease;
}
.del-btn:hover { transform: scale(1.08); background: #f5d6d6; }
.del-btn:active { transform: scale(.96); }

/* ---------- Story: 5-minute read-aloud passages (theme-story) ---------- */
body.theme-story {
  --accent: #d4683f;
  --accent-soft: #f3cdbd;
  --accent-bg: #fbf0eb;
}
body.theme-story .ranking {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.card-story { grid-template-columns: 1fr; height: auto; }
.card-story .card-body { height: auto; overflow: visible; gap: 12px; padding: 22px 26px; }

.story-head { display: flex; align-items: baseline; gap: 12px; cursor: pointer; user-select: none; }
.story-fold-icon {
  margin-left: auto; align-self: center;
  font-size: 14px; color: var(--ink-soft);
  transition: transform .15s ease;
}
.card-story.collapsed .story-fold-icon { transform: rotate(-90deg); }
.card-story.collapsed .story-controls,
.card-story.collapsed .story-body { display: none; }
.story-title {
  font-size: 20px; font-weight: 800; margin: 0; line-height: 1.4;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px;
}
.story-kana { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

/* Controls row: one toggle button + 和訳 toggle */
.story-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: sticky; top: 52px; z-index: 5;
  padding: 6px 0;
  background: linear-gradient(var(--card) 70%, rgba(255,255,255,0));
}
.story-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 800; font-size: 14.5px;
  color: #fff; background: var(--accent);
  border: none; border-radius: 999px;
  padding: 9px 20px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.story-btn .story-btn-icon { font-size: 13px; line-height: 1; }
.story-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(212,104,63,.32); }
.story-btn:active { transform: translateY(0); }
.story-btn.playing {
  background: #e8595c;
  animation: speak-pulse 1s ease-in-out infinite;
}
.story-jp-toggle {
  font: inherit; font-weight: 700; font-size: 12.5px;
  color: var(--accent); background: var(--accent-bg);
  border: 1px solid var(--accent-soft); border-radius: 999px;
  padding: 7px 14px; cursor: pointer;
  transition: background .12s ease;
}
.story-jp-toggle:hover { background: var(--accent-soft); }
.story-jp-toggle[aria-pressed="false"] { color: var(--ink-soft); }

/* Story body: one sentence per row (English highlightable + JP beneath) */
.story-body { display: flex; flex-direction: column; gap: 10px; }
.story-sent-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 12px; border-radius: 10px;
  border-left: 3px solid transparent;
  scroll-margin: 90px;
  transition: background .15s ease, border-color .15s ease;
}
.story-sentence {
  font-size: 17px; line-height: 1.75; color: var(--ink);
  border-radius: 4px;
}
.story-ja { font-size: 13px; line-height: 1.7; color: var(--ink-soft); }
.story-body.jp-off .story-ja { display: none; }

/* The sentence currently being spoken */
.story-sent-row:has(.story-sentence.speaking) {
  background: var(--accent-bg);
  border-left-color: var(--accent);
}
.story-sentence.speaking {
  background: linear-gradient(transparent 58%, var(--accent-soft) 58%);
  font-weight: 700;
}

@media (max-width: 640px) {
  .card-story .card-body { padding: 16px 16px; }
  .story-controls { top: 48px; }
  .story-sentence { font-size: 16px; }
}
