/* School Cricket — Stadium + Bento Grid UI */
:root {
  --ink: #123028;
  --ink-soft: #3d5c50;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.78);
  --glass-shadow: 0 14px 36px rgba(4, 16, 20, 0.35);
  --accent-coral: #ff6b8a;
  --accent-mint: #5ad6b0;
  --accent-sun: #ffd24d;
  --accent-lilac: #c9b6f2;
  --accent-sky: #6ec8f0;
  --wicket: #e84565;
  --field: #3cb371;
  --field-deep: #1f7a4d;
  --pitch: #d4b896;
  --radius: 22px;
  --radius-sm: 14px;
  --font-display: "Baloo 2", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Trebuchet MS", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}


body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: #1a6b45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* ---------- Stadium background (crowd photo + dark glass overlay) ---------- */
.stadium {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #1a2a32;
}

.stadium-crowd-blur {
  position: absolute;
  inset: 0;
  background-image: url('./assets/stadium-crowd-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: none;
  transform: none;
  animation: none;
  opacity: 1;
}

.stadium-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(6, 18, 22, 0.55) 0%,
      rgba(8, 28, 24, 0.48) 40%,
      rgba(6, 20, 18, 0.62) 100%
    ),
    radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, 0.06), transparent 55%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ---------- App shell ---------- */
.app {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 14px 12px 28px;
  overflow-x: hidden;
}

.screen {
  display: none;
  animation: fadeIn 0.28s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Glass Bento cards ---------- */
.bento-card {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 14px 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.bento-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(12, 48, 32, 0.22);
  background: var(--glass-strong);
}

.card-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-head .card-title {
  margin: 0;
}

.pill {
  font-family: var(--font-display);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 210, 77, 0.85);
  color: #5a4200;
  max-width: 58%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Home / setup / lobby layouts ---------- */
.bento-home {
  display: grid;
  gap: 12px;
  max-width: 480px;
  margin: 8vh auto 0;
}

.bento-hero {
  text-align: center;
  padding: 28px 20px 22px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-sun), var(--accent-coral));
  box-shadow: 0 8px 0 rgba(255, 107, 138, 0.35);
  font-size: 2rem;
  margin-bottom: 10px;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.bento-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}

.brand-tag {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.bento-panel {
  max-width: 520px;
  margin: 12px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-card {
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 14px 36px rgba(12, 48, 32, 0.2);
}

.setup-lead {
  margin: -4px 0 4px;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.team-picker {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.team-flag {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: rgba(255, 255, 255, 0.85);
  font-size: 1.7rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 rgba(18, 48, 40, 0.1);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.team-flag:hover {
  transform: scale(1.08);
}

.team-flag.selected {
  border-color: var(--accent-coral);
  box-shadow:
    0 0 0 4px rgba(255, 107, 138, 0.35),
    0 6px 14px rgba(255, 107, 138, 0.35);
  background: #fff5f7;
  transform: scale(1.08);
}

.team-flag .team-code {
  display: none;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.name-row input {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.9);
  padding: 0 14px;
  color: var(--ink);
  outline: none;
  font-family: var(--font-display);
}

.name-row input:focus {
  border-color: var(--accent-sky);
}

.btn-dice {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(180deg, #ffe08a, var(--accent-sun));
  box-shadow: 0 4px 0 #e0b03a;
  font-size: 1.35rem;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease;
}

.btn-dice:active {
  transform: translateY(2px) rotate(-12deg);
}

.btn-start-plump {
  min-height: 56px;
  font-size: 1.2rem;
  background: linear-gradient(180deg, #ffb0bc, #ff6b8a 55%, #f25575);
  box-shadow: 0 8px 0 #d94e6a, 0 12px 24px rgba(249, 85, 117, 0.35);
  letter-spacing: 0.01em;
}

.btn-start-plump:hover {
  filter: brightness(1.04);
}

.local-player-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 16px rgba(12, 48, 40, 0.08);
}

.local-player-card .player-top {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  align-items: center;
}

.local-name-input {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.9);
  padding: 0 12px;
  font-family: var(--font-display);
  color: var(--ink);
  outline: none;
}

.local-name-input:focus {
  border-color: var(--accent-sky);
}

.local-player-card .team-picker {
  padding-bottom: 2px;
}

.local-player-card .team-flag {
  width: 46px;
  height: 46px;
  font-size: 1.4rem;
}

@media (max-width: 768px) {
  .setup-card {
    margin: 8px auto;
  }

  .team-flag {
    width: 50px;
    height: 50px;
  }

  .btn-start-plump {
    min-height: 54px;
  }
}

.bento-lobby {
  display: grid;
  gap: 12px;
  max-width: 520px;
  margin: 12px auto;
}

/* ---------- Game Bento Grid ---------- */
.bento-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.bento-grid > .bento-card {
  min-width: 0;
  max-width: 100%;
}

.bento-wheel {
  order: 1;
}
.bento-score {
  order: 2;
}
.bento-balls {
  order: 3;
}
.bento-scorecard {
  order: 4;
  overflow: hidden;
}
.bento-pitch {
  order: 5;
}
.bento-info {
  order: 6;
}
.bento-chat {
  order: 7;
}

/* Desktop / tablet landscape */
@media (min-width: 769px) {
  .bento-grid {
    grid-template-columns: 1.15fr 0.95fr 0.95fr;
    grid-template-areas:
      "wheel score pitch"
      "wheel balls balls"
      "wheel scorecard scorecard"
      "wheel chat info";
    align-items: start;
  }

  .bento-wheel {
    grid-area: wheel;
    order: unset;
    position: sticky;
    top: 12px;
  }
  .bento-score {
    grid-area: score;
    order: unset;
  }
  .bento-balls {
    grid-area: balls;
    order: unset;
  }
  .bento-scorecard {
    grid-area: scorecard;
    order: unset;
  }
  .bento-pitch {
    grid-area: pitch;
    order: unset;
  }
  .bento-chat {
    grid-area: chat;
    order: unset;
  }
  .bento-info {
    grid-area: info;
    order: unset;
  }
}

/* Phones — single column, no horizontal blowout */
@media (max-width: 768px) {
  .app {
    padding: 10px 10px max(20px, env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .bento-home,
  .bento-lobby,
  .bento-panel,
  .setup-card {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: none;
    gap: 10px;
    width: 100%;
    max-width: 100%;
  }

  .bento-grid > .bento-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .bento-card {
    padding: 12px;
  }

  .bento-card:hover {
    transform: none;
  }

  .bento-wheel {
    order: 1;
    display: flex;
    flex-direction: column;
  }
  .bento-score {
    order: 2;
  }
  .bento-balls {
    order: 3;
  }
  .bento-scorecard {
    order: 4;
  }
  .bento-pitch {
    order: 5;
  }
  .bento-info {
    order: 6;
  }
  .bento-chat {
    order: 7;
  }

  .pill {
    max-width: 55%;
    font-size: 0.72rem;
  }

  .wheel-wrap {
    width: min(100%, 300px, 58dvh);
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin-top: 4px;
  }

  .wheel {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-width: 4px;
  }

  .wheel-hub {
    width: clamp(52px, 16vw, 68px);
  }

  .bento-wheel #btn-spin {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 6;
    min-height: 52px;
    margin-top: 8px;
    box-shadow:
      0 6px 0 #d94e6a,
      0 10px 24px rgba(12, 48, 32, 0.28);
  }

  .btn {
    min-height: 48px;
    min-width: 48px;
  }

  .btn-block {
    min-height: 52px;
  }

  .audio-toggle {
    width: 48px;
    height: 48px;
  }

  .scorecard-body {
    max-height: min(55vh, 420px);
    padding-bottom: 4px;
  }

  .scorecard-table-wrap {
    margin-inline: -2px;
    padding-bottom: 2px;
  }

  .scorecard-table {
    font-size: 0.74rem;
    min-width: 380px;
  }

  .scorecard-table.bowling-table {
    min-width: 300px;
  }

  .scorecard-table th,
  .scorecard-table td {
    padding: 5px 4px;
  }

  .scorecard-inn-title {
    font-size: 0.88rem;
  }

  .scorecard-inn-meta,
  .scorecard-foot {
    font-size: 0.76rem;
  }

  .scorecard-past-toggle {
    min-height: 44px;
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  .crease-batter {
    grid-template-columns: minmax(4.5rem, auto) minmax(0, 1fr) auto;
    gap: 4px 8px;
    padding: 8px;
    font-size: 0.9rem;
  }

  .score-big {
    font-size: clamp(1.6rem, 8vw, 2.2rem);
  }

  .share-qr,
  #lobby-qr {
    width: min(180px, 70vw);
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .menu-sheet {
    align-items: flex-end;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .menu-panel {
    width: min(420px, 100%);
    max-height: min(88dvh, 640px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- Buttons ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:active {
  transform: translateY(2px) scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #ff9aa8, var(--accent-coral));
  color: #fff;
  box-shadow: 0 6px 0 #d94e6a;
}

.btn-secondary {
  background: linear-gradient(180deg, #9fe0cf, var(--accent-mint));
  color: #134438;
  box-shadow: 0 6px 0 #3aa888;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 0 rgba(18, 48, 40, 0.12);
}

.btn-sun {
  background: linear-gradient(180deg, #ffe08a, var(--accent-sun));
  color: #5a4200;
  box-shadow: 0 6px 0 #e0b03a;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  filter: grayscale(0.35) brightness(1.05);
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- Forms ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.85);
  padding: 0 14px;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent-sky);
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.avatar-opt {
  aspect-ratio: 1;
  border-radius: 16px;
  border: 3px solid transparent;
  background: rgba(255, 255, 255, 0.85);
  font-size: 1.6rem;
  box-shadow: inset 0 0 0 2px rgba(18, 48, 40, 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.avatar-opt:hover {
  transform: scale(1.05);
}

.avatar-opt.selected {
  border-color: var(--accent-coral);
  background: #fff0f3;
}

.local-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.local-player-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  padding: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.8);
}

.hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 0;
}

/* ---------- Lobby ---------- */
.lobby-code {
  text-align: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 16px;
  border: 2px dashed var(--accent-lilac);
}

.lobby-code .code {
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.28em;
  color: var(--accent-coral);
  margin: 4px 0;
}

.lobby-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 8px;
}

.share-qr {
  width: 180px;
  height: 180px;
  max-width: 100%;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(20, 53, 44, 0.12);
}

#share-sheet-qr {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  display: block;
}

.share-url {
  font-size: 0.78rem;
  line-height: 1.35;
  word-break: break-all;
  color: var(--ink-muted, #3d5a4f);
  margin: 0 0 8px;
  padding: 0 6px;
}

.share-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-actions .btn {
  flex: 1 1 120px;
}

.share-panel {
  align-items: stretch;
  text-align: center;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
}

.player-chip .emoji {
  font-size: 1.5rem;
}

.player-chip .meta {
  flex: 1;
}

.player-chip .name {
  font-family: var(--font-display);
  font-weight: 700;
}

.badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-sun);
  color: #5a4200;
}

/* ---------- Scoreboard ---------- */
.scoreboard {
  background: linear-gradient(160deg, #1a2f28, #2a4a3e);
  color: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 0 #0f1c18;
  font-family: var(--font-display);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.scoreboard .live {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.score-label {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-bottom: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.score-big {
  font-size: clamp(1.6rem, 7vw, 2rem);
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.score-meta {
  font-size: 1rem;
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 12px;
  border-radius: 999px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.target-line {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--accent-sun);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.chase-panel {
  margin-top: 12px;
  padding: 12px 12px 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 210, 77, 0.28), rgba(255, 107, 138, 0.2));
  border: 1.5px solid rgba(255, 210, 77, 0.55);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.chase-target {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-display);
}

.chase-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 245, 210, 0.85);
}

.chase-target strong {
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 800;
  color: #ffe566;
  text-shadow: 0 2px 0 rgba(80, 40, 0, 0.35);
  line-height: 1;
}

.chase-need {
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff8e7;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.chase-need.is-won {
  color: #9dffc0;
}

.scorecard-inn-block.is-active-innings {
  order: -1;
}

.scorecard-inn-block.is-collapsed-past {
  border-top: 1px dashed rgba(18, 48, 40, 0.15);
  padding-top: 8px;
}

.scorecard-past-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(18, 48, 40, 0.14);
  background: rgba(255, 255, 255, 0.55);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.scorecard-past-toggle:hover {
  background: rgba(255, 255, 255, 0.78);
}

.scorecard-past-toggle .chev {
  font-size: 0.85rem;
  opacity: 0.7;
}

.scorecard-past-body {
  margin-top: 10px;
}

.scorecard-past-body.is-hidden {
  display: none;
}

.fx-text-win {
  top: 22%;
  color: #ffe566;
  text-shadow:
    0 0 22px rgba(80, 200, 140, 0.85),
    0 0 40px rgba(255, 210, 77, 0.7),
    0 6px 0 rgba(20, 60, 40, 0.3);
  animation: sixTextPop 1.5s ease forwards;
}

.audio-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 8000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 40, 28, 0.55);
  backdrop-filter: blur(10px);
  color: #e8fff4;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.audio-toggle:hover {
  background: rgba(12, 60, 40, 0.7);
  transform: scale(1.04);
}

.audio-toggle:active {
  transform: scale(0.96);
}

.audio-toggle.is-muted {
  color: rgba(232, 255, 244, 0.55);
}

.audio-toggle .audio-icon {
  display: block;
}

.batter-line {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #e8fff4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.crease-pair {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.crease-batter {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr auto;
  gap: 6px 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(8, 40, 28, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.crease-batter.is-striker {
  background: rgba(255, 210, 77, 0.14);
  border-color: rgba(255, 210, 77, 0.45);
}

.crease-role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(232, 255, 244, 0.7);
  font-family: var(--font-display);
}

.crease-batter.is-striker .crease-role {
  color: #ffe566;
}

.crease-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #f5fff9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crease-score {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #c8f5d8;
}

.over-note {
  margin-top: 8px;
  font-size: 0.85rem;
  font-family: var(--font-display);
  color: #ffe566;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.scorecard-table tr.is-striker td:first-child {
  font-weight: 700;
}

/* Full scorecard — televised dual tables */
.scorecard-body {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.scorecard-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.scorecard-innings {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.scorecard-inn-block {
  padding-bottom: 4px;
}

.scorecard-inn-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
  font-family: var(--font-display);
}

.scorecard-inn-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #123028;
}

.scorecard-inn-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.scorecard-section-label {
  margin: 10px 0 4px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-display);
  font-size: 0.8rem;
  min-width: 420px;
}

.scorecard-table.bowling-table {
  min-width: 360px;
}

.scorecard-table th,
.scorecard-table td {
  padding: 7px 5px;
  text-align: left;
  border-bottom: 1px solid rgba(18, 48, 40, 0.12);
  vertical-align: top;
}

.scorecard-table th {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.scorecard-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scorecard-table td.status {
  font-size: 0.74rem;
  color: var(--ink-soft);
  max-width: 11rem;
}

.scorecard-table tr.is-batting {
  background: rgba(255, 210, 77, 0.28);
}

.scorecard-table tr.is-out {
  opacity: 0.82;
}

.scorecard-table tr.is-waiting td:first-child {
  color: var(--ink-soft);
}

.scorecard-table tr.is-striker td:first-child {
  font-weight: 700;
}

.scorecard-table tr.is-active-bowler {
  background: rgba(80, 160, 220, 0.16);
}

.scorecard-foot {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: #123028;
  display: grid;
  gap: 4px;
}

.scorecard-foot strong {
  font-weight: 800;
}

.scorecard-fow {
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

/* ---------- Ball log (TV-style recent ticker) ---------- */
.ball-log {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow: hidden;
  padding: 6px 4px;
  min-height: 46px;
  width: 100%;
  max-width: 100%;
  scrollbar-width: none;
}

.ball-log::-webkit-scrollbar {
  display: none;
}

.ball {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: var(--font-display);
  background: #4a6075;
  color: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.ball.is-fresh {
  animation: ballTickerIn 0.35s cubic-bezier(0.2, 0.85, 0.25, 1);
}

@keyframes ballTickerIn {
  from {
    opacity: 0;
    transform: translateX(14px) scale(0.7);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.ball.boundary {
  background: var(--accent-mint);
  color: #14352c;
}

.ball.six {
  background: var(--accent-sun);
  color: #5a4200;
}

.ball.out {
  background: var(--wicket);
  color: #fff;
}

.ball.extra {
  background: var(--accent-sky);
  color: #143246;
}

.ball.dot {
  background: #8aa0b4;
}

.over-sep {
  flex: 0 0 auto;
  align-self: center;
  width: 3px;
  height: 22px;
  margin: 0 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(18, 48, 40, 0.55));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
  color: transparent;
  font-size: 0;
  overflow: hidden;
}

/* ---------- Wheel ---------- */
.wheel-wrap {
  position: relative;
  width: min(100%, 350px);
  max-width: 100%;
  margin: 6px auto 0;
  height: auto;
  aspect-ratio: 1 / 1;
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--accent-coral);
  filter: drop-shadow(0 2px 0 #d45566);
}

.wheel {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow:
    0 0 0 4px rgba(255, 107, 138, 0.35),
    0 12px 24px rgba(12, 48, 32, 0.2);
  transition: transform 0.05s linear;
  background: #fff;
}

.wheel.spinning {
  transition: transform 4s cubic-bezier(0.12, 0.75, 0.08, 1);
}

.wheel.shuffling {
  animation: wheelShuffle 0.55s ease;
}

@keyframes wheelShuffle {
  0% {
    filter: blur(0);
    transform: scale(1) rotate(var(--wheel-rot, 0deg));
  }
  35% {
    filter: blur(2px);
    transform: scale(0.92) rotate(calc(var(--wheel-rot, 0deg) + 8deg));
  }
  70% {
    filter: blur(1px);
    transform: scale(1.04) rotate(calc(var(--wheel-rot, 0deg) - 4deg));
  }
  100% {
    filter: blur(0);
    transform: scale(1) rotate(var(--wheel-rot, 0deg));
  }
}

.wheel-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(60px, 18vw, 78px);
  aspect-ratio: 1 / 1;
  height: auto;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  overflow: visible;
}

.hub-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.9) 0 7%, transparent 20%),
    conic-gradient(
      from 200deg,
      #fff3b0,
      #d4af37 16%,
      #fff8d6 34%,
      #8b7320 52%,
      #f0d878 70%,
      #c9a227 86%,
      #fff3b0
    );
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.34),
    inset 0 1px 2px rgba(255, 255, 255, 0.7),
    inset 0 -2px 4px rgba(70, 45, 0, 0.4);
}

.hub-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #1a2420;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28);
}

.hub-ball {
  position: relative;
  z-index: 1;
  display: block;
  width: 68%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.spin-result {
  text-align: center;
  min-height: 1.4em;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent-coral);
  margin: 8px 0;
}

.freehit-banner {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 230, 80, 0.55), rgba(110, 200, 240, 0.55));
  border: 2px solid #ffe566;
  color: #143246;
  margin-bottom: 10px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow:
    0 0 0 3px rgba(255, 229, 102, 0.35),
    0 0 22px rgba(110, 200, 240, 0.55),
    0 8px 18px rgba(0, 40, 60, 0.18);
  animation: freeHitPulse 1.4s ease-in-out infinite;
}

.freehit-banner .freehit-sub {
  font-weight: 700;
  font-size: 0.88em;
  opacity: 0.92;
}

@keyframes freeHitPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(255, 229, 102, 0.3),
      0 0 16px rgba(110, 200, 240, 0.4),
      0 8px 18px rgba(0, 40, 60, 0.16);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(255, 229, 102, 0.5),
      0 0 28px rgba(255, 210, 77, 0.65),
      0 8px 18px rgba(0, 40, 60, 0.2);
  }
}

.finished-banner {
  text-align: center;
  padding: 14px;
  margin-top: 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 247, 214, 0.9), rgba(255, 232, 240, 0.9));
  border: 2px solid var(--accent-sun);
}

.finished-banner h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

/* ---------- Mini pitch ---------- */
.mini-pitch {
  position: relative;
  height: 160px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #4ecf82, #2f9e5f);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.mini-grass {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 10px,
    rgba(255, 255, 255, 0.06) 10px 20px
  );
}

.mini-strip {
  position: absolute;
  left: 50%;
  top: 12%;
  bottom: 18%;
  width: 36px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #c4a47a, #e8d2b0, #c4a47a);
  border-radius: 4px;
}

.mini-stumps {
  position: absolute;
  left: 50%;
  bottom: 28%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  align-items: flex-end;
  z-index: 2;
}

.mini-stumps span {
  width: 5px;
  height: 34px;
  background: #f5f0e6;
  border-radius: 2px;
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.15);
  transform-origin: bottom center;
  transition: transform 0.35s ease;
}

.mini-stumps .bails {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: #f5f0e6;
  border-radius: 2px;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.mini-ball {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #e85d4a 55%, #b83228);
  left: 18%;
  bottom: 30%;
  opacity: 0;
  z-index: 3;
}

.mini-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background-image:
    radial-gradient(circle, #ffd24d 2px, transparent 3px),
    radial-gradient(circle, #ff6b8a 2px, transparent 3px),
    radial-gradient(circle, #6ec8f0 2px, transparent 3px),
    radial-gradient(circle, #5ad6b0 2px, transparent 3px);
  background-size: 40px 40px, 36px 36px, 44px 44px, 32px 32px;
  background-position: 10% 20%, 70% 30%, 40% 60%, 80% 70%;
}

.mini-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 210, 77, 0.35);
  opacity: 0;
  pointer-events: none;
}

.mini-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  z-index: 4;
}

/* Pitch reactions */
.mini-pitch[data-react="out"] .mini-ball {
  animation: ballToStumps 0.55s ease forwards;
}

.mini-pitch[data-react="out"] .mini-stumps span:nth-child(1) {
  transform: rotate(-18deg) translateX(-4px);
}
.mini-pitch[data-react="out"] .mini-stumps span:nth-child(2) {
  transform: rotate(8deg);
}
.mini-pitch[data-react="out"] .mini-stumps span:nth-child(3) {
  transform: rotate(22deg) translateX(5px);
}
.mini-pitch[data-react="out"] .mini-stumps .bails {
  transform: translate(10px, -14px) rotate(40deg);
  opacity: 0;
}

.mini-pitch[data-react="six"] .mini-confetti {
  animation: confettiPop 1.1s ease forwards;
}

.mini-pitch[data-react="four"] .mini-flash {
  animation: boundaryFlash 0.7s ease;
}

.mini-pitch[data-react="extra"] .mini-flash {
  background: rgba(110, 200, 240, 0.4);
  animation: boundaryFlash 0.7s ease;
}

@keyframes ballToStumps {
  0% {
    opacity: 1;
    left: 18%;
    bottom: 30%;
  }
  100% {
    opacity: 1;
    left: 48%;
    bottom: 34%;
  }
}

@keyframes confettiPop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  30% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1.3) translateY(-12px);
  }
}

@keyframes boundaryFlash {
  0%,
  100% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
}

/* ---------- Chat / info ---------- */
.chat-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-tag-hint {
  margin: 0 0 8px;
  font-size: 0.78rem;
}

.chat-tag {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 rgba(18, 48, 40, 0.12);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.chat-tag:hover {
  transform: scale(1.05);
}

.chat-tag.is-selected {
  border-color: var(--accent-coral);
  background: #fff0f3;
  box-shadow: 0 0 0 3px rgba(255, 107, 138, 0.35);
}

.chat-tag.is-you {
  opacity: 0.55;
}

.chat-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  padding: 8px 12px;
  min-height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink);
  transition: transform 0.12s ease, background 0.12s ease;
}

.chip:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-1px);
}

.chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chip.is-emoji {
  font-size: 1.15rem;
  min-width: 44px;
  padding-left: 10px;
  padding-right: 10px;
}

.chat-nudge {
  margin-bottom: 10px;
}

.chat-nudge:disabled {
  filter: grayscale(0.4);
}

.chat-feed {
  min-height: 72px;
  max-height: 160px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-line {
  font-family: var(--font-display);
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
}

.chat-line .who {
  font-weight: 800;
}

.chat-line .mention {
  color: #b4234a;
  font-weight: 800;
}

.chat-line.is-system {
  color: var(--ink-soft);
  font-style: italic;
}

.chat-line.is-nudge {
  color: #8a5a00;
  background: rgba(255, 210, 77, 0.28);
  border-radius: 8px;
  padding: 4px 8px;
}

.chat-feed .hint {
  margin: 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 12px;
  font-family: var(--font-display);
}

.info-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Menu / toasts ---------- */
.menu-sheet {
  position: fixed;
  inset: 0;
  background: rgba(12, 40, 28, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}

.menu-sheet.open {
  display: flex;
}

.menu-panel {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUp 0.22s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 24px));
  pointer-events: none;
}

.toast {
  background: #1a2f28;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  font-family: var(--font-display);
  text-align: center;
  box-shadow: var(--glass-shadow);
  animation: toastIn 0.25s ease;
}

.toast.error {
  background: #c4455a;
}

@keyframes toastIn {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* ---------- Full-screen cricket celebration FX (1.5s) ---------- */
.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}

.fx-overlay:not(.fx-active) {
  visibility: hidden;
}

.fx-cricket-ball {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff6f0 0 12%, transparent 13%),
    radial-gradient(circle at 50% 50%, #ff6b4a 0%, #b82218 70%);
  box-shadow:
    inset -6px -8px 12px rgba(0, 0, 0, 0.25),
    0 8px 18px rgba(0, 0, 0, 0.28);
  position: relative;
}

.fx-cricket-ball::before,
.fx-cricket-ball::after {
  content: "";
  position: absolute;
  inset: 18% 42%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  border-top-color: transparent;
  border-bottom-color: transparent;
}

.fx-cricket-ball::after {
  transform: scaleX(-1);
}

/* SIX — ball flies up toward camera */
.fx-six-stage {
  position: absolute;
  inset: 0;
}

.fx-ball-fly {
  position: absolute;
  left: 50%;
  bottom: 8%;
  margin-left: -28px;
  animation: ballFly 1.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.fx-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 14vw, 6rem);
  letter-spacing: 0.02em;
  white-space: nowrap;
  will-change: transform, opacity;
}

.fx-text-six {
  top: 18%;
  color: #ffe566;
  text-shadow:
    0 0 24px rgba(80, 180, 255, 0.85),
    0 0 40px rgba(255, 210, 77, 0.75),
    0 6px 0 rgba(20, 60, 120, 0.3);
  opacity: 0;
  animation: sixTextPop 1.5s ease forwards;
}

@keyframes ballFly {
  0% {
    opacity: 0.85;
    transform: translateY(0) scale(0.35);
  }
  55% {
    opacity: 1;
    transform: translateY(-52vh) scale(1.35);
  }
  100% {
    opacity: 0;
    transform: translateY(-62vh) scale(1.7);
  }
}

@keyframes sixTextPop {
  0%,
  35% {
    opacity: 0;
    transform: translateX(-50%) scale(0.4);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.12);
  }
  75% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.2);
  }
}

/* FOUR — ball races along the ground */
.fx-four-stage {
  position: absolute;
  inset: 0;
}

.fx-boundary-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 4px;
  background: linear-gradient(90deg, transparent, #fff 10%, #fff 90%, transparent);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.55);
  opacity: 0.85;
}

.fx-ball-roll {
  position: absolute;
  bottom: calc(18% - 22px);
  left: -10%;
  animation: ballRoll 1.5s cubic-bezier(0.15, 0.75, 0.25, 1) forwards;
}

.fx-text-four {
  bottom: 28%;
  color: #ff8a3d;
  text-shadow:
    0 0 20px rgba(255, 120, 40, 0.85),
    0 4px 0 rgba(120, 40, 0, 0.35);
  animation: fourTextSweep 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes ballRoll {
  0% {
    opacity: 0;
    transform: translateX(0) rotate(0deg) scale(0.8);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
    transform: translateX(115vw) rotate(720deg) scale(1);
  }
}

@keyframes fourTextSweep {
  0% {
    opacity: 0;
    transform: translateX(-120%) skewX(-8deg);
  }
  25% {
    opacity: 1;
    transform: translateX(-50%) skewX(0deg);
  }
  65% {
    opacity: 1;
    transform: translateX(-50%);
  }
  100% {
    opacity: 0;
    transform: translateX(40%) skewX(6deg);
  }
}

/* OUT — stumps shatter */
.fx-out-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.fx-flash {
  position: absolute;
  inset: 0;
  background: rgba(220, 40, 60, 0.35);
  animation: fxFlash 1.5s ease-out forwards;
}

.fx-stumps {
  position: relative;
  width: 140px;
  height: 160px;
  z-index: 1;
}

.fx-stump {
  position: absolute;
  bottom: 20px;
  width: 18px;
  height: 110px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(90deg, #f7ecd7, #d4b896 55%, #b8956a);
  box-shadow: inset -3px 0 0 rgba(0, 0, 0, 0.12);
  transform-origin: bottom center;
}

.fx-stump-1 {
  left: 20px;
  animation: stumpsShatter 1.5s ease-out forwards;
  animation-delay: 0.12s;
}
.fx-stump-2 {
  left: 61px;
  animation: stumpsShatterMid 1.5s ease-out forwards;
  animation-delay: 0.12s;
}
.fx-stump-3 {
  left: 102px;
  animation: stumpsShatterRight 1.5s ease-out forwards;
  animation-delay: 0.12s;
}

.fx-bail {
  position: absolute;
  top: 18px;
  height: 8px;
  width: 42px;
  border-radius: 3px;
  background: #fff8e7;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.fx-bail-1 {
  left: 22px;
  animation: bailFlyLeft 1.5s ease-out forwards;
  animation-delay: 0.12s;
}
.fx-bail-2 {
  left: 76px;
  animation: bailFlyRight 1.5s ease-out forwards;
  animation-delay: 0.12s;
}

.fx-hit-ball {
  position: absolute;
  left: -30px;
  bottom: 48px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #e85d4a 55%, #b83228);
  animation: hitBall 1.5s ease-out forwards;
}

.fx-text-out {
  top: 18%;
  z-index: 2;
  color: #ff3b4a;
  text-shadow:
    0 0 18px rgba(255, 60, 80, 0.9),
    0 4px 0 rgba(90, 0, 10, 0.4);
  animation: outTextShake 1.5s ease-in-out forwards;
}

@keyframes stumpsShatter {
  0%,
  8% {
    transform: rotate(0) translate(0, 0);
  }
  100% {
    transform: rotate(-28deg) translate(-40px, 30px);
    opacity: 0.35;
  }
}

@keyframes stumpsShatterMid {
  0%,
  8% {
    transform: rotate(0) translate(0, 0);
  }
  100% {
    transform: rotate(8deg) translate(10px, 50px);
    opacity: 0.35;
  }
}

@keyframes stumpsShatterRight {
  0%,
  8% {
    transform: rotate(0) translate(0, 0);
  }
  100% {
    transform: rotate(32deg) translate(48px, 24px);
    opacity: 0.35;
  }
}

@keyframes bailFlyLeft {
  0%,
  8% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50px, -90px) rotate(-140deg);
    opacity: 0;
  }
}

@keyframes bailFlyRight {
  0%,
  8% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translate(60px, -100px) rotate(160deg);
    opacity: 0;
  }
}

@keyframes hitBall {
  0% {
    transform: translateX(0) scale(0.8);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  18% {
    transform: translateX(78px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(160px) translateY(-20px) scale(0.7);
    opacity: 0;
  }
}

@keyframes outTextShake {
  0%,
  10% {
    opacity: 0;
    transform: translateX(-50%);
  }
  18% {
    opacity: 1;
    transform: translateX(calc(-50% - 12px));
  }
  26% {
    transform: translateX(calc(-50% + 12px));
  }
  34% {
    transform: translateX(calc(-50% - 8px));
  }
  42% {
    transform: translateX(calc(-50% + 8px));
  }
  55%,
  75% {
    opacity: 1;
    transform: translateX(-50%);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.1);
  }
}

@keyframes fxFlash {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- Coin toss ---------- */
.toss-shell {
  max-width: 440px;
  margin: 4vh auto 0;
  padding: 0 4px;
}

.toss-card {
  text-align: center;
}

.toss-lead {
  margin: 4px 0 16px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.coin-scene {
  perspective: 900px;
  height: 200px;
  display: grid;
  place-items: center;
  margin: 8px auto 18px;
}

.coin {
  width: 150px;
  height: 150px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
}

.coin-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 50%;
  box-shadow:
    0 12px 28px rgba(60, 40, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  overflow: hidden;
}

.coin-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.coin-tails {
  transform: rotateY(180deg);
}

.coin.is-flipping {
  animation-name: coinTossFlip;
  animation-timing-function: cubic-bezier(0.15, 0.7, 0.2, 1);
  animation-fill-mode: forwards;
}

.coin.land-heads {
  --coin-end: 1800deg; /* 5 full turns → heads */
}

.coin.land-tails {
  --coin-end: 1980deg; /* 5.5 turns → tails */
}

@keyframes coinTossFlip {
  0% {
    transform: translateY(0) rotateY(0deg) scale(1);
  }
  18% {
    transform: translateY(-72px) rotateY(420deg) scale(1.08);
  }
  42% {
    transform: translateY(-110px) rotateY(980deg) scale(1.12);
  }
  68% {
    transform: translateY(-48px) rotateY(1480deg) scale(1.04);
  }
  88% {
    transform: translateY(-8px) rotateY(calc(var(--coin-end) - 40deg)) scale(1.01);
  }
  100% {
    transform: translateY(0) rotateY(var(--coin-end)) scale(1);
  }
}

.toss-result-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  background: linear-gradient(135deg, rgba(255, 230, 120, 0.7), rgba(255, 180, 90, 0.55));
  border: 2px solid rgba(201, 162, 39, 0.85);
  color: #5a3a00;
  animation: tossBannerIn 0.45s ease;
}

@keyframes tossBannerIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toss-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.toss-wait {
  margin: 12px 0 0;
  min-height: 1.3em;
}

@media (max-width: 768px) {
  .toss-shell {
    margin-top: 2vh;
  }

  .coin-scene {
    height: 180px;
  }

  .coin {
    width: min(140px, 42vw);
    height: min(140px, 42vw);
  }

  .toss-actions .btn {
    min-height: 52px;
  }
}

/* ---------- Phone login ---------- */
.login-shell {
  margin-top: 6vh;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-config-hint {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 210, 77, 0.28);
  color: #5a4200;
}

.login-config-hint code {
  font-size: 0.85em;
}

.otp-input {
  letter-spacing: 0.35em;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
}

.login-otp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-otp-actions .btn {
  flex: 1 1 140px;
  min-height: 44px;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(232, 69, 101, 0.16);
  color: #8a1230;
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.home-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-account strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

@media (max-width: 768px) {
  .login-shell {
    margin-top: 3vh;
  }

  .otp-input {
    min-height: 52px;
  }
}
