:root {
  --font-ui: Inter, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --line: #29292e;
  --line-soft: #202024;
  --text: #f6f6f7;
  --muted: #8b8b92;
  --user-book: #bcdcff;
  --user-book-strong: #8fc4ff;
  --user-book-ink: #0a2036;
  --notif: #ff4d4f;
  --radius: 14px;
  --radius-sm: 11px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* The document itself never scrolls. In the iOS app the web view otherwise pans the
   page when the keyboard opens and can leave it offset, so taps miss the tab bar. */
html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- PWA install prompt ---------- */
.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  animation: install-rise 0.25s ease;
}
@keyframes install-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.install-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex: none;
}
.install-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.install-copy strong { font-size: 14px; font-weight: 600; }
.install-actions { display: flex; gap: 8px; flex: none; }
button.small { padding: 8px 12px; font-size: 13px; }

.ios-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.ios-sheet-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: install-rise 0.25s ease;
}
.ios-sheet-card strong { font-size: 17px; }
.ios-steps {
  text-align: left;
  align-self: stretch;
  margin: 4px 0 8px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 1.45;
}
.ios-steps b { color: var(--user-book-strong); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "JetBrains Mono", monospace; }

/* soft ambient glow instead of a busy grid */
.bg-grid {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, 0.06), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.logo-img { display: block; height: 34px; width: auto; max-width: 150px; margin: 0 auto; object-fit: contain; }

/* ---------- form controls ---------- */
button {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
button:hover { border-color: #43434a; }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--text); color: #000; border-color: var(--text); }
button.primary:hover { background: #fff; }
button.ghost { background: transparent; }
button.block { display: block; width: 100%; }

.linkbtn {
  border: none;
  background: none;
  padding: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover { border: none; opacity: 0.75; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  font-weight: 500;
}
input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom */
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
}
input::placeholder, textarea::placeholder { color: #56565c; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #6a6a72; }
textarea { resize: none; }
/* Keep browser autofill on the dark surface instead of the yellow default */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  border: 1px solid var(--line);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  box-shadow: 0 0 0 1000px var(--surface-2) inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* ---------- players & levels editor ---------- */
.players-editor { margin: 18px 0 4px; }
.players-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.players-editor-head button.small {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.player-row input, .player-row select { margin-top: 0; }
.player-row .pl-name { flex: 1 1 auto; min-width: 0; }
.player-row .pl-level { flex: 0 0 92px; }
.player-row .pl-remove {
  flex: 0 0 auto;
  padding: 0;
  width: 44px;
  height: 46px;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
}
.player-row .pl-remove:hover { color: var(--text); border-color: #43434a; }
#players-rows .player-row { flex-wrap: wrap; }
#players-rows .player-row .pl-name { flex: 1 1 0; }
.pl-suggest {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border, #2a2a2f);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.pl-suggest.hidden { display: none; }
.pl-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
}
.pl-suggest-item:hover, .pl-suggest-item:focus-visible { background: var(--surface); }
.pl-suggest-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form-msg { font-size: 13.5px; margin-top: 14px; min-height: 18px; color: var(--muted); text-align: center; }
.form-msg.error { color: #ff9090; }
.form-msg.ok { color: #86e6a0; }

/* ---------- centered views (auth / onboard) ---------- */
.view.center {
  position: relative;
  z-index: 1;
  height: var(--app-h, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 26px;
  text-align: center;
}
.brand-title {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 16px 0 6px;
}
.auth-tagline { margin-bottom: 26px; font-size: 15px; }
.auth-card form { margin-top: 4px; text-align: left; }
.auth-card label:last-of-type { margin-bottom: 22px; }
.auth-switch {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
}

.auth-forgot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line, #2a2a2f);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.auth-forgot.hidden { display: none; }
.auth-forgot-title { font-size: 15px; font-weight: 700; color: var(--text); }
.auth-forgot-text { font-size: 14px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.auth-privacy { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; text-wrap: pretty; }
.auth-privacy.hidden { display: none; }
.auth-forgot-btn {
  margin-top: 8px;
  min-height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
}
.auth-forgot-id { font-size: 14px; font-weight: 500; color: var(--muted); }
.auth-forgot-note { font-size: 13.5px; line-height: 1.5; color: var(--muted); min-height: 0; }
.auth-forgot-note:empty { display: none; }

/* onboarding heading spacing */
#view-onboard .brand-title { margin-top: 4px; }
#view-onboard .muted { margin-bottom: 24px; }

/* ---------- avatar ---------- */
.avatar {
  border-radius: 50%;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--line);
  flex: none;
}
.avatar-lg { width: 88px; height: 88px; }
.avatar-sm { width: 46px; height: 46px; }
.avatar-xs { width: 32px; height: 32px; }
.avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.file-btn {
  display: inline-block;
  margin: 0;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.file-btn:hover { border-color: #43434a; }

/* ---------- app shell ---------- */
.app {
  position: relative;
  z-index: 1;
  height: var(--app-h, 100%);
  display: flex;
  flex-direction: column;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
}
.app-main { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

  .tab-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 18px 10px;
  }
.tab-head-center { flex: 1; text-align: center; }
.tab-head-center h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.tab-head-center .muted { margin-top: 2px; font-size: 12px; }
.nav-btn {
  width: 42px; height: 42px;
  font-size: 20px; padding: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

/* ---------- booking board ---------- */
.cust-board {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 10px;
}
.court-labels {
  flex: none;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  background: var(--bg);
  padding: 8px 0 4px;
  z-index: 3;
}
.court-labels span {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.slot-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 0;
  min-height: 34px;
}
.slot-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot {
  min-height: 0;
  height: 100%;
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px 8px;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: center;
  overflow: hidden;
  transition: background-color 0.12s ease, transform 0.06s ease, border-color 0.12s ease;
  font-weight: 500;
}
.slot:active { transform: scale(0.97); }
.slot.free { color: #3d3d43; font-size: 18px; background: transparent; }
.slot.free:hover { background: var(--surface); border-color: #43434a; color: var(--muted); }
.slot.booked { background: var(--surface-2); color: var(--text); cursor: default; border-color: var(--line); }
.slot.user { background: var(--user-book); color: var(--user-book-ink); border-color: var(--user-book); cursor: default; }
.slot.user .slot-tag { color: var(--user-book-ink); opacity: 0.65; }
.slot.mine { background: var(--user-book-strong); color: var(--user-book-ink); border-color: var(--user-book-strong); cursor: pointer; }
.slot.mine .slot-tag { color: var(--user-book-ink); opacity: 0.6; }
.slot.joinable { cursor: pointer; border-style: dashed; border-color: var(--user-book-strong); }
.slot.joinable:hover { background: var(--user-book); }
.slot.joined { cursor: pointer; }
.slot.event { background: var(--surface-2); color: var(--text); cursor: default; border-color: #3a3a40; }
.slot.event.joinable { cursor: pointer; border-color: var(--user-book-strong); }
.slot.past { opacity: 0.28; pointer-events: none; }
.slot .slot-until { font-size: 12px; line-height: 1.3; opacity: 0.7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slot.cont .slot-tag { opacity: 0.8; }
.board-key { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 4px 10px; font-size: 12px; color: var(--muted); }
.board-key .key-item { display: inline-flex; align-items: center; gap: 6px; }
.board-key .key-sw { display: inline-block; width: 18px; height: 12px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--surface-2); }
.board-key .key-open { border-style: dashed; border-color: var(--user-book-strong); background: transparent; }
.board-key .key-mine { border-color: var(--user-book-strong); background: var(--user-book-strong); }
  .slot .slot-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; line-height: 1.3; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.65; font-weight: 600; }
  .slot .slot-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13px; line-height: 1.3; }

.join-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.join-toggle input { width: 18px; height: 18px; accent-color: var(--user-book-strong); flex: none; }

.coach-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.coach-pick.hidden { display: none; }
.coach-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.coach-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--user-book-strong); flex: none; }
.coach-opt .coach-name { flex: 1; font-weight: 600; }
.coach-opt:has(input:checked) { border-color: var(--user-book-strong); }
.coach-summary { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ---------- dialogs ---------- */
#confirm-modal {
  width: min(400px, calc(100vw - 40px));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-1);
  color: var(--text);
  padding: 22px 20px;
}
#confirm-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
#confirm-modal h3 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
#confirm-modal .meta {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin-top: 8px;
}
#detail-modal {
  width: min(400px, calc(100vw - 40px));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-1);
  color: var(--text);
  padding: 22px 20px;
}
#detail-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
#detail-modal h3 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
#detail-modal .meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}
.detail-status {
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}
.detail-status.ok {
  background: var(--user-book);
  color: var(--user-book-ink);
}
.detail-status.wait {
  background: var(--surface-2);
  color: var(--muted);
}
.detail-roster {
  list-style: none;
  margin: 14px 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-roster li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.detail-roster li.dr-open {
  background: transparent;
  border-style: dashed;
}
  .detail-roster .dr-name { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 10px; }
  .detail-roster .dr-photo {
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    background: var(--surface-2) center / cover no-repeat;
    border: 1px solid var(--line);
  }
.detail-roster li.dr-open .dr-name { color: var(--muted); font-weight: 500; }
.detail-roster .dr-rating {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
#book-modal, #group-modal, #score-modal {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  max-height: calc(var(--app-h, 100dvh) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* With the iOS keyboard up, pin the form to the top of the visible area so its
   scrollable body ends at the keyboard instead of running underneath it. */
.kb-open #book-modal, .kb-open #group-modal {
  margin-top: calc(env(safe-area-inset-top) + 8px);
  margin-bottom: auto;
  max-height: calc(var(--app-h, 100dvh) - env(safe-area-inset-top) - 16px);
}
#book-modal::backdrop, #group-modal::backdrop, #score-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
#score-modal { padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
#score-modal .meta { color: var(--muted); font-size: 14px; margin-top: -4px; }
#score-modal .modal-actions { margin-top: 6px; }
#book-modal h3, #group-modal h3, #score-modal h3 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
#book-modal .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
  .duration-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text);
  }
  .duration-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  }
.group-picker { max-height: 260px; overflow-y: auto; margin: 4px 0; display: flex; flex-direction: column; gap: 2px; }
.group-pick-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 6px; border-radius: 10px; cursor: pointer;
}
.group-pick-row:hover { background: var(--surface-2); }
.group-pick-row .player-name { flex: 1; font-weight: 600; }
.group-pick-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--user-book, #7fb2ff); flex: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
  .detail-edit { display: block; width: 100%; min-height: 44px; margin-top: 18px; }
  .detail-edit + .modal-actions { margin-top: 10px; }
.modal-actions button { flex: 1; }

/* ---------- players & chats ---------- */
.players-list, .chats-list { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.player-row, .chat-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
  width: 100%;
  text-align: left;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.player-row:hover, .chat-row:hover { border-color: #3a3a40; background: var(--surface-2); }
.player-row.is-me {
  border-color: var(--user-book-strong);
  background: color-mix(in srgb, var(--user-book) 9%, var(--surface));
}
.player-row.is-me:hover { border-color: var(--user-book); background: color-mix(in srgb, var(--user-book) 14%, var(--surface)); }
.player-row.is-me .avatar { box-shadow: 0 0 0 2px var(--user-book-strong); }
.player-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-tag {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--user-book-strong);
  color: var(--user-book-ink);
}
.player-main { flex: 1; min-width: 0; }
.player-name { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.rating-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.member-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c9a45c;
  color: #141414;
}
.sub-with-star { display: inline-flex; align-items: center; gap: 8px; }
.price-sig-head:has(.sub-with-star) { align-items: center; }
.player-played { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.player-played-num { font-family: "JetBrains Mono", monospace; font-size: 15px; font-weight: 600; color: var(--text); }
.player-played-label { font-size: 11px; color: var(--muted); }
.player-bio, .chat-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.chat-time { font-size: 11px; color: var(--muted); font-family: "JetBrains Mono", monospace; flex: none; align-self: flex-start; margin-top: 2px; }
  .empty-state { padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.5; }

  /* ---------- join tab (open sessions) ---------- */
  #tab-join { overflow-y: auto; }
  .join-list { padding: 8px 18px 16px; }

  /* match group headers */
  .match-group { margin-bottom: 22px; }
  .match-group-head {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    margin: 4px 0 12px;
  }

  .my-matches { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
  .my-matches .match-card { border-color: var(--user-book-strong); }
  .mc-status { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }

  /* match card */
  .match-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 14px 12px;
    margin-bottom: 12px;
  }
  .mc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .mc-when { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
  .mc-court {
    flex: none;
    background: var(--user-book-strong);
    color: var(--user-book-ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 999px;
  }
  .mc-title {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mc-slots {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 14px 0 4px;
  }
  .mc-slots.event {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 6px;
  }
  .pslot {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
  }
  .pavatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
  }
  .pavatar-wrap { position: relative; }
  .pslot-star {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #c9a45c;
    color: #141414;
    border: 2px solid var(--surface);
  }
  .pavatar.photo {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }
  .pavatar.add {
    border-style: dashed;
    color: var(--muted);
    font-weight: 500;
    font-size: 22px;
    line-height: 1;
  }
  .ps-name {
    font-size: 11.5px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ps-rating { font-size: 10.5px; color: var(--muted); margin-top: -3px; }
  .mc-vs {
    flex: none;
    align-self: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    padding: 0 2px;
  }
  .mc-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
  }
  .level-pill {
    background: rgba(143, 196, 255, 0.14);
    color: var(--user-book-strong);
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
  }
  .mc-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
  }
  .mc-count svg { width: 15px; height: 15px; }
  .mc-join {
    margin-left: auto;
    flex: none;
    min-height: 40px;
    padding: 0 20px;
    font-size: 14px;
  }

  /* Challenger matches */
  .match-card.challenger { border-color: var(--user-book-strong); }
  .match-card.challenger.live { box-shadow: inset 0 0 0 1px var(--user-book-strong); }
  .ch-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .ch-badge {
    display: inline-flex;
    align-items: center;
    background: var(--user-book);
    color: var(--user-book-ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 6px;
  }
  .ch-format, .ch-final {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .ch-final { color: var(--text); }
  .ch-prize {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--text);
    padding: 3px 8px;
    border: 1px solid var(--user-book-strong);
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
  }
  .sb-names .sb-hc {
    align-self: flex-start;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    padding: 1px 6px;
    border: 1px solid var(--user-book-strong);
    border-radius: 5px;
    white-space: nowrap;
  }
  .ch-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--notif);
  }
  .ch-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--notif); animation: ch-pulse 1.4s ease-in-out infinite; }
  @keyframes ch-pulse { 50% { opacity: 0.3; } }
  @media (prefers-reduced-motion: reduce) { .ch-live i { animation: none; } }

  .scoreboard {
    margin: 12px 0 4px;
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }
  .sb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    min-height: 60px;
  }
  .sb-row + .sb-row { border-top: 1px solid var(--line-soft); }
  .sb-avs { flex: none; display: flex; }
  .sb-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 10.5px;
    font-weight: 800;
    background: var(--surface-2);
    border: 2px solid var(--bg);
    color: var(--text);
    background-size: cover;
    background-position: center;
  }
  .sb-av + .sb-av { margin-left: -9px; }
  .sb-av.open { color: var(--muted); font-weight: 500; font-size: 14px; }
  .sb-names { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
  .sb-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sb-names .muted { color: var(--muted); font-weight: 500; }
  .sb-row.won .sb-names { color: var(--user-book-strong); }
  .sb-scores { flex: none; display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
  .sb-set {
    width: 22px;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--muted);
  }
  .sb-set.win { color: var(--text); font-weight: 800; }
  .sb-set.cur { color: var(--text); font-weight: 800; }
  .sb-pt {
    min-width: 38px;
    height: 32px;
    margin-left: 4px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--user-book-strong);
    color: var(--user-book-ink);
    font-size: 15px;
    font-weight: 800;
  }
  .sb-note {
    border-top: 1px solid var(--line-soft);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--user-book-strong);
  }

  .ch-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
  .ch-watch {
    flex: 1;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--bg);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
  }
  .ch-watch svg { width: 16px; height: 16px; }
  .ch-nostream { flex: 1; font-size: 13px; color: var(--muted); }
  .ch-stream-qr {
    flex: 1 1 100%;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .ch-stream-qr img {
    flex: none;
    width: 132px;
    height: 132px;
    border-radius: 10px;
    background: #fff;
    image-rendering: pixelated;
    -webkit-touch-callout: default;
  }
  .ch-stream-qr figcaption { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.45; color: var(--muted); }
  .ch-stream-qr strong { font-size: 15px; color: var(--text); }
  .ch-score { flex: none; min-height: 44px; padding: 0 16px; font-size: 14px; }

  /* live scorer */
  .score-body { display: flex; flex-direction: column; gap: 10px; }
  .score-body .ch-badge { align-self: flex-start; }
  .score-body .scoreboard { margin: 4px 0 0; }
  .score-body .sb-row { min-height: 72px; }
  .score-body .sb-set { width: 26px; font-size: 20px; }
  .score-body .sb-pt { min-width: 46px; height: 38px; font-size: 18px; }
  .score-hint { font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; min-height: 20px; }
  .score-btns { display: flex; gap: 10px; }
  .score-pt {
    flex: 1;
    min-width: 0;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--user-book-strong);
    background: var(--surface-2);
    color: var(--text);
    touch-action: manipulation;
  }
  .score-pt:active:not(:disabled) { background: var(--user-book-strong); color: var(--user-book-ink); }
  .score-pt:disabled { opacity: 0.4; }
  .sp-label { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--user-book-strong); }
  .score-pt:active:not(:disabled) .sp-label { color: inherit; }
  .sp-team { font-size: 14px; font-weight: 700; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }

  /* legacy join card (unused, kept for safety) */
  .join-card {
  display: flex;
  align-items: center;
  gap: 14px;
    padding: 13px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .join-info { flex: 1; min-width: 0; }
  .join-title { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
  .join-meta { font-size: 13px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .join-spots { font-size: 11.5px; color: var(--user-book-strong); margin-top: 4px; font-weight: 600; }
  .join-btn { flex: none; min-height: 44px; padding: 0 20px; }

/* ---------- profile tab ---------- */
 .profile-form { flex-shrink: 0; padding: 4px 18px 8px; }
 #tab-profile { overflow-y: auto; }
 #tab-profile > * { flex-shrink: 0; }
 #tab-profile .profile-form label { margin-bottom: 10px; }
 #tab-profile .profile-form input:not([type="checkbox"]), #tab-profile .profile-form select, #tab-profile .profile-form textarea { margin-top: 5px; padding: 10px 14px; }
 #tab-profile .avatar-picker { flex-direction: row; justify-content: center; gap: 16px; margin-bottom: 12px; }
 #tab-profile .avatar-lg { width: 64px; height: 64px; }
 #tab-profile .profile-form button[type="submit"] { margin-top: 2px; }
 #tab-profile .form-msg:empty { display: none; }
 .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
 .switch-title { font-size: 14px; color: var(--text); }
 input.switch {
 appearance: none; -webkit-appearance: none; flex-shrink: 0;
 width: 48px; height: 28px; margin: 0; padding: 0; border-radius: 999px;
 background: var(--surface-2); border: 1px solid var(--line); position: relative; cursor: pointer;
 transition: background 0.2s;
 }
 input.switch::after {
 content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
 background: var(--muted); transition: transform 0.2s, background 0.2s;
 }
 input.switch:checked { background: var(--text); border-color: var(--text); }
 input.switch:checked::after { transform: translateX(20px); background: var(--bg); }
 input.switch:focus-visible { outline: 2px solid var(--user-book-strong); outline-offset: 2px; }
 .lang-pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 0 18px 8px; }
 .lang-title { font-size: 13px; color: var(--muted); }
 .lang-pick .lang-select { width: auto; min-width: 150px; min-height: 44px; margin: 0; padding: 8px 14px; font-weight: 600; }
.lang-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.lang-seg button {
  min-width: 0; min-height: 44px; padding: 0 6px; border: 0; border-radius: 12px;
  background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.lang-seg button.active { background: var(--text); color: var(--bg); }
.lang-seg button:focus-visible { outline: 2px solid var(--user-book-strong); outline-offset: 2px; }
 #sign-out { margin: 0 18px; width: calc(100% - 36px); }
 .account-links { display: flex; justify-content: space-between; align-items: center; padding: 0 18px; }
 #tab-profile .app-version { margin: 0; padding: 0 22px 12px; }
.account-link { min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
.account-link.danger { color: var(--notif); }

/* ---------- chat thread ---------- */
.thread { position: absolute; inset: 0; background: var(--bg); z-index: 5; }
.thread-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.thread-back {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: -8px -4px -8px -10px; padding: 0;
  background: none; border: 0; border-radius: 999px; color: var(--text);
}
.thread-peer { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: 16px; min-width: 0; }
  .thread-peer-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .thread-peer-name { line-height: 1.2; }
  .thread-peer-sub { font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-messages { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg-day { align-self: center; display: flex; justify-content: center; padding: 6px 0 2px; }
.msg-day span { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; }
.msg { max-width: 80%; padding: 9px 13px; font-size: 14.5px; line-height: 1.4; border-radius: 16px; }
.msg .msg-time { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; font-family: "JetBrains Mono", monospace; }
.msg.in { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.msg.out { align-self: flex-end; background: var(--text); color: #000; border-bottom-right-radius: 5px; }
.msg.out .msg-time { color: #555; }
  .msg.system { align-self: center; background: none; color: var(--muted); font-size: 13px; text-align: center; max-width: 100%; }
  .msg .msg-sender { display: block; font-size: 11px; font-weight: 700; color: var(--user-book, #7fb2ff); margin-bottom: 2px; }
.composer { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line-soft); }
.composer input { margin-top: 0; border-radius: 999px; }
  .composer button { flex: none; border-radius: 999px; padding: 13px 20px; }
.composer .composer-photo {
  width: 46px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-soft);
}
.composer .composer-mic {
  width: 46px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center;
}
.composer.has-text .composer-mic, .composer:not(.has-text) .composer-send { display: none; }
.composer.recording > :not(.voice-rec) { display: none; }
.voice-rec { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.voice-rec.hidden { display: none; }
.composer .voice-cancel {
  width: 46px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--notif); border: 1px solid var(--line-soft);
}
.voice-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--notif); animation: voice-pulse 1.1s ease-in-out infinite; flex: none; }
.voice-rec-time { font-family: "JetBrains Mono", monospace; font-size: 16px; font-variant-numeric: tabular-nums; }
.voice-rec-label { flex: 1; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes voice-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .voice-rec-dot { animation: none; } }

.msg-voice { display: flex; align-items: center; gap: 10px; width: 210px; max-width: 100%; }
.msg-voice .voice-play {
  flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--text); color: var(--bg);
}
.msg.out .msg-voice .voice-play { background: var(--bg); color: var(--text); }
.voice-play .i-pause, .msg-voice.playing .voice-play .i-play { display: none; }
.msg-voice.playing .voice-play .i-pause { display: block; }
.voice-track { flex: 1; height: 4px; border-radius: 2px; background: rgba(128, 128, 128, 0.35); overflow: hidden; }
.voice-fill { display: block; height: 100%; width: 0; background: currentColor; }
.voice-dur { font-family: "JetBrains Mono", monospace; font-size: 12px; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.msg-voice.failed .voice-play { opacity: 0.4; cursor: default; }
.visually-hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.msg.has-photo { padding: 4px; }
.msg.has-photo .msg-sender, .msg.has-photo .msg-text, .msg.has-photo .msg-time { padding: 0 9px; }
.msg.has-photo .msg-time { padding-bottom: 5px; }
.msg.has-photo .msg-text { display: block; margin-top: 6px; }
.msg-photo {
  display: block; width: 220px; max-width: 100%; min-height: 160px; padding: 0; border: 0;
  border-radius: 13px; overflow: hidden; background: var(--surface-2); cursor: zoom-in;
}
.msg.out .msg-photo { background: rgba(0, 0, 0, 0.08); }
.msg-photo.loaded { min-height: 0; }
.msg-photo img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; }
.msg-photo:not(.loaded) img { visibility: hidden; }
.msg-photo.failed { min-height: 60px; cursor: default; }
.msg-photo.failed::after { content: "Photo unavailable"; display: block; padding: 20px 12px; font-size: 13px; color: var(--muted); }
.msg.sending { opacity: 0.6; }
.msg.failed-send .msg-time { color: #ff6b6b; }
.photo-view {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(0, 0, 0, 0.94); display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
}
.photo-view[open] { display: flex; }
.photo-view::backdrop { background: rgba(0, 0, 0, 0.94); }
.photo-view img { max-width: 100%; max-height: 85dvh; object-fit: contain; }
.photo-view-hint { font-size: 13px; color: #aaa; }

/* ---------- live americano scores ---------- */
.pill {
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}
.pill.live { background: rgba(198, 255, 0, 0.16); color: #c6ff00; }
.pill.done { background: var(--surface-2); color: var(--muted); }
.pill.live::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c6ff00;
  margin-right: 5px;
  vertical-align: middle;
  animation: livepulse 1.4s ease-in-out infinite;
}
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Live-now cards in the Matches tab */
.live-events { padding: 8px 18px 0; }
.live-events:empty { padding: 0; }
.past-events { padding: 20px 18px 24px; }
.past-events:empty { padding: 0; }
.played-list { padding: 20px 18px 0; }
.played-list:empty { padding: 0; }
.played-more { width: 100%; min-height: 44px; margin-top: 2px; }
.played-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.played-counts { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.played-empty { margin: 0; padding: 4px 2px 0; line-height: 1.5; }
.played-rank { color: var(--text); }
.played-rank.podium { color: #c6ff00; }
.played-rank-of { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.played-standings { min-height: 44px; margin-top: 8px; }
.live-events-head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 6px 2px 10px;
}
.live-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 14px; margin-bottom: 8px;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); text-align: left; color: var(--text);
}
.live-card:hover { border-color: var(--line); }
.live-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.live-card-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card-score { flex: none; font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 700; color: var(--muted); }
.ch-result-toggle { width: 100%; text-align: left; min-height: 44px; }
.ch-result-toggle[aria-expanded="true"] .live-card-score { color: var(--text); }
.ch-result-detail { margin: -2px 0 10px; }
.ch-result-detail .match-card { margin: 0; }

/* Live overlay */
.live-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.live-head .nav-btn { width: 34px; height: 34px; }
.live-head .nav-btn svg { width: 20px; height: 20px; }
.live-head-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.live-title { font-size: 16px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-sub { font-size: 12px; color: var(--muted); line-height: 1.2; }
.live-tabs { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.live-tab {
  flex: 1; padding: 9px 0; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-soft); border-radius: 999px;
  background: none; color: var(--muted);
}
.live-tab.active { background: var(--text); color: #000; border-color: var(--text); }
.live-body { flex: 1; overflow-y: auto; padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }

/* Standings table */
.live-stand { width: 100%; border-collapse: collapse; font-size: 14px; }
.live-stand th {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); text-align: right; padding: 0 6px 10px; white-space: nowrap;
}
.live-stand th.rk { text-align: center; width: 30px; }
.live-stand th.l { text-align: left; }
.live-stand td { padding: 11px 6px; text-align: right; border-top: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.live-stand td.rk { text-align: center; color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: 13px; }
 .live-stand td.l { text-align: left; font-weight: 600; width: 100%; max-width: 0; }
  .ls-player { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .ls-photo {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--line-soft) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  }
  .ls-initial { font-size: 12px; font-weight: 700; color: var(--muted); }
  .ls-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .ls-name, .ls-handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ls-handle { font-size: 12px; font-weight: 500; color: var(--muted); }
.live-stand td.pts { font-weight: 800; }
.live-stand tr.top td.rk { color: #c6ff00; }
  .live-stand td.pos { color: #c6ff00; }
  .live-stand td.neg { color: var(--muted); }
  .live-stand td.wl { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); white-space: nowrap; }
  .live-stand td.pts.adj { color: #c6ff00; }
  .live-note { margin-top: 10px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

/* Rounds / match scores */
.live-round { margin-bottom: 18px; }
.live-round-head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.live-game {
  display: flex; align-items: stretch; gap: 10px;
  padding: 10px 12px; margin-bottom: 7px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface);
}
.live-court {
  flex: none; align-self: center;
  font-family: "JetBrains Mono", monospace; font-size: 11px; font-weight: 700;
  color: var(--muted);
}
.live-teams { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.live-team { display: flex; align-items: center; gap: 8px; }
.lt-names { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.lt-score { flex: none; font-family: "JetBrains Mono", monospace; font-size: 15px; font-weight: 700; color: var(--muted); }
.live-team.win .lt-names, .live-team.win .lt-score { color: var(--text); }
.live-sitouts { font-size: 12px; color: var(--muted); margin-top: 2px; padding-left: 2px; }

/* ---------- tabbar ---------- */
  /* The logo file has a solid black background; "screen" drops it into the dark app bg.
     The artwork only fills the middle ~55% of the file's height, so the row clips the
     empty padding to keep the lettering large without a tall row. */
  /* Tab headers differ in height (subtitle, + button), so headers above the logo share
     one fixed height to keep the logo at the same screen position on every tab. */
  .tab-head:has(+ .tab-brand) {
  box-sizing: border-box;
  height: calc(62px + env(safe-area-inset-top, 0px));
  flex: none;
  /* The logo sits absolutely at the left, so reserve its width (18px inset + ~95px art + gap)
     and start the heading after it instead of centering underneath it. */
  padding-left: 126px;
  }
  .tab-head:has(+ .tab-brand) .tab-head-center { min-width: 0; text-align: left; }
  .tab-head:has(+ .tab-brand) .tab-head-center > * {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .tab:has(> .tab-brand) { position: relative; }
  .tab-brand {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 18px;
  z-index: 1;
  display: flex;
  height: 34px;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
  pointer-events: none;
  }
  .tab-brand img {
  display: block;
  height: 62px;
  width: auto;
  margin-top: -14px;
  mix-blend-mode: screen;
  opacity: 0.92;
  }
  .tabbar {
  display: flex;
  border-top: 1px solid var(--line-soft);
  background: rgba(11, 11, 12, 0.92);
  backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbtn {
  flex: 1;
  border: none;
  background: none;
  padding: 11px 0 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.tabbtn svg { width: 23px; height: 23px; }
.tabbtn:hover { border: none; color: var(--text); }
.tabbtn.active { color: var(--text); }
.tabicon { position: relative; display: inline-flex; }
.tab-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--notif);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--bg);
}

/* unread conversation indicator */
.chat-row { position: relative; }
.chat-row.unread .player-name { font-weight: 700; }
.chat-row.unread .chat-preview { color: var(--text); }
.chat-dot {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--notif);
}
.chat-row .chat-time + .chat-dot { right: 14px; }

/* in-app message toast */
.toast-host {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(env(safe-area-inset-top, 0) + 10px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--notif);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transform: translateY(-14px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-title { font-size: 13.5px; font-weight: 700; }
.toast-body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

  /* club tab */
  #tab-club { overflow-y: auto; }
  .club-body { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 12px; }
  .club-card {
    background: var(--surface-2);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 12px 14px;
  }
  .club-card-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); margin: 0 0 6px;
  }

  .price-list { list-style: none; margin: 0; padding: 0; }
  .price-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 7px 0; border-bottom: 1px solid var(--line-soft);
  }
  .price-row:last-child { border-bottom: none; }
  .price-label { font-size: 15px; color: var(--text); display: flex; flex-direction: column; gap: 1px; }
  .price-sub-note { font-size: 12px; font-weight: 400; color: var(--muted); }
  .price-value { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .price-unit { font-size: 12px; font-weight: 500; color: var(--muted); }

  .price-row.lead { padding: 8px 0; }
  .price-row.lead .price-label { font-weight: 700; }
  .price-row.lead .price-value { font-size: 18px; font-weight: 800; }
.price-value.price-stack { text-align: right; line-height: 1.35; }
  .price-cap {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); padding: 8px 0 2px;
  }
  .price-row.sub .price-label { padding-left: 12px; color: var(--muted); font-size: 14px; }
  .price-row.price-row-block { flex-direction: column; align-items: stretch; gap: 6px; }
  .price-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .price-tiers-2 { grid-template-columns: repeat(2, 1fr); }
  .price-tier {
    display: flex; flex-direction: column; gap: 1px; min-width: 0;
    background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 8px;
  }
  .price-tier-k { font-size: 12px; color: var(--muted); line-height: 1.3; }
  .price-tier-v { font-size: 16px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
  .price-sig-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .price-perks { gap: 3px; padding: 8px 10px; }
  .price-perk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); line-height: 1.4; }
  .price-buy, .price-sig-buy {
    font: inherit; color: inherit; text-align: left; cursor: pointer;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  }
  .price-buy { position: relative; padding-right: 26px; min-height: 44px; justify-content: center; transition: opacity .15s, transform .15s; }
  .price-buy::after {
    content: ""; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px;
    border-top: 2px solid var(--muted); border-right: 2px solid var(--muted);
    transform: translateY(-50%) rotate(45deg);
  }
  .price-sig-buy { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 0; background: none; border: 0; }
  .price-buy:active, .price-sig-buy:active .price-buy { opacity: .7; transform: scale(.985); }
  .price-buy:focus-visible, .price-sig-buy:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 10px; }
  .wallet-flash { animation: wallet-flash 1.8s ease-out; }
  @keyframes wallet-flash { 0%, 35% { box-shadow: 0 0 0 2px var(--text); } 100% { box-shadow: 0 0 0 2px transparent; } }
  .price-perk::before { content: ""; flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
  .price-notes { list-style: none; margin: 4px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; }
  .price-notes li { font-size: 12px; color: var(--muted); line-height: 1.4; }
  .price-notes li::before { content: "· "; }

  .club-duo { display: flex; gap: 10px; align-items: stretch; }
  .club-duo .club-card { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .qr-wrap {
    display: flex; align-items: center; justify-content: center;
    background: #fff; border-radius: 12px; padding: 8px;
  }
  .qr-link { text-decoration: none; transition: transform 0.12s ease, opacity 0.12s ease; }
  .qr-link:active { transform: scale(0.97); opacity: 0.85; }
  .qr-link:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
  .qr-img { width: 100%; max-width: 150px; height: auto; display: block; }
  .qr-pair { display: flex; gap: 10px; }
  .qr-option { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
  .qr-option .qr-wrap { flex: 1; }
  .qr-option .qr-img { max-width: 100%; }
  .qr-label { font-size: 14px; font-weight: 600; color: var(--text); text-align: center; }
  .qr-placeholder {
    display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 100%; min-height: 130px; color: #111; font-weight: 600; text-align: center;
  }
  .qr-placeholder .muted { color: #666; }
  .club-note { margin: 8px 0 0; }
  .club-venue { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 2px; }
  .club-address { font-size: 14px; color: var(--text); margin: 6px 0 10px; line-height: 1.45; }
  .club-map-btn {
  text-align: center; text-decoration: none; margin-top: auto;
  border: 1px solid var(--text); background: var(--text); color: #000;
  border-radius: var(--radius-sm); padding: 13px 18px; font-size: 15px; font-weight: 600;
  justify-content: center; -webkit-tap-highlight-color: transparent;
}
.club-map-btn:active { opacity: 0.85; }

  /* Club tab fits the screen: the payment card absorbs the leftover height and the QR codes scale to it */
  .club-body { flex: 1; min-height: 0; gap: 8px; padding: 0 0 8px; }
  .club-card { padding: 10px 14px; }
  .club-card-title { margin: 0 0 4px; }
  .price-row, .price-row.lead { padding: 5px 0; }
  .price-row.lead .price-value { font-size: 17px; }
  .price-value.price-stack { line-height: 1.25; }
  .club-body > .club-card:nth-child(2) { flex: 0 1 auto; min-height: 176px; display: flex; flex-direction: column; }
  .club-body > .club-card:nth-child(2) .qr-pair { flex: 0 1 auto; min-height: 0; }
  .club-body > .club-card:nth-child(2) .qr-option { min-height: 0; }
  .club-body > .club-card:nth-child(2) .qr-wrap { position: relative; flex: 0 1 auto; aspect-ratio: 0.7; min-height: 0; padding: 0; }
  .club-body > .club-card:nth-child(2) .qr-img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); max-width: none; object-fit: contain; }
  .club-body > .club-card:nth-child(2) .qr-label { font-size: 13px; }
  .club-note { margin: 6px 0 0; line-height: 1.4; }
  .club-body > .club-card:nth-child(3) { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
  .club-body > .club-card:nth-child(3) > .club-card-title,
  .club-body > .club-card:nth-child(3) > p { grid-column: 1; }
  .club-body > .club-card:nth-child(3) .club-address { margin: 2px 0 0; font-size: 13px; line-height: 1.4; }
  .club-body > .club-card:nth-child(3) .club-map-btn { grid-column: 2; grid-row: 1 / span 4; align-self: center; margin: 0; padding-inline: 14px; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; }

  /* concierge accent row */
.chat-row.concierge { background: var(--surface-2); border-color: var(--line); }
.concierge-mark {
  width: 46px; height: 46px; flex: none;
  border: 1px solid var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
  background: var(--text); color: #000;
  border-radius: 50%;
}

@media (min-width: 480px) {
  .app { border-radius: 0; }
}

/* Live Americano: personal card */
.live-me {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 0 14px; padding: 14px;
  border: 1px solid rgba(198, 255, 0, 0.35);
  background: rgba(198, 255, 0, 0.06);
  border-radius: var(--radius-sm);
}
.live-me.claim { border-style: dashed; border-color: var(--line); background: transparent; }
.live-me-claim { font-size: 14px; line-height: 1.5; color: var(--muted); }
.live-me-top { display: flex; align-items: center; gap: 12px; }
.live-me-rank {
  font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 800;
  color: #c6ff00; font-variant-numeric: tabular-nums; min-width: 44px;
}
.live-me-stats { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.live-me-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-me-line { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.live-me-change {
  flex: none; background: none; border: 0; color: var(--muted);
  font-size: 12px; text-decoration: underline; padding: 6px; cursor: pointer;
}
.live-me-next {
  font-size: 14px; line-height: 1.45; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line-soft);
}
.live-me-next.sit { color: var(--muted); }
.live-me-next.now { border-color: #c6ff00; color: #c6ff00; }
.live-stand tr.me td { background: rgba(198, 255, 0, 0.08); }
.live-stand tr.me td.l { color: #c6ff00; }
.live-stand tr.claimable { cursor: pointer; }
.live-stand tr.claimable td.l { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.live-game.mine { border-color: rgba(198, 255, 0, 0.45); background: rgba(198, 255, 0, 0.05); }

/* Profile: Americano record */
.profile-stats:empty { display: none; }
.stats-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.stats-head { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 400px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 10px;
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.stat-v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stats-lines { display: flex; flex-direction: column; }
.stats-line {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 14px;
}
.stats-line span:first-child { color: var(--muted); }
.stats-line span:last-child { font-weight: 600; text-align: right; }
.hist-list { display: flex; flex-direction: column; gap: 6px; }
.hist-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; text-align: left; color: var(--text); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.hist-row:hover, .hist-row:focus-visible { border-color: var(--line); }
.hist-rank {
  flex: none; min-width: 40px; font-family: "JetBrains Mono", monospace;
  font-weight: 800; font-size: 15px; color: var(--muted);
}
.hist-rank.podium { color: #c6ff00; }
.hist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hist-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Open matches: level filter + waitlist */
.level-filter {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.lf-btn {
  flex: 1; padding: 9px 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.lf-btn.active { background: var(--text); color: var(--bg); }
.level-hidden { padding: 14px 4px; text-align: center; font-size: 13px; color: var(--muted); }
.mc-wait { border-style: dashed; }
.mc-wait.on { border-style: solid; border-color: var(--user-book-strong); color: var(--user-book-strong); }

/* Traditional Chinese uses the matching regional glyph set. */
html:lang(zh-TW) {
  --font-ui: Inter, "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

/* match invite links */
.auth-invite {
  margin: -12px 0 20px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.auth-invite-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-invite-match {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-wrap: pretty;
}
.guest-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guest-form input {
  font-size: 16px;
}
.guest-done {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guest-done-title,
.guest-done-text,
.auth-invite-or {
  margin: 0;
}
.guest-done-title {
  font-weight: 600;
  font-size: 16px;
}
.auth-invite-or {
  font-size: 13px;
  color: var(--muted);
}
.auth-invite .form-msg:empty {
  display: none;
}
.mc-share {
  margin-left: auto;
  flex: none;
  min-height: 40px;
  min-width: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.mc-share svg { width: 17px; height: 17px; }
.mc-share + .mc-join,
.mc-share + .mc-status { margin-left: 0; }
@media (max-width: 380px) {
  .mc-share span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
#share-modal {
  width: min(400px, calc(100vw - 40px));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-1);
  color: var(--text);
  padding: 22px 20px;
}
#share-modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
#share-modal h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
#share-modal .meta { color: var(--muted); font-size: 15px; line-height: 1.5; margin-top: 8px; }
#share-what { color: var(--text); font-weight: 600; }
.share-url {
  width: 100%;
  margin-top: 14px;
  font-size: 16px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-overflow: ellipsis;
}
.share-note { min-height: 20px; margin-top: 8px; font-size: 14px; color: var(--muted); }
#share-modal .modal-actions { margin-top: 10px; flex-wrap: wrap; }
.msg-link { color: inherit; text-decoration: underline; word-break: break-all; }
.msg-join {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 700;
}

#setpw-modal {
  width: min(400px, calc(100vw - 40px));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-1);
  color: var(--text);
  padding: 22px 20px;
}
#setpw-modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
#setpw-modal form { display: flex; flex-direction: column; gap: 14px; }
#setpw-modal h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
#setpw-modal .meta { color: var(--muted); font-size: 15px; line-height: 1.5; }
#setpw-modal label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
#setpw-modal input { font-size: 16px; min-height: 44px; }
#setpw-modal .form-msg:empty { display: none; }

/* Americano prizes */
.live-prizes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.prize-feature { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.prize-feature img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 40%; }
.prize-feature figcaption { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.prize-place { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.prize-what { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.35; }
.prize-winner { font-size: 14px; color: var(--muted); }
.prize-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prize-row { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 14px; }
.prize-row + .prize-row { border-top: 1px solid var(--line-soft); }
.prize-row .prize-place { min-width: 34px; }
.prize-row-main { display: flex; flex: 1; align-items: baseline; justify-content: space-between; gap: 10px; }

/* ---------- wallet ---------- */
.wallet { display: flex; flex-direction: column; gap: 14px; margin: 0 16px 20px; padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.wallet:empty { display: none; }
.wallet-top { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.wallet-label { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wallet-balance { font-size: 40px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.wallet-member { margin-top: 6px; padding: 4px 12px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.wallet-guest { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.wallet-guest-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wallet-guest-title { font-weight: 600; color: var(--text); }
.wallet-guest-count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wallet-guest-count strong { font-size: 18px; color: var(--text); }
.wallet-guest-dots { display: flex; gap: 6px; list-style: none; }
.wallet-guest-dots li { flex: 1; height: 8px; border-radius: 999px; background: var(--line); }
  .wallet-guest-dots li.on { background: #d4a94a; }
  .wallet-guest-names { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
  .wallet-guest-section-only .wallet-guest-names { padding-top: 0; border-top: 0; }
  .wallet-guest-sub { font-size: 13px; color: var(--muted); }
  .wallet-guest-names ul { display: flex; flex-direction: column; gap: 6px; list-style: none; }
  .wallet-guest-names li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .wallet-guest-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.wallet-sub { font-size: 15px; font-weight: 600; color: var(--text); }
.wallet-pending, .wallet-pkgs, .wallet-perks, .wallet-history ul { list-style: none; }
.wallet-pending { display: flex; flex-direction: column; gap: 8px; }
.wallet-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.wallet-pending-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wallet-pending-name { font-weight: 600; color: var(--text); }
.wallet-cancel { flex-shrink: 0; min-height: 44px; padding: 0 14px; }
.wallet-pkgs { display: flex; flex-direction: column; gap: 8px; }
.wallet-pkg { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.wallet-pkg.open { border-color: var(--muted); }
.wallet-pkg-head { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 14px 4px; background: none; border: 0; border-radius: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.wallet-pkg-name { font-weight: 600; font-size: 16px; }
.wallet-pkg-price { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-perks { display: flex; flex-direction: column; gap: 2px; padding: 0 14px 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.wallet-perks li::before { content: "· "; }
.wallet-pay { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border-top: 1px solid var(--line-soft); }
.wallet-pay p { line-height: 1.5; color: var(--text); }
.wallet-pay-links { display: flex; gap: 8px; }
.wallet-pay-link { flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 8px; font-size: 14px; text-align: center; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.wallet-pay-link.picked { border-color: var(--text); }
.wallet-history summary { min-height: 44px; display: flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }
.wallet-history ul { display: flex; flex-direction: column; }
.wallet-hist-row { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.wallet-hist-text { display: flex; flex-direction: column; color: var(--text); }
.wallet-hist-amt { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.wallet-hist-amt.neg { color: var(--muted); }
.wallet-hist-date { grid-column: 1 / -1; }
.wallet-pkg-extend { order: -1; }
.wallet-extend { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 14px; background: none; border: 0; border-radius: 0; color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; }
