:root {
  --bg-top: #eef2f8;
  --bg-bottom: #cfd8e6;
  --ink: #0c3c94;
  --muted: #40557c;
  --panel: #fff7e1;
  --panel-border: rgba(12, 60, 148, 0.14);
  --panel-shadow: 0 18px 40px rgba(15, 28, 52, 0.2);
  --panel-shadow-soft: 0 8px 22px rgba(15, 28, 52, 0.14);
  --blue: #0c3c94;
  --blue-dark: #0c3c94;
  --gold: #fbbb24;
  --silver: #fcd67c;
  --bronze: #a48c54;
  --brown: #966a02;
  --slate: #40557c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next Condensed", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 12% 15%, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0) 68%),
    repeating-linear-gradient(
      -32deg,
      rgba(255, 255, 255, 0.07) 0px,
      rgba(255, 255, 255, 0.07) 8px,
      rgba(255, 255, 255, 0) 8px,
      rgba(255, 255, 255, 0) 24px
    ),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

.app {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 360px;
  gap: 20px;
  height: 100vh;
  align-items: center;
  padding: 0;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  min-height: 0;
  padding: 16px 16px 16px 0;
}

.panel-card {
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 253, 0.94)),
    var(--panel);
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
}

.wheel-area {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  min-height: 100vh;
  animation: wheel-enter 420ms ease-out;
}

.wheel-area::before {
  content: none;
}

.goal-card {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 14px 16px;
  min-width: 260px;
  max-width: 360px;
}

.goal-label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.goal-text {
  margin: 4px 0 0;
  font-size: 1.65rem;
  line-height: 1.12;
  font-weight: 800;
  color: var(--blue-dark);
}

.latest-daily-card {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 10px 14px;
  min-width: 320px;
  max-width: 460px;
}

.latest-daily-label {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.latest-daily-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
  font-weight: 700;
  color: var(--blue-dark);
  display: grid;
  gap: 4px;
}

.latest-head {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.latest-name {
  display: inline-block;
  font-size: 1.4rem;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0.005em;
  color: #0c3c94;
}

.latest-time-pill {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
  color: #163f89;
  font-family: "Avenir Next Condensed", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: none;
  line-height: 1.02;
  padding: 5px 10px 6px;
  border-radius: 8px;
  border: 1px solid rgba(64, 85, 124, 0.22);
  background: rgba(252, 214, 124, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.latest-date {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  line-height: 1;
  text-transform: uppercase;
}

.wheel-stack {
  position: relative;
  width: min(84vh, 88vw, 940px);
  aspect-ratio: 1;
  filter: drop-shadow(0 18px 28px rgba(20, 28, 45, 0.3));
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

#wheelHintCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.pointer {
  position: absolute;
  right: -3.4%;
  top: 50%;
  transform: translateY(-50%);
  width: 96px;
  height: 76px;
  pointer-events: none;
  filter: drop-shadow(-5px 8px 8px rgba(0, 0, 0, 0.28));
}

.pointer::before,
.pointer::after {
  content: "";
  position: absolute;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.pointer::before {
  inset: 0;
  background: linear-gradient(155deg, #f7f9ff 0%, #dde4ef 56%, #c4ccda 100%);
}

.pointer::after {
  inset: 8px 10px 8px 0;
  background:
    radial-gradient(circle at 28% 34%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 54%),
    linear-gradient(150deg, #edf2fb 0%, #d2d9e6 66%, #bcc6d6 100%);
}

.ranking-panel {
  padding: 18px 16px 14px;
  flex: 0 0 auto;
  overflow: visible;
  animation: panel-enter 460ms ease-out;
}

.ranking-panel h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(19, 34, 61, 0.12);
}

.ranking-panel h2::after {
  content: "Najszybsze daily 2026";
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ranking-list {
  list-style: none;
  counter-reset: rank;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ranking-list li {
  counter-increment: rank;
  font-size: 1.08rem;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(19, 34, 61, 0.1);
  padding: 8px 10px;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.ranking-list .rank-empty {
  display: block;
  grid-template-columns: none;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.76);
  border-style: dashed;
}

.ranking-list li:hover {
  transform: translateY(-1px);
  border-color: rgba(26, 79, 170, 0.32);
  box-shadow: var(--panel-shadow-soft);
}

.ranking-list li:nth-child(1) {
  background: linear-gradient(90deg, rgba(255, 236, 164, 0.65), rgba(255, 255, 255, 0.9));
  border-color: rgba(189, 144, 19, 0.55);
  box-shadow: 0 0 0 1px rgba(189, 144, 19, 0.15), 0 10px 20px rgba(189, 144, 19, 0.16);
}

.ranking-list li:nth-child(2) {
  background: linear-gradient(90deg, rgba(230, 238, 252, 0.72), rgba(255, 255, 255, 0.9));
  border-color: rgba(127, 146, 179, 0.45);
  box-shadow: 0 0 0 1px rgba(127, 146, 179, 0.14), 0 10px 20px rgba(72, 95, 131, 0.14);
}

.ranking-list li:nth-child(3) {
  background: linear-gradient(90deg, rgba(242, 218, 197, 0.68), rgba(255, 255, 255, 0.9));
  border-color: rgba(160, 110, 70, 0.45);
  box-shadow: 0 0 0 1px rgba(160, 110, 70, 0.14), 0 10px 20px rgba(118, 82, 53, 0.14);
}

.ranking-list li::before {
  content: counter(rank);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, var(--slate), var(--blue));
}

.ranking-list li:nth-child(1)::before {
  color: #3e2b00;
  background: linear-gradient(170deg, #ffe285, var(--gold));
}

.ranking-list li:nth-child(2)::before {
  color: var(--blue-dark);
  background: linear-gradient(170deg, #eff4ff, var(--silver));
}

.ranking-list li:nth-child(3)::before {
  color: #3f2715;
  background: linear-gradient(170deg, #efcfb2, var(--bronze));
}

.ranking-list li:nth-child(-n + 3) .rank-name {
  font-weight: 800;
}

.ranking-list li:nth-child(1) .rank-time {
  border-color: rgba(189, 144, 19, 0.55);
  color: var(--brown);
  background: rgba(255, 233, 154, 0.44);
}

.ranking-list li:nth-child(2) .rank-time {
  border-color: rgba(64, 85, 124, 0.45);
  color: var(--slate);
  background: rgba(205, 216, 238, 0.42);
}

.ranking-list li:nth-child(3) .rank-time {
  border-color: rgba(150, 106, 2, 0.45);
  color: var(--brown);
  background: rgba(236, 210, 163, 0.42);
}

.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.rank-time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--blue-dark);
  background: rgba(12, 60, 148, 0.11);
  border: 1px solid rgba(12, 60, 148, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
}

.debug-panel {
  padding: 10px 12px 12px;
  position: relative;
  z-index: 20;
  animation: panel-enter 500ms ease-out;
}

.debug-panel summary {
  cursor: pointer;
  user-select: none;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-dark);
}

.debug-body {
  display: none;
  gap: 8px;
}

.debug-panel[open] .debug-body {
  display: grid;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 253, 0.96)),
    var(--panel);
  box-shadow: var(--panel-shadow);
  animation: debug-dropdown-enter 220ms ease-out;
}

.debug-controls {
  display: grid;
  grid-template-columns: auto 90px 1fr;
  gap: 8px;
  align-items: center;
}

.debug-target-controls {
  grid-template-columns: auto 1fr;
}

.debug-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.debug-input {
  width: 100%;
  border: 1px solid rgba(19, 34, 61, 0.2);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue-dark);
  background: #fff;
}

.debug-select {
  cursor: pointer;
}

.debug-run {
  border: 1px solid rgba(12, 60, 148, 0.45);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f8fbff;
  background: linear-gradient(180deg, var(--slate), var(--blue));
  cursor: pointer;
}

.sim-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.sim-results {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
}

.sim-results li {
  font-size: 0.84rem;
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
}

.alarm-panel {
  border: 10px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(var(--gold), var(--gold)) padding-box,
    repeating-linear-gradient(-45deg, #111 0 8px, var(--gold) 8px 16px) border-box;
  padding: 10px 14px 12px;
  text-align: center;
  color: #111;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: box-shadow 140ms ease;
}

.alarm-wrap {
  margin-top: auto;
  padding: 0;
  animation: panel-enter 520ms ease-out;
}

.alarm-title {
  margin: 2px 0 8px;
  font-size: 2rem;
  letter-spacing: 0.06em;
  line-height: 1;
}

.alarm-button {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 10px solid #0b0b0b;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 35%),
    radial-gradient(circle at 72% 78%, rgba(255, 177, 162, 0.42), rgba(255, 177, 162, 0) 34%),
    radial-gradient(circle at 50% 55%, #f37a66 0%, #dd4e39 72%, #b6311e 100%);
  box-shadow: 0 8px 0 #8d2819, 0 15px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
}

.alarm-button:hover {
  filter: brightness(1.08);
}

.alarm-button:active,
.alarm-button.armed {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #8d2819, 0 8px 12px rgba(0, 0, 0, 0.35);
}

.alarm-subtitle {
  margin: 10px 0 0;
  font-size: 1.02rem;
  letter-spacing: 0.07em;
  line-height: 1.1;
}

.winner-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(26, 79, 170, 0.22), rgba(10, 18, 34, 0.62)),
    rgba(10, 18, 34, 0.5);
  z-index: 1000;
  padding: 20px;
  will-change: opacity;
}

.winner-modal.hidden {
  display: none;
}

.winner-card {
  position: relative;
  width: min(640px, 94vw);
  border-radius: 24px;
  overflow: visible;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  background: linear-gradient(165deg, rgba(250, 252, 255, 0.96), rgba(237, 243, 252, 0.95));
  border: 1px solid rgba(146, 170, 210, 0.42);
  box-shadow: 0 24px 54px rgba(9, 18, 34, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  will-change: transform, opacity;
}

.winner-card.celebrate {
  animation: winner-pop 360ms cubic-bezier(0.22, 0.96, 0.22, 1);
}

.winner-header {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #40557c, #0c3c94);
  color: #f7faff;
  border: 1px solid rgba(156, 189, 243, 0.55);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 16px;
  box-shadow: 0 8px 16px rgba(28, 73, 154, 0.35);
  white-space: nowrap;
}

.winner-body {
  color: var(--ink);
  padding: 46px 24px 18px;
  text-align: center;
}

.winner-name {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.3rem);
  text-align: center;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  color: var(--blue-dark);
  text-shadow: none;
}

.winner-card.celebrate .winner-name {
  animation: winner-glow 900ms ease-out;
}

.winner-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(19, 34, 61, 0.12);
}

.winner-btn {
  border: 1px solid rgba(19, 34, 61, 0.16);
  border-radius: 12px;
  min-width: 120px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.winner-close {
  background: rgba(255, 255, 255, 0.95);
  color: var(--slate);
}

.winner-copy {
  border-color: rgba(12, 60, 148, 0.34);
  background: rgba(245, 249, 255, 0.98);
  color: var(--blue);
}

.winner-remove {
  border-color: rgba(12, 60, 148, 0.5);
  background: linear-gradient(180deg, #40557c, #0c3c94);
  color: #f8fbff;
}

.winner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(17, 32, 58, 0.2);
}

.winner-btn:active {
  transform: translateY(0);
}

.hover-tooltip {
  position: fixed;
  z-index: 3000;
  transform: translate(-50%, -100%);
  background: rgba(15, 22, 36, 0.96);
  color: #f6f8fc;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.hover-tooltip.hidden {
  display: none;
}

.confetti-piece {
  position: absolute;
  top: var(--start-y, 16%);
  width: var(--w, 8px);
  height: var(--h, 12px);
  border-radius: 2px;
  opacity: 0.92;
  pointer-events: none;
  z-index: 1001;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.2, 0.6, 0.3, 1);
  animation-fill-mode: forwards;
  will-change: transform, opacity;
  box-shadow: 0 1px 2px rgba(8, 14, 28, 0.28);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes debug-dropdown-enter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes winner-pop {
  0% {
    transform: scale(0.9);
    opacity: 0.2;
  }
  70% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes winner-glow {
  0% {
    text-shadow: 0 0 0 rgba(255, 255, 255, 0.5);
  }
  35% {
    text-shadow: 0 0 24px rgba(255, 255, 255, 0.55);
  }
  100% {
    text-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -22px, 0) rotate(0deg) scale(0.86);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  68% {
    opacity: 0.9;
  }
  100% {
    transform: translate3d(var(--dx), var(--dy, 420px), 0) rotate(var(--dr)) scale(var(--sx, 1));
    opacity: 0;
  }
}

@keyframes wheel-enter {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1140px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    align-items: center;
    gap: 12px;
  }

  .side-column {
    height: auto;
  }

  .wheel-area {
    min-height: auto;
  }

  .goal-card {
    position: static;
    width: 100%;
    max-width: none;
    margin-bottom: 10px;
  }

  .latest-daily-card {
    position: static;
    width: 100%;
    max-width: none;
    margin-top: 10px;
    margin-bottom: 6px;
  }

  .wheel-stack {
    width: min(72vh, 94vw, 860px);
  }

  .ranking-panel {
    flex: initial;
  }

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

  .winner-btn {
    width: 100%;
  }
}
