:root {
  color: #481719;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: #f45c4c;
}

button,
input {
  font: inherit;
}

.page-shell {
  display: grid;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  place-items: center;
}

.blessing-view {
  width: min(100%, 560px);
  height: 100%;
  min-height: 0;
}

.comic-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #f45c4c;
}

.text-blessing {
  display: grid;
  height: 100%;
  min-height: 0;
  place-items: center;
  padding: 12svh 9vw 10svh;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.text-panel {
  width: min(100%, 460px);
  padding: clamp(2rem, 8vw, 3.5rem) clamp(1.5rem, 7vw, 3rem);
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 28px;
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 18px 45px rgb(115 20 23 / 22%), inset 0 1px 0 rgb(255 255 255 / 76%);
  backdrop-filter: blur(10px);
}

.text-panel p {
  margin: 0;
  color: #5a1b20;
  font-size: clamp(1.55rem, 7vw, 2.4rem);
  font-weight: 760;
  line-height: 1.7;
  text-align: center;
  text-wrap: balance;
}

.gate-dialog {
  display: grid;
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100dvh;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 1rem;
  place-items: center;
  border: 0;
  background:
    radial-gradient(circle at 14% 7%, rgb(255 221 170 / 90%) 0 6%, transparent 6.5%),
    radial-gradient(circle at 87% 86%, rgb(255 190 148 / 75%) 0 12%, transparent 12.5%),
    linear-gradient(145deg, #ef4e51, #f38a56 55%, #f3ae5d);
}

.gate-dialog[hidden] {
  display: none;
}

.gate-card {
  width: min(100%, 390px);
  padding: clamp(1.5rem, 4vh, 2.25rem) 2rem 1.75rem;
  border: 1px solid rgb(255 255 255 / 68%);
  border-radius: 28px;
  background: rgb(255 247 238 / 92%);
  box-shadow: 0 22px 55px rgb(111 28 23 / 25%), inset 0 1px 0 #fff;
}

.gate-kicker {
  margin: 0 0 0.5rem;
  color: #c24742;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.gate-card h1 {
  margin: 0 0 1.35rem;
  color: #5a1b20;
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  line-height: 1;
}

.gate-card label {
  display: block;
  margin-bottom: 0.55rem;
  color: #713638;
  font-size: 0.95rem;
  font-weight: 700;
}

.gate-card input {
  width: 100%;
  height: 3.35rem;
  padding: 0 1rem;
  border: 1.5px solid #d99584;
  border-radius: 14px;
  outline: none;
  background: #fffdfa;
  color: #481719;
  font-size: 1.1rem;
}

.gate-card input:focus {
  border-color: #bd453f;
  box-shadow: 0 0 0 4px rgb(189 69 63 / 17%);
}

.form-status {
  min-height: 1.45rem;
  margin: 0.75rem 0;
  color: #a63036;
  font-size: 0.95rem;
  font-weight: 700;
}

.gate-card button {
  width: 100%;
  min-height: 3.35rem;
  border: 0;
  border-radius: 14px;
  background: #9f2e35;
  color: #fffaf1;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.03em;
  transition: transform 160ms ease, background 160ms ease;
}

.gate-card button:hover {
  background: #86232b;
}

.gate-card button:active {
  transform: translateY(1px) scale(0.99);
}

.gate-card button:disabled {
  cursor: wait;
  opacity: 0.68;
}

@media (min-width: 640px) {
  .blessing-view {
    height: min(100dvh, 860px);
    min-height: 0;
    overflow: hidden;
    border-radius: 32px;
    box-shadow: 0 28px 70px rgb(111 28 23 / 28%);
  }

  .comic-image,
  .text-blessing {
    height: 100%;
    min-height: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .blessing-view {
    animation: appear 360ms ease-out both;
  }

  .gate-dialog {
    animation: gate-in 280ms ease-out both;
  }
}

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

@keyframes gate-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
