:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #242320;
  color: #e8e2d8;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; }
button:focus-visible { outline: 2px solid #d4b99b; outline-offset: 3px; }

.app {
  max-width: 600px;
  min-height: 100vh;
  margin: 0 auto;
  background: #292725;
  padding: max(env(safe-area-inset-top), 12px) 20px max(env(safe-area-inset-bottom), 24px);
}

.masthead { display: flex; align-items: center; gap: 11px; min-height: 56px; }
.brand-icon { width: 42px; height: 42px; background: #393531; border: 1px solid #51483f; border-radius: 13px; overflow: hidden; flex: none; }
.brand-icon img { width: 100%; height: 100%; display: block; }
.brand-copy { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.brand-copy strong { font-size: 15px; font-weight: 650; letter-spacing: .04em; }
.brand-copy span { color: #a59c91; font-size: 11px; }
.lesson-chip { color: #d4b99b; background: #3e3730; border: 1px solid #50463b; border-radius: 100px; padding: 7px 11px; font-size: 11px; white-space: nowrap; }

.lesson-heading { padding: 31px 2px 25px; }
.heading-overline { color: #b5a99b; font-size: 12px; letter-spacing: .04em; }
.lesson-heading h1 { font-size: clamp(24px, 6vw, 29px); line-height: 1.6; font-weight: 600; margin: 15px 0 3px; letter-spacing: .02em; }
.lesson-heading h1 rt { font-size: 10px; color: #bfb4a7; }
.lesson-heading p { font-size: 13px; color: #ada398; margin: 0; }

.main-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: #242320; border: 1px solid #3c3935; border-radius: 14px; }
.main-tabs button { min-height: 43px; border: 0; border-radius: 10px; background: transparent; color: #a79d92; font-size: 14px; font-weight: 600; cursor: pointer; }
.main-tabs button[aria-current="page"] { background: #494038; color: #f5e5d1; }
.error { margin-top: 17px; padding: 13px 15px; border: 1px solid #78514a; border-radius: 12px; color: #ffb5a7; font-size: 13px; line-height: 1.6; }
.loading { padding: 50px 0; color: #b7aa9d; text-align: center; font-size: 14px; }

.section-strip { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 22px 0 7px; margin: 0 -2px; }
.section-strip::-webkit-scrollbar { display: none; }
.section-strip button { flex: none; min-height: 35px; padding: 0 14px; border: 1px solid #4c453d; border-radius: 100px; color: #b5aba0; background: transparent; font-size: 12px; cursor: pointer; }
.section-strip button[aria-pressed="true"] { background: #d4b99b; border-color: #d4b99b; color: #292725; font-weight: 700; }
.section-intro { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 22px 0 14px; }
.section-intro h2, .theater-heading h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: .02em; }
.section-intro p, .theater-heading p { margin: 7px 0 0; color: #a99f94; font-size: 12px; }
.play-all { min-height: 37px; border: 1px solid #5f5245; border-radius: 10px; color: #e2cdb7; background: #3a342e; padding: 0 11px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.play-all svg, .small-icon svg { width: 15px; height: 15px; vertical-align: -3px; }

.options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 13px; }
.options button, .voice-options button { min-height: 31px; border: 1px solid #4a443c; border-radius: 8px; background: #302d2a; padding: 0 9px; color: #a99f95; font-size: 11px; cursor: pointer; }
.options button[aria-pressed="true"], .voice-options button[aria-pressed="true"] { color: #ead7c3; border-color: #75614e; background: #403830; }
.options .hint { flex: 1; min-width: 90px; text-align: right; color: #8f877e; font-size: 11px; }
.voice-options { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; color: #a99f95; font-size: 11px; }
.voice-options span { margin-right: 2px; }

.reader-list { overflow: hidden; border: 1px solid #48423b; border-radius: 17px; background: #33302d; }
.reader-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 17px 15px; text-align: left; color: inherit; background: transparent; border: 0; border-bottom: 1px solid #46413b; cursor: pointer; }
.reader-item:last-child { border-bottom: 0; }
.reader-item.is-active { background: #4b4036; }
.reader-text { flex: 1; min-width: 0; }
.speaker { color: #c5a88b; font-size: 11px; font-weight: 600; margin-bottom: 5px; }
.japanese { font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", -apple-system, sans-serif; font-size: 17px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.japanese rt { color: #bdafa1; font-size: 9px; }
.translation { color: #b7ada2; font-size: 12px; line-height: 1.65; margin-top: 3px; }
.word-meta { color: #a89c8d; font-size: 11px; margin-top: 5px; }
.row-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #5c5045; border-radius: 50%; color: #d2b89c; flex: none; }
.row-icon svg { width: 15px; height: 15px; }
.hide-ruby rt { visibility: hidden; }
.hide-translation .translation { display: none; }

.theater-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 25px 0 16px; }
.theater-count { color: #bea991; font-size: 12px; white-space: nowrap; }
.scene-card { border: 1px solid #49423b; border-radius: 16px; overflow: hidden; background: #33302d; }
.scene-media { width: 100%; aspect-ratio: 740 / 500; overflow: hidden; background: #211f1d; }
.scene-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.scene-dialogue { padding: 18px 18px 20px; min-height: 123px; }
.scene-dialogue .speaker { margin-bottom: 8px; }
.scene-dialogue .japanese { font-size: 18px; }
.scene-dialogue .translation { margin-top: 7px; }
.theater-controls { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; margin-top: 13px; }
.theater-controls button { min-height: 46px; padding: 8px; border: 1px solid #51483f; border-radius: 12px; color: #d9c7b5; background: #37322e; font-size: 13px; cursor: pointer; }
.theater-controls button.primary { color: #292725; background: #d4b99b; border-color: #d4b99b; font-weight: 700; }
.theater-controls button:disabled { color: #716a62; opacity: .6; cursor: default; }
.theater-extra { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 13px 2px 0; }
.theater-extra button { color: #bfb1a1; border: 0; background: transparent; padding: 8px 2px; font-size: 12px; cursor: pointer; }
.theater-extra .options { margin: 0; gap: 6px; }
.theater-extra .options button { padding: 0 8px; }

footer { padding: 33px 0 4px; color: #827970; text-align: center; font-size: 11px; }

@media (min-width: 650px) {
  .app { min-height: 100vh; padding-left: 32px; padding-right: 32px; box-shadow: 0 0 50px #181715; }
}

@media (max-width: 350px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .reader-item { padding-left: 12px; padding-right: 12px; }
}
