/* Icebreaker Roulette (/icebreakers/). Builds on the tokens in styles.css. */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.hero .intention svg { color: var(--red); }
.ib [hidden] { display: none !important; }

.ib {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
  margin: 32px 0 48px;
}
@media (min-width: 900px) {
  .ib { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: start; }
  .ib-morale { transform: rotate(.6deg); }
}
.ib-side { display: grid; gap: 24px; min-width: 0; }

.ib-stage {
  text-align: center;
  background: linear-gradient(165deg, var(--lavender), var(--card) 55%);
  border: 0;
}
.ib-stage h2 { margin-bottom: 0; }
.ib-sub { margin: 0 0 18px; }

/* The reel: a solid drum seen through a window. Each category is a panel on
   the drum's surface; the drum fills the window top to bottom, with cylinder
   shading over it, and a translucent coral payline sits on top of whichever
   panel lands in front. */
.ib-reel {
  --row: clamp(2.9rem, 2.4rem + 1.6vw, 3.6rem);
  /* Cylinder radius for 8 panels: row / (2 * tan(22.5deg)). */
  --depth: calc(var(--row) * 1.2071);
  position: relative;
  isolation: isolate;
  /* The drum's projected height, so its curve meets the window edges. */
  height: calc(var(--row) * 2.3);
  max-width: 480px;
  margin: 0 auto 20px;
  overflow: hidden;
  border-radius: 18px;
  background: #2a1d35;
  box-shadow: 0 0 0 6px var(--card), 0 0 0 7px var(--line-strong), var(--shadow-soft);
}
.ib-reel__window {
  position: absolute;
  z-index: 0;
  inset: 0;
  perspective: calc(var(--row) * 22);
  perspective-origin: 50% 50%;
}
.ib-reel__window.is-spinning { filter: url(#ib-blur); }
.ib-reel__drum {
  position: absolute;
  left: -4%;
  right: -4%;
  top: 50%;
  height: var(--row);
  margin: calc(var(--row) / -2) 0 0;
  padding: 0;
  list-style: none;
  transform-style: preserve-3d;
  will-change: transform;
}
.ib-face {
  position: absolute;
  inset: -0.5px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(4% + 30px);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.05rem, .85rem + 1.2vw, 1.5rem);
  line-height: 1.1;
  /* A cream drum with plum lettering in both themes, like a physical object. */
  color: #3d2a44;
  white-space: nowrap;
  background: #fffaf3;
  border-top: 2px solid #ecd3c6;
  backface-visibility: hidden;
  transform: rotateX(calc(var(--i) * var(--face))) translateZ(var(--depth));
}
.ib-face:nth-child(even) { background: #fff1c9; }
.ib-face.ib-face--8 { background: #3d2a44; color: #fffaf3; border-top-color: #3d2a44; }
/* Cylinder shading: the drum darkens as it curves away top and bottom, with
   a soft highlight across the middle. */
.ib-reel__shade {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    rgba(40, 24, 48, .62) 0%,
    rgba(40, 24, 48, .22) 20%,
    rgba(255, 255, 255, 0) 38%,
    rgba(255, 255, 255, .10) 50%,
    rgba(255, 255, 255, 0) 62%,
    rgba(40, 24, 48, .22) 80%,
    rgba(40, 24, 48, .62) 100%
  );
}
/* The payline: a coral band laid over the front panel. */
.ib-reel::before {
  content: '';
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  top: 50%;
  height: var(--row);
  transform: translateY(-50%);
  pointer-events: none;
  background: color-mix(in srgb, #ff8a6b 30%, transparent);
  border-block: 3px solid #b8432c;
}
/* Coral notches either side of the payline. */
.ib-reel::after {
  content: '';
  position: absolute;
  z-index: 3;
  inset-inline: 0;
  top: 50%;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
  background:
    linear-gradient(135deg, #b8432c 50%, transparent 50%) left center / 18px 18px no-repeat,
    linear-gradient(-135deg, #b8432c 50%, transparent 50%) right center / 18px 18px no-repeat;
}
.ib-reel.is-spinning::before { background: color-mix(in srgb, #ff8a6b 10%, transparent); }
.ib-reel.is-landed::before { animation: ib-land .6s ease-out; }
@keyframes ib-land {
  0% { background: color-mix(in srgb, #ff8a6b 10%, transparent); }
  35% { background: color-mix(in srgb, #ff8a6b 55%, transparent); }
  100% { background: color-mix(in srgb, #ff8a6b 30%, transparent); }
}
.ib-reel__defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* The revealed icebreaker. */
.ib-prompt {
  margin: 0 auto 18px;
  max-width: 560px;
  padding: 20px 22px;
  background: var(--card);
  border: 2px dashed var(--line-strong);
  border-radius: 24px;
  text-align: left;
}
.ib-prompt.is-revealed { animation: ib-rise .45s ease-out; }
.ib-prompt__who {
  margin: 0 0 6px;
  font-family: var(--hand);
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--ink-soft);
}
.ib-prompt__cat {
  display: inline-block;
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--on-red);
  background: var(--red);
  border-radius: 999px;
  padding: 3px 12px;
}
.ib-prompt__text {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.2rem, 1.05rem + .7vw, 1.55rem);
  line-height: 1.35;
  text-wrap: pretty;
}
.ib-prompt__note {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 2px dotted var(--line-strong);
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-wrap: pretty;
}

.ib-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 0; }
.ib-secondary {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line-strong);
}
.ib-secondary:hover { background: var(--butter); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line-strong); }
#ib-spin[aria-disabled="true"] { cursor: progress; transform: none; opacity: .8; }

/* Share follow-ups: optional timer and the "done" button. */
.ib-share { margin-top: 20px; }
.ib-timer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 6px 16px 6px 6px;
  font-family: var(--display);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}
.ib-timer__ring {
  --left: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--card) 62%, transparent 64%),
    conic-gradient(var(--grass) calc(var(--left) * 360deg), var(--line) 0);
}
.ib-timer.is-low .ib-timer__ring {
  background:
    radial-gradient(closest-side, var(--card) 62%, transparent 64%),
    conic-gradient(var(--red) calc(var(--left) * 360deg), var(--line) 0);
}
.ib-timer__time { font-weight: 600; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.ib-timer__label { color: var(--ink-soft); }

/* The facilitator's speech bubble. */
.ib-facilitator {
  position: relative;
  margin: 22px auto 0;
  max-width: 480px;
  padding: 14px 20px 16px;
  background: var(--butter);
  border-radius: 24px 24px 24px 6px;
  text-align: left;
}
.ib-facilitator.is-new { animation: ib-rise .35s ease-out; }
.ib-facilitator figcaption {
  margin: 0;
  text-align: left;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.ib-facilitator blockquote {
  margin: 2px 0 0;
  font-family: var(--hand);
  font-size: 1.45rem;
  line-height: 1.3;
  color: var(--ink);
  text-wrap: pretty;
}

/* Morale card. */
.ib-morale { background: linear-gradient(165deg, var(--mint), var(--card) 60%); border: 0; }
.ib-morale h2,
.ib-room h2 { font-size: clamp(1.35rem, 1.15rem + .6vw, 1.65rem); }
.ib-morale__score { margin: 0; font-family: var(--display); line-height: 1.1; }
#ib-morale-num { font-size: 3rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.ib-morale__unit { color: var(--ink-soft); font-weight: 500; }
.ib-meter {
  height: 14px;
  margin: 10px 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 70%, var(--line));
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.ib-meter__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--grass), #8fd19e);
  transition: width .7s cubic-bezier(.3, .7, .3, 1);
}
.ib-meter.is-low .ib-meter__fill { background: linear-gradient(90deg, var(--red), #ffb199); }
.ib-morale__mood { margin: 0 0 12px; font-family: var(--hand); font-size: 1.3rem; line-height: 1.3; color: var(--ink-soft); }
.ib-ledger__title { margin: 0 0 4px; font-size: 1rem; }
.ib-ledger { list-style: none; margin: 0 0 10px; padding: 0; font-size: 0.95rem; }
.ib-ledger li {
  display: grid;
  grid-template-columns: 3.2em 1fr;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--line-strong) 55%, transparent);
}
.ib-ledger li:last-child { animation: ib-rise .35s ease-out; }
.ib-ledger__amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--red); }
.ib-ledger li:first-child .ib-ledger__amt { color: var(--grass); }
.ib-morale .fineprint { margin: 0; }

/* Go around the room. */
.ib-room { background: linear-gradient(165deg, var(--peach), var(--card) 60%); border: 0; }
.ib-room__intro { margin: 0 0 12px; color: var(--ink-soft); text-wrap: pretty; }
.ib-order { margin: 0 0 16px; padding-left: 1.4em; }
.ib-order li { padding: 4px 8px; margin-left: -8px; border-radius: 12px; text-wrap: pretty; }
.ib-order li.is-up { background: color-mix(in srgb, var(--card) 70%, transparent); box-shadow: inset 0 0 0 2px var(--red); }
.ib-order li::marker { font-family: var(--display); font-weight: 600; color: var(--red); }
.ib-room .ib-buttons { justify-content: flex-start; }

@keyframes ib-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
  .ib-face { padding: 0 calc(4% + 24px); }
  .ib-prompt { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ib-prompt.is-revealed,
  .ib-facilitator.is-new,
  .ib-ledger li:last-child,
  .ib-reel.is-landed::before { animation: none; }
  .ib-meter__fill { transition: none; }
  .ib-morale { transform: none; }
}
