:root {
  color-scheme: light;
  --book-width: clamp(320px, 70vw, 420px);
  --book-height: clamp(460px, 82vh, 560px);
  --flip-duration: 1s;
  --flip-duration-fast: 0.45s;
  --table-base: #f1dfc2;
  --table-grain-light: rgba(217, 192, 154, 0.35);
  --table-grain-dark: rgba(181, 155, 118, 0.35);
  --ink: #2c1d13;
  --accent: #b1834a;
  --cover-front: linear-gradient(140deg, #a56d36 0%, #7c4f28 45%, #a57138 100%);
  --cover-edge: rgba(62, 39, 25, 0.65);
  --paper-bg: #fdfcf7;
  --paper-rule: rgba(57, 123, 198, 0.12);
  --paper-margin: rgba(198, 77, 77, 0.4);
  --shadow: 0 32px 40px rgba(0, 0, 0, 0.25);
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 250, 235, 0.6) 0 30%, transparent 62%),
    radial-gradient(circle at 80% 22%, rgba(255, 240, 213, 0.55) 0 28%, transparent 60%),
    repeating-linear-gradient(90deg, var(--table-grain-light) 0 24px, rgba(245, 226, 192, 0.5) 24px 48px),
    repeating-linear-gradient(0deg, var(--table-grain-dark) 0 32px, rgba(245, 226, 192, 0.5) 32px 64px),
    linear-gradient(180deg, var(--table-base), #e5d1af);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: clamp(24px, 6vw, 64px);
  position: relative;
  overflow: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.05) 80%);
}

.table-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 4vh, 28px);
  position: relative;
  z-index: 1;
}

.book-scene {
  position: relative;
  width: var(--book-width);
  height: var(--book-height);
  display: flex;
  justify-content: center;
  perspective: 1600px;
  transform: translate3d(0, 0, 0);
  transition: transform 0.9s ease, filter 0.9s ease;
  transform-origin: center center;
}

.book-shadow {
  position: absolute;
  inset: auto 8%;
  bottom: -14%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0.08) 62%, transparent 80%);
  transform: skewX(-6deg);
  filter: blur(12px);
  z-index: 0;
  transition: transform 0.9s ease, opacity 0.9s ease;
}

.book-container {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1500px;
  transform-style: preserve-3d;
  z-index: 1;
}

.book-scene.book-scene--travel {
  transform: translate3d(-12px, -24px, 0) scale(1.08) rotateY(-9deg);
  filter: drop-shadow(-12px 28px 32px rgba(0, 0, 0, 0.35));
}

.book-scene.book-scene--travel .book-shadow {
  transform: scaleX(1.35) translateY(16%);
  opacity: 0.4;
}

.page {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--flip-duration) ease-in-out;
  z-index: 1;
}

.book-container.book-fast-flip .page {
  transition: transform var(--flip-duration-fast) ease-in-out;
}

.page-front,
.page-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: clamp(18px, 4vw, 26px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(24px, 5vh, 36px);
}

.page-back {
  transform: rotateY(180deg);
}

.page.flipped {
  transform: rotateY(-180deg);
}

.page--cover {
  z-index: 6;
}

.page--cover .page-front {
  background: var(--cover-front);
  box-shadow:
    -3px 0 0 0 rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px rgba(255, 255, 255, 0.15),
    inset 0 0 0 6px rgba(255, 255, 255, 0.08);
  color: #f9ecda;
}

.cover-front::before {
  content: "";
  position: absolute;
  inset: clamp(18px, 4vw, 28px);
  border-radius: clamp(16px, 4vw, 24px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.cover-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: clamp(12px, 2.6vw, 14px);
}

.cover-badge {
  background: rgba(0, 0, 0, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
}

.cover-body {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 4vh, 24px);
  width: 100%;
  max-width: 90%;
}

.cover-title {
  font-family: "Sawarabi Mincho", serif;
  font-size: clamp(26px, 6vw, 34px);
  margin: 0;
  text-align: center;
  letter-spacing: 0.18em;
}

.cover-subtitle {
  margin: 0;
  font-size: clamp(13px, 3.4vw, 16px);
  line-height: 1.7;
  text-align: center;
  color: rgba(255, 239, 223, 0.85);
}

.cover-form {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3vh, 16px);
  align-items: stretch;
}

.cover-label-text {
  font-weight: 600;
  letter-spacing: 0.1em;
}

.cover-required {
  margin-left: 6px;
  font-size: 12px;
  color: rgba(255, 240, 210, 0.85);
}

.cover-form input[type="text"] {
  width: 100%;
  padding: clamp(12px, 3vh, 16px);
  border-radius: 12px;
  border: 1.6px solid rgba(255, 255, 255, 0.6);
  font-size: clamp(15px, 4vw, 17px);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cover-form input[type="text"]::placeholder {
  color: rgba(54, 38, 24, 0.4);
}

.cover-form input[type="text"]:focus {
  outline: none;
  border-color: rgba(255, 212, 142, 0.8);
  box-shadow: 0 0 0 4px rgba(255, 212, 142, 0.28);
}

.cover-helper {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: rgba(255, 240, 210, 0.85);
}

.cover-button {
  padding: clamp(12px, 3vh, 16px);
  border-radius: 14px;
  border: none;
  font-weight: 600;
  font-size: clamp(16px, 4vw, 18px);
  cursor: pointer;
  background: linear-gradient(180deg, #ffe0b3 0%, #d79a4b 100%);
  color: var(--ink);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease, filter 0.2s ease;
}

.cover-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.cover-button:disabled {
  cursor: wait;
  opacity: 0.7;
  box-shadow: none;
}

.cover-message {
  min-height: 28px;
  font-size: 13px;
  text-align: center;
  color: rgba(255, 240, 210, 0.92);
}

.cover-message.error {
  color: #ffd0c2;
}

.cover-message.success {
  color: #c2ffd7;
}

.cover-back {
  background: linear-gradient(145deg, #d7c1a1 0%, #b89b74 50%, #8b6946 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
  color: rgba(47, 30, 20, 0.85);
}

.cover-back-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 251, 246, 0.4) 0 2px, transparent 2px),
    radial-gradient(rgba(79, 44, 21, 0.25) 0 2px, transparent 2px);
  background-size: 24px 24px, 18px 18px;
  opacity: 0.55;
}

.cover-back-text {
  position: relative;
  font-family: "Sawarabi Mincho", serif;
  font-size: clamp(20px, 5vw, 28px);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.page--inner {
  background: transparent;
  z-index: 4;
}

.page--inner .page-front {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.96));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.page--inner .page-back {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.96));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.inner-page-content {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, var(--paper-margin) 45px, transparent 45px),
    repeating-linear-gradient(180deg, transparent 0 26px, var(--paper-rule) 26px 27px);
  border-radius: clamp(16px, 4vw, 22px);
  padding: clamp(24px, 4vh, 32px) clamp(24px, 5vw, 40px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 3vh, 20px);
  align-items: flex-start;
  justify-content: center;
}

.inner-page-content--blank {
  display: block;
  min-height: 100%;
  padding: 0;
}

.inner-page-content h2 {
  margin: 0;
  font-family: "Yomogi", "Sawarabi Mincho", cursive;
  font-size: clamp(20px, 4.6vw, 24px);
  color: rgba(50, 40, 28, 0.9);
}

.inner-page-content p,
.inner-page-content li {
  margin: 0;
  font-size: clamp(14px, 3.4vw, 17px);
  line-height: 1.8;
  color: rgba(50, 40, 28, 0.85);
}

.inner-page-content ol {
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inner-caption {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(65, 48, 33, 0.5);
}

.lined-paper {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, var(--paper-margin) 45px, transparent 45px),
    repeating-linear-gradient(180deg, transparent 0 26px, var(--paper-rule) 26px 27px);
  border-radius: clamp(16px, 4vw, 22px);
  opacity: 0.9;
}

.copyright {
  margin-top: clamp(24px, 6vh, 36px);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: rgba(46, 34, 23, 0.5);
}

.screen-fade {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.85) 76%, #ffffff 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.screen-fade--active {
  animation: screen-fade-inward 1.2s forwards ease;
}

@keyframes screen-fade-inward {
  0% {
    opacity: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.85) 76%, #ffffff 100%);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    background: #ffffff;
  }
}

@media (max-width: 680px) {
  body {
    padding: clamp(18px, 8vw, 32px);
  }

  .book-shadow {
    bottom: -12%;
    height: 16%;
  }

  .cover-subtitle,
  .cover-helper {
    font-size: clamp(12px, 3.4vw, 14px);
  }

  .cover-label-text {
    font-size: clamp(13px, 3.6vw, 15px);
  }
}
.cookie-consent {
  position: fixed;
  bottom: clamp(16px, 5vw, 32px);
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 92vw);
  padding: clamp(20px, 4vw, 28px);
  background: rgba(255, 255, 255, 0.95);
  border-radius: clamp(16px, 4vw, 22px);
  box-shadow: 0 28px 48px rgba(40, 36, 28, 0.28);
  border: 1px solid rgba(140, 110, 80, 0.18);
  display: none;
  z-index: 30;
}

.cookie-consent.is-visible {
  display: block;
}

.cookie-consent__content {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 4vw, 18px);
}

.cookie-consent__title {
  margin: 0;
  font-size: clamp(18px, 4.4vw, 20px);
  font-family: "Sawarabi Mincho", serif;
  color: rgba(48, 34, 24, 0.92);
}

.cookie-consent__message {
  margin: 0;
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.6;
  color: rgba(58, 43, 31, 0.86);
}

.cookie-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.cookie-consent__button {
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(120, 90, 60, 0.24);
  background: rgba(240, 226, 206, 0.65);
  font-size: 14px;
  font-weight: 600;
  color: rgba(70, 48, 32, 0.92);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
}

.cookie-consent__button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.cookie-consent__button:focus-visible {
  outline: 2px solid rgba(180, 120, 70, 0.6);
  outline-offset: 2px;
}

.cookie-consent__button--primary {
  background: linear-gradient(160deg, #f9d8a6 0%, #dca66f 100%);
  border-color: rgba(160, 110, 60, 0.35);
  color: rgba(46, 30, 20, 0.92);
}

.cookie-consent__button--secondary {
  background: rgba(255, 255, 255, 0.75);
}

.book-form--disabled {
  opacity: 0.6;
  pointer-events: none;
}

.book-form--disabled .book-button {
  cursor: not-allowed;
}
