:root {
  --bg: #0b1020;
  --bg2: #121a31;
  --panel: rgba(18, 26, 49, 0.88);
  --panel-strong: rgba(23, 34, 65, 0.96);
  --card: rgba(255, 255, 255, 0.06);
  --card-strong: rgba(255, 255, 255, 0.09);

  --text: #f8fbff;
  --muted: #a6b3d1;
  --line: rgba(255, 255, 255, 0.1);

  --accent: #8b5cf6;
  --accent2: #22c55e;
  --accent3: #f97316;
  --accent4: #06b6d4;
  --danger: #ef4444;

  --ipa: #8bdcff;
  --ipa-hit: #ffd84d;

  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.2);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;

  --max: 1160px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Inter",
    "Noto Sans JP",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(139, 92, 246, 0.22),
      transparent 28%
    ),
    radial-gradient(
      circle at top right,
      rgba(34, 197, 94, 0.18),
      transparent 24%
    ),
    radial-gradient(
      circle at bottom center,
      rgba(249, 115, 22, 0.14),
      transparent 28%
    ),
    linear-gradient(180deg, #09101d 0%, #0b1020 40%, #0d1528 100%);
  min-height: 100vh;
}

.site-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 15% 10%,
      rgba(139, 92, 246, 0.15),
      transparent 18%
    ),
    radial-gradient(
      circle at 85% 12%,
      rgba(6, 182, 212, 0.12),
      transparent 18%
    ),
    radial-gradient(circle at 65% 75%, rgba(34, 197, 94, 0.08), transparent 18%);
  filter: blur(10px);
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.site-header {
  display: grid;
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.35);
}

.brand-title {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.top-nav {
  display: block;
}

.sound-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sound-tab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.sound-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.sound-tab.is-active {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.28),
    rgba(249, 115, 22, 0.24)
  );
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 12px 24px rgba(0, 0, 0, 0.18);
}

.main {
  display: grid;
  gap: 22px;
}

.panel {
  background: linear-gradient(
    180deg,
    rgba(18, 26, 49, 0.92),
    rgba(13, 20, 38, 0.92)
  );
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(12px);
}

/* =========================
   HERO
========================= */

.hero {
  overflow: hidden;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 18% 20%,
      rgba(139, 92, 246, 0.16),
      transparent 22%
    ),
    radial-gradient(
      circle at 82% 22%,
      rgba(249, 115, 22, 0.14),
      transparent 18%
    );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  padding: 26px;
}

.hero-left,
.hero-right {
  min-width: 0;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d8e2ff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-ipa-wrap {
  display: grid;
  gap: 12px;
}

.hero-ipa {
  font-size: clamp(4.6rem, 12vw, 7.4rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 20px rgba(139, 92, 246, 0.22),
    0 0 38px rgba(249, 115, 22, 0.16);
}

.hero-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.18),
    rgba(6, 182, 212, 0.14)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1rem;
  font-weight: 700;
}

.hero-card {
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.hero-card-label {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #d6e2ff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mouth-hint {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.8;
}

.mouth-hint b {
  color: #fff;
}

/* =========================
   COMMON SECTION
========================= */

.section-block {
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 900;
  letter-spacing: 0.01em;
}

.section-sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.96rem;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #07111f;
  background: linear-gradient(135deg, var(--accent2), #6ee7b7);
  box-shadow: 0 14px 24px rgba(34, 197, 94, 0.24);
}

.btn-ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.speed-label {
  font-weight: 800;
  color: #dce7ff;
}

.speed-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent3);
}

.speed-value {
  min-width: 48px;
  text-align: right;
  font-weight: 800;
  color: #fff;
}

/* =========================
   WORDS
========================= */

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.chip {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.035)
  );
  color: var(--text);
  border-radius: 22px;
  padding: 16px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.chip:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

.chip.is-active {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.22),
    rgba(249, 115, 22, 0.2)
  );
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 34px rgba(0, 0, 0, 0.25);
}

.chip .w {
  display: block;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.15;
}

.chip .w-ipa {
  display: block;
  margin-top: 6px;
  color: var(--ipa);
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.chip .jp {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* =========================
   SENTENCES
========================= */

.patterns {
  display: grid;
  gap: 18px;
}

.pattern-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.03)
  );
  border-radius: 24px;
  padding: 18px;
}

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

.pattern-title-wrap {
  min-width: 0;
}

.pattern-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pattern-label {
  margin: 10px 0 0;
  font-size: 1.04rem;
  font-weight: 800;
}

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

.example-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.example-item.is-jump-target {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.2),
    rgba(6, 182, 212, 0.16)
  );
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 16px 28px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.play-mini {
  appearance: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 900;
  color: #081120;
  background: linear-gradient(135deg, var(--accent3), #fdba74);
  box-shadow: 0 12px 22px rgba(249, 115, 22, 0.24);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
  flex-shrink: 0;
}

.play-mini:hover {
  transform: translateY(-1px) scale(1.02);
}

.example-main {
  min-width: 0;
}

.example-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.example-en {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
}

.example-ja {
  color: var(--muted);
  line-height: 1.6;
  white-space: normal;
  text-align: right;
  font-size: 0.97rem;
  max-width: 26ch;
}

.example-ipa {
  margin-top: 6px;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ipa);
  opacity: 0.95;
  word-break: break-word;
}

.ipa-hit {
  color: #ffd84d;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(255, 216, 77, 0.35);
}

/* =========================
   CONVERSATION
========================= */

.conversation-list {
  display: grid;
  gap: 18px;
}

.conversation-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.03)
  );
  border-radius: 24px;
  padding: 18px;
}

.conversation-head {
  margin-bottom: 14px;
}

.conversation-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 900;
}

.conversation-sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.conversation-turns {
  display: grid;
  gap: 12px;
}

.conversation-turn {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.conversation-main {
  min-width: 0;
}

.conversation-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.conversation-en {
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
}

.conversation-ja {
  color: var(--muted);
  line-height: 1.6;
  white-space: normal;
  text-align: right;
  font-size: 0.96rem;
  max-width: 26ch;
}

.conversation-ipa {
  margin-top: 6px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ipa);
  opacity: 0.95;
  word-break: break-word;
}

/* =========================
   COMPARE
========================= */

.compare-wrap {
  display: grid;
  gap: 18px;
}

.compare-card {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.compare-head {
  margin-bottom: 14px;
}

.compare-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
}

.compare-sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-line;
}

.compare-list {
  display: grid;
  gap: 12px;
}

.compare-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.compare-main {
  min-width: 0;
}

.compare-words {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-size: 1.06rem;
  line-height: 1.5;
}

.compare-word {
  font-weight: 900;
}

.compare-ipa {
  color: #9ddcff;
  font-weight: 700;
}

.compare-vs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.28),
    rgba(249, 115, 22, 0.25)
  );
  color: #fff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.compare-ja {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.empty-note {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

/* =========================
   SOUND MAP
========================= */

.section-head--map {
  margin-bottom: 16px;
}

.sound-map-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
}

.map-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.03)
  );
  border-radius: 24px;
  padding: 14px;
}

.map-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.map-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}

.map-card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.map-sections {
  display: grid;
  gap: 12px;
}

.map-sections--vowels {
  grid-template-columns: 1.15fr 1fr 1.2fr;
  align-items: start;
}

.map-sections--cons {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.map-block {
  min-width: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.map-block-title {
  padding: 8px 10px;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #eef5ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.map-sections--vowels .map-block:nth-child(1) .map-block-title {
  background: rgba(249, 115, 22, 0.18);
}

.map-sections--vowels .map-block:nth-child(2) .map-block-title {
  background: rgba(245, 208, 84, 0.18);
}

.map-sections--vowels .map-block:nth-child(3) .map-block-title {
  background: rgba(255, 255, 255, 0.12);
}

.map-sections--cons .map-block:nth-child(1) .map-block-title {
  background: rgba(34, 197, 94, 0.18);
}

.map-sections--cons .map-block:nth-child(2) .map-block-title {
  background: rgba(255, 255, 255, 0.12);
}

.map-node-grid {
  display: grid;
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.map-node-grid--short {
  grid-template-columns: repeat(2, 1fr);
}

.map-node-grid--long {
  grid-template-columns: repeat(2, 1fr);
}

.map-node-grid--diph {
  grid-template-columns: repeat(3, 1fr);
}

.map-node-grid--cons {
  grid-template-columns: repeat(3, 1fr);
}

.map-node {
  appearance: none;
  min-height: 66px;
  border: 0;
  background: rgba(10, 18, 38, 0.92);
  color: var(--text);
  padding: 8px 6px 7px;
  cursor: pointer;
  text-align: center;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.map-node:hover:not(:disabled) {
  background: rgba(22, 33, 62, 0.96);
}

.map-node.is-active {
  background: #ff7a1a;
  color: #fff;
  border-color: #ff7a1a;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 10px 20px rgba(0, 0, 0, 0.16);
}

.map-node.is-soon,
.map-node:disabled {
  cursor: default;
  opacity: 0.62;
}

.map-node-ipa {
  display: block;
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.1;
}

.map-node-ex {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

/* =========================
   HOME / TOP PAGE
========================= */

#homeView,
#lessonView {
  display: block;
}

#homeView .hero-ipa {
  font-size: clamp(2.8rem, 8vw, 5rem);
  letter-spacing: 0.08em;
}

#homeView .hero-badge {
  font-size: 0.98rem;
}

#homeView .hero-card {
  display: flex;
  align-items: center;
}

#homeView .mouth-hint {
  font-size: 1rem;
  line-height: 1.9;
}

#homeView .pattern-card {
  padding: 20px;
}

#homeView .pattern-title {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.4;
}

#homeView .pattern-sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

#homeView .section-block + .section-block {
  margin-top: 0;
}

/* =========================
   HOME INFO COMPACT
========================= */

#homeInfoView {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

#homeInfoView .section-block {
  padding: 18px;
}

#homeInfoView .section-head {
  margin-bottom: 12px;
}

#homeInfoView .section-title {
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
}

#homeInfoView .section-sub {
  margin-top: 6px;
  font-size: 0.9rem;
  line-height: 1.6;
}

#homeInfoView .patterns {
  gap: 10px;
}

#homeInfoView .pattern-card {
  padding: 14px 16px;
  border-radius: 18px;
}

#homeInfoView .pattern-title {
  margin: 0 0 4px;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.35;
}

#homeInfoView .pattern-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* =========================
   ACTIONS
========================= */

.back-to-top {
  margin-top: 40px;
  text-align: center;
}

.dual-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-top {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 12px;
  background: #ff7a1a;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
}

.btn-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.btn-top-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-top-ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

/* Scroll Top Button */

.scroll-top-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #ff7a1a;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 0.25s;
}

.scroll-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  transform: translateY(-2px);
}

/* =========================
   TABLET
========================= */

@media (max-width: 1100px) {
  .sound-map-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

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

/* =========================
   MOBILE
========================= */

@media (max-width: 720px) {
  .wrap {
    width: min(calc(100% - 16px), var(--max));
    padding-top: 14px;
  }

  .site-header {
    gap: 14px;
    margin-bottom: 16px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .hero-inner,
  .section-block {
    padding: 16px;
  }

  .section-head {
    flex-direction: column;
  }

  .speed-row {
    flex-wrap: wrap;
  }

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

  .chip {
    padding: 14px;
    border-radius: 18px;
  }

  .chip .w {
    font-size: 1.05rem;
  }

  .chip .w-ipa {
    margin-top: 5px;
    font-size: 0.84rem;
  }

  .chip .jp {
    margin-top: 6px;
    font-size: 0.9rem;
  }

  .pattern-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .example-item,
  .conversation-turn {
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
  }

  .example-line,
  .conversation-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .example-en,
  .conversation-en {
    font-size: 1rem;
    line-height: 1.42;
  }

  .example-ja,
  .conversation-ja {
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: normal;
    text-align: left;
    max-width: 100%;
  }

  .example-ipa,
  .conversation-ipa {
    margin-top: 5px;
    font-size: 0.9rem;
  }

  .play-mini {
    width: 46px;
    height: 46px;
  }

  .compare-row {
    grid-template-columns: 1fr;
  }

  .compare-words {
    gap: 8px;
  }

  #homeView .hero-ipa {
    font-size: clamp(2.2rem, 10vw, 3.6rem);
    letter-spacing: 0.06em;
  }

  #homeView .pattern-card {
    padding: 16px;
    border-radius: 20px;
  }

  #homeView .pattern-title {
    font-size: 0.98rem;
  }

  #homeView .pattern-sub {
    font-size: 0.9rem;
  }

  #homeInfoView {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  #homeInfoView .section-block {
    padding: 14px;
  }

  #homeInfoView .section-head {
    margin-bottom: 10px;
  }

  #homeInfoView .section-title {
    font-size: 1.05rem;
  }

  #homeInfoView .section-sub {
    font-size: 0.84rem;
    line-height: 1.5;
  }

  #homeInfoView .patterns {
    gap: 8px;
  }

  #homeInfoView .pattern-card {
    padding: 12px 14px;
    border-radius: 16px;
  }

  #homeInfoView .pattern-title {
    font-size: 0.9rem;
    margin-bottom: 3px;
  }

  #homeInfoView .pattern-sub {
    font-size: 0.8rem;
    line-height: 1.42;
  }

  .map-card {
    padding: 10px;
    border-radius: 18px;
  }

  .map-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .map-sections {
    gap: 10px;
  }

  .map-sections--vowels,
  .map-sections--cons {
    grid-template-columns: 1fr;
  }

  .map-block {
    border-radius: 14px;
  }

  .map-block-title {
    padding: 7px 9px;
    font-size: 0.8rem;
  }

  .map-node-grid--short,
  .map-node-grid--long,
  .map-node-grid--diph,
  .map-node-grid--cons {
    grid-template-columns: repeat(2, 1fr);
  }

  .map-node {
    min-height: 56px;
    padding: 7px 4px 6px;
  }

  .map-node-ipa {
    font-size: 0.88rem;
  }

  .map-node-ex {
    margin-top: 4px;
    font-size: 0.64rem;
    line-height: 1.2;
  }
}

.phrases-cta {
  margin: 20px 0 8px;
  display: flex;
  justify-content: center;
}

.phrases-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fbff;
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.phrases-cta-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.phrases-cta-btn:active {
  transform: translateY(0);
}

/* =========================
   PHRASES PAGE
========================= */
.phrases-page .hero-ipa {
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.04em;
}

.phrases-page .hero-badge {
  font-size: 0.98rem;
}

.phrases-root {
  display: grid;
  gap: 22px;
}

.unit-block {
  display: grid;
  gap: 18px;
}

.unit-head {
  display: grid;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.unit-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d6e2ff;
}

.unit-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 900;
}

.unit-lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.phrase-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.03)
  );
  border-radius: 24px;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.phrase-head {
  display: grid;
  gap: 8px;
}

.phrase-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.phrase-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 900;
}

.phrase-meaning {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
  color: #eafff2;
}

.phrase-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.94rem;
}

.phrase-section-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 900;
  color: #eef5ff;
  letter-spacing: 0.02em;
}

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

.phrase-example {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.phrase-example-main {
  min-width: 0;
}

.phrase-example-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.phrase-example-en {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.phrase-example-ja {
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
  font-size: 0.96rem;
  max-width: 26ch;
}

.phrase-example-ipa {
  margin-top: 6px;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ipa);
  word-break: break-word;
}

.phrase-focus {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phrase-focus-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  margin-right: 2px;
}

.phrase-focus-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.phrase-focus-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}

.phrases-unit-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.phrases-unit-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fbff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.phrases-unit-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

/* =========================
   PHRASES CLICK / SPEAK FEEDBACK
========================= */

.phrase-example,
.phrase-compare-card {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.14s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease;
}

.phrase-example:hover,
.phrase-compare-card:hover {
  transform: translateY(-1px);
}

.phrase-example:active,
.phrase-compare-card:active,
.phrase-example.is-pressed,
.phrase-compare-card.is-pressed {
  transform: scale(0.992);
}

.phrase-example.is-pressed,
.phrase-compare-card.is-pressed {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 10px 22px rgba(0, 0, 0, 0.18);
}

.phrase-example.is-speaking,
.phrase-compare-card.is-speaking {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.24),
    0 0 0 6px rgba(139, 92, 246, 0.08),
    0 16px 34px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(
      180deg,
      rgba(139, 92, 246, 0.11),
      rgba(249, 115, 22, 0.06)
    ),
    rgba(255, 255, 255, 0.04);
}

.phrase-example.is-speaking .play-mini,
.phrase-compare-card.is-speaking .play-mini {
  transform: scale(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 6px rgba(139, 92, 246, 0.12);
}

.phrase-example.is-speaking .phrase-example-en,
.phrase-compare-card.is-speaking .phrase-compare-en {
  color: #ffffff;
}

.phrase-example.is-speaking .phrase-example-ipa,
.phrase-compare-card.is-speaking .phrase-compare-ipa {
  color: #d9c7ff;
}

.play-mini {
  transition:
    transform 0.14s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.play-mini:active {
  transform: scale(0.96);
}

@media (prefers-reduced-motion: reduce) {
  .phrase-example,
  .phrase-compare-card,
  .play-mini {
    transition: none;
  }
}



/* =========================
   PHRASES COMPARE
========================= */

.phrase-compare-section {
  display: grid;
  gap: 14px;
  margin-top: 2px;
}

.phrase-compare-section-head {
  display: grid;
  gap: 8px;
}

.phrase-compare-section-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #f3f7ff;
}

.phrase-compare-section-sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.phrase-compare-wrap {
  display: grid;
  gap: 16px;
}

.phrase-compare-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.045),
    rgba(255, 255, 255, 0.025)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.phrase-compare-block-head {
  display: grid;
  gap: 8px;
}

.phrase-compare-block-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 900;
  color: #f4f7ff;
}

.phrase-compare-block-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.94rem;
}

.phrase-compare-list {
  display: grid;
  gap: 12px;
}

.phrase-compare-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
}

.phrase-compare-card-main {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.phrase-compare-sides {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}

.phrase-compare-side {
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.phrase-compare-side.is-a {
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.08);
}

.phrase-compare-side.is-b {
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.08);
}

.phrase-compare-side-head {
  margin-bottom: 8px;
}

.phrase-compare-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.28),
    rgba(249, 115, 22, 0.24)
  );
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.phrase-compare-side-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.phrase-compare-en {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.phrase-compare-side-ja {
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
  font-size: 0.94rem;
  max-width: 24ch;
}

.phrase-compare-ipa {
  margin-top: 6px;
  color: var(--ipa);
  font-size: 0.96rem;
  line-height: 1.55;
  word-break: break-word;
}

.phrase-compare-divider {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.24),
    rgba(249, 115, 22, 0.2)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phrase-compare-note-ja {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 720px) {
  .phrase-compare-card {
    grid-template-columns: 1fr;
  }

  .phrase-compare-sides {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .phrase-compare-divider {
    justify-self: start;
    min-width: 44px;
    height: 32px;
  }

  .phrase-compare-side-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .phrase-compare-side-ja {
    text-align: left;
    max-width: 100%;
    font-size: 0.9rem;
  }

  .phrase-compare-section-title {
    font-size: 1.18rem;
  }
}




.unit-back-top {
  margin-top: 12px;
  text-align: right;
}

.unit-back-top-link {
  color: #8fb7ff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.unit-back-top-link:hover {
  text-decoration: underline;
}

.variation-list {
  display: grid;
  gap: 10px;
}

.variation-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.variation-main {
  min-width: 0;
}

.variation-en {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.variation-ja {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.9rem;
}

.variation-ipa {
  margin-top: 5px;
  color: var(--ipa);
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

.template-box {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.14),
    rgba(6, 182, 212, 0.12)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.template-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dbe9ff;
}

.template-line {
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

@media (max-width: 720px) {
  .phrase-card {
    padding: 16px;
    border-radius: 20px;
  }

  .phrase-example-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .phrase-example-ja {
    text-align: left;
    max-width: 100%;
    font-size: 0.9rem;
  }
}

/* step */
.phrase-step {
  margin-top: 10px;
}

.phrase-step-title {
  font-size: 0.95rem;
  font-weight: 900;
  margin-bottom: 8px;
  color: #e5ecff;
}

/* CTA */
.phrases-cta {
  margin: 20px 0 28px;
  display: flex;
  justify-content: center;
}

.phrases-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  color: #f8fbff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
  transition: all 0.18s ease;
}

.phrases-cta-btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.24);
}

.back-links {
  margin: 40px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.back-link {
  font-size: 0.9rem;
  color: #8fb7ff;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.next-actions {
  margin-top: 36px;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.back-link-top {
  font-size: 0.9rem;
  color: #8fb7ff;
  text-decoration: none;
}

.back-link-top:hover {
  text-decoration: underline;
}

.listening-cta {
  margin-top: 20px;
  text-align: center;
}

.step-box {
  margin-bottom: 12px;
  margin-bottom: 28px; /* ←ここ広げる */
}

.step-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.step-label {
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #eef5ff;
}

.step-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    opacity 0.18s ease;
}

.step-btn:hover {
  transform: translateY(-1px);
}

.step-btn.done {
  background: #22c55e;
  color: #081120;
}

.goal-box {
  margin-top: 20px;
}

.goal {
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.28);
  text-align: center;
}

.goal-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
}

.goal-sub {
  margin: 8px 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.goal-next-btn,
.goal-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: none;
  background: #22c55e;
  color: #081120;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.sound-tab.is-done {
  position: relative;
  padding-right: 30px;
}

.sound-tab-check {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-size: 0.72rem;
  font-weight: 900;
}

/* STEPごとに少しだけ色変える */
.step-box:nth-of-type(1) .step-row {
  background: linear-gradient(90deg, rgba(139,92,246,0.15), transparent);
}

.step-box:nth-of-type(2) .step-row {
  background: linear-gradient(90deg, rgba(59,130,246,0.15), transparent);
}

.step-box:nth-of-type(3) .step-row {
  background: linear-gradient(90deg, rgba(16,185,129,0.15), transparent);
}

.step-box:nth-of-type(4) .step-row {
  background: linear-gradient(90deg, rgba(245,158,11,0.15), transparent);
}

.step-box:nth-of-type(5) .step-row {
  background: linear-gradient(90deg, rgba(236,72,153,0.15), transparent);
}

.step-btn.done {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: #081120;
}