/* Püşk: çarx, komandalar, sıra, zər və rəqəm */

.pk-modes { max-width: 620px; margin-bottom: 16px; }

.pk-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.pk-grid.solo { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) {
  .pk-grid { grid-template-columns: minmax(0, 1fr); }
}

.hint.center { text-align: center; }
.hint:empty { display: none; }

/* ---------- Səhnə ---------- */

.stage { position: relative; min-height: 420px; }
.stage-tools { position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; gap: 2px; }
.stage-tools .icon-btn { color: var(--muted); }
.stage-tools .icon-btn:hover { color: var(--text); }
.stage-tools .icon-btn svg { stroke: currentColor; stroke-width: 1.4; }
#sound .off, #sound[aria-pressed="false"] .on { display: none; }
#sound[aria-pressed="false"] .off { display: block; }

.pane { display: grid; gap: 20px; justify-items: center; padding-top: 28px; }
.pane[hidden] { display: none; }

.stage:fullscreen {
  display: grid;
  align-content: center;
  padding: 32px;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  overflow: auto;
}
.stage:fullscreen .wheel-wrap { width: min(74vh, 92vw); }
.stage:fullscreen .hint { font-size: 1rem; }

/* ---------- Əsas düymə ---------- */

.pk-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 26px;
  border: 0;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.pk-go.sm { height: 40px; padding: 0 20px; border-radius: 11px; font-size: 0.9rem; }
.pk-go:hover { transform: translateY(-1px); }
.pk-go:active { transform: scale(0.97); }
.pk-go:disabled { opacity: 0.4; cursor: default; transform: none; }
.pk-go:focus-visible, .wheel-hub:focus-visible, .coin-scene:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- Çarx ---------- */

.wheel-wrap { position: relative; width: min(100%, 440px); aspect-ratio: 1; margin: 6px auto 0; }

.wheel {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--surface), 0 0 0 7px var(--line), 0 22px 44px -20px rgb(0 0 0 / 0.4);
  cursor: pointer;
  will-change: transform;
}

.wheel-pointer {
  position: absolute;
  top: -20px;
  left: 50%;
  z-index: 2;
  width: 34px;
  height: 44px;
  margin-left: -17px;
  color: var(--text);
  transform-origin: 50% 32%;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.3));
  pointer-events: none;
}
.wheel-pointer circle { fill: var(--surface); }
.wheel-pointer.kick { animation: pk-kick 0.12s ease-out; }
@keyframes pk-kick {
  40% { transform: rotate(-18deg); }
}

.wheel-hub {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 24%;
  height: 24%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgb(0 0 0 / 0.22);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.wheel-hub:hover:not(:disabled) { transform: scale(1.07); }
.wheel-hub:active:not(:disabled) { transform: scale(0.95); }
.wheel-hub:disabled { color: var(--faint); cursor: default; }
.stage:fullscreen .wheel-hub { font-size: 1.3rem; }

/* ---------- Komandalar ---------- */

.pk-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 0 40px; }

.stepper { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 9px; background: var(--soft); }
.stepper button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.stepper button:disabled { opacity: 0.4; cursor: default; }
.stepper output { min-width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; width: 100%; }
.teams:empty, .order:empty { display: none; }

.team {
  --c: var(--brand);
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: 14px;
  background: linear-gradient(color-mix(in srgb, var(--c) 9%, transparent), transparent 55%), var(--raised);
}
.team h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--c); }
.team h3 small { color: var(--faint); font-size: 0.75rem; font-weight: 500; }
.team ol { display: grid; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; }
.team li { overflow-wrap: anywhere; }

.anim .team li, .anim.order li { animation: pk-in 0.35s both; animation-delay: calc(var(--i) * 45ms); }
@keyframes pk-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ---------- Sıra ---------- */

.order { display: grid; gap: 6px; width: 100%; max-width: 440px; margin: 0; padding: 0; list-style: none; counter-reset: n; }
.order li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  overflow-wrap: anywhere;
  counter-increment: n;
}
.order li::before {
  content: counter(n);
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.order li:first-child::before { background: var(--text); color: var(--bg); }

/* ---------- Zər, qəpik, rəqəm ---------- */

.luck { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }
@media (max-width: 760px) {
  .luck { grid-template-columns: minmax(0, 1fr); }
}

.luck-box {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  justify-items: center;
  align-content: start;
  padding: 20px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--raised);
  text-align: center;
}
.luck-box > :last-child { align-self: end; }

.luck-out { min-height: 1.6em; font-family: "Playfair Display", Georgia, serif; font-size: 1.5rem; font-weight: 500; line-height: 1.1; }
.luck-out.num { min-height: 1em; font-size: 3.4rem; font-variant-numeric: tabular-nums; }
.luck-out.pop { animation: pk-pop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes pk-pop {
  from { transform: scale(0.7); opacity: 0.4; }
}

.coin-scene { padding: 0; border: 0; border-radius: 50%; background: none; perspective: 700px; cursor: pointer; }
.coin { position: relative; display: block; width: 116px; height: 116px; transform-style: preserve-3d; transition: transform 1.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.coin span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: radial-gradient(circle at 30% 25%, #f8de93, #d7a22c 72%);
  color: #5a3d05;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 5px rgb(255 255 255 / 0.28), inset 0 0 0 6px rgb(90 61 5 / 0.25), 0 10px 20px -10px rgb(0 0 0 / 0.45);
}
.coin .tails { transform: rotateY(180deg); background: radial-gradient(circle at 30% 25%, #eef0f4, #a7adb9 72%); color: #353a45; }

.dice { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 76px; }
.die {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: 60px;
  height: 60px;
  padding: 9px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 8px 16px -10px rgb(0 0 0 / 0.4);
}
.die i { place-self: center; width: 9px; height: 9px; border-radius: 50%; }
.die i.on { background: var(--text); }
.dice.rolling .die { animation: pk-shake 0.22s linear infinite; }
.dice.rolling .die:nth-child(2) { animation-delay: -0.08s; }
.dice.rolling .die:nth-child(3) { animation-delay: -0.15s; }
@keyframes pk-shake {
  25% { transform: rotate(-10deg) translateY(-4px); }
  75% { transform: rotate(10deg) translateY(3px); }
}

.num-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; width: 100%; max-width: 240px; color: var(--muted); }

/* ---------- Siyahı ---------- */

.pk-list { min-height: 200px; font-family: inherit; }

.pk-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}
.pk-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pk-input.narrow { width: 84px; }
.num-range .pk-input { text-align: center; }

.pk-row { display: flex; align-items: center; gap: 8px; }
.pk-row .btn { flex: none; height: 38px; }
.pk-row .hint { flex: none; }

.saved { display: flex; flex-wrap: wrap; gap: 6px; }
.saved:empty { display: none; }
.saved-item { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid var(--line); border-radius: 99px; background: var(--raised); }
.saved-item button { border: 0; background: none; cursor: pointer; }
.saved-load { min-width: 0; padding: 5px 4px 5px 12px; overflow: hidden; font-size: 0.82rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.saved-load small { margin-left: 4px; color: var(--faint); font-weight: 400; }
.saved-del { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-right: 2px; border-radius: 50%; color: var(--faint); }
.saved-del:hover { background: var(--soft); color: var(--bad); }
.saved-del svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- Tarixçə ---------- */

.pk-history { margin-top: 16px; }
.pk-history[hidden] { display: none; }
.pk-log { display: grid; gap: 2px; max-height: 260px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.pk-log li { display: grid; grid-template-columns: 48px 92px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.9rem; overflow-wrap: anywhere; }
.pk-log li:first-child { border-top: 0; }
.pk-log time { color: var(--faint); font-variant-numeric: tabular-nums; }
.pk-log span { color: var(--muted); }

/* ---------- Qalib pəncərəsi ---------- */

.pk-win { width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 16px; border: 0; background: none; color: var(--text); }
.pk-win[open] { display: grid; place-items: center; }
.pk-win::backdrop { background: rgb(10 10 14 / 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.pk-win canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.pk-win-card {
  position: relative;
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(100%, 520px);
  padding: 36px 28px 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5);
  text-align: center;
  animation: pk-win-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pk-win-in {
  from { transform: scale(0.8) translateY(16px); opacity: 0; }
}
.pk-win-card .label { letter-spacing: 0.2em; text-transform: uppercase; }
#winName { font-family: "Playfair Display", Georgia, serif; font-size: clamp(2.2rem, 9vw, 4rem); font-weight: 500; line-height: 1.1; overflow-wrap: anywhere; }
.pk-win-card .actions { justify-content: center; align-items: center; margin-top: 14px; }
.pk-win-card .btn { height: 48px; padding: 0 18px; border-radius: 14px; font-size: 0.9rem; }

#winNote { white-space: pre-line; }

/* Bildirişdə "Geri qaytar" düyməsi */
.toast { display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }
.toast button { flex: none; padding: 0; border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

@media (max-width: 520px) {
  .pk-modes button { padding: 0 4px; font-size: 0.85rem; white-space: nowrap; }
  .pk-controls { padding: 0; }
  .pane { padding-top: 34px; }
  .pk-log li { grid-template-columns: 44px minmax(0, 1fr); }
  .pk-log span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .coin { transition: none; }
  .wheel-pointer.kick, .dice.rolling .die, .luck-out.pop, .pk-win-card, .anim .team li, .anim.order li { animation: none; }
}

/* display təyin olunmuş düymələr hidden atributuna tabe olsun */
.stage [hidden], .pk-win [hidden] { display: none; }
