:root {
  --table: #eadcc4;
  --ink: #243044;
  --ball: #f0c400;
  --ball-ink: #3a2a00;
  --knot: #8a6438;
  --band: calc(7.6rem + env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--table);
  color: var(--ink);
}

body {
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  font-family: "Yuanti SC", "PingFang SC", "Hiragino Maru Gothic ProN", sans-serif;
}

[hidden] { display: none !important; }

.book {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  touch-action: none;
}

.sheet {
  width: min(100%, calc(100dvh - env(safe-area-inset-top) - var(--band)));
  max-width: 100%;
}

.frame {
  width: 100%;
  aspect-ratio: 1;
  background: #f3e6cf;
  overflow: hidden;
}

.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.frame[data-turn="next"] img { animation: arrive-next 220ms ease-out; }
.frame[data-turn="prev"] img { animation: arrive-prev 220ms ease-out; }
.frame[data-bump="next"] { animation: bump-next 160ms ease; }
.frame[data-bump="prev"] { animation: bump-prev 160ms ease; }

@keyframes arrive-next {
  from { transform: translateX(7%); }
  to { transform: none; }
}
@keyframes arrive-prev {
  from { transform: translateX(-7%); }
  to { transform: none; }
}
@keyframes bump-next {
  50% { transform: translateX(-12px); }
}
@keyframes bump-prev {
  50% { transform: translateX(12px); }
}

.strip {
  height: var(--band);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.dots {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 0.8rem;
}

.dots span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--knot);
}

.dots span[data-on] {
  width: 0.72rem;
  height: 0.72rem;
  background: var(--ball);
}

.go, .line {
  font-family: inherit;
  color: var(--ink);
  border: 0;
  cursor: pointer;
}

.go {
  width: 4.8rem;
  height: 4.8rem;
  border-radius: 50%;
  background: var(--ball);
  color: var(--ball-ink);
  font-size: 1.35rem;
  font-weight: 700;
}

.hint {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  text-align: center;
}

.line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.15rem 0.2rem;
  background: transparent;
  font-size: clamp(2rem, 5.4vw, 3.15rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.04em;
}

.bead {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: var(--ball);
  color: var(--ball-ink);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 700;
  flex: none;
}

.go:focus-visible,
.line:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .frame[data-turn] img,
  .frame[data-bump] {
    animation: none;
  }
}
