:root {
  color-scheme: light;
  --ink: #27313c;
  --muted: #66717f;
  --paper: #fffdf8;
  --sun: #ffd166;
  --mint: #8bd7c5;
  --rose: #ff9b9b;
  --sky: #8cc8ff;
  --leaf: #99c97b;
  --line: rgba(39, 49, 60, 0.12);
  --shadow: 0 16px 34px rgba(64, 48, 24, 0.12);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 209, 102, 0.35), transparent 30%),
    radial-gradient(circle at 85% 8%, rgba(140, 200, 255, 0.28), transparent 34%),
    linear-gradient(180deg, #fff7e8 0%, #f5fbff 100%);
  color: var(--ink);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.top-bar,
.scene-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #7c5d2f;
  font-size: 13px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 36px;
  line-height: 1;
}

h2 {
  font-size: 30px;
  line-height: 1.05;
}

.icon-button,
.back-button,
.sheet-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 900;
}

.back-button {
  width: 48px;
  height: 48px;
  font-size: 38px;
  line-height: 1;
}

.scene-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.scene-card {
  display: grid;
  grid-template-columns: 90px 1fr 42px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
  text-align: left;
}

.scene-art,
.picture-frame,
.sheet-picture {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent-a), var(--accent-b));
  font-size: 46px;
}

.scene-card h3 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.05;
}

.scene-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.scene-arrow {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 21px;
  background: #f1f7f2;
  font-size: 26px;
  font-weight: 900;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 16px;
}

.word-card {
  display: flex;
  min-height: 178px;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 10px 24px rgba(64, 48, 24, 0.1);
  text-align: center;
}

.word-card .picture-frame {
  width: 100%;
  font-size: 74px;
}

.word-card strong {
  display: block;
  min-height: 32px;
  font-size: 24px;
  line-height: 1.1;
}

.word-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(39, 49, 60, 0.36);
}

.audio-toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 40;
  width: min(calc(100% - 36px), 440px);
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(39, 49, 60, 0.92);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(39, 49, 60, 0.2);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
}

.word-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 520px);
  padding: 22px 18px max(24px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  box-shadow: 0 -20px 50px rgba(39, 49, 60, 0.18);
  transform: translateX(-50%);
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 21px;
  box-shadow: none;
  background: #f1f4f6;
}

.sheet-picture {
  width: 140px;
  margin: 8px auto 12px;
  font-size: 76px;
}

.word-label {
  margin: 0 0 14px;
  text-align: center;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
}

.sound-row,
.sentence-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f2f8ff;
  text-align: left;
}

.sentence-row {
  background: #f3fbf1;
}

.sound-row span,
.sentence-row span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: #ffffff;
  color: #2f6fa8;
  font-size: 18px;
}

.sound-row strong {
  font-size: 25px;
}

.sentence-row strong {
  font-size: 19px;
  line-height: 1.2;
}

.is-hidden {
  display: none;
}

.is-speaking {
  outline: 4px solid rgba(255, 209, 102, 0.75);
  outline-offset: 2px;
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 34px;
  }

  .scene-grid {
    grid-template-columns: 1fr;
  }
}
