:root {
  --bg: #f3f4fb;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(20, 20, 35, 0.09);
  --text: #14141f;
  --text-muted: rgba(20, 20, 31, 0.62);
  --accent-a: #7c3aed;
  --accent-b: #ec4899;
  --accent-c: #0891b2;
  --shadow: rgba(30, 20, 60, 0.16);
  --glow-1: rgba(124, 58, 237, 0.22);
  --glow-2: rgba(236, 72, 153, 0.18);
  --glow-3: rgba(6, 182, 212, 0.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a12;
    --surface: rgba(255, 255, 255, 0.045);
    --surface-solid: #17141f;
    --border: rgba(255, 255, 255, 0.09);
    --text: #f5f5f8;
    --text-muted: rgba(245, 245, 248, 0.62);
    --accent-a: #a78bfa;
    --accent-b: #f472b6;
    --accent-c: #22d3ee;
    --shadow: rgba(0, 0, 0, 0.55);
    --glow-1: rgba(167, 139, 250, 0.28);
    --glow-2: rgba(244, 114, 182, 0.2);
    --glow-3: rgba(34, 211, 238, 0.16);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a12;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #17141f;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f5f5f8;
  --text-muted: rgba(245, 245, 248, 0.62);
  --accent-a: #a78bfa;
  --accent-b: #f472b6;
  --accent-c: #22d3ee;
  --shadow: rgba(0, 0, 0, 0.55);
  --glow-1: rgba(167, 139, 250, 0.28);
  --glow-2: rgba(244, 114, 182, 0.2);
  --glow-3: rgba(34, 211, 238, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  direction: rtl;
  font-family: "Rubik", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 76px 16px 56px;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48vmax 40vmax at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(46vmax 38vmax at 105% 10%, var(--glow-2), transparent 60%),
    radial-gradient(50vmax 42vmax at 50% 115%, var(--glow-3), transparent 60%);
}

noscript {
  display: block;
  max-width: 440px;
  text-align: center;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
}

.masthead {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(12px);
}

.kicker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 0 10px 1px var(--glow-1);
}

.masthead h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(30px, 7vw, 45px);
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--text);
  background: linear-gradient(120deg, var(--accent-a), var(--accent-b) 60%, var(--accent-c));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sleeve {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px 22px 24px;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 30px 60px -24px var(--shadow), 0 1px 0 var(--border) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.now-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

.visualizer {
  --size: 60px;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 10px 24px -10px var(--glow-1);
}

.visualizer .bar {
  width: 4px;
  height: 40%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
  animation: eq 1.1s ease-in-out infinite;
}

.visualizer .bar:nth-child(1) {
  animation-delay: -0.9s;
}

.visualizer .bar:nth-child(2) {
  animation-delay: -0.5s;
}

.visualizer .bar:nth-child(3) {
  animation-delay: -0.2s;
}

.visualizer .bar:nth-child(4) {
  animation-delay: -0.7s;
}

@keyframes eq {

  0%,
  100% {
    height: 30%;
  }

  50% {
    height: 85%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .visualizer .bar {
    animation: none;
    height: 55%;
  }
}

.track-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.track-info.pop {
  animation: pop-in 0.32s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .track-info.pop {
    animation: none;
  }
}

.track-info .title {
  font-weight: 800;
  font-size: clamp(21px, 5vw, 26px);
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: anywhere;
  color: var(--text);
}

.track-info .artist {
  font-weight: 500;
  font-size: 16.5px;
  color: var(--text-muted);
}

.track-info .year {
  display: inline-block;
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-c);
  background: color-mix(in srgb, var(--accent-c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-c) 30%, transparent);
  border-radius: 999px;
  padding: 2px 12px;
  font-variant-numeric: tabular-nums;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #05050a;
  box-shadow: 0 1px 0 var(--border) inset;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.shuffle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 18.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  border: none;
  border-radius: 999px;
  padding: 16px 38px;
  cursor: pointer;
  box-shadow: 0 16px 34px -14px var(--glow-1);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.shuffle-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 20px 40px -14px var(--glow-1);
}

.shuffle-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 8px 18px -10px var(--glow-1);
}

.shuffle-btn:focus-visible,
.yt-link:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 3px;
}

.secondary-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--accent-c);
  background: color-mix(in srgb, var(--accent-c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-c) 30%, transparent);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.share-btn:hover {
  background: color-mix(in srgb, var(--accent-c) 20%, transparent);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: scale(0.97);
}

.share-btn:disabled {
  opacity: 0.85;
  cursor: default;
  transform: none;
}

.share-btn:focus-visible,
.yt-link:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 2px;
}

.yt-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.yt-link:hover {
  color: var(--accent-c);
  border-color: var(--accent-c);
}

/* --- ניקוד קבוצות: כפתור צף + פופאפ --- */

.score-fab {
  position: fixed;
  top: 16px;
  inset-inline-start: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px -14px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.score-fab:hover {
  transform: translateY(-1px);
}

.score-fab:active {
  transform: translateY(1px) scale(0.98);
}

.score-fab:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 3px;
}

.wa-fab {
  position: fixed;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
  text-decoration: none;
  background: #25d366;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 10px 24px -14px rgba(37, 211, 102, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wa-fab:hover {
  transform: translateY(-1px);
}

.wa-fab:active {
  transform: translateY(1px) scale(0.98);
}

.wa-fab:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 3px;
}

body.modal-open {
  overflow: hidden;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 5, 12, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: overlay-in 0.18s ease;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  width: min(380px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px 20px 22px;
  box-shadow: 0 30px 70px -20px var(--shadow);
  animation: modal-in 0.22s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {

  .modal-overlay,
  .modal {
    animation: none;
  }
}

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

.modal-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
}

.modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}

.modal-close:hover {
  color: var(--text);
  transform: rotate(90deg);
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 2px;
}

.modal-body {
  display: flex;
  flex-direction: column;
}

.modal-label {
  margin: 0 0 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.score-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.stepper-btn:hover {
  background: color-mix(in srgb, var(--accent-a) 14%, var(--surface));
}

.stepper-btn:active {
  transform: scale(0.94);
}

.stepper-value {
  min-width: 48px;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.primary-btn {
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 16.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
  box-shadow: 0 14px 28px -14px var(--glow-1);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.primary-btn:active {
  transform: translateY(1px) scale(0.98);
}

.scoreboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.score-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
}

.team-name-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 16.5px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 8px;
  text-align: right;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.team-name-input:hover {
  background: color-mix(in srgb, var(--accent-a) 8%, transparent);
}

.team-name-input:focus {
  outline: none;
  background: var(--surface-solid);
  border-color: color-mix(in srgb, var(--accent-c) 45%, transparent);
}

.team-name-input:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 1px;
}

.score-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.score-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.score-btn.plus {
  color: var(--accent-c);
}

.score-btn.minus {
  color: var(--accent-b);
}

.score-btn:hover {
  background: color-mix(in srgb, var(--accent-a) 12%, var(--surface-solid));
}

.score-btn:active {
  transform: scale(0.92);
}

.score-value {
  min-width: 26px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.scoreboard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.link-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--accent-c);
}

.danger-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-b);
  background: color-mix(in srgb, var(--accent-b) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-b) 30%, transparent);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.danger-btn:hover {
  background: color-mix(in srgb, var(--accent-b) 20%, transparent);
}

.danger-btn:active {
  transform: scale(0.97);
}

.score-fab:focus-visible,
.stepper-btn:focus-visible,
.primary-btn:focus-visible,
.score-btn:focus-visible,
.link-btn:focus-visible,
.danger-btn:focus-visible {
  outline: 2px solid var(--accent-c);
  outline-offset: 2px;
}

footer.meta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  backdrop-filter: blur(12px);
}
