* { box-sizing: border-box; }
:root {
  --banner-background: linear-gradient(135deg, #ffb473, #ffca8c 70%, #ffdba3);
  color-scheme: light;
  --ready-green: #e4f4df;
  --paper: #fff8ef;
  --card: #fffefa;
  --ink: #382219;
  --muted: #745345;
  --accent: #a83e13;
  --line: #f0d7c3;
  --peach: #fff0df;
}
body { margin: 0; background: var(--paper); color: var(--ink); font-family: system-ui, "Malgun Gothic", sans-serif; line-height: 1.55; }
.wrap { width: calc(100% - 2rem); max-width: 40rem; margin: 0 auto; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner, .brand, .section-head { display: flex; align-items: center; }
.top-inner { min-height: 4rem; justify-content: space-between; gap: .5rem; }
.brand { gap: .55rem; letter-spacing: .045em; font-weight: 900; white-space: nowrap; }
.mark { display: flex; align-items: center; justify-content: center; gap: 2px; width: 2rem; height: 2rem; border-radius: .7rem; background: #ffad6e; }
.mark i { width: 2px; height: .42rem; border-radius: 2px; background: #55270f; }
.mark i:nth-child(2n) { height: .7rem; }
.mark i:nth-child(3) { height: 1rem; }
.connection { padding: .3rem .65rem; border-radius: 999px; background: #ffedda; color: #7b391c; font-size: .8125rem; font-weight: 750; white-space: nowrap; }
.connection[data-ready="true"] { background: var(--ready-green); color: #29512b; }
main { padding-block: 1rem max(2.5rem, env(safe-area-inset-bottom)); }
.hero { overflow: hidden; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) clamp(5rem, 25vw, 10rem); column-gap: .35rem; align-items: center; padding: clamp(1rem, 4vw, 1.7rem); border: 1px solid #f6a363; border-radius: 1.65rem; background: var(--banner-background); }
.hero h1 { margin: 0; font-size: clamp(1.65rem, 7vw, 3.25rem); letter-spacing: -.055em; line-height: 1.08; font-weight: 950; }
.hero p { margin: .55rem 0 0; max-width: 18rem; color: #59301f; font-weight: 650; word-break: keep-all; }
.steps { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; list-style: none; padding: 0; margin: .95rem 0 0; font-size: .8125rem; font-weight: 750; }
.steps li { padding: .22rem .52rem; border-radius: 999px; background: #fff0d7; }
.steps li + li::before { content: "·"; margin-right: .35rem; color: #a44319; }

.mascot { position: relative; justify-self: center; width: clamp(4.9rem, 23vw, 8.75rem); height: clamp(4.9rem, 23vw, 8.75rem); display: grid; place-items: center; container-type: inline-size; }
.mascot::before { content: ""; position: absolute; inset: 9% 4% 1% 7%; background: #ffdc9c; border-radius: 50%; }
.mascot::after { content: "✦"; position: absolute; top: 0; right: 2%; color: #84350e; font-size: clamp(.9rem, 4vw, 1.5rem); }
.note { position: absolute; inset: 22% 23% 13%; border: 2px solid #6e351d; border-radius: 18% 20% 23% 22%; background: #fff8e6; box-shadow: 3px 4px 0 #b25028; transform: rotate(10deg); }
.note::before { content: ""; position: absolute; inset: 18% 24% auto; height: 3px; background: #e6aa7d; border-radius: 99px; }
.note::after { content: ""; position: absolute; width: 20%; height: 10%; bottom: 26%; left: 40%; border: 2px solid #683018; border-top: 0; border-radius: 0 0 99px 99px; }
.eyes { position: absolute; inset: 42% 23% auto; display: flex; justify-content: space-between; }
.eyes i { width: 14%; aspect-ratio: 1; border-radius: 50%; background: #4e2718; }
.cheeks { position: absolute; inset: 55% 14% auto; display: flex; justify-content: space-between; }
.cheeks i { width: 20%; height: clamp(3px, 6cqw, 7px); border-radius: 99px; background: #ff9c7c; }
.headphones { position: absolute; inset: 9% 17% 36%; border: clamp(3px, 6cqw, 7px) solid #743316; border-bottom: 0; border-radius: 50% 50% 0 0; transform: rotate(10deg); }
.headphones::before, .headphones::after { content: ""; position: absolute; width: 21%; height: 43%; bottom: -13%; border: 2px solid #743316; border-radius: 99px; background: #f27542; }
.headphones::before { left: -15%; }
.headphones::after { right: -15%; }

.panel, .lecture, .empty { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 1.25rem; padding: 1rem; }
.panel, .library { margin-top: .95rem; }
.panel { box-shadow: 0 3px 0 #f5e2d1; }
h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.035em; }
form { display: grid; gap: .65rem; margin-top: .65rem; }
button, .picker, .download { min-height: 2.875rem; font: inherit; font-weight: 780; border-radius: .9rem; cursor: pointer; }
button { border: 0; padding: .6rem .9rem; background: var(--accent); color: white; }
button:disabled { background: #f4e5d9; color: #77584a; cursor: default; }
.picker { position: relative; display: flex; align-items: center; gap: .65rem; padding: .7rem; border: 1px dashed #c47850; background: #fff7ed; overflow-wrap: anywhere; }
.picker > span { min-width: 0; }
.picker:focus-within, :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.picker input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.file-icon { flex: 0 0 2.25rem; display: grid; place-items: center; min-height: 2.25rem; border-radius: .75rem; background: #ffdfc0; color: #823312; font-size: 1.25rem; }
.ratio-setting { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.ratio-setting label, .ratio-setting output { white-space: nowrap; font-weight: 750; }
.ratio-setting output { color: var(--accent); font-variant-numeric: tabular-nums; }
.narration-setting { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.narration-setting label { font-weight: 750; }
.narration-setting select { min-height: 44px; min-width: 6rem; padding-inline: .55rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--card); color: var(--ink); font: inherit; }
.narration-setting select:disabled { opacity: .55; }
#summary-ratio { flex: 1; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
small, .meta, .notice, #count { color: var(--muted); font-size: .875rem; }
small { display: block; margin-top: .08rem; font-weight: 500; }
progress { width: 100%; margin-top: .75rem; accent-color: var(--accent); }
.notice { margin: .55rem 0 0; }
.notice:empty { display: none; }
.secondary, .download { background: #ffdab8; color: #702e10; }
.section-head { justify-content: space-between; gap: .65rem; margin-bottom: .55rem; }
.empty, .lecture { margin: 0 0 .55rem; }
.empty { color: var(--muted); }
.lecture h3 { margin: 0; font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.lecture p { margin: .3rem 0; }
.status { font-size: .875rem; font-weight: 650; color: var(--accent); }
.status[data-state="failed"] { color: #9d2340; }
.listen { min-width: 0; margin-block: .65rem; }
audio { display: block; width: 100%; min-width: 0; margin: .25rem 0 .5rem; }
.downloads { display: flex; flex-wrap: wrap; gap: .4rem; }
.download { display: inline-flex; align-items: center; padding: .45rem .8rem; text-decoration: none; }
details { border-top: 1px solid var(--line); }
summary { display: list-item; min-height: 2.875rem; padding-block: .65rem; cursor: pointer; font-weight: 700; }
.lecture details p { margin-bottom: .7rem; color: var(--ink); font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
@media (max-width: 350px) {
  .wrap { width: calc(100% - 1.25rem); }
  .panel, .lecture { padding: .8rem; }
}
.recorder { margin-top: .65rem; }
#record { background: #b32d35; color: #fff; }
#record:disabled { opacity: .7; }
#record-status { display: block; margin-top: .3rem; color: var(--muted); font-size: .875rem; }
#record-result { padding-block: .4rem; }

.summary-files { display: grid; gap: .4rem; }
.summary-files button { text-align: left; overflow-wrap: anywhere; }
.summary-files button[aria-pressed="true"] { background: var(--accent); color: white; }

.page-header { position: sticky; top: 0; z-index: 5; background: var(--paper); padding-block: .3rem; }
.page-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; margin-top: .4rem; }
.page-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .18rem; min-height: 2.125rem; padding: .2rem .1rem; border: 1px solid #f6a363; border-radius: .65rem; background: var(--banner-background); color: var(--ink); text-decoration: none; font-size: clamp(.8125rem, 3.6vw, 1rem); font-weight: 800; line-height: 1.2; text-align: center; word-break: keep-all; }
.page-nav a[aria-current="page"] { background: #903308; border-color: #903308; color: #fff; }
.playback select { display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: .45rem; padding-inline: .55rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--card); color: var(--ink); font: inherit; }
.audio-group, .read-group { margin-top: .65rem; padding: .75rem; border: 1px solid var(--line); border-radius: .9rem; background: #fffaf3; }
.audio-group h3, .read-group h3 { margin: 0; font-size: 1rem; }
.script-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 1rem; }

@media (max-height: 520px) {
  .page-header .hero { padding-block: .55rem; }
  .page-header .hero p, .page-header .steps, .page-header .mascot { display: none; }
  .page-header .hero h1 { font-size: 1.5rem; }
}

.delete-file { margin-top: .4rem; }

.read-actions { flex-wrap: nowrap; align-items: center; margin-top: .55rem; }
.read-actions .download, .read-actions .delete-file { padding-inline: .65rem; font-size: .875rem; white-space: nowrap; }
.read-actions .delete-file { margin: 0 0 0 .35rem; border: 1px solid #df9ca5; background: #fff4f5; color: #982037; }
