:root {
  --bg: #fffefb;
  --bg-deep: #f5f1e8;
  --panel: rgba(255, 252, 246, 0.9);
  --panel-strong: rgba(248, 244, 235, 0.92);
  --line: rgba(155, 138, 111, 0.16);
  --line-strong: rgba(155, 138, 111, 0.34);
  --text: #2d2418;
  --muted: rgba(102, 89, 68, 0.58);
  --accent: #efe6d7;
  --accent-2: #e5dac8;
  --warning: #b07b3b;
  --item-height: 60px;
  --visible-items: 5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 20%, rgba(235, 230, 220, 0.52), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(244, 240, 232, 0.48), transparent 24%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(150, 137, 115, 0.05) 1px, transparent 1px);
  background-size: 100% 24px;
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
  pointer-events: none;
}

.ambient {
  position: fixed;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
}

.ambient-left {
  top: -8vw;
  left: -10vw;
  background: rgba(232, 226, 214, 0.62);
}

.ambient-right {
  right: -12vw;
  bottom: -12vw;
  background: rgba(242, 238, 229, 0.68);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 18px;
  padding: 22px 20px;
}

.app-shell.is-idle {
  align-content: center;
  gap: 14px;
  padding-top: 22px;
  padding-bottom: 22px;
}

.hero {
  width: min(980px, 100%);
  text-align: center;
}

.persistent-tag {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.persistent-tag-roulette {
  margin-bottom: 12px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(1.7rem, 4.1vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.roulette-card {
  width: min(520px, calc(100vw - 32px));
  padding: 2px 0 0;
}

.app-shell > [hidden] {
  display: none !important;
}

.session-panel[aria-hidden="true"] {
  display: none !important;
}

.roulette-frame {
  position: relative;
  height: calc(var(--item-height) * var(--visible-items));
  overflow: hidden;
}

.focus-band {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: var(--item-height);
  transform: translateY(-50%);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(232, 213, 186, 0.12) 18%,
    rgba(239, 221, 192, 0.28) 50%,
    rgba(232, 213, 186, 0.12) 82%,
    transparent 100%
  );
  box-shadow:
    0 0 24px rgba(211, 184, 143, 0.16),
    inset 0 0 18px rgba(255, 248, 237, 0.42);
  z-index: 2;
  pointer-events: none;
}

.focus-band::before,
.focus-band::after {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 84px;
  pointer-events: none;
}

.focus-band::before {
  left: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 253, 247, 0.98) 0%,
    rgba(255, 250, 241, 0.58) 45%,
    transparent 100%
  );
}

.focus-band::after {
  right: 0;
  background: linear-gradient(
    270deg,
    rgba(255, 253, 247, 0.98) 0%,
    rgba(255, 250, 241, 0.58) 45%,
    transparent 100%
  );
}

.roulette-window {
  position: absolute;
  inset: 0;
}

.roulette-item {
  height: var(--item-height);
  display: grid;
  place-items: center;
  padding: 0 22px;
  text-align: center;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  letter-spacing: 0.02em;
  color: rgba(101, 80, 52, 0.55);
  text-transform: uppercase;
  transition:
    color 180ms ease,
    transform 180ms ease,
    font-size 180ms ease,
    text-shadow 180ms ease;
}

.roulette-item.is-focused {
  color: var(--text);
  font-size: clamp(1.18rem, 2.9vw, 1.45rem);
  font-weight: 700;
  transform: scale(1.05);
  text-shadow: 0 0 18px rgba(240, 219, 193, 0.7);
}

.roulette-item.is-winning {
  color: var(--warning);
  text-shadow: 0 0 20px rgba(226, 195, 149, 0.7);
}

.result-panel {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(190, 161, 118, 0.18);
  background: rgba(255, 250, 241, 0.76);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(197, 173, 138, 0.14);
}

.timer-label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-value {
  font-family: "Syne", sans-serif;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
  text-shadow: 0 0 16px rgba(240, 219, 193, 0.3);
}

.session-panel {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(560px, calc(100vw - 40px));
  text-align: center;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.session-panel.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.back-button {
  position: absolute;
  top: -4px;
  left: 0;
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 180ms ease, transform 180ms ease;
}

.back-button:hover {
  color: var(--text);
  transform: translateX(-1px);
}

.session-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.session-concept {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  text-wrap: balance;
}

.timer-orb {
  --timer-progress: 1;
  position: relative;
  width: min(72vw, 320px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 250, 241, 0.96) 0 54%, transparent 55%),
    conic-gradient(
      from -90deg,
      rgba(228, 200, 162, 0.92) 0deg,
      rgba(228, 200, 162, 0.92) calc(var(--timer-progress) * 360deg),
      rgba(205, 182, 145, 0.14) calc(var(--timer-progress) * 360deg),
      rgba(205, 182, 145, 0.14) 360deg
    );
  box-shadow:
    0 30px 60px rgba(214, 189, 153, 0.24),
    inset 0 0 30px rgba(255, 248, 237, 0.85);
  transition:
    transform 280ms ease,
    box-shadow 280ms ease,
    opacity 280ms ease;
}

.timer-orb::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.94), rgba(255, 247, 233, 0.9) 58%, rgba(244, 232, 213, 0.78) 100%);
  box-shadow: inset 0 0 24px rgba(219, 194, 157, 0.2);
}

.timer-orb.is-running {
  transform: scale(1);
}

.timer-orb.is-finished {
  box-shadow:
    0 26px 54px rgba(214, 189, 153, 0.18),
    inset 0 0 30px rgba(255, 248, 237, 0.85);
}

.timer-orb.is-finished .timer-value {
  color: var(--warning);
}

.timer-orb-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.session-button {
  width: min(320px, 100%);
}

.result-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

#result-text {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: 0.02em;
}

.spin-button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3f2410;
  background: linear-gradient(90deg, #f4bf78, #ef9f57);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: 0 12px 30px rgba(239, 159, 87, 0.28);
}

.spin-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(239, 159, 87, 0.34);
}

.spin-button:active {
  transform: translateY(1px) scale(0.995);
}

.spin-button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  box-shadow: none;
}

.social-footer {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.creator-link {
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: lowercase;
  transition: color 180ms ease, opacity 180ms ease;
}

.creator-link:hover {
  color: var(--text);
}

.social-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social-link {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: rgba(91, 70, 42, 0.72);
  text-decoration: none;
  background: rgba(255, 250, 241, 0.56);
  border: 1px solid rgba(190, 161, 118, 0.16);
  transition:
    transform 180ms ease,
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.social-link:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: rgba(255, 248, 237, 0.9);
  box-shadow: 0 10px 20px rgba(214, 189, 153, 0.22);
}

.social-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

@keyframes pulseWin {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

.result-panel.is-winning {
  animation: pulseWin 700ms ease 2;
}

@media (max-width: 640px) {
  :root {
    --item-height: 52px;
    --visible-items: 5;
  }

  body {
    min-height: 100dvh;
  }

  .app-shell {
    min-height: 100dvh;
    gap: 14px;
    padding: 16px 14px 18px;
  }

  .app-shell.is-idle {
    gap: 12px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .hero h1 {
    font-size: clamp(1.58rem, 7vw, 2.18rem);
    line-height: 1.02;
  }

  .persistent-tag {
    font-size: 0.68rem;
    margin-bottom: 8px;
  }

  .roulette-item {
    padding: 0 16px;
    font-size: 0.92rem;
  }

  .roulette-item.is-focused {
    font-size: 1.08rem;
    transform: scale(1.03);
  }

  .spin-button {
    padding: 12px 16px;
    font-size: 0.88rem;
  }

  .session-panel {
    gap: 14px;
  }

  .back-button {
    top: -2px;
    font-size: 0.8rem;
  }

  .session-concept {
    font-size: clamp(1.72rem, 8vw, 2.6rem);
  }

  .timer-value {
    font-size: clamp(1.7rem, 8vw, 2.4rem);
  }

  .timer-orb {
    width: min(74vw, 280px);
  }

  .creator-link {
    font-size: 0.78rem;
  }

  .social-link {
    width: 34px;
    height: 34px;
  }
}

@media (max-height: 820px) {
  .app-shell {
    place-items: center;
    gap: 14px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .app-shell.is-idle {
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.7rem);
  }
}

@media (max-width: 380px) {
  :root {
    --item-height: 46px;
  }

  .roulette-card {
    width: min(100%, calc(100vw - 20px));
  }

  .hero h1 {
    font-size: clamp(1.4rem, 7.1vw, 1.9rem);
  }
}
