:root {
  --bg-0: #f6e6c9;
  --bg-1: #e8bb72;
  --card: rgba(255, 248, 238, 0.78);
  --line: rgba(97, 60, 26, 0.26);
  --ink: #2f1d0c;
  --ink-soft: #7c5a39;
  --accent: #8e4f17;
  --accent-2: #bb6f2f;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 16px 44px rgba(62, 33, 8, 0.2);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 255, 255, 0.56) 0%, transparent 40%),
    radial-gradient(circle at 90% 16%, rgba(255, 255, 255, 0.28) 0%, transparent 42%),
    linear-gradient(150deg, var(--bg-0) 6%, var(--bg-1) 88%);
}

.grain-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.14;
  background-image:
    radial-gradient(circle, rgba(74, 44, 15, 0.45) 0.8px, transparent 0.9px),
    radial-gradient(circle, rgba(74, 44, 15, 0.3) 0.8px, transparent 0.9px);
  background-size:
    3px 3px,
    4px 4px;
  mix-blend-mode: multiply;
}

.page {
  position: relative;
  z-index: 1;
  width: min(92vw, 540px);
  margin: 18px auto 36px;
  display: grid;
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow);
}

.poster-panel {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.poster-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(90, 54, 21, 0.32);
  background: rgba(255, 255, 255, 0.9);
  min-height: 320px;
  display: grid;
  place-items: center;
}

#poster-image {
  width: 100%;
  display: block;
  opacity: 0;
  transition: opacity 220ms ease;
}

#poster-image.is-ready {
  opacity: 1;
}

.poster-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(255, 248, 236, 0.95), rgba(244, 223, 189, 0.92)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.65), transparent 55%);
  transition: opacity 240ms ease, visibility 240ms ease;
}

.poster-loading.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.poster-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(122, 74, 28, 0.2);
  border-top-color: #8e4f17;
  border-right-color: #c07834;
  box-shadow: 0 10px 24px rgba(121, 69, 20, 0.16);
  animation: spin 0.82s linear infinite;
}

.poster-loading-text {
  margin: 0;
  color: #6f4620;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hint-strong {
  margin: 0;
  padding: 14px 12px;
  border-radius: 10px;
  border: 2px solid #be2b0f;
  background: linear-gradient(120deg, #fff6de, #ffd89a, #ffe9bf);
  background-size: 220% 220%;
  color: #7d170a;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  animation: bg-sweep 4.5s ease-in-out infinite;
  box-shadow: 0 8px 18px rgba(177, 67, 12, 0.18);
}

.copy-btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(132deg, #0f67b8, #1b85d4, #31a0eb);
  background-size: 220% 220%;
  box-shadow: 0 8px 18px rgba(7, 63, 108, 0.35);
  animation: bg-sweep 3.8s ease-in-out infinite;
}

.copy-btn:active {
  transform: translateY(1px);
}

.copy-btn:disabled {
  opacity: 0.85;
}

.status {
  min-height: 36px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #57391c;
  text-align: center;
}

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

@keyframes bg-sweep {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
