:root {
  --bg: #241b12;
  --bg-soft: #332615;
  --paper: #efe2c2;
  --paper-soft: #f6eccf;
  --paper-deep: #d7bd82;
  --amber: #d58a2a;
  --amber-light: #f1c46a;
  --brown: #6b4423;
  --text-main: #fff4df;
  --text-muted: #cbbda3;
  --ink: #2b2118;
  --green: #5b6b45;
  --red: #8a3f2d;
  font-family:
    "Noto Sans SC", "LXGW WenKai Screen", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 24% 6%, rgba(241, 196, 106, 0.16), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(91, 107, 69, 0.2), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, #1b140e 100%);
  color: var(--text-main);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  background-image:
    linear-gradient(rgba(255, 244, 223, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 244, 223, 0.035) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 244, 223, 0.16) 0 1px, transparent 1.4px);
  background-size: 34px 34px, 34px 34px, 12px 12px;
  mix-blend-mode: screen;
}

button {
  border: 0;
  font: inherit;
}

.app {
  width: min(100vw, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 24px max(22px, env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
}

.screen {
  min-height: calc(100svh - 40px);
  display: flex;
  flex-direction: column;
  animation: page-in 360ms ease both;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 18px auto auto -34px;
  width: 124px;
  height: 38px;
  background: rgba(215, 189, 130, 0.24);
  transform: rotate(-10deg);
  border: 1px solid rgba(239, 226, 194, 0.18);
  pointer-events: none;
}

.hero,
.summary {
  justify-content: center;
  gap: 22px;
}

.hero {
  align-items: center;
  text-align: center;
}

.file-label,
.kicker {
  width: fit-content;
  border: 1px solid rgba(107, 68, 35, 0.38);
  border-radius: 4px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--paper-deep);
  font-size: 13px;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 0 rgba(43, 33, 24, 0.18);
}

.tape-label {
  position: relative;
  transform: rotate(-1.5deg);
}

.tape-label::after {
  content: "";
  position: absolute;
  right: -14px;
  top: 50%;
  width: 26px;
  height: 15px;
  background: rgba(239, 226, 194, 0.36);
  transform: translateY(-50%) rotate(8deg);
  border: 1px solid rgba(107, 68, 35, 0.1);
}

.home-poster,
.paper-card,
.paper-strip,
.danmaku-stage {
  position: relative;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.22), transparent 23%),
    linear-gradient(145deg, var(--paper-soft), var(--paper));
  color: var(--ink);
  border: 1px solid rgba(107, 68, 35, 0.28);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.home-poster::before,
.paper-card::before,
.paper-strip::before,
.danmaku-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(43, 33, 24, 0.28) 0 0.8px, transparent 1.2px),
    linear-gradient(90deg, rgba(107, 68, 35, 0.08), transparent 42%);
  background-size: 10px 10px, 100% 100%;
}

.home-poster {
  width: 100%;
  min-height: 260px;
  border-radius: 8px;
  padding: 46px 20px 34px;
  display: grid;
  place-items: center;
  gap: 18px;
  transform: rotate(0.7deg);
}

.home-poster::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 28px;
  top: -12px;
  height: 24px;
  background: rgba(215, 189, 130, 0.48);
  transform: rotate(-1.5deg);
  border: 1px solid rgba(107, 68, 35, 0.12);
}

.title {
  margin: 0;
  color: var(--ink);
  font-family:
    "Smiley Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(38px, 12vw, 50px);
  line-height: 1.08;
  letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 rgba(215, 189, 130, 0.5);
}

.home-title {
  max-width: 100%;
  text-align: center;
  font-size: clamp(30px, 9vw, 42px);
}

.subtitle,
.narration,
.summary-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.62;
  font-weight: 400;
}

.home-subtitle {
  color: #5f4934;
  text-align: center;
}

.primary-btn,
.warm-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 7px;
  padding: 0 20px;
  font-weight: 800;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 20%, rgba(255, 255, 255, 0.24), transparent 24%),
    linear-gradient(135deg, var(--amber-light), var(--amber));
  border: 2px solid rgba(107, 68, 35, 0.42);
  box-shadow:
    0 8px 0 #8d5823,
    0 18px 30px rgba(0, 0, 0, 0.2);
}

.paper-btn {
  transform: rotate(-0.8deg);
}

.primary-btn:active,
.warm-btn:active {
  transform: translateY(5px) rotate(-0.8deg);
  box-shadow:
    0 3px 0 #8d5823,
    0 10px 20px rgba(0, 0, 0, 0.16);
}

.scene {
  display: grid;
  grid-template-rows: 8svh 16svh minmax(260px, 39svh) minmax(205px, 27svh) auto;
  gap: 8px;
}

.scene-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-text {
  color: var(--text-muted);
  font-size: 13px;
}

.paper-strip {
  border-radius: 8px;
  padding: 14px 14px 12px;
  align-self: start;
  transform: rotate(-0.4deg);
}

.scene-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 27px;
  line-height: 1.14;
  font-weight: 900;
}

.paper-strip .narration {
  color: #725741;
  font-size: 14px;
  line-height: 1.5;
}

.visual {
  width: min(100%, 306px);
  aspect-ratio: 3 / 4;
  max-height: 39svh;
  margin: 0 auto;
  padding: 8px;
  border-radius: 6px;
  position: relative;
  overflow: visible;
  background: var(--paper);
  border: 1px solid rgba(107, 68, 35, 0.34);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.24),
    0 0 0 7px rgba(239, 226, 194, 0.14);
  transform: rotate(0.8deg);
}

.visual::before,
.visual::after {
  content: "";
  position: absolute;
  width: 74px;
  height: 20px;
  background: rgba(215, 189, 130, 0.5);
  border: 1px solid rgba(107, 68, 35, 0.12);
  z-index: 2;
}

.visual::before {
  left: -18px;
  top: 18px;
  transform: rotate(-16deg);
}

.visual::after {
  right: -18px;
  bottom: 28px;
  transform: rotate(-14deg);
}

.visual img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: cover;
  filter: sepia(0.06) saturate(0.94) contrast(1.02) brightness(1.06);
}

.score-zone {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 0;
}

.ring-button {
  --score: 0;
  --progress: 0%;
  width: 164px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  color: var(--paper);
  background:
    radial-gradient(circle, #332615 0 52%, transparent 53%),
    repeating-conic-gradient(from -1deg, rgba(239, 226, 194, 0.64) 0 1deg, transparent 1deg 7.2deg),
    conic-gradient(var(--amber) var(--progress), rgba(239, 226, 194, 0.18) 0);
  border: 2px solid rgba(239, 226, 194, 0.32);
  box-shadow:
    inset 0 0 0 8px rgba(43, 33, 24, 0.5),
    0 0 0 7px rgba(215, 189, 130, 0.14),
    0 14px 24px rgba(0, 0, 0, 0.24);
  user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.ring-button.is-pressing {
  box-shadow:
    inset 0 0 0 8px rgba(43, 33, 24, 0.44),
    0 0 0 7px rgba(215, 189, 130, 0.2),
    0 0 30px rgba(213, 138, 42, 0.32);
}

.meter-face {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle at 50% 25%, rgba(255, 255, 255, 0.06), transparent 30%),
    #2b2118;
  border: 1px solid rgba(239, 226, 194, 0.18);
}

.meter-title {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
}

.score-number {
  color: var(--amber-light);
  font-size: 39px;
  font-weight: 900;
  line-height: 0.98;
}

.score-label {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
}

.score-level {
  margin-top: 5px;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--ink);
  background: var(--paper-deep);
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
}

.tick {
  position: absolute;
  color: rgba(239, 226, 194, 0.72);
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.tick-0 {
  left: 12px;
  bottom: 42px;
}

.tick-25 {
  left: 25px;
  top: 28px;
}

.tick-50 {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.tick-75 {
  right: 25px;
  top: 28px;
}

.tick-100 {
  right: 10px;
  bottom: 42px;
}

.tip {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.recorded {
  min-height: 20px;
  color: var(--amber-light);
  font-size: 13px;
}

.recorded.show {
  animation: pop 420ms ease both;
}

.summary .scene-title {
  color: var(--text-main);
  font-size: 31px;
}

.summary-card {
  border-radius: 8px;
  padding: 22px;
}

.big-score {
  margin: 8px 0 0;
  color: var(--red);
  font-size: 48px;
  font-weight: 900;
}

.score-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 18px;
}

.score-pill {
  border-radius: 6px;
  padding: 9px 8px;
  text-align: center;
  color: #5f4934;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(107, 68, 35, 0.14);
  font-size: 13px;
}

.score-pill strong {
  color: var(--red);
  font-size: 18px;
  text-shadow: 0 0 16px rgba(138, 63, 45, 0.18);
}

.warm {
  background:
    radial-gradient(circle at 16% 8%, rgba(213, 138, 42, 0.2), transparent 32%),
    radial-gradient(circle at 84% 12%, rgba(91, 107, 69, 0.18), transparent 28%),
    linear-gradient(180deg, #efe2c2 0%, #d7bd82 100%);
  color: var(--ink);
}

.warm .screen::before {
  background: rgba(255, 255, 255, 0.3);
}

.warm .kicker {
  color: var(--ink);
  border-color: rgba(107, 68, 35, 0.26);
  background: var(--paper-soft);
}

.comfort {
  position: relative;
  justify-content: flex-start;
  padding-top: 8px;
  gap: 12px;
  min-height: calc(100svh - 40px);
}

.comfort-prompt {
  margin: 0 0 12px;
  color: var(--ink);
  text-align: center;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
}

.danmaku-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 2px 0 8px;
  overflow: hidden;
  border-radius: 8px;
}

.comfort-action {
  display: grid;
  justify-items: center;
  padding-bottom: 12px;
}

.danmaku {
  position: absolute;
  top: var(--top);
  left: 100%;
  width: max-content;
  max-width: 86vw;
  border-radius: 4px;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--paper-soft);
  border: 1px solid rgba(107, 68, 35, 0.18);
  box-shadow: 0 8px 18px rgba(89, 58, 31, 0.13);
  white-space: nowrap;
  animation: danmaku-move var(--duration) linear forwards;
}

.danmaku:nth-child(3n + 1) {
  background: #f3dfac;
  transform: rotate(-1deg);
}

.danmaku:nth-child(3n + 2) {
  background: #e7d5b5;
  transform: rotate(1.2deg);
}

.collage-btn {
  width: 154px;
  min-height: 74px;
  align-self: center;
  border-radius: 10px;
  position: relative;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.28), transparent 24%),
    linear-gradient(145deg, #f1c46a, #d58a2a);
  border: 2px solid rgba(107, 68, 35, 0.48);
  box-shadow:
    0 9px 0 #8d5823,
    0 18px 28px rgba(89, 58, 31, 0.25);
  transform: rotate(-1.5deg);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.collage-btn::before,
.collage-btn::after {
  content: "";
  position: absolute;
  width: 54px;
  height: 18px;
  background: rgba(239, 226, 194, 0.48);
  border: 1px solid rgba(107, 68, 35, 0.1);
}

.collage-btn::before {
  left: -20px;
  top: -10px;
  transform: rotate(-18deg);
}

.collage-btn::after {
  right: -18px;
  bottom: -8px;
  transform: rotate(-12deg);
}

.collage-btn.is-pressing,
.collage-btn:active {
  transform: translateY(5px) rotate(-1.5deg);
  box-shadow:
    0 4px 0 #8d5823,
    0 10px 18px rgba(89, 58, 31, 0.2);
}

.close-btn {
  align-self: center;
  min-width: 128px;
  min-height: 40px;
  margin-top: 0;
  border-radius: 6px;
  color: #5f4934;
  background: rgba(246, 236, 207, 0.72);
  border: 1px solid rgba(107, 68, 35, 0.22);
  box-shadow: 0 8px 18px rgba(89, 58, 31, 0.12);
}

.comfort-footer {
  margin-top: auto;
  display: grid;
  justify-items: center;
  padding-top: 8px;
}

.close-note {
  min-height: 19px;
  margin: 4px 0 0;
  text-align: center;
  color: #725741;
  font-size: 13px;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  50% {
    transform: scale(1.08);
  }
}

@keyframes danmaku-move {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100vw - 100%));
  }
}

@media (max-height: 760px) {
  .app {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .scene {
    grid-template-rows: 7svh 15svh minmax(220px, 36svh) minmax(184px, 27svh) auto;
    gap: 6px;
  }

  .scene-title {
    font-size: 23px;
  }

  .paper-strip {
    padding: 11px 12px 10px;
  }

  .subtitle,
  .narration,
  .summary-copy {
    font-size: 14px;
    line-height: 1.48;
  }

  .visual {
    width: min(100%, 254px);
    max-height: 36svh;
  }

  .ring-button {
    width: 140px;
  }

  .meter-face {
    width: 80px;
    height: 80px;
  }

  .score-number {
    font-size: 32px;
  }

  .tick {
    font-size: 9px;
  }

  .danmaku-stage {
    min-height: 0;
  }

  .collage-btn {
    width: 138px;
    min-height: 66px;
    font-size: 21px;
  }
}

@media (min-width: 600px) {
  body {
    display: grid;
    place-items: center;
    min-height: 100vh;
  }

  .app {
    min-height: 760px;
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  }
}
