@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;1,500&family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
  --brand: #472642;
  --ink-light: #fff8f3;
  --panel-bg: rgba(28, 16, 40, 0.62);
  --panel-border: rgba(255, 220, 204, 0.32);
  --input-border: rgba(255, 205, 184, 0.45);
  --form-panel-bg: linear-gradient(180deg, rgba(236, 223, 201, 0.8) 0%, rgba(223, 206, 182, 0.8) 100%);
  --form-panel-border: rgba(248, 232, 210, 0.5);
  --form-label: #472642;
  --form-input-text: #4a4542;
  --form-input-placeholder: rgba(74, 69, 66, 0.58);
  --form-input-bg: #ffffff;
  --form-input-border: rgba(120, 101, 90, 0.28);
  --cinema-panel-bg: rgba(13, 9, 14, 0.72);
  --cinema-panel-border: rgba(238, 193, 139, 0.3);
  --cinema-soft-border: rgba(224, 188, 143, 0.24);
  --cinema-text-soft: #ecd7ba;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Poppins", sans-serif;
  color: var(--ink-light);
  background: #341c44 url("/assets/hero-bg.jpg") center / cover no-repeat fixed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top-header {
  width: 100%;
  min-height: 68px;
  background: #ffffff;
  border-bottom: 1px solid rgba(32, 18, 40, 0.12);
}

.top-header-inner {
  width: 100%;
  min-height: 68px;
  padding: 0 clamp(16px, 3.2vw, 36px);
  display: flex;
  align-items: center;
}

.brand {
  width: min(340px, 78vw);
}

.brand img {
  display: block;
  width: auto;
  height: clamp(28px, 3.4vw, 42px);
  max-width: 100%;
}

.container {
  width: min(1140px, 94vw);
  margin: 0 auto;
  padding: 32px 0 24px;
  flex: 1 0 auto;
}

.global-error {
  width: min(1140px, 94vw);
  margin: 12px auto 0;
  padding: 0 0 8px;
}

.global-error-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 180, 150, 0.3);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(58, 21, 24, 0.94) 0%, rgba(34, 12, 18, 0.94) 100%);
  color: #fff3e0;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.global-error-inner p {
  margin: 0;
  line-height: 1.45;
}

.global-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

#step-redeem {
  width: min(980px, 94vw);
  margin: 0 auto;
  text-align: left;
}

.screen-title {
  margin: 0;
  text-align: center;
  font-size: clamp(2.35rem, 6vw, 4.5rem);
  line-height: 1.05;
  font-weight: 700;
  color: #ffffff;
}

.screen-title:focus,
.screen-title:focus-visible {
  outline: none;
}

#redeem-title {
  width: min(720px, 92vw);
  margin: 0 auto;
  font-size: clamp(1.95rem, 4.6vw, 3.9rem);
  line-height: 1.1;
  white-space: nowrap;
  text-align: left;
  transform: translateX(-12px);
}

#step-redeem .intro-copy {
  width: min(720px, 92vw);
  margin: 22px auto 0;
  text-align: center;
  font-size: calc(clamp(1.02rem, 2.2vw, 1.5rem) - 4pt);
  font-weight: 700;
  line-height: 1.45;
  color: #fff3ec;
}

#step-redeem .intro-copy .intro-copy-cta {
  display: block;
  margin-top: 12px;
}

.redeem-stack {
  width: min(360px, 90vw);
  margin: 30px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: translateX(-22px);
}

.redeem-feedback {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff1e7;
  text-shadow: 0 1px 8px rgba(48, 19, 42, 0.35);
}

.redeem-feedback[data-variant="error"] {
  color: #ffd8cf;
}

.redeem-feedback[data-variant="redeemed-error"] {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #472642;
  background: rgba(255, 255, 255, 0.96);
  color: #3d3d3d;
  text-shadow: none;
  font-weight: 500;
  line-height: 1.35;
}

.redeem-feedback[data-variant="success"] {
  color: #e7ffef;
}

#redeem-code {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #472642;
  background: rgba(255, 255, 255, 0.95);
  color: #2e1c2b;
  font-size: 1rem;
  font-family: "Poppins", sans-serif;
  text-align: center;
}

#redeem-code::placeholder {
  color: #7d6a77;
}

.form-feedback {
  min-height: 1.3em;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: #ffe8da;
}

.form-feedback[data-variant="error"] {
  color: #ffd4c7;
}

.form-feedback[data-variant="success"] {
  color: #e6ffee;
}

#btn-redeem {
  width: min(300px, 84vw);
  align-self: center;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 13px;
  border: none;
  background: #472642;
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-family: "Poppins", sans-serif;
  cursor: pointer;
}

#btn-redeem:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.form-title {
  font-size: clamp(2.1rem, 5.2vw, 4rem);
  margin-bottom: 14px;
}

.form-copy {
  width: min(980px, 96vw);
  margin: 0 auto 22px;
  text-align: center;
  font-size: clamp(1rem, 2.1vw, 1.5rem);
  line-height: 1.5;
  color: #fff2e8;
}

#generation-form {
  max-width: 1040px;
  margin: 0 auto;
  border: 1px solid var(--form-panel-border);
  border-radius: 16px;
  background: var(--form-panel-bg);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255, 247, 238, 0.08);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#generation-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--form-label);
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(255, 246, 236, 0.22);
}

.field-full {
  grid-column: 1 / -1;
}

#generation-form input,
#generation-form select,
#generation-form textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--form-input-border);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--form-input-bg);
  color: var(--form-input-text);
  font-size: 0.95rem;
  line-height: 1.35;
  font-family: "Poppins", sans-serif;
}

#generation-form input::placeholder,
#generation-form textarea::placeholder {
  color: var(--form-input-placeholder);
  font-size: 0.88rem;
}

#generation-form select {
  color: var(--form-input-text);
  font-size: 0.95rem;
  line-height: 1.35;
}

#generation-form input:focus,
#generation-form select:focus,
#generation-form textarea:focus {
  outline: none;
  border-color: rgba(244, 221, 194, 0.82);
  box-shadow: 0 0 0 2px rgba(244, 221, 194, 0.18);
}

a:focus-visible,
button:focus-visible,
#generation-form input:focus-visible,
#generation-form select:focus-visible,
#generation-form textarea:focus-visible {
  outline: 3px solid rgba(255, 232, 193, 0.95);
  outline-offset: 2px;
}

#generation-form input:-webkit-autofill,
#generation-form input:-webkit-autofill:hover,
#generation-form input:-webkit-autofill:focus,
#generation-form textarea:-webkit-autofill,
#generation-form textarea:-webkit-autofill:hover,
#generation-form textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--form-input-text);
  caret-color: var(--form-input-text);
  box-shadow: 0 0 0 1000px var(--form-input-bg) inset;
  transition: background-color 9999s ease-out 0s;
}

#generation-form textarea {
  resize: vertical;
  min-height: 102px;
}

#btn-generate {
  margin: 2px auto 0;
  min-height: 52px;
  padding: 0 26px;
  border: none;
  border-radius: 12px;
  background: #472642;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
  cursor: pointer;
}

#btn-generate:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.panel {
  max-width: 1040px;
  margin: 0 auto;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel-bg);
  backdrop-filter: blur(5px);
  padding: 18px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  font-weight: 600;
}

#step-progress {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 28px);
  border-radius: 24px;
  border-color: rgba(251, 207, 151, 0.28);
  background:
    radial-gradient(circle at top left, rgba(255, 186, 107, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(196, 56, 36, 0.2), transparent 34%),
    linear-gradient(155deg, rgba(58, 28, 24, 0.94) 0%, rgba(31, 16, 20, 0.96) 50%, rgba(18, 10, 18, 0.98) 100%);
  box-shadow:
    0 24px 46px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 229, 193, 0.06);
}

.progress-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  font-weight: 600;
  line-height: 1.1;
  color: #fff3d8;
}

.progress-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35em;
  filter: drop-shadow(0 4px 12px rgba(255, 178, 91, 0.3));
}

.progress-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.progress-track {
  width: 100%;
  height: 18px;
  padding: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(18, 9, 12, 0.92) 0%, rgba(45, 21, 19, 0.76) 100%);
  border: 1px solid rgba(255, 218, 180, 0.18);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.06),
    inset 0 -1px 4px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.progress-bar {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 360ms ease;
  background:
    linear-gradient(90deg, #c93225 0%, #e35a31 22%, #f08d46 50%, #f7c35d 78%, #fff0ae 100%);
  box-shadow:
    0 0 18px rgba(255, 173, 89, 0.35),
    inset 0 0 0 1px rgba(255, 248, 214, 0.14);
  overflow: hidden;
}

.progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    102deg,
    rgba(255, 247, 214, 0.34) 0 10px,
    rgba(255, 247, 214, 0) 10px 16px
  );
  opacity: 0.9;
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 48%, transparent 100%);
  transform: translateX(-100%);
  animation: progress-sheen 2.6s linear infinite;
}

.progress-percentage {
  min-width: 3ch;
  text-align: right;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 700;
  line-height: 1;
  color: #ffe8a7;
  text-shadow: 0 0 14px rgba(255, 181, 88, 0.18);
}

.progress-stage {
  margin: 18px 0 0;
  padding: 15px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 213, 173, 0.16);
  background: linear-gradient(180deg, rgba(96, 50, 44, 0.52) 0%, rgba(61, 31, 31, 0.5) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 30px rgba(0, 0, 0, 0.18);
  font-size: clamp(1rem, 2.2vw, 1.14rem);
  font-weight: 600;
  line-height: 1.4;
  color: #fff2dc;
}

.progress-feedback {
  min-height: 1.2em;
  margin-top: 14px;
  color: #ffd8c2;
}

@keyframes progress-sheen {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar,
  .progress-bar::after {
    animation: none;
    transition: none;
  }
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.row-mt-12 {
  margin-top: 12px;
}

#step-result {
  text-align: left;
  transform: none;
  border-color: var(--cinema-panel-border);
  background:
    linear-gradient(165deg, rgba(26, 18, 24, 0.82) 0%, rgba(10, 7, 12, 0.84) 100%),
    var(--cinema-panel-bg);
  box-shadow:
    0 22px 42px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(255, 218, 163, 0.08);
}

#step-result .row {
  justify-content: flex-start;
  margin-top: 14px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(280px, 440px) minmax(0, 1fr);
  gap: clamp(16px, 2.8vw, 28px);
  align-items: start;
}

.result-poster-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-poster-frame {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(246, 214, 170, 0.34);
  background: rgba(14, 8, 17, 0.82);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 227, 186, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.result-content-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 2px;
}

#result-title {
  margin: 0;
  font-size: calc(1.08rem + 4px);
  line-height: 1.24;
  font-weight: 700;
  color: #f7e4c9;
  text-wrap: balance;
}

#result-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: rgba(16, 10, 20, 0.86);
}

.tagline {
  margin: 0;
  font-size: calc(1rem + 2px);
  line-height: 1.35;
  color: #e8d4b5;
  text-align: left;
}

.synopsis {
  max-width: 100%;
  margin: 0;
  text-align: left;
  line-height: 1.6;
}

.result-meta {
  margin: 2px 0 0;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid var(--cinema-soft-border);
  background: rgba(11, 8, 13, 0.64);
}

.result-meta-item {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  column-gap: 8px;
}

.result-meta dt {
  margin: 0;
  font-weight: 700;
  color: #efd8b7;
}

.result-meta dd {
  margin: 0;
  color: #f4ebde;
}

.result-actions {
  margin-top: 16px;
}

#btn-download-poster,
#btn-download-sheet,
#btn-back-from-progress,
#btn-back-home-from-result,
#btn-global-error-retry,
#btn-global-error-dismiss {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(236, 189, 132, 0.18);
  border-radius: 10px;
  background: linear-gradient(160deg, #322129 0%, #21151e 100%);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

#btn-download-poster:disabled,
#btn-download-sheet:disabled,
#btn-back-from-progress:disabled,
#btn-back-home-from-result:disabled,
#btn-global-error-retry:disabled,
#btn-global-error-dismiss:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

@media (max-width: 720px) {
  .global-error-inner {
    flex-direction: column;
    align-items: stretch;
  }
}

.site-footer {
  width: 100%;
  margin-top: auto;
  background: #ffffff;
  color: #2d1830;
}

.footer-inner {
  width: min(1080px, 92vw);
  min-height: 104px;
  margin: 0 auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-bottom: 6px;
}

.footer-links a {
  color: #2d1830;
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.site-footer p {
  margin: 2px 0;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .container {
    padding-top: 24px;
  }

  #redeem-title {
    white-space: normal;
    text-align: center;
    transform: none;
  }

  .redeem-stack {
    transform: none;
  }

  #generation-form {
    width: 100%;
    padding: 14px 12px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  #generation-form label {
    min-width: 0;
    font-size: 0.82rem;
  }

  #generation-form input,
  #generation-form select,
  #generation-form textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #generation-form select {
    min-height: 58px;
    height: auto;
    white-space: normal;
    text-overflow: clip;
  }

  #generation-form option {
    font-size: 0.95rem;
  }

  #btn-generate,
  #btn-download-poster,
  #btn-download-sheet,
  #btn-back-from-progress,
  #btn-back-home-from-result {
    width: 100%;
    justify-content: center;
  }

  .result-layout {
    grid-template-columns: 1fr;
  }

  #step-progress {
    padding: 20px 16px 18px;
  }

  .progress-meter {
    gap: 10px;
  }

  .progress-track {
    height: 16px;
  }

  .progress-stage {
    padding: 14px 16px;
  }

  #step-result {
    text-align: center;
    transform: none;
  }

  #step-result .row {
    justify-content: center;
  }

  .result-content-panel {
    align-items: center;
  }

  #result-title,
  .tagline {
    text-align: center;
  }

  .synopsis {
    max-width: 92%;
  }

  .footer-inner {
    min-height: 96px;
  }
}
