/* PKcard — the player's own screen (phone first). */
:root {
  --bg: #0e0b16; --panel: #1a1426; --ink: #f4effa; --mute: #a99cbf; --line: #2e2440;
  --pink: #ff3d8b; --cyan: #21d4e8; --lime: #9be53b; --amber: #ffb627;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100dvh; padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; overflow-x: hidden;
}
.hidden { display: none !important; }
.muted { color: var(--mute); } .small { font-size: 13px; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 0 6px; }
.top h1 { font-size: 20px; margin: 0; letter-spacing: .02em; }
.top h1 b { color: var(--pink); }
.back { color: var(--mute); text-decoration: none; font-size: 26px; line-height: 1; }
.conn { margin-left: auto; font-size: 12px; color: var(--mute); }
.conn.on { color: var(--lime); } .conn.off { color: var(--pink); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 12px 0; }
.panel h2 { font-size: 17px; margin: 0 0 4px; }
.center { text-align: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 14px; padding: 12px 16px; font: inherit; font-weight: 800;
  background: var(--pink); color: #fff; cursor: pointer; text-decoration: none; min-height: 46px;
}
.btn:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: #ffffff14; color: var(--ink); }
.btn.sm { padding: 8px 12px; min-height: 0; font-size: 13px; }
.btn.lime { background: var(--lime); color: #203006; } .btn.cyan { background: var(--cyan); color: #062a2e; }
.link { background: none; border: 0; color: var(--mute); text-decoration: underline; cursor: pointer; font: inherit; padding: 8px 0; }

.lobby { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lobby li { display: flex; align-items: center; gap: 10px; background: #ffffff0a; border-radius: 12px; padding: 8px 10px; }
.lobby li .nm { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby li .busy { font-size: 12px; color: var(--amber); }
#practice { width: 100%; margin-top: 4px; }
.barlink { display: flex; gap: 8px; margin: 8px 0 2px; }
.barlink input { flex: 1; min-width: 0; background: #0006; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 12px; }

/* match */
.opp { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.opp-cards { display: flex; }
.opp-cards .pkc-card { margin-right: -14px; }
.pk { background: var(--pink); color: #fff; border-radius: 8px; padding: 1px 7px; font-size: 12px; font-weight: 900; }
.series { margin-left: auto; font-weight: 900; color: var(--amber); }
.series.big { font-size: 22px; margin: 6px 0 14px; }
.clocks { display: flex; align-items: baseline; gap: 10px; }
.clock { font-weight: 900; font-size: 18px; color: var(--amber); font-variant-numeric: tabular-nums; }
.phase { font-size: 12px; color: var(--pink); font-weight: 800; }
.step { height: 6px; background: #ffffff14; border-radius: 4px; overflow: hidden; margin: 6px 0 0; }
.step i { display: block; height: 100%; width: 0; background: var(--lime); transition: width .25s linear; }
.step i.warn { background: var(--pink); }
.table { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 22px 0 10px; }
.pile { background: none; border: 0; padding: 0; cursor: pointer; }
.pile:disabled { cursor: default; opacity: .6; }
.status { text-align: center; font-weight: 800; margin: 4px 0 0; min-height: 1.4em; }
.status.you { color: var(--lime); }
.last { text-align: center; margin: 2px 0 0; min-height: 1.3em; }
.hand {
  display: flex; gap: 8px; overflow-x: auto; padding: 18px 4px 12px; margin: 6px -16px 0;
  padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity;
}
.hand .pkc-card { scroll-snap-align: center; transition: transform .12s; opacity: .45; }
.hand .pkc-card.pkc-playable { opacity: 1; transform: translateY(-10px); box-shadow: 0 0 0 3px #fff, 0 6px 16px #000a; }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.actions .btn { flex: 1; }
.pk-btn { background: #ffffff14; } .pk-btn.hot { background: var(--pink); animation: pulse .8s ease-in-out infinite alternate; }
.catch { background: var(--amber); color: #3a2400; }
@keyframes pulse { to { transform: scale(1.05); } }
#leave { display: block; margin: 14px auto 0; }

/* over */
.over-big { font-size: 64px; line-height: 1.1; }

/* modals */
.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: 100%; max-width: 420px; text-align: center; }
.modal .box.alert { border: 2px solid var(--pink); background: #2a0f1c; }
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.modal .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.modal .row .btn { flex: 1; min-width: 100px; }
.colors { display: flex; justify-content: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.colors .pkc-card { border: 0; cursor: pointer; --w: 64px; }

/* the big 3-second card */
.pop { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 15; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: popin .25s ease-out; }
.pop .who { background: #000c; border-radius: 10px; padding: 4px 10px; font-weight: 800; font-size: 13px; }
.pop .lbl { font-size: 40px; font-weight: 900; text-shadow: 0 3px 12px #000; padding: 6px 14px; border-radius: 14px; background: #000b; }
@keyframes popin { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #000d; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; z-index: 30; max-width: calc(100% - 32px); text-align: center; }

/* the gift war */
.war { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 8px; font-size: 12px; }
.wside { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wl { font-weight: 800; color: var(--mute); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en { flex: 1; height: 6px; border-radius: 4px; background: #ffffff14; overflow: hidden; min-width: 30px; }
.en i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--amber)); transition: width .4s; }
.en.op i { background: linear-gradient(90deg, var(--cyan), var(--lime)); }
.wtags { white-space: nowrap; }
.wtags .bd { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.wst { grid-column: 1 / -1; text-align: center; font-weight: 900; min-height: 1.2em; }
.wst .rv { color: var(--pink); } .wst .hn { color: var(--amber); } .wst .bl { color: var(--cyan); }
.bonus-row { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.bonus-row .pkc-card { --w: 58px; box-shadow: 0 0 0 2px #fff8, 0 4px 12px #000a; }
.bonus-row .pkc-card.armed { box-shadow: 0 0 0 3px #fff, 0 0 14px var(--amber); }
.hand.swapping .pkc-card { opacity: 1; outline: 2px dashed var(--amber); outline-offset: 2px; }
.hand.tickle { flex-direction: row-reverse; justify-content: flex-end; }
.hand.tickle .pkc-card { transform: rotate(180deg); }
.btn.swap { background: var(--amber); color: #3a2400; flex: .8; }
.btn.amber { background: var(--amber); color: #3a2400; }
.testgift summary { cursor: pointer; font-weight: 800; }
.tg-side { display: flex; gap: 14px; margin: 8px 0; flex-wrap: wrap; }
.tg-btns { display: flex; flex-wrap: wrap; gap: 6px; }
