:root {
  color-scheme: light;
  --ink: #172019;
  --muted: #69746c;
  --paper: #f4f2eb;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --line: #dcded7;
  --green: #284f39;
  --green-soft: #dce9df;
  --coral: #e9785e;
  --coral-soft: #fae4dd;
  --gold: #e6b85c;
  --shadow: 0 18px 48px rgba(31, 48, 37, .09);
}

* { box-sizing: border-box; }
html { background: #dfe4de; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(233,120,94,.18), transparent 29rem),
    radial-gradient(circle at 85% 15%, rgba(40,79,57,.18), transparent 32rem),
    #e7ebe5;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 88px;
  background: var(--paper);
  box-shadow: var(--shadow);
  position: relative;
}
.topbar {
  height: 68px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(244,242,235,.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { border: 0; background: none; display: flex; align-items: center; gap: 9px; padding: 0; font-weight: 700; cursor: pointer; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 10px; letter-spacing: .12em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--green); color: white; }
.prototype-badge, .tag { border-radius: 999px; padding: 6px 10px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 650; }
main { padding: 12px 20px 30px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 8vw, 38px); line-height: 1.12; letter-spacing: -.045em; margin-bottom: 10px; }
h2 { font-size: 21px; letter-spacing: -.025em; }
h3 { font-size: 16px; }
.eyebrow { color: var(--coral); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 10px; }
.muted { color: var(--muted); line-height: 1.7; }
.hero { padding: 24px 4px 18px; }
.hero p { max-width: 36ch; }
.streak { display: inline-flex; align-items: center; gap: 8px; margin-top: 7px; color: var(--green); font-size: 13px; font-weight: 650; }
.streak::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px var(--coral-soft); }
.section-head { display: flex; align-items: end; justify-content: space-between; margin: 22px 0 12px; }
.section-head h2 { margin: 0; }
.section-head span { color: var(--muted); font-size: 12px; }
.song-card, .panel {
  background: var(--surface);
  border: 1px solid rgba(40,79,57,.09);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(40,79,57,.06);
}
.song-cover {
  min-height: 190px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 18px;
  color: #fbfff8;
  background:
    linear-gradient(135deg, rgba(21,32,25,.08), rgba(21,32,25,.42)),
    radial-gradient(circle at 25% 20%, #f5a18b 0 3%, transparent 3.3%),
    radial-gradient(circle at 72% 28%, #f7c6b7 0 4%, transparent 4.3%),
    linear-gradient(145deg, #53785e 0 48%, #a7bd9f 48% 63%, #e7c58a 63%);
}
.song-cover strong { font-size: 27px; letter-spacing: -.04em; }
.song-cover small { opacity: .88; }
.song-meta { padding: 15px 3px 2px; }
.song-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.song-meta h3 { margin: 0 0 5px; font-size: 18px; }
.song-meta p { margin: 0; color: var(--muted); font-size: 13px; }
.progress-track { height: 7px; border-radius: 999px; background: #e7e6df; overflow: hidden; margin-top: 14px; }
.progress-fill { height: 100%; background: var(--coral); transition: width .25s ease; }
.primary, .secondary, .ghost, .icon-button, .choice {
  border: 0;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
}
.primary:active, .secondary:active, .icon-button:active, .choice:active { transform: scale(.98); }
.primary { width: 100%; min-height: 50px; padding: 12px 18px; background: var(--green); color: white; border-radius: 16px; font-weight: 700; }
.secondary { min-height: 44px; padding: 10px 15px; border-radius: 14px; background: var(--green-soft); color: var(--green); font-weight: 700; }
.ghost { background: transparent; padding: 8px; color: var(--muted); }
.detail-hero { padding: 18px 4px 8px; }
.back { margin-left: -8px; margin-bottom: 18px; }
.detail-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 16px 0; }
.fact { text-align: center; padding: 13px 6px; border-radius: 16px; background: var(--surface); }
.fact strong { display: block; font-size: 16px; }
.fact span { color: var(--muted); font-size: 11px; }
.notice { padding: 12px 14px; border-radius: 14px; background: var(--coral-soft); color: #784334; font-size: 12px; line-height: 1.6; margin: 14px 0; }
.lesson-list { display: grid; gap: 10px; margin: 14px 0 22px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.lesson-number { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 800; }
.lesson-row div:nth-child(2) { flex: 1; }
.lesson-row strong, .lesson-row small { display: block; }
.lesson-row small { color: var(--muted); margin-top: 4px; }
.study-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.study-top .progress-track { flex: 1; margin: 0; }
.counter { font-size: 12px; color: var(--muted); white-space: nowrap; }
.lyric-card { text-align: center; padding: 26px 16px 20px; }
.lyric-original { font-family: "Yu Mincho", "Noto Serif JP", serif; font-size: 27px; margin: 4px 0 12px; }
.lyric-kana { color: var(--green); font-weight: 650; margin-bottom: 8px; }
.lyric-romaji { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.lyric-translation { font-size: 17px; }
.display-options { display: flex; justify-content: center; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.toggle { border: 1px solid var(--line); background: var(--surface); padding: 7px 11px; border-radius: 999px; font-size: 12px; cursor: pointer; }
.toggle[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: white; }
.player { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin: 16px 0; }
.player-main { text-align: center; }
.player-main .progress-track { margin: 8px 0 6px; }
.time-row { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.icon-button { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-strong); box-shadow: 0 6px 18px rgba(40,79,57,.1); }
.icon-button.playing { background: var(--coral); color: white; }
.speed-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.speed { border: 0; background: transparent; color: var(--muted); padding: 6px 9px; border-radius: 10px; cursor: pointer; }
.speed.active { background: var(--green-soft); color: var(--green); font-weight: 700; }
.word-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.word-chip { border: 1px solid var(--line); background: var(--surface-strong); padding: 9px 11px; border-radius: 12px; cursor: pointer; }
.word-detail { min-height: 72px; padding: 13px; border-radius: 14px; background: var(--green-soft); margin: 12px 0 18px; }
.word-detail strong { margin-right: 8px; }
.word-detail small { display: block; color: var(--muted); margin-top: 5px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.record { background: var(--coral-soft); color: #7d3e30; }
.record.recording { background: var(--coral); color: white; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .72; } }
.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.nav-row .secondary { flex: 1; }
.quiz-question { font-size: 19px; font-weight: 700; margin: 12px 0 16px; }
.choices { display: grid; gap: 10px; }
.choice { text-align: left; background: var(--surface); border: 1px solid var(--line); padding: 14px; border-radius: 14px; }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.wrong { border-color: var(--coral); background: var(--coral-soft); }
.empty-state { text-align: center; padding: 70px 20px; }
.empty-icon { width: 74px; height: 74px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 26px; background: var(--green-soft); font-size: 30px; }
.report-score { width: 126px; height: 126px; margin: 12px auto 22px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--coral) var(--score), #e2e2da 0); position: relative; }
.report-score::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.report-score strong { z-index: 1; font-size: 28px; }
.bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px); min-height: 70px; display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 14px max(8px, env(safe-area-inset-bottom)); background: rgba(255,253,248,.95); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
.bottom-nav button { border: 0; background: transparent; color: var(--muted); display: grid; place-content: center; gap: 3px; font-size: 11px; cursor: pointer; }
.bottom-nav button span { font-size: 19px; }
.bottom-nav button.active { color: var(--green); font-weight: 750; }
.feedback-trigger {
  position: fixed;
  z-index: 30;
  right: max(16px, calc((100vw - 520px) / 2 + 16px));
  bottom: calc(82px + env(safe-area-inset-bottom));
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(40,79,57,.16);
  border-radius: 999px;
  background: rgba(255,253,248,.96);
  color: var(--green);
  box-shadow: 0 8px 22px rgba(40,79,57,.12);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.feedback-trigger:hover { background: var(--green-soft); box-shadow: 0 10px 26px rgba(40,79,57,.16); }
.feedback-trigger:active { transform: scale(.98); }
.feedback-dialog {
  width: min(calc(100% - 28px), 488px);
  max-height: min(86vh, 760px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(40,79,57,.14);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(21,32,25,.22);
  overflow: hidden;
}
.feedback-dialog[open] { display: flex; flex-direction: column; }
.feedback-dialog::backdrop { background: rgba(21,32,25,.46); backdrop-filter: blur(3px); }
.feedback-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.feedback-title {
  margin: 7px 0 0;
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 24px;
  letter-spacing: -.035em;
}
.feedback-phrase-mark { display: flex; align-items: center; gap: 4px; height: 5px; }
.feedback-phrase-mark span { width: 18px; height: 3px; border-radius: 999px; background: var(--line); }
.feedback-phrase-mark .active { width: 28px; background: var(--coral); }
.feedback-close {
  min-width: 44px;
  min-height: 44px;
  margin: -9px -9px 0 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.feedback-close:hover { background: var(--green-soft); color: var(--green); }
.feedback-content {
  overflow-y: auto;
}
.feedback-form, .feedback-receipt {
  padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
}
.feedback-form { display: grid; gap: 16px; }
.feedback-receipt { border-top: 1px solid var(--line); }
.feedback-receipt-item + .feedback-receipt-item { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.feedback-receipt-notice { margin: 0 20px 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.feedback-field { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.feedback-field select,
.feedback-field input,
.feedback-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 450;
  outline: none;
}
.feedback-field select, .feedback-field input { min-height: 44px; padding: 9px 11px; }
.feedback-field textarea { min-height: 126px; padding: 11px 12px; line-height: 1.65; resize: vertical; }
.feedback-counter { justify-self: end; color: var(--muted); font-size: 11px; font-weight: 500; }
.feedback-rating { min-width: 0; margin: 0; padding: 0; border: 0; }
.feedback-rating legend { margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.feedback-rating-options { display: flex; gap: 6px; flex-wrap: wrap; }
.feedback-rating-options label { cursor: pointer; }
.feedback-rating-options input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-rating-options span {
  min-width: 36px;
  min-height: 36px;
  padding: 7px 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.feedback-rating-options input:checked + span { border-color: var(--green); background: var(--green); color: white; font-weight: 750; }
.feedback-rating-options input:focus-visible + span { outline: 3px solid rgba(233,120,94,.35); outline-offset: 2px; }
.feedback-privacy { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.feedback-status { min-height: 19px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.feedback-status.loading { color: var(--green); }
.feedback-status.error { color: #9a3f30; }
.feedback-status.success { color: var(--green); font-weight: 700; }
.feedback-submit:disabled,
.feedback-contact-submit:disabled,
.feedback-withdraw:disabled { cursor: wait; opacity: .68; }
.feedback-honeypot { position: fixed; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.feedback-success { margin-bottom: 8px; color: var(--green); font-weight: 750; line-height: 1.6; }
.feedback-receipt-id { margin-bottom: 13px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.feedback-withdraw {
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #9a3f30;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.feedback-contact-form { display: grid; gap: 13px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.feedback-contact-form h3 { margin: 0; }
.feedback-contact-submit { width: 100%; }
.feedback-contact-expand { width: 100%; margin-top: 4px; }
.feedback-consent { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: 12px; line-height: 1.55; cursor: pointer; }
.feedback-consent input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--green); }
.feedback-invite {
  position: fixed;
  z-index: 31;
  right: max(16px, calc((100vw - 520px) / 2 + 16px));
  bottom: calc(134px + env(safe-area-inset-bottom));
  width: min(286px, calc(100vw - 32px));
  padding: 13px 14px;
  border: 1px solid rgba(40,79,57,.13);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(40,79,57,.16);
}
.feedback-invite p { margin: 0 0 9px; font-size: 13px; font-weight: 700; }
.feedback-invite div { display: flex; justify-content: flex-end; gap: 6px; }
.feedback-invite button { min-height: 34px; padding: 6px 9px; border: 0; border-radius: 10px; cursor: pointer; font-size: 11px; }
.feedback-invite-open { background: var(--green-soft); color: var(--green); font-weight: 750; }
.feedback-invite-close { background: transparent; color: var(--muted); }
.feedback-trigger:focus-visible,
.feedback-dialog button:focus-visible,
.feedback-dialog input:focus-visible,
.feedback-dialog select:focus-visible,
.feedback-dialog textarea:focus-visible,
.feedback-invite button:focus-visible {
  outline: 3px solid rgba(233,120,94,.38);
  outline-offset: 2px;
}
.feedback-field input:focus-visible,
.feedback-field select:focus-visible,
.feedback-field textarea:focus-visible { border-color: var(--green); }
#toast { position: fixed; z-index: 50; left: 50%; bottom: 88px; transform: translate(-50%, 20px); max-width: min(88vw, 420px); padding: 11px 15px; border-radius: 12px; background: #162019; color: white; opacity: 0; pointer-events: none; transition: .2s; text-align: center; font-size: 13px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border-radius: 30px; overflow: hidden; }
  .bottom-nav { bottom: 24px; border-radius: 0 0 30px 30px; }
  .feedback-trigger { bottom: 110px; }
  .feedback-invite { bottom: 162px; }
}
@media (max-width: 380px) {
  .feedback-dialog { width: calc(100% - 18px); max-height: 92vh; border-radius: 20px; }
  .feedback-dialog-head { padding: 17px 16px 12px; }
  .feedback-form, .feedback-receipt { padding-left: 16px; padding-right: 16px; }
  .feedback-rating-options { gap: 5px; }
  .feedback-rating-options span { min-width: 34px; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
