/* Live PK (js/pk.js): its own layer over the game (the room, the result, "Tell us what you think", the double
   knock-out show) and the screen's edge in the last five seconds. Only opacity and transform move. */

#pk-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.72);
}
#pk-layer[hidden] { display: none; }

.pk-card {
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px 18px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.pk-card h2 { font-size: 28px; font-weight: 900; margin-top: 10px; }
.pk-card p { font-size: 19px; line-height: 1.5; margin-top: 10px; font-weight: 700; }
.pk-card .pk-small { font-size: 15px; color: var(--muted); font-weight: 600; }
.pk-card .pk-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 10px;
  background: #facc15;
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  transform: rotate(-3deg);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.55);
}
.pk-card .pk-try { margin-top: 8px; font-size: 16px; font-weight: 800; color: var(--muted); }

.pk-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 15px 18px;
  border-radius: 16px;
  background: var(--brand);
  box-shadow: 0 5px 0 var(--brand-dark);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}
.pk-btn.go { background: #16a34a; box-shadow: 0 5px 0 #166534; }
.pk-btn.quiet { background: rgba(127, 127, 127, 0.18); box-shadow: none; color: var(--ink); font-size: 19px; }
.pk-btn:disabled { opacity: 0.55; }

.pk-vs { display: flex; align-items: center; justify-content: space-around; margin-top: 18px; }
.pk-vs > div { display: grid; justify-items: center; gap: 6px; font-size: 18px; font-weight: 800; min-width: 96px; }
.pk-vs .pk-mark { font-size: 30px; font-weight: 900; color: #f59e0b; min-width: 0; }
.pk-vs .pk-wait { width: 84px; height: 84px; border-radius: 50%; border: 4px dashed rgba(127, 127, 127, 0.5); display: grid; place-items: center; font-size: 40px; color: var(--muted); }
.pk-vs .face { width: 84px; height: 84px; }
.pk-code { margin-top: 8px; font-size: 15px; color: var(--muted); letter-spacing: 2px; }

.pk-coins { margin-top: 12px; font-size: 24px; font-weight: 900; color: #ca8a04; }
.pk-result-win h2 { color: #f59e0b; }
.pk-result-loss h2 { color: #64748b; }

.pk-card textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 3px solid rgba(127, 127, 127, 0.35);
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 21px;
  line-height: 1.45;
  resize: vertical;
}
.pk-card textarea:focus { outline: none; border-color: #facc15; }
.pk-note { margin-top: 12px; padding: 12px; border-radius: 14px; font-size: 20px; font-weight: 900; color: #fff; }
.pk-note.ok { background: #16a34a; }
.pk-note.bad { background: #b91c1c; }

/* The double knock-out: "Both down!", "Who holds on?", then who did. */
.pk-show { width: min(100%, 420px); text-align: center; color: #fff; }
.pk-show h2 { font-size: 44px; font-weight: 900; text-shadow: 0 3px 0 #111827, 0 0 18px rgba(0, 0, 0, 0.6); }
.pk-show .pk-two { display: flex; justify-content: space-around; margin-top: 24px; }
.pk-show .pk-two > div { display: grid; justify-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.pk-show .pk-low { font-size: 48px; font-weight: 900; text-shadow: 0 3px 0 #111827; }
.pk-show .pk-low.held { color: #fde047; transform: scale(1.12); }
.pk-show .pk-low.fell { color: #f87171; }
.pk-show .face { width: 92px; height: 92px; }
.pk-fade { animation: pk-fade 0.35s ease-out both; }
@keyframes pk-fade { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

/* The last five seconds before the player has moved: the screen's edge glows red, once a second. */
#pk-edge {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  border: 4px solid #f87171;
  box-shadow: inset 0 0 46px 18px rgba(239, 68, 68, 0.75), inset 0 0 10px 4px rgba(254, 202, 202, 0.9);
  opacity: 0;
}
#pk-edge.on { animation: pk-edge 1s ease-in-out infinite; will-change: opacity; }
@keyframes pk-edge { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #pk-edge.on { animation: none; opacity: 0.8; }
  .pk-fade { animation: none; }
}

/* No skill bar in PK: its skills are the moments' picks (body.pk-on, js/pk.js duelBegin). */
body.pk-on #skill-bar { display: none !important; }

/* A skill moment's card: the countdown big, both sides' dots, four big choices with an icon each. */
.pk-pick { position: relative; padding-top: 14px; }
.pk-pick h2 { margin-top: 2px; color: #c084fc; }
.pk-help {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.2);
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}
.pk-pick-clock {
  width: 108px;
  height: 108px;
  margin: 12px auto 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 8px solid #facc15;
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.pk-pick-clock.hot { border-color: #ef4444; color: #fca5a5; box-shadow: 0 0 28px rgba(239, 68, 68, 0.8); animation: pk-beat 1s ease-in-out infinite; }
@keyframes pk-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.pk-pick-dots { display: flex; justify-content: center; gap: 26px; margin-top: 14px; font-size: 18px; font-weight: 900; }
.pk-pick-dots > span { display: inline-flex; align-items: center; gap: 8px; }
.pk-dots { display: inline-flex; gap: 6px; }
.pk-dots i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid rgba(127, 127, 127, 0.6); }
.pk-dots i.on { background: #a855f7; border-color: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.8); }
.pk-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pk-pick-btn {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 6px 10px;
  border-radius: 18px;
  color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
}
.pk-pick-btn svg { width: 40px; height: 40px; fill: currentColor; }
.pk-pick-btn b { font-size: 26px; font-weight: 900; line-height: 1.2; }
.pk-pick-btn small { font-size: 17px; font-weight: 800; opacity: 0.92; }
.pk-pick-btn.attack { background: #dc2626; }
.pk-pick-btn.heal { background: #16a34a; }
.pk-pick-btn.shield { background: #2563eb; }
.pk-pick-btn.keep { background: #475569; }
.pk-pick-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.pk-pick-btn .pk-dots i { width: 14px; height: 14px; border-color: rgba(255, 255, 255, 0.55); }
.pk-pick-btn .pk-dots i.on { background: #fff; border-color: #fff; box-shadow: none; }
.pk-pick-btn.off { background: rgba(127, 127, 127, 0.25); color: var(--muted); box-shadow: none; align-content: center; }
.pk-pick-btn.off svg { opacity: 0.5; }
/* What no pick does, the last three seconds. */
.pk-pick-warn { margin-top: 8px; min-height: 28px; font-size: 22px; font-weight: 900; color: #fca5a5; opacity: 0; }
.pk-pick-warn.on { animation: pk-blink 0.5s steps(2, jump-none) infinite alternate; }
@keyframes pk-blink { from { opacity: 1; } to { opacity: 0.25; } }

/* The three pictures: three moments; more dots, a bigger blow; their dots and a shield. */
.pk-intro-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(127, 127, 127, 0.14); text-align: left; }
.pk-intro-row > svg { width: 56px; height: 56px; flex: none; fill: #facc15; }
.pk-intro-row b { font-size: 24px; font-weight: 900; line-height: 1.25; }
.pk-grow, .pk-watch { display: flex; align-items: center; gap: 4px; flex: none; }
.pk-grow > span { display: grid; justify-items: center; gap: 2px; }
.pk-grow svg { fill: #f97316; }
.pk-grow-1 svg { width: 20px; height: 20px; }
.pk-grow-2 svg { width: 30px; height: 30px; }
.pk-grow-3 svg { width: 42px; height: 42px; filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.8)); }
.pk-grow .pk-dots { gap: 2px; }
.pk-grow .pk-dots i { width: 7px; height: 7px; border-width: 2px; }
.pk-grow .pk-dots i:not(.on) { display: none; }
.pk-arrow { font-style: normal; font-weight: 900; color: var(--muted); }
.pk-watch { flex-direction: column; gap: 4px; font-size: 15px; font-weight: 900; color: var(--muted); }
.pk-watch svg { width: 34px; height: 34px; fill: #3b82f6; }
.pk-watch .pk-dots i { width: 12px; height: 12px; }

/* The other's pick over the whole screen (js/pk.js pkFlash): what, and with how many dots. */
.pk-flash {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(2, 6, 23, 0.6);
  animation: pk-flash 1.8s ease-out both;
}
.pk-flash > div { display: grid; justify-items: center; gap: 6px; padding: 22px 34px; border-radius: 26px; color: #fff; box-shadow: 0 0 40px rgba(0, 0, 0, 0.5); }
.pk-flash.attack > div { background: #dc2626; }
.pk-flash.heal > div { background: #16a34a; }
.pk-flash.shield > div { background: #2563eb; }
.pk-flash span { font-size: 22px; font-weight: 900; }
.pk-flash svg { width: 84px; height: 84px; fill: #fff; }
.pk-flash b { font-size: 56px; font-weight: 900; line-height: 1.1; }
.pk-flash .pk-dots i { width: 22px; height: 22px; border-color: rgba(255, 255, 255, 0.55); }
.pk-flash .pk-dots i.on { background: #fff; border-color: #fff; }
@keyframes pk-flash { 0% { opacity: 0; transform: scale(0.8); } 12% { opacity: 1; transform: scale(1.04); } 20%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pk-pick-clock.hot, .pk-pick-warn.on { animation: none; }
  .pk-pick-warn.on { opacity: 1; }
  .pk-flash { animation: none; }
}

/* The lobby, typing a room's number, the host's room number (the user's calls: big buttons, a big box for digits). */
.pk-lobby, .pk-enter { position: relative; }
.pk-btn.pk-big { padding: 20px 18px; font-size: 26px; }
.pk-code-input {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border-radius: 18px;
  border: 4px solid rgba(127, 127, 127, 0.45);
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pk-code-input:focus { outline: none; border-color: #facc15; }
.pk-code-input::placeholder { color: #cbd5e1; }
.pk-code-why { min-height: 34px; margin-top: 10px; font-size: 26px !important; font-weight: 900 !important; color: #f87171; }
.pk-room-no { display: grid; justify-items: center; margin-top: 12px; padding: 10px; border-radius: 18px; background: rgba(250, 204, 21, 0.12); }
.pk-room-no span { font-size: 18px; font-weight: 900; color: var(--muted); }
.pk-room-no b { font-size: 56px; font-weight: 900; letter-spacing: 8px; color: #facc15; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* The main menu's card: the duel card's look, its own colour, "Trial" in the corner. */
.pk-mode { background: radial-gradient(120% 140% at 0% 50%, #0f3b4a, #081d26 48%, #04090c); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.38), 0 10px 24px -14px rgba(14, 116, 144, 0.9); }
.pk-mode .duel-card-pic { background: linear-gradient(160deg, #0ea5e9, #075985); color: #fef08a; }
.pk-trial-tag { position: absolute; top: 10px; right: 12px; padding: 2px 10px; border-radius: 10px; background: #facc15; color: #111827; font-size: 14px; font-weight: 900; transform: rotate(4deg); }

/* Match the game's cards: the content scrolls, while the actions share its bottom edge. */
.pk-card.has-footer { display: flex; flex-direction: column; padding: 0; overflow: hidden; border-radius: 26px; box-shadow: inset 0 0 0 1px var(--hair), 0 24px 60px -20px #0009; }
.pk-body { position: relative; flex: 1 1 auto; min-height: 0; padding: 24px 20px; overflow: auto; overscroll-behavior: contain; }
.pk-body:focus { outline: none; }
.pk-actions { display: flex; flex: none; flex-direction: column; gap: 10px; padding: 16px 20px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in srgb, var(--muted) 20%, transparent); background: var(--surface); }
.pk-actions .pk-btn { margin: 0; box-shadow: none; }
.pk-actions .pk-btn.quiet { padding-block: 10px; }
