:root {
  --red: #ef304c;
  --red-dark: #ad1538;
  --blue: #1689eb;
  --blue-dark: #0752a1;
  --yellow: #ffe21b;
  --purple: #7a3ff2;
  --pink: #ff6bc4;
  --ink: #1c1733;
  --paper: #fffdf1;
  --muted: #6c6680;
  --green: #26b765;
  --shadow: 0 12px 0 rgba(53, 25, 70, 0.15), 0 18px 45px rgba(53, 25, 70, 0.22);
  --soft-shadow: 0 8px 24px rgba(53, 25, 70, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #211b3c;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 226, 27, 0.22) 0 3px, transparent 4px),
    radial-gradient(circle at 90% 12%, rgba(255, 255, 255, 0.18) 0 4px, transparent 5px),
    linear-gradient(135deg, #34235f, #18142e 64%, #3b1745);
  background-size: 48px 48px, 75px 75px, auto;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(22, 137, 235, 0.35);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px clamp(10px, 2vw, 28px) calc(150px + env(safe-area-inset-bottom));
}

.viewer-shell {
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 8px 12px;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(25, 19, 49, 0.8);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.topbar-logo {
  width: 94px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar-title strong {
  display: block;
  overflow: hidden;
  font-size: clamp(0.9rem, 2vw, 1.12rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title small {
  display: block;
  margin-top: 3px;
  color: #d8d3eb;
  font-size: 0.73rem;
}

.connection-pill,
.stage-pill,
.presence-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.connection-pill {
  color: #e9fff2;
  background: rgba(38, 183, 101, 0.22);
  border: 1px solid rgba(74, 236, 147, 0.45);
}

.connection-pill::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #54f29b;
  box-shadow: 0 0 10px #54f29b;
  content: "";
}

.connection-pill.offline {
  color: #fff0f0;
  background: rgba(239, 48, 76, 0.25);
  border-color: rgba(255, 122, 141, 0.5);
}

.connection-pill.offline::before {
  background: #ff7287;
  box-shadow: none;
}

.sound-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 4px 0 #c9a700;
  cursor: pointer;
  font-size: 1.15rem;
}

.stage {
  position: relative;
  z-index: 2;
  min-height: min(760px, calc(100dvh - 115px));
  margin-top: 14px;
  padding: clamp(18px, 4vw, 46px);
  overflow: hidden;
  border: 5px solid var(--yellow);
  border-radius: clamp(26px, 4vw, 46px);
  background:
    linear-gradient(rgba(255, 253, 241, 0.96), rgba(255, 253, 241, 0.97)),
    repeating-conic-gradient(from 45deg, #f4d8e7 0 25%, #dcebf8 0 50%) 0 / 42px 42px;
  box-shadow: var(--shadow), inset 0 0 0 5px var(--red);
}

.stage::before,
.stage::after {
  position: absolute;
  z-index: -1;
  width: 160px;
  height: 160px;
  border: 28px solid rgba(22, 137, 235, 0.08);
  border-radius: 50%;
  content: "";
}

.stage::before {
  top: -80px;
  right: -55px;
}

.stage::after {
  bottom: -95px;
  left: -70px;
  border-color: rgba(239, 48, 76, 0.08);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red-dark);
  font-size: clamp(0.76rem, 1.6vw, 0.92rem);
  font-weight: 1000;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.display-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 6vw, 4.9rem);
  font-weight: 1000;
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.display-title .red {
  color: var(--red);
}

.subtitle {
  max-width: 720px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  line-height: 1.45;
  text-wrap: balance;
}

.centered {
  text-align: center;
}

.primary-button,
.secondary-button,
.danger-button,
.spin-button {
  min-height: 52px;
  padding: 13px 22px;
  border: 0;
  border-radius: 17px;
  font-weight: 1000;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.primary-button {
  color: white;
  background: linear-gradient(145deg, var(--red), #d81c61);
  box-shadow: 0 7px 0 #9f1738, 0 12px 22px rgba(173, 21, 56, 0.22);
}

.secondary-button {
  color: white;
  background: linear-gradient(145deg, var(--blue), var(--blue-dark));
  box-shadow: 0 6px 0 #063f7d;
}

.danger-button {
  min-height: 42px;
  padding: 9px 14px;
  color: #8e1833;
  border: 2px solid #f1a2b0;
  background: #fff0f2;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.danger-button:hover:not(:disabled),
.spin-button:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled),
.spin-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #82132f;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4);
  opacity: 0.55;
}

.locked-layout {
  display: grid;
  min-height: 620px;
  place-items: center;
}

.locked-content {
  position: relative;
  z-index: 3;
  width: min(740px, 100%);
  padding: clamp(16px, 4vw, 36px);
  text-align: center;
}

.hero-logo {
  width: min(480px, 90%);
  max-height: 260px;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 10px 0 rgba(28, 23, 51, 0.12));
}

.cute-lock {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 6px auto 20px;
  border: 5px solid var(--ink);
  border-radius: 24px;
  background: var(--yellow);
  box-shadow: 0 8px 0 rgba(28, 23, 51, 0.2);
  place-items: center;
  font-size: 2rem;
  animation: lock-wiggle 2.6s ease-in-out infinite;
}

.curtain {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  width: 19%;
  background: repeating-linear-gradient(90deg, #a61138 0 18px, #ee2c4b 18px 36px, #c81942 36px 52px);
  box-shadow: inset 0 0 28px rgba(65, 5, 22, 0.35);
}

.curtain.left {
  left: 0;
  border-radius: 38px 0 55% 0;
}

.curtain.right {
  right: 0;
  border-radius: 0 38px 0 55%;
}

.waiting-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 10px 16px;
  color: var(--blue-dark);
  border: 2px solid #a9d6fb;
  border-radius: 999px;
  background: #eaf6ff;
  font-size: 0.88rem;
  font-weight: 900;
}

.waiting-dots::after {
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: dots 1.5s steps(4, end) infinite;
  content: "";
}

.countdown-layout {
  display: grid;
  min-height: 620px;
  text-align: center;
  place-items: center;
}

.countdown-orbit {
  position: relative;
  display: grid;
  width: clamp(220px, 48vw, 390px);
  height: clamp(220px, 48vw, 390px);
  margin: 28px auto;
  border: 13px dashed var(--blue);
  border-radius: 50%;
  background: radial-gradient(circle, white 0 52%, #ffefd1 53% 62%, var(--yellow) 63%);
  box-shadow: 0 0 0 13px var(--red), var(--shadow);
  place-items: center;
  animation: orbit-pulse 1s ease-in-out infinite;
}

.countdown-number {
  color: var(--red);
  font-size: clamp(7rem, 25vw, 13rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: -0.09em;
  text-shadow: 7px 7px 0 var(--yellow), 11px 11px 0 var(--ink);
}

.order-layout {
  min-height: 620px;
}

.round-badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 8px 13px;
  color: white;
  border-radius: 999px;
  background: var(--purple);
  font-size: 0.85rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.order-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 20px);
  max-width: 1050px;
  margin: 32px auto 0;
}

.order-card,
.final-niece-card,
.assignment-card {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--ink);
  background: white;
  box-shadow: 0 8px 0 rgba(28, 23, 51, 0.22);
}

.order-card {
  padding: clamp(8px, 1.6vw, 16px);
  border-radius: clamp(17px, 3vw, 28px);
  transform: rotate(var(--tilt, 0deg));
}

.order-card:nth-child(odd) {
  --tilt: -1.5deg;
  background: #fff8cb;
}

.order-card:nth-child(even) {
  --tilt: 1.5deg;
  background: #eaf6ff;
}

.order-number {
  position: absolute;
  z-index: 2;
  top: 5px;
  left: 5px;
  display: grid;
  width: clamp(36px, 6vw, 58px);
  height: clamp(36px, 6vw, 58px);
  color: white;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 3px 0 var(--red-dark);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 1000;
  place-items: center;
}

.portrait {
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: clamp(12px, 2vw, 21px);
  object-fit: cover;
}

.order-name {
  margin: 10px 0 2px;
  font-size: clamp(1rem, 2.4vw, 1.65rem);
  font-weight: 1000;
  text-align: center;
}

.order-card.shuffling {
  animation: card-shuffle 550ms ease-in-out infinite alternate;
}

.order-card.shuffling:nth-child(2) {
  animation-delay: -180ms;
}

.order-card.shuffling:nth-child(3) {
  animation-delay: -360ms;
}

.order-card.shuffling:nth-child(4) {
  animation-delay: -90ms;
}

.order-card.shuffling .portrait {
  filter: blur(7px) saturate(1.4);
}

.order-card.shuffling .order-name {
  color: transparent;
}

.order-card.shuffling .order-name::after {
  color: var(--ink);
  content: "¿Quién será?";
}

.shuffle-arena {
  position: relative;
  width: min(100%, 1050px);
  height: clamp(300px, 46vw, 440px);
  margin: 25px auto 0;
  overflow: hidden;
  border: 4px dashed rgba(122, 63, 242, 0.36);
  border-radius: clamp(22px, 4vw, 38px);
  background:
    radial-gradient(circle at center, rgba(255, 226, 27, 0.24), transparent 45%),
    repeating-conic-gradient(from 45deg, rgba(239, 48, 76, 0.055) 0 25%, rgba(22, 137, 235, 0.055) 0 50%) 0 / 34px 34px;
  box-shadow: inset 0 0 45px rgba(122, 63, 242, 0.1);
  isolation: isolate;
}

.shuffle-arena::before {
  position: absolute;
  inset: 50% auto auto 50%;
  color: rgba(122, 63, 242, 0.08);
  content: "?";
  font-size: clamp(9rem, 26vw, 18rem);
  font-weight: 1000;
  line-height: 1;
  transform: translate(-50%, -50%) rotate(-9deg);
}

.shuffle-card {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: clamp(92px, 17vw, 165px);
  aspect-ratio: 0.72;
  filter: drop-shadow(0 10px 5px rgba(28, 23, 51, 0.24));
  will-change: top, left, transform;
}

.shuffle-card-back {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  border: clamp(4px, 0.7vw, 7px) solid white;
  border-radius: clamp(15px, 2.3vw, 24px);
  background:
    linear-gradient(135deg, transparent 48%, rgba(255, 255, 255, 0.28) 49% 51%, transparent 52%),
    repeating-conic-gradient(from 45deg, var(--red) 0 25%, var(--blue) 0 50%) 0 / 30px 30px;
  box-shadow: inset 0 0 0 4px var(--ink), 0 0 0 3px var(--yellow);
  place-items: center;
}

.shuffle-card-back::before {
  position: absolute;
  inset: 8%;
  border: 3px dashed rgba(255, 255, 255, 0.75);
  border-radius: 13px;
  content: "";
}

.shuffle-card-back img {
  position: relative;
  z-index: 2;
  width: 80%;
  max-height: 48%;
  padding: 3px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
}

.shuffle-card-back span {
  position: absolute;
  z-index: 3;
  right: 9%;
  bottom: 6%;
  display: grid;
  width: 30%;
  aspect-ratio: 1;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-size: clamp(1.2rem, 3vw, 2.3rem);
  font-weight: 1000;
  place-items: center;
}

.shuffle-path-1 { animation: shuffle-path-one 3.72s cubic-bezier(0.45, 0.02, 0.35, 1) both; }
.shuffle-path-2 { animation: shuffle-path-two 3.72s cubic-bezier(0.45, 0.02, 0.35, 1) both; }
.shuffle-path-3 { animation: shuffle-path-three 3.72s cubic-bezier(0.45, 0.02, 0.35, 1) both; }
.shuffle-path-4 { animation: shuffle-path-four 3.72s cubic-bezier(0.45, 0.02, 0.35, 1) both; }

.shuffle-dust {
  position: absolute;
  z-index: 1;
  color: var(--yellow);
  font-size: clamp(2rem, 5vw, 4rem);
  text-shadow: 2px 2px 0 var(--red);
  animation: shuffle-spark 700ms ease-in-out infinite alternate;
}

.dust-one { top: 12%; left: 8%; }
.dust-two { top: 15%; right: 10%; animation-delay: -300ms; }
.dust-three { right: 20%; bottom: 8%; animation-delay: -500ms; }

.water-banner {
  position: relative;
  z-index: 5;
  width: min(680px, 96%);
  margin: -5px auto 10px;
  padding: 17px 28px;
  color: white;
  border: 5px solid white;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--blue), #42c0fa);
  box-shadow: 0 8px 0 var(--blue-dark), 0 14px 30px rgba(7, 82, 161, 0.25);
  font-size: clamp(2rem, 7vw, 4.7rem);
  font-weight: 1000;
  letter-spacing: -0.04em;
  line-height: 0.9;
  text-align: center;
  transform: rotate(-2deg);
}

.water-banner small {
  display: block;
  margin-top: 8px;
  font-size: clamp(0.8rem, 2vw, 1.05rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.final-order-banner {
  max-width: 760px;
  margin: 22px auto 0;
  padding: 13px 20px;
  color: #755c00;
  border: 3px solid #e5c800;
  border-radius: 18px;
  background: #fff8b9;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 1000;
  text-align: center;
}

.roulette-layout {
  min-height: 650px;
}

.roulette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.phase-chip {
  flex: 0 0 auto;
  padding: 10px 15px;
  color: white;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 4px 0 var(--red-dark);
  font-size: 0.82rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase-chip.plushes {
  background: var(--purple);
  box-shadow: 0 4px 0 #5320ad;
}

.roulette-content {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(20px, 4vw, 55px);
  align-items: center;
}

.wheel-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1;
  margin-top: 18px;
}

.wheel-pointer {
  position: absolute;
  z-index: 8;
  top: -23px;
  left: 50%;
  width: 0;
  height: 0;
  border-top: 0;
  border-right: 24px solid transparent;
  border-bottom: 55px solid var(--ink);
  border-left: 24px solid transparent;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.2));
  transform: translateX(-50%);
}

.wheel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: clamp(9px, 1.5vw, 16px) solid var(--ink);
  border-radius: 50%;
  background: repeating-conic-gradient(
    from -22.5deg,
    var(--red) 0deg 45deg,
    var(--yellow) 45deg 90deg,
    var(--blue) 90deg 135deg,
    var(--pink) 135deg 180deg
  );
  box-shadow: inset 0 0 0 7px white, var(--shadow);
  will-change: transform;
}

.wheel::before {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: grid;
  width: 19%;
  height: 19%;
  border: clamp(4px, 1vw, 7px) solid white;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 clamp(3px, 0.7vw, 5px) var(--yellow);
  content: "?";
  color: white;
  font-size: clamp(1.4rem, 5vw, 3.5rem);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%);
  place-items: center;
}

.wheel::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from -0.7deg, transparent 0deg 44deg, rgba(28, 23, 51, 0.85) 44deg 45deg);
  content: "";
  pointer-events: none;
}

.sector-label {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 19%;
  height: 19%;
  margin: -9.5%;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 0 rgba(28, 23, 51, 0.3);
  font-size: clamp(0.85rem, 3vw, 2.2rem);
  font-weight: 1000;
  place-items: center;
}

.sector-0 { transform: rotate(0deg) translateY(-185%) rotate(0deg); }
.sector-1 { transform: rotate(45deg) translateY(-185%) rotate(-45deg); }
.sector-2 { transform: rotate(90deg) translateY(-185%) rotate(-90deg); }
.sector-3 { transform: rotate(135deg) translateY(-185%) rotate(-135deg); }
.sector-4 { transform: rotate(180deg) translateY(-185%) rotate(-180deg); }
.sector-5 { transform: rotate(225deg) translateY(-185%) rotate(-225deg); }
.sector-6 { transform: rotate(270deg) translateY(-185%) rotate(-270deg); }
.sector-7 { transform: rotate(315deg) translateY(-185%) rotate(-315deg); }

.sector-label.revealed {
  overflow: hidden;
  color: white;
  border-color: white;
  background: var(--ink);
  font-size: clamp(0.48rem, 1.4vw, 0.85rem);
  line-height: 1;
  text-align: center;
}

.sector-label.revealed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sector-label.revealed.repeat {
  background: var(--red-dark);
}

.active-turn {
  display: flex;
  width: min(100%, 570px);
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: white;
  box-shadow: 0 6px 0 rgba(28, 23, 51, 0.18);
}

.active-turn img {
  width: clamp(58px, 11vw, 82px);
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 16px;
  object-fit: cover;
}

.active-turn small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.active-turn strong {
  display: block;
  margin-top: 1px;
  color: var(--red);
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  font-weight: 1000;
}

.spin-button {
  position: relative;
  width: min(100%, 440px);
  min-height: clamp(72px, 15vw, 102px);
  margin-top: 26px;
  overflow: hidden;
  color: white;
  border: 5px solid white;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--red), #c61a56);
  box-shadow: 0 9px 0 var(--red-dark), 0 15px 34px rgba(173, 21, 56, 0.32), 0 0 0 4px var(--ink);
  font-size: clamp(1.65rem, 5vw, 3rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spin-button::after {
  position: absolute;
  top: -100%;
  left: -30%;
  width: 25%;
  height: 300%;
  background: rgba(255, 255, 255, 0.25);
  content: "";
  transform: rotate(25deg);
  animation: button-shine 2.5s ease-in-out infinite;
}

.spin-help {
  max-width: 490px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.result-column {
  min-width: 0;
}

.result-card,
.waiting-card {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: clamp(17px, 3vw, 30px);
  border: 4px solid var(--ink);
  border-radius: clamp(22px, 3vw, 34px);
  background: white;
  box-shadow: var(--shadow);
  text-align: center;
}

.waiting-card {
  background: #f4f0ff;
}

.turn-spotlight {
  display: grid;
  grid-template-columns: minmax(105px, 150px) 1fr;
  gap: clamp(13px, 2.5vw, 24px);
  align-items: center;
  text-align: left;
}

.spotlight-portrait {
  width: 100%;
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: clamp(17px, 2.5vw, 26px);
  background: white;
  box-shadow: 0 6px 0 rgba(28, 23, 51, 0.18);
  object-fit: cover;
}

.waiting-card .big-icon {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(2.5rem, 8vw, 5rem);
}

.waiting-card h2,
.result-card h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.8rem);
  line-height: 1;
  text-wrap: balance;
}

.waiting-card p,
.result-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.result-card.repeat-result {
  color: white;
  border-color: white;
  background: linear-gradient(145deg, var(--blue), var(--purple));
  box-shadow: 0 10px 0 var(--blue-dark), var(--shadow);
  animation: result-pop 500ms cubic-bezier(0.17, 0.89, 0.32, 1.5);
}

.result-card.repeat-result p {
  color: #f0edff;
}

.result-card.gift-result {
  background: #fff9cc;
  animation: result-pop 600ms cubic-bezier(0.17, 0.89, 0.32, 1.5);
}

.result-gift-image {
  width: min(250px, 75%);
  max-height: 250px;
  margin: 0 auto 13px;
  border: 4px solid var(--ink);
  border-radius: 24px;
  background: white;
  object-fit: contain;
}

.gift-name {
  color: var(--red);
}

.mercy-note {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 12px;
  color: #6d5500;
  border-radius: 999px;
  background: var(--yellow);
  font-size: 0.82rem;
  font-weight: 1000;
}

.assignments-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 1120px;
  margin: 34px auto 0;
}

.assignment-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px;
  border-width: 2px;
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(28, 23, 51, 0.16);
}

.assignment-card > img {
  width: 45px;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 10px;
  object-fit: cover;
}

.assignment-info {
  min-width: 0;
}

.assignment-info strong {
  display: block;
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-gifts {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.mini-gift,
.mini-placeholder {
  width: 31px;
  height: 31px;
  border: 1px solid #b9b5c7;
  border-radius: 7px;
  background: #efedf4;
  object-fit: contain;
}

.mini-placeholder {
  display: grid;
  color: #9e98ad;
  font-size: 0.72rem;
  font-weight: 1000;
  place-items: center;
}

.admin-bar {
  position: fixed;
  z-index: 50;
  right: max(12px, calc((100vw - 1480px) / 2 + 18px));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 1480px) / 2 + 18px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 22px;
  background: rgba(24, 19, 45, 0.94);
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
}

.admin-label {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--yellow);
  border: 1px solid rgba(255, 226, 27, 0.35);
  border-radius: 11px;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-actions {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.admin-actions button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 13px;
  font-size: 0.82rem;
}

.admin-presence {
  flex: 0 0 auto;
  color: #dcd7ea;
  font-size: 0.76rem;
  font-weight: 800;
}

.paused-overlay {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: grid;
  padding: 22px;
  color: white;
  background: rgba(28, 23, 51, 0.88);
  backdrop-filter: blur(8px);
  place-items: center;
  text-align: center;
}

.paused-overlay div {
  max-width: 520px;
}

.paused-overlay span {
  display: block;
  font-size: clamp(4rem, 17vw, 8rem);
}

.paused-overlay h2 {
  margin: 4px 0 8px;
  color: var(--yellow);
  font-size: clamp(2.2rem, 9vw, 5rem);
}

.paused-overlay p {
  margin: 0;
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: 800;
}

.final-layout {
  min-height: 650px;
  text-align: center;
}

.final-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 20px);
  max-width: 1180px;
  margin: 30px auto 0;
}

.final-niece-card {
  padding: clamp(9px, 1.5vw, 17px);
  border-radius: clamp(18px, 3vw, 28px);
  background: #fff9c9;
  animation: final-card-in 650ms backwards cubic-bezier(0.17, 0.89, 0.32, 1.3);
}

.final-niece-card:nth-child(2) { animation-delay: 120ms; }
.final-niece-card:nth-child(3) { animation-delay: 240ms; }
.final-niece-card:nth-child(4) { animation-delay: 360ms; }

.final-niece-card .portrait {
  aspect-ratio: 1;
}

.final-niece-card h2 {
  margin: 9px 0;
  color: var(--red);
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.final-gifts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.final-gift {
  min-width: 0;
  padding: 5px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: white;
}

.final-gift img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: contain;
}

.final-gift strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  font-size: clamp(0.62rem, 1.4vw, 0.85rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-layout,
.loading-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  place-items: center;
  text-align: center;
}

.loading-screen {
  color: white;
  font-weight: 900;
}

.loading-ball {
  width: 70px;
  height: 70px;
  margin: 0 auto;
  border: 9px solid white;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0 25%, var(--yellow) 0 50%, var(--blue) 0 75%, var(--pink) 0);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.25);
  animation: loading-spin 1s linear infinite;
}

.login-card {
  width: min(460px, 100%);
  padding: clamp(22px, 5vw, 38px);
  border: 5px solid var(--yellow);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: var(--shadow), inset 0 0 0 4px var(--red);
}

.login-card img {
  width: min(280px, 85%);
  margin: 0 auto 8px;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1;
}

.login-card p {
  color: var(--muted);
  font-weight: 750;
}

.login-card label {
  display: block;
  margin: 18px 0 7px;
  font-size: 0.82rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.login-card input,
.modal input {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  color: var(--ink);
  border: 3px solid #c7c1d8;
  border-radius: 14px;
  background: white;
  font-size: 1.15rem;
  font-weight: 900;
}

.login-card button {
  width: 100%;
  margin-top: 14px;
}

.form-error {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--red-dark) !important;
  font-size: 0.86rem;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 18px;
  background: rgba(17, 13, 35, 0.78);
  backdrop-filter: blur(8px);
  place-items: center;
}

.modal {
  width: min(480px, 100%);
  padding: 25px;
  border: 4px solid var(--red);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0;
  font-size: 1.8rem;
}

.modal p {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: flex-end;
}

.toast-region {
  position: fixed;
  z-index: 200;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  display: grid;
  width: min(390px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 13px 16px;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 15px;
  background: var(--ink);
  box-shadow: var(--soft-shadow);
  font-size: 0.9rem;
  font-weight: 850;
  animation: toast-in 250ms ease-out;
}

.toast.error {
  background: var(--red-dark);
}

#confetti {
  position: fixed;
  z-index: 90;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes lock-wiggle {
  0%, 80%, 100% { transform: rotate(0); }
  86% { transform: rotate(-8deg); }
  92% { transform: rotate(8deg); }
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

@keyframes orbit-pulse {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.035) rotate(2deg); }
}

@keyframes card-shuffle {
  0% { transform: translate(-7px, -5px) rotate(-5deg) scale(0.96); }
  100% { transform: translate(7px, 6px) rotate(5deg) scale(1.03); }
}

@keyframes shuffle-path-one {
  0% { top: 24%; left: 14%; z-index: 2; transform: translate(-50%, -50%) rotate(-10deg) scale(0.9); }
  10% { top: 52%; left: 50%; z-index: 5; transform: translate(-50%, -50%) rotate(20deg) scale(1.08); }
  22% { top: 73%; left: 84%; z-index: 3; transform: translate(-50%, -50%) rotate(185deg) scale(0.88); }
  34% { top: 25%; left: 68%; z-index: 6; transform: translate(-50%, -50%) rotate(332deg) scale(1.04); }
  48% { top: 70%; left: 19%; z-index: 2; transform: translate(-50%, -50%) rotate(515deg) scale(0.92); }
  62% { top: 28%; left: 84%; z-index: 7; transform: translate(-50%, -50%) rotate(690deg) scale(1.08); }
  76% { top: 72%; left: 52%; z-index: 3; transform: translate(-50%, -50%) rotate(850deg) scale(0.9); }
  90% { top: 50%; left: 50%; z-index: 4; transform: translate(-50%, -50%) rotate(1050deg) scale(1); }
  100% { top: 50%; left: 50%; z-index: 4; transform: translate(-50%, -50%) rotate(1080deg) scale(1); }
}

@keyframes shuffle-path-two {
  0% { top: 24%; left: 38%; z-index: 3; transform: translate(-50%, -50%) rotate(5deg) scale(0.92); }
  12% { top: 73%; left: 15%; z-index: 6; transform: translate(-50%, -50%) rotate(-170deg) scale(1.05); }
  25% { top: 28%; left: 83%; z-index: 2; transform: translate(-50%, -50%) rotate(-350deg) scale(0.86); }
  38% { top: 72%; left: 64%; z-index: 7; transform: translate(-50%, -50%) rotate(-505deg) scale(1.08); }
  52% { top: 28%; left: 22%; z-index: 3; transform: translate(-50%, -50%) rotate(-680deg) scale(0.9); }
  66% { top: 58%; left: 86%; z-index: 6; transform: translate(-50%, -50%) rotate(-835deg) scale(1.04); }
  80% { top: 28%; left: 50%; z-index: 2; transform: translate(-50%, -50%) rotate(-990deg) scale(0.9); }
  92% { top: 50%; left: 50%; z-index: 5; transform: translate(-50%, -50%) rotate(-1070deg) scale(1); }
  100% { top: 50%; left: 50%; z-index: 5; transform: translate(-50%, -50%) rotate(-1080deg) scale(1); }
}

@keyframes shuffle-path-three {
  0% { top: 24%; left: 62%; z-index: 4; transform: translate(-50%, -50%) rotate(-5deg) scale(0.9); }
  11% { top: 68%; left: 72%; z-index: 2; transform: translate(-50%, -50%) rotate(160deg) scale(0.88); }
  24% { top: 48%; left: 12%; z-index: 7; transform: translate(-50%, -50%) rotate(335deg) scale(1.08); }
  39% { top: 24%; left: 49%; z-index: 3; transform: translate(-50%, -50%) rotate(520deg) scale(0.92); }
  53% { top: 72%; left: 87%; z-index: 6; transform: translate(-50%, -50%) rotate(690deg) scale(1.05); }
  67% { top: 27%; left: 19%; z-index: 2; transform: translate(-50%, -50%) rotate(840deg) scale(0.88); }
  81% { top: 70%; left: 46%; z-index: 7; transform: translate(-50%, -50%) rotate(1010deg) scale(1.06); }
  93% { top: 50%; left: 50%; z-index: 6; transform: translate(-50%, -50%) rotate(1070deg) scale(1); }
  100% { top: 50%; left: 50%; z-index: 6; transform: translate(-50%, -50%) rotate(1080deg) scale(1); }
}

@keyframes shuffle-path-four {
  0% { top: 24%; left: 86%; z-index: 5; transform: translate(-50%, -50%) rotate(10deg) scale(0.92); }
  13% { top: 28%; left: 20%; z-index: 3; transform: translate(-50%, -50%) rotate(-175deg) scale(0.88); }
  27% { top: 72%; left: 42%; z-index: 6; transform: translate(-50%, -50%) rotate(-340deg) scale(1.05); }
  41% { top: 44%; left: 86%; z-index: 2; transform: translate(-50%, -50%) rotate(-510deg) scale(0.9); }
  55% { top: 73%; left: 13%; z-index: 7; transform: translate(-50%, -50%) rotate(-685deg) scale(1.07); }
  69% { top: 24%; left: 62%; z-index: 3; transform: translate(-50%, -50%) rotate(-840deg) scale(0.9); }
  83% { top: 60%; left: 76%; z-index: 5; transform: translate(-50%, -50%) rotate(-1010deg) scale(1.03); }
  94% { top: 50%; left: 50%; z-index: 7; transform: translate(-50%, -50%) rotate(-1070deg) scale(1); }
  100% { top: 50%; left: 50%; z-index: 7; transform: translate(-50%, -50%) rotate(-1080deg) scale(1); }
}

@keyframes shuffle-spark {
  from { opacity: 0.25; transform: rotate(-18deg) scale(0.75); }
  to { opacity: 1; transform: rotate(18deg) scale(1.25); }
}

@keyframes button-shine {
  0%, 45% { left: -40%; }
  75%, 100% { left: 125%; }
}

@keyframes result-pop {
  from { opacity: 0; transform: scale(0.7) rotate(-3deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes final-card-in {
  from { opacity: 0; transform: translateY(35px) scale(0.85) rotate(-3deg); }
  to { opacity: 1; transform: none; }
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
}

@media (max-width: 850px) {
  .app-shell {
    padding-bottom: calc(176px + env(safe-area-inset-bottom));
  }

  .topbar-logo {
    width: 72px;
  }

  .connection-pill span {
    display: none;
  }

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

  .result-column {
    order: -1;
  }

  .result-card,
  .waiting-card {
    max-width: 570px;
  }

  .wheel-wrap {
    width: min(88vw, 510px);
  }

  .admin-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .admin-actions {
    width: 100%;
    flex-basis: 100%;
  }

  .admin-actions button {
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 8px 7px calc(190px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 7px;
    min-height: 58px;
    padding: 6px 8px;
    border-radius: 16px;
  }

  .topbar-logo {
    width: 58px;
    height: 42px;
  }

  .topbar-title small {
    display: none;
  }

  .stage {
    min-height: calc(100dvh - 88px);
    margin-top: 8px;
    padding: 19px 12px 28px;
    border-width: 3px;
    border-radius: 25px;
    box-shadow: 0 8px 0 rgba(53, 25, 70, 0.17), inset 0 0 0 3px var(--red);
  }

  .curtain {
    width: 10%;
  }

  .locked-layout,
  .countdown-layout,
  .order-layout,
  .roulette-layout,
  .final-layout {
    min-height: calc(100dvh - 150px);
  }

  .roulette-layout {
    min-height: auto;
  }

  .order-grid,
  .final-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-grid {
    margin-top: 22px;
  }

  .roulette-header {
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .roulette-header .display-title {
    font-size: clamp(1.85rem, 9vw, 2.6rem);
  }

  .roulette-header .subtitle {
    margin-top: 7px;
    font-size: 0.88rem;
    text-align: left;
  }

  .phase-chip {
    padding: 7px 10px;
    font-size: 0.68rem;
  }

  .assignments-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
  }

  .wheel-wrap {
    width: min(82vw, 340px);
    margin-top: 12px;
  }

  .active-turn {
    width: min(94%, 340px);
    padding: 7px 10px;
    border-radius: 17px;
  }

  .active-turn img {
    width: 84px;
    border-radius: 12px;
  }

  .roulette-content {
    gap: 10px;
  }

  .result-column.idle {
    display: none;
  }

  .result-column.spinning,
  .result-column.has-result {
    order: -1;
  }

  .roulette-content.showing-gift .wheel-column {
    display: none;
  }

  .roulette-content.showing-gift .result-column {
    order: initial;
  }

  .roulette-content.showing-repeat .repeat-result {
    padding: 11px 14px;
  }

  .roulette-content.showing-repeat .repeat-result h2 {
    font-size: 1.45rem;
  }

  .roulette-content.showing-repeat .repeat-result p {
    display: none;
  }

  .roulette-content.showing-repeat .mercy-note {
    margin-top: 6px;
  }

  .result-column.spinning .waiting-card {
    padding: 11px 15px;
  }

  .result-column.spinning .turn-spotlight {
    display: block;
    text-align: center;
  }

  .result-column.spinning .spotlight-portrait {
    display: none;
  }

  .result-column.spinning .big-icon {
    display: inline;
    margin: 0 6px 0 0;
    font-size: 1.4rem;
  }

  .result-column.spinning h2 {
    display: inline;
    font-size: 1.25rem;
  }

  .result-column.spinning p {
    display: none;
  }

  .spin-button {
    min-height: 64px;
    margin-top: 14px;
    border-width: 4px;
    font-size: clamp(1.4rem, 8vw, 2.1rem);
  }

  .spin-help {
    display: none;
  }

  .shuffle-arena {
    height: clamp(285px, 90vw, 355px);
    margin-top: 18px;
  }

  .shuffle-card {
    width: clamp(80px, 27vw, 118px);
  }

  .admin-label {
    display: none;
  }

  .admin-presence {
    flex: 1;
  }

  .admin-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .admin-actions .primary-button {
    min-width: 0;
  }

  .admin-actions .danger-button {
    padding-right: 9px;
    padding-left: 9px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }
}

@media (max-width: 380px) {
  .topbar-title strong {
    font-size: 0.76rem;
  }

  .sound-button {
    width: 38px;
    height: 38px;
  }

  .stage {
    padding-right: 8px;
    padding-left: 8px;
  }

  .roulette-header .display-title {
    font-size: 1.8rem;
  }

  .phase-chip {
    padding: 6px 8px;
    font-size: 0.6rem;
  }

  .wheel-wrap {
    width: min(80vw, 278px);
  }

  .wheel-pointer {
    top: -18px;
    border-right-width: 19px;
    border-bottom-width: 43px;
    border-left-width: 19px;
  }

  .active-turn img {
    width: 82px;
  }

  .assignment-card > img {
    width: 38px;
  }

  .mini-gift,
  .mini-placeholder {
    width: 27px;
    height: 27px;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .app-shell {
    padding: 5px 8px 6px;
  }

  .admin-shell {
    padding-bottom: 68px;
  }

  .topbar {
    min-height: 48px;
    padding: 4px 9px;
    border-radius: 15px;
  }

  .topbar-logo {
    width: 72px;
    height: 39px;
  }

  .topbar-title strong {
    font-size: 0.92rem;
  }

  .topbar-title small {
    margin-top: 1px;
    font-size: 0.63rem;
  }

  .sound-button {
    width: 38px;
    height: 38px;
  }

  .stage {
    min-height: calc(100dvh - 65px);
    height: calc(100dvh - 65px);
    margin-top: 5px;
    padding: 10px 18px;
    border-width: 3px;
    border-radius: 22px;
    box-shadow: 0 6px 0 rgba(53, 25, 70, 0.17), inset 0 0 0 3px var(--red);
  }

  .display-title {
    font-size: clamp(1.75rem, 5.2vw, 2.7rem);
    line-height: 0.95;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 0.66rem;
  }

  .subtitle {
    margin-top: 6px;
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .locked-layout,
  .countdown-layout,
  .order-layout,
  .roulette-layout,
  .final-layout {
    min-height: calc(100dvh - 65px);
  }

  .locked-content {
    display: grid;
    grid-template-columns: minmax(190px, 0.9fr) minmax(270px, 1.1fr);
    gap: clamp(10px, 3vw, 34px);
    width: min(72%, 720px);
    padding: 3px;
    align-items: center;
  }

  .locked-art,
  .locked-copy {
    min-width: 0;
  }

  .hero-logo {
    width: min(100%, 320px);
    max-height: 210px;
    margin: 0 auto;
  }

  .cute-lock {
    width: 44px;
    height: 44px;
    margin: 0 auto 5px;
    border-width: 3px;
    border-radius: 13px;
    box-shadow: 0 4px 0 rgba(28, 23, 51, 0.2);
    font-size: 1.15rem;
  }

  .locked-copy .display-title {
    font-size: clamp(1.45rem, 3.6vw, 2.2rem);
  }

  .locked-copy .subtitle {
    font-size: 0.72rem;
  }

  .waiting-badge {
    margin-top: 8px;
    padding: 5px 10px;
    font-size: 0.68rem;
  }

  .countdown-layout {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .countdown-orbit {
    width: min(37vh, 165px);
    height: min(37vh, 165px);
    margin: 7px auto;
    border-width: 7px;
    box-shadow: 0 0 0 7px var(--red), 0 8px 18px rgba(53, 25, 70, 0.22);
  }

  .countdown-number {
    font-size: min(18vh, 6rem);
    text-shadow: 4px 4px 0 var(--yellow), 7px 7px 0 var(--ink);
  }

  .order-layout {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .round-badge {
    margin-bottom: 4px;
    padding: 4px 9px;
    font-size: 0.66rem;
  }

  .order-layout .subtitle {
    max-width: 620px;
  }

  .order-grid {
    gap: 8px;
    max-width: 650px;
    margin-top: 8px;
  }

  .order-card {
    padding: 5px;
    border-width: 3px;
    border-radius: 14px;
    box-shadow: 0 4px 0 rgba(28, 23, 51, 0.2);
  }

  .order-card .portrait {
    max-height: min(30vh, 115px);
  }

  .order-number {
    width: 30px;
    height: 30px;
    border-width: 2px;
    font-size: 1rem;
  }

  .order-name {
    margin-top: 3px;
    font-size: 0.9rem;
  }

  .water-banner {
    position: absolute;
    z-index: 8;
    top: 72px;
    left: 50%;
    width: min(330px, 50%);
    margin: 0;
    padding: 8px 15px;
    border-width: 3px;
    border-radius: 15px;
    box-shadow: 0 5px 0 var(--blue-dark), 0 8px 18px rgba(7, 82, 161, 0.22);
    font-size: 1.6rem;
    transform: translateX(-50%) rotate(-2deg);
  }

  .water-banner small {
    margin-top: 2px;
    font-size: 0.58rem;
  }

  .final-order-banner {
    margin-top: 5px;
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .shuffle-arena {
    width: min(100%, 690px);
    height: min(47vh, 195px);
    margin-top: 7px;
    border-width: 3px;
    border-radius: 18px;
  }

  .shuffle-card {
    width: min(19vh, 78px);
  }

  .shuffle-card-back {
    border-width: 3px;
    border-radius: 12px;
  }

  .roulette-layout {
    padding: 8px 16px;
  }

  .roulette-header {
    margin-bottom: 4px;
  }

  .roulette-header .display-title {
    font-size: clamp(1.6rem, 4.2vw, 2.3rem);
  }

  .roulette-header .subtitle {
    display: none;
  }

  .phase-chip {
    padding: 6px 9px;
    font-size: 0.62rem;
  }

  .roulette-content {
    grid-template-columns: minmax(210px, 0.9fr) minmax(245px, 1.1fr);
    gap: 14px;
    align-items: center;
  }

  .roulette-content.showing-gift .wheel-column {
    display: flex;
  }

  .roulette-content.showing-gift .result-column {
    order: initial;
  }

  .result-column {
    order: initial;
  }

  .result-column.idle {
    display: block;
  }

  .active-turn {
    width: min(100%, 230px);
    gap: 7px;
    padding: 3px 7px;
    border-width: 2px;
    border-radius: 13px;
    box-shadow: 0 3px 0 rgba(28, 23, 51, 0.18);
  }

  .active-turn img {
    width: 34px;
    border-width: 2px;
    border-radius: 9px;
  }

  .active-turn small {
    font-size: 0.54rem;
  }

  .active-turn strong {
    font-size: 1rem;
  }

  .wheel-wrap {
    width: min(42vh, 190px);
    margin-top: 3px;
  }

  .wheel {
    border-width: 7px;
    box-shadow: inset 0 0 0 4px white, 0 6px 0 rgba(53, 25, 70, 0.15), 0 10px 20px rgba(53, 25, 70, 0.18);
  }

  .wheel-pointer {
    top: -12px;
    border-right-width: 15px;
    border-bottom-width: 33px;
    border-left-width: 15px;
  }

  .spin-button {
    width: min(100%, 230px);
    min-height: 42px;
    margin-top: 4px;
    padding: 4px 12px;
    border-width: 3px;
    box-shadow: 0 5px 0 var(--red-dark), 0 8px 18px rgba(173, 21, 56, 0.26), 0 0 0 2px var(--ink);
    font-size: 1.1rem;
  }

  .spin-help,
  .assignments-strip {
    display: none;
  }

  .waiting-card,
  .result-card {
    max-width: 380px;
    max-height: min(55vh, 225px);
    padding: 12px;
    border-width: 3px;
    border-radius: 18px;
    box-shadow: 0 5px 0 rgba(28, 23, 51, 0.18), 0 9px 22px rgba(53, 25, 70, 0.18);
  }

  .turn-spotlight {
    grid-template-columns: min(26vh, 110px) 1fr;
    gap: 10px;
    text-align: left;
  }

  .spotlight-portrait {
    width: min(26vh, 110px);
    border-width: 3px;
    border-radius: 13px;
    box-shadow: 0 4px 0 rgba(28, 23, 51, 0.18);
  }

  .wheel::before {
    border-width: 4px;
    box-shadow: 0 0 0 3px var(--yellow);
    font-size: 1.25rem;
  }

  .waiting-card .big-icon {
    margin-bottom: 2px;
    font-size: 2rem;
  }

  .waiting-card h2,
  .result-card h2 {
    font-size: clamp(1.2rem, 3.3vw, 1.75rem);
  }

  .waiting-card p,
  .result-card p {
    margin-top: 5px;
    font-size: 0.7rem;
    line-height: 1.25;
  }

  .result-gift-image {
    width: min(28vh, 115px);
    max-height: 105px;
    margin-bottom: 4px;
    border-width: 2px;
    border-radius: 12px;
  }

  .mercy-note {
    margin-top: 5px;
    padding: 4px 8px;
    font-size: 0.62rem;
  }

  .final-layout {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .final-grid {
    gap: 8px;
    max-width: 720px;
    margin-top: 8px;
  }

  .final-niece-card {
    padding: 5px;
    border-width: 3px;
    border-radius: 14px;
  }

  .final-niece-card .portrait {
    width: min(18vh, 75px);
    margin: 0 auto;
    border-width: 2px;
    border-radius: 9px;
  }

  .final-niece-card h2 {
    margin: 3px 0;
    font-size: 0.92rem;
  }

  .final-gifts {
    gap: 3px;
  }

  .final-gift {
    padding: 2px;
    border-width: 1px;
    border-radius: 7px;
  }

  .final-gift strong {
    margin-top: 1px;
    font-size: 0.52rem;
  }

  .admin-bar {
    right: 8px;
    bottom: 5px;
    left: 8px;
    min-height: 48px;
    padding: 5px 7px;
    border-radius: 15px;
  }

  .admin-actions button {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.68rem;
  }

  .admin-label,
  .admin-presence {
    font-size: 0.61rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
