body.theme-sofa {
  --g1: #667eea;
  --g2: #764ba2;
  --g3: #f093fb;
  --g4: #8e6bff;
  --orb-a: #f093fb;
  --orb-b: #667eea;
  --orb-c: #fff;
  --btn: #4a1d78;
  --bar: #f093fb;
  --toast: #1b1030;
}

body.theme-block {
  --g1: #3e9a45;
  --g2: #1d6a38;
  --g3: #d4b06a;
  --g4: #2f8f4e;
  --orb-a: #9be07a;
  --orb-b: #1f6b3c;
  --orb-c: #f3d48a;
  --btn: #143318;
  --bar: #b6f58a;
  --toast: #10240f;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: Raleway, sans-serif;
  background: linear-gradient(125deg, var(--g1), var(--g2) 42%, var(--g3) 78%, var(--g4));
  background-size: 280% 280%;
  animation: shift 18s ease infinite;
  overflow-x: hidden;
}

h1, h2, h3, .btn, .kicker, .traits li {
  font-family: Montserrat, sans-serif;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.03em; }
h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); font-weight: 800; line-height: 0.95; text-shadow: 0 2px 18px rgba(20, 0, 40, 0.35); }
h2 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; line-height: 1.05; text-shadow: 0 2px 18px rgba(20, 0, 40, 0.35); }
h3 { font-size: 1.05rem; font-weight: 700; margin: 1.4rem 0 0.8rem; }

.bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.55;
}

.orb-a { width: 42vw; height: 42vw; left: -8vw; top: -10vw; background: var(--orb-a); animation: drift 14s ease-in-out infinite; }
.orb-b { width: 36vw; height: 36vw; right: -10vw; top: 20vh; background: var(--orb-b); animation: drift 18s ease-in-out infinite reverse; }
.orb-c { width: 28vw; height: 28vw; left: 30vw; bottom: -12vw; background: var(--orb-c); opacity: 0.28; animation: drift 16s ease-in-out infinite; }

.float {
  position: absolute;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  animation: float 7s ease-in-out infinite;
  filter: drop-shadow(0 10px 16px rgba(80, 20, 120, 0.25));
}
.f1, .b1 { left: 7%; top: 16%; animation-delay: 0s; }
.f2, .b2 { right: 10%; top: 12%; animation-delay: -2s; font-size: 1.4rem; }
.f3, .b3 { left: 12%; bottom: 14%; animation-delay: -3.5s; }
.f4, .b4 { right: 16%; bottom: 22%; animation-delay: -1s; }
.f5, .b5 { left: 46%; top: 8%; animation-delay: -4s; font-size: 1.5rem; }

.switch-wrap {
  position: fixed;
  z-index: 4;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(40, 10, 70, 0.18);
}

.switch button {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  background: transparent;
  color: #fff;
  font-family: Montserrat, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
}

.switch button.on {
  background: #fff;
  color: var(--btn);
}

.switch button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

main {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 84px 16px 40px;
}

.screen { display: none; width: min(680px, 100%); }
.screen.active { display: block !important; animation: rise 0.55s ease; }

.card {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 28px;
  padding: clamp(22px, 4vw, 40px);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(70, 20, 110, 0.28);
}

.hero-emoji {
  font-size: clamp(4.2rem, 12vw, 6.5rem);
  line-height: 1;
  animation: bounce 2.6s ease-in-out infinite;
  filter: drop-shadow(0 16px 18px rgba(80, 20, 120, 0.28));
}

.kicker {
  margin: 14px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.86);
}

.lead, .story, .credit {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.05rem;
  line-height: 1.55;
}

.lead { margin: 12px 0 22px; }

.btn {
  position: relative;
  overflow: hidden;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 15px 26px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--btn);
  background: #fff;
  box-shadow: 0 10px 24px rgba(60, 10, 90, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.7), transparent 80%);
  transform: translateX(-120%);
}

.btn:hover { transform: translateY(-2px) scale(1.02); }
.btn:hover::after { animation: sheen 0.7s ease; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.btn.ghost {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-family: Montserrat, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  font: 700 1.4rem/1 Montserrat, sans-serif;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

input::placeholder { color: rgba(255, 255, 255, 0.45); }
input:focus {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

.load-card { text-align: center; padding-top: 48px; padding-bottom: 48px; }
.spin {
  font-size: 5.5rem;
  display: inline-block;
  animation: spin 1.4s linear infinite;
  filter: drop-shadow(0 12px 16px rgba(80, 20, 120, 0.3));
}
.load-line {
  min-height: 3.2em;
  margin: 18px 0 0;
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: clamp(1.15rem, 3vw, 1.5rem);
}
.load-line.in { animation: rise 0.35s ease; }

.shot {
  margin: 18px 0 8px;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  box-shadow: 0 16px 40px rgba(50, 10, 80, 0.28);
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  animation: ken 8s ease-in-out infinite alternate;
}

.shot.as-cube {
  aspect-ratio: auto;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.cube svg {
  width: min(220px, 64%);
  height: auto;
  display: block;
  margin: 6px auto 0;
  filter: drop-shadow(0 16px 16px rgba(0, 0, 0, 0.28));
}

.traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 0;
  list-style: none;
}
.traits li {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.82rem;
  font-weight: 700;
  animation: rise 0.45s ease backwards;
}
.traits li:nth-child(2) { animation-delay: 0.08s; }
.traits li:nth-child(3) { animation-delay: 0.16s; }

.story { margin-top: 12px; }

.compat { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.compat li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.compat .name { font-weight: 600; font-size: 0.95rem; }
.compat .pct { font-family: Montserrat, sans-serif; font-weight: 700; font-size: 0.85rem; }
.track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff, var(--bar));
  animation: bar 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.credit { margin: 16px 0 0; font-size: 0.78rem; }

.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 22px;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--toast);
  color: #fff;
  font-family: Montserrat, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes shift {
  0% { background-position: 0% 40%; }
  50% { background-position: 100% 60%; }
  100% { background-position: 0% 40%; }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-18px) rotate(8deg); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(20px, -24px, 0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes sheen {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ken { to { transform: scale(1.12); } }
@keyframes bar { to { width: var(--w); } }

body.theme-sofa .block-only,
body.theme-block .sofa-only { display: none; }

@media (max-width: 560px) {
  .fields { gap: 8px; }
  input { font-size: 1.15rem; padding: 14px 6px; }
  .switch button { padding: 10px 14px; }
  .float { display: none; }
  body.theme-sofa .f1,
  body.theme-sofa .f3,
  body.theme-block .b1,
  body.theme-block .b3 { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .track span { width: var(--w); }
}
