/* Hops · party screens. Uses the tokens and components in style.css. */

#party { display: flex; justify-content: center; }

.pt-wrap {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.pt-center { min-height: 100dvh; justify-content: center; }

.pt-topline {
  width: 100%; min-height: 48px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pt-wrap > .tag { margin-bottom: 10px; }

.pt-icon {
  flex: none; width: 44px; height: 44px; margin-left: -8px; padding: 0;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 14px; color: var(--forest); cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.5s var(--spring), background-color 0.2s var(--ease);
}
.pt-icon svg { width: 22px; height: 22px; }
.pt-icon:active { transform: scale(0.9); transition-duration: 0.08s; }
@media (hover: hover) { .pt-icon:hover { background: var(--cream-2); } }

.pt-title {
  font-size: clamp(44px, 13vw, 72px); font-weight: 800; letter-spacing: -0.045em; line-height: 0.98;
  color: var(--forest); text-wrap: balance;
}
.pt-lead {
  margin-top: 14px; max-width: 24em;
  font-size: clamp(18px, 4.8vw, 21px); line-height: 1.38; font-weight: 500; color: var(--forest-deep); text-wrap: balance;
}
.pt-from { margin-top: 8px; overflow-wrap: anywhere; }

.pt-card { padding: 20px; text-align: left; }
.pt-card h3, .pt-h { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--forest-deep); }
.pt-h + * { margin-top: 10px; }
.pt-count-note { font-size: 14px; font-weight: 600; color: var(--muted); text-align: right; }

.pt-wide { width: 100%; }
.pt-small { height: 44px; padding: 0 16px; font-size: 15px; border-radius: 14px; }
.pt-buttons { width: min(340px, 100%); margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pt-bunny .bunny { --size: 112px; }
.pt-bunny { margin: 6px 0 18px; }

/* ---- forms ---- */
.pt-form { display: flex; flex-direction: column; gap: 10px; }
.pt-label { font-size: 15px; font-weight: 700; color: var(--forest-deep); }
.pt-input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--forest-deep);
  font: 600 18px/1.2 var(--sans); letter-spacing: -0.01em;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.pt-input::placeholder { color: var(--muted); opacity: 0.7; }
.pt-input:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 22%, transparent); }
.pt-input:disabled { opacity: 0.45; }
.pt-input.picked { border-color: var(--leaf); }
.pt-form .btn-play { margin-top: 8px; width: 100%; }
.pt-join { display: flex; gap: 10px; }
.pt-join .btn-quiet { flex: none; min-width: 96px; }
.pt-code-input { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; }
.pt-code-input::placeholder { letter-spacing: 0.3em; }
.pt-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--muted); font-size: 14px; font-weight: 600; }
.pt-or::before, .pt-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pt-error { margin-top: 14px; font-size: 15px; font-weight: 700; color: var(--carrot-deep); }
.pt-link {
  margin-top: 20px; min-height: 44px; padding: 0 12px;
  background: none; border: 0; border-radius: 12px; cursor: pointer;
  font: 600 15px var(--sans); color: var(--forest); text-decoration: underline; text-underline-offset: 3px;
}

/* ---- lobby ---- */
.pt-code-label { margin-top: 8px; }
.pt-code {
  margin: 6px -0.14em 0 0;
  font-family: var(--mono); font-size: clamp(48px, 15vw, 120px); font-weight: 800;
  letter-spacing: 0.14em; line-height: 1; color: var(--forest);
  font-variant-numeric: tabular-nums;
  animation: pt-pop 0.8s 0.1s var(--spring) both;
}
.pt-copy { margin-top: 18px; min-width: 180px; }
.pt-cols { width: 100%; display: flex; flex-direction: column; }

.pt-players, .pt-rank, .pt-board { list-style: none; margin: 0; padding: 0; }
.pt-player, .pt-board-row {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 0;
  font-size: 17px; font-weight: 700;
}
.pt-player + .pt-player, .pt-board-row + .pt-board-row, .pt-rank-row + .pt-rank-row { border-top: 1px solid var(--line); }
.pt-player.away { color: var(--muted); }
.pt-pname { min-width: 0; overflow-wrap: anywhere; }
.pt-player .pt-pname { flex: 0 1 auto; }
.pt-score { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--forest); }
.pt-away { font-size: 13px; font-weight: 600; color: var(--muted); }
.pt-badge {
  flex: none; display: inline-block; vertical-align: 2px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--forest); color: var(--cream);
  font: 700 10px/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
}
.pt-badge.pt-you { background: var(--line); color: var(--forest); }

/* segmented control */
.pt-seg {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: 16px; background: var(--cream); border: 1.5px solid var(--line);
}
.pt-seg-item { position: relative; display: block; cursor: pointer; }
.pt-seg-item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pt-seg-item span {
  display: grid; place-items: center; min-height: 48px; padding: 0 4px; border-radius: 12px;
  font-size: 15px; font-weight: 700; color: var(--forest);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.5s var(--spring);
}
.pt-seg-item input:checked + span { background: var(--forest); color: var(--cream); }
.pt-seg-item:active span { transform: scale(0.94); transition-duration: 0.08s; }
@media (hover: hover) { .pt-seg-item:hover input:not(:checked) + span { background: var(--cream-2); } }
.pt-seg-item input:focus-visible + span { outline: 3px solid var(--forest); outline-offset: 2px; }
.pt-hint { margin-top: 8px; }

.pt-custom { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.pt-field { display: flex; flex-direction: column; gap: 6px; }
.pt-suggest { position: relative; }
.pt-sug {
  list-style: none; margin: 4px 0 0; padding: 6px;
  border-radius: 16px; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 18px 40px -22px rgba(20, 51, 37, 0.45);
  animation: pop-in 0.35s var(--spring) both;
}
.pt-sug-item {
  appearance: none; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 10px;
  background: none; font: 600 16px/1.25 var(--sans); color: var(--forest-deep); text-align: left; cursor: pointer;
  overflow-wrap: anywhere;
}
@media (hover: hover) { .pt-sug-item:hover { background: var(--cream-2); } }
.pt-sug-item:focus-visible { outline: none; background: var(--cream-2); box-shadow: inset 0 0 0 2px var(--forest); }
.pt-sug-note { padding: 10px 12px; font-size: 15px; color: var(--muted); }

.pt-host .pt-h:not(:first-child) { margin-top: 24px; }
.pt-limit { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pt-minutes { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; color: var(--forest-deep); }
.pt-num { width: 96px; text-align: center; font-variant-numeric: tabular-nums; }

.pt-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; font-size: 17px; font-weight: 700; color: var(--forest-deep); position: relative; }
.pt-switch input { position: absolute; opacity: 0; width: 52px; height: 32px; margin: 0; cursor: pointer; }
.pt-track {
  position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px;
  background: var(--line); transition: background-color 0.25s var(--ease);
}
.pt-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 2px 6px rgba(20, 51, 37, 0.25);
  transition: transform 0.5s var(--spring);
}
.pt-switch input:checked + .pt-track { background: var(--forest); }
.pt-switch input:checked + .pt-track::after { transform: translateX(20px); }
.pt-switch input:focus-visible + .pt-track { outline: 3px solid var(--forest); outline-offset: 3px; }

.pt-host .btn-play { margin-top: 26px; }
.pt-guest { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 20px 28px; }
.pt-guest .pt-bunny .bunny { --size: 96px; }
.pt-wait-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--forest); margin-bottom: 6px; }

/* ---- countdown ---- */
.pt-countdown .pt-bunny { margin-bottom: 0; }
.pt-count {
  font-size: clamp(150px, 46vw, 260px); font-weight: 800; letter-spacing: -0.06em; line-height: 0.9;
  font-variant-numeric: tabular-nums; color: var(--carrot);
  margin: 4px 0 18px; min-height: 0.9em;
}
.pt-count.pop { animation: pt-count 0.8s var(--spring) both; }
@keyframes pt-count { from { transform: scale(0.45); } to { transform: none; } }
@keyframes pt-pop { from { transform: translateY(10px) scale(0.92); } to { transform: none; } }

/* ---- waiting ---- */
.pt-big {
  font-size: clamp(84px, 26vw, 128px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.95;
  font-variant-numeric: tabular-nums; color: var(--forest);
}
.pt-big.out { font-size: clamp(48px, 14vw, 80px); letter-spacing: -0.04em; line-height: 1; }
.pt-sub { margin-top: 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; text-wrap: balance; }
.pt-progress { text-align: center; }
.pt-progress-n { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--forest); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.pt-waiting > .btn-quiet { margin-top: 18px; width: min(340px, 100%); }

/* ---- results ---- */
.pt-results .pt-title { margin-top: 2px; }
.pt-row {
  appearance: none; width: 100%; min-height: 60px; padding: 10px 0;
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; border-radius: 12px; font: inherit; color: inherit; text-align: left;
}
button.pt-row { cursor: pointer; transition: transform 0.5s var(--spring); }
button.pt-row:active { transform: scale(0.98); transition-duration: 0.08s; }
button.pt-row:focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }
.pt-place { flex: none; width: 1.8em; font: 700 15px var(--mono); color: var(--muted); text-align: center; }
.pt-place.first { color: var(--carrot-deep); }
.pt-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pt-who .pt-pname { font-size: 17px; font-weight: 800; color: var(--forest-deep); }
.pt-meta { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.pt-points { flex: none; font-size: 18px; font-weight: 800; color: var(--forest); font-variant-numeric: tabular-nums; }
.pt-points.zero { color: var(--muted); }
.pt-chev { flex: none; width: 14px; height: 14px; color: var(--muted); }
.pt-chev svg { display: block; width: 14px; height: 14px; transition: transform 0.55s var(--spring); }
.pt-rank-row.open .pt-chev svg { transform: rotate(180deg); }
.pt-route { padding: 0 0 12px calc(1.8em + 12px); animation: pop-in 0.4s var(--spring) both; }
.pt-route .route li { font-size: 16px; padding: 5px 0; }
.pt-board-row .pt-place { font-size: 14px; }
.pt-board-row .pt-pname { flex: 1 1 auto; }
.pt-board-row.me .pt-pname { color: var(--forest); }
.pt-results .pt-buttons .fine { text-align: center; }

@media (min-width: 900px) {
  .pt-wrap { width: min(980px, 100%); padding-top: max(36px, env(safe-area-inset-top)); }
  .pt-wrap:not(.pt-lobby):not(.pt-results) { width: min(620px, 100%); }
  .pt-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 8px; }
  .pt-cols > .card { margin-top: 22px; }
  .pt-lobby .pt-cols { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .pt-results .pt-cols { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .pt-card { padding: 24px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .pt-code, .pt-count.pop, .pt-sug, .pt-route { animation: none; }
}
