@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #04111f;
  --bg-deep: #020b14;
  --panel: rgba(11, 35, 59, 0.78);
  --panel-strong: #0b243d;
  --panel-soft: rgba(19, 54, 87, 0.58);
  --line: rgba(164, 204, 234, 0.13);
  --line-bright: rgba(164, 204, 234, 0.25);
  --text: #f5fbff;
  --muted: #91a9bb;
  --muted-2: #6f8799;
  --blue: #3aa7ff;
  --blue-light: #8fd5ff;
  --cyan: #2ed6c3;
  --violet: #9f7cff;
  --gold: #f6b84b;
  --danger: #ff6d7c;
  --success: #56e3a5;
  --shadow: 0 24px 80px rgba(0, 5, 12, 0.42);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 17px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% -5%, rgba(38, 135, 211, 0.26), transparent 38%),
    radial-gradient(circle at 92% 32%, rgba(19, 93, 146, 0.17), transparent 35%),
    linear-gradient(155deg, #061b2e 0%, #04111f 42%, #020b14 100%);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one {
  top: -170px;
  right: -120px;
  background: #38a9ff;
}

.ambient-two {
  left: -180px;
  top: 48%;
  background: #1d72b8;
}

.card-suits-bg {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.card-suit {
  position: absolute;
  color: #a7d7f4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(76px, 18vw, 148px);
  line-height: 1;
  opacity: 0.055;
  filter: drop-shadow(0 0 28px currentColor);
  transform: rotate(var(--suit-rotate));
  user-select: none;
}

.suit-heart {
  --suit-rotate: -12deg;
  top: 8%;
  right: -18px;
  color: #ff6576;
}

.suit-spade {
  --suit-rotate: 14deg;
  top: 36%;
  left: -22px;
}

.suit-club {
  --suit-rotate: -10deg;
  right: -20px;
  bottom: 19%;
}

.suit-diamond {
  --suit-rotate: 12deg;
  bottom: 2%;
  left: 5%;
  color: #ff6576;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  min-height: 100vh;
  margin-inline: auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(34px, env(safe-area-inset-bottom));
}

.screen {
  animation: screen-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-header,
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 2px 22px;
}

.brand-header {
  justify-content: flex-start;
}

.brand-header .icon-button {
  margin-inline-start: auto;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 5px;
  width: 52px;
  height: 52px;
  place-content: center;
  border: 1px solid var(--line-bright);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(52, 145, 216, 0.22), rgba(11, 34, 58, 0.65));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 30px rgba(0,0,0,0.2);
}

.brand-mark span {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(145deg, var(--blue-light), var(--blue));
  box-shadow: 0 0 14px rgba(58, 167, 255, 0.55);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.brand-header h1,
.game-header h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.hero-card {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 240px;
  overflow: hidden;
  padding: 30px;
  border: 1px solid rgba(126, 197, 244, 0.18);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(125deg, rgba(13, 58, 94, 0.96), rgba(7, 33, 56, 0.88)),
    var(--panel-strong);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.07);
}

.entry-panel-hidden {
  display: none !important;
}

.setup-screen.entry-panel-open .hero-card {
  display: none;
}

.entry-mode-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.entry-mode-button {
  display: flex;
  min-width: 0;
  min-height: 126px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 16px 10px;
  border: 1px solid var(--line-bright);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(20, 67, 102, 0.78), rgba(7, 29, 49, 0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 14px 38px rgba(0, 7, 16, 0.22);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.entry-mode-button:active {
  transform: scale(.98);
}

.entry-mode-button:hover {
  border-color: rgba(143, 213, 255, .4);
  background: linear-gradient(145deg, rgba(25, 81, 122, 0.86), rgba(8, 35, 58, 0.95));
}

.entry-mode-button strong {
  font-size: 18px;
  line-height: 1.5;
}

.entry-mode-button small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.entry-mode-icon {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 3px;
  place-items: center;
  border: 1px solid rgba(143, 213, 255, .2);
  border-radius: 14px;
  background: rgba(58, 167, 255, .1);
  color: var(--blue-light);
  font-size: 23px;
  font-weight: 500;
  line-height: 1;
}

.follow-game .entry-mode-icon {
  border-color: rgba(86, 227, 165, .2);
  background: rgba(86, 227, 165, .08);
  color: #8cebc0;
  font-size: 18px;
}

.account-entry .entry-mode-icon {
  font-size: 21px;
}

.account-panel {
  display: grid;
  gap: 16px;
}

.account-auth-card,
.account-dashboard,
.account-lounge-editor {
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-xl);
}

.account-auth-card {
  padding: 24px;
}

.account-panel-heading,
.account-dashboard-head,
.account-editor-head,
.account-players-head,
.account-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.account-panel-heading {
  align-items: flex-start;
}

.account-panel-heading h2,
.account-dashboard-head h2,
.account-editor-head h3 {
  margin: 2px 0 4px;
}

.account-panel-heading p,
.account-dashboard-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.account-lock-icon {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 17px;
  background: var(--panel-soft);
  color: var(--blue-light);
  font-size: 25px;
}

.account-auth-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 22px;
}

.account-auth-modes button {
  display: grid;
  min-width: 0;
  min-height: 72px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  text-align: right;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.account-auth-modes button:active { transform: scale(.98); }

.account-auth-modes button > span:last-child,
.account-auth-modes button strong,
.account-auth-modes button small {
  display: block;
  min-width: 0;
}

.account-auth-modes button strong {
  font-size: 14px;
  line-height: 1.5;
}

.account-auth-modes button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.account-mode-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.035);
  color: var(--blue-light);
  font-size: 18px;
  font-weight: 800;
}

.account-auth-modes button.selected {
  border-color: var(--line-bright);
  background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 55%, #080304));
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--blue) 22%, transparent);
}

.account-auth-modes button.selected small { color: rgba(255,255,255,.74); }
.account-auth-modes button.selected .account-mode-icon {
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.13);
  color: #fff;
}

.account-auth-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.account-auth-form label,
.account-lounge-name {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-auth-form input,
.account-lounge-name input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
}

.account-passcode-note {
  margin: -2px 2px 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

.account-submit,
.account-save-lounge,
.account-add-lounge {
  margin-top: 3px;
}

.account-dashboard {
  padding: 22px;
}

.account-dashboard-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.account-logout,
.account-editor-head button,
.account-lounge-actions button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.account-logout {
  flex: 0 0 auto;
  color: var(--blue-light);
}

.account-add-lounge {
  width: 100%;
}

.account-add-lounge span {
  margin-inline-end: 5px;
  font-size: 22px;
  line-height: 0;
}

.account-empty {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 32px 16px 18px;
  color: var(--muted);
  text-align: center;
}

.account-empty > span {
  color: var(--blue-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  opacity: .72;
}

.account-empty strong {
  color: var(--text);
  font-size: 15px;
}

.account-empty small {
  font-size: 11px;
  line-height: 1.7;
}

.account-lounges-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.account-lounge-card {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.account-lounge-info strong,
.account-lounge-info small {
  display: block;
}

.account-lounge-info strong {
  color: var(--text);
  font-size: 17px;
}

.account-lounge-info small {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-lounge-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, .7fr));
  gap: 7px;
}

.account-lounge-actions .account-lounge-start {
  border-color: var(--line-bright);
  background: var(--blue);
  color: #fff;
}

.account-lounge-actions .account-lounge-delete {
  color: var(--danger);
}

.account-lounge-editor {
  margin-top: 18px;
  padding: 18px;
}

.account-editor-head {
  margin-bottom: 16px;
}

.account-players-head,
.account-rules-head {
  margin: 20px 1px 11px;
}

.account-rules-head {
  align-items: flex-end;
}

.account-rules-head strong {
  font-size: 16px;
}

.account-rules-head small {
  color: var(--muted);
  font-size: 10px;
}

.account-player-inputs {
  max-height: none;
  overflow: visible;
}

.account-lounge-editor .setup-rules-grid {
  margin-top: 0;
}

.settings-screen {
  min-height: calc(100vh - max(22px, env(safe-area-inset-top)) - max(34px, env(safe-area-inset-bottom)));
  padding-bottom: 26px;
}

.settings-page-header {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 12px;
  padding: 2px 0 20px;
}

.settings-page-header > div { text-align: center; }
.settings-page-header h1 { margin: 2px 0 0; font-size: 24px; }

.settings-back-button,
.settings-header-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  background: var(--panel-soft);
  color: var(--blue-light);
}

.settings-back-button {
  cursor: pointer;
  font-size: 23px;
}

.settings-header-mark { font-size: 20px; }

.settings-intro-card {
  position: relative;
  display: flex;
  min-height: 142px;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line-bright);
  border-radius: 26px;
}

.settings-intro-card::after {
  content: "♥  ♦";
  position: absolute;
  left: 15px;
  bottom: -8px;
  color: var(--blue-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 46px;
  opacity: .08;
  transform: rotate(-10deg);
}

.settings-suit {
  display: grid;
  flex: 0 0 auto;
  width: 62px;
  height: 74px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 19px;
  background: var(--panel-soft);
  color: var(--blue-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  transform: rotate(-5deg);
}

.settings-intro-card h2 { margin: 3px 0 4px; font-size: 24px; }
.settings-intro-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }

.settings-page-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 23px;
}

.settings-card-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card-heading strong,
.settings-card-heading small { display: block; }
.settings-card-heading strong { font-size: 16px; }
.settings-card-heading small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.settings-card-number {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--blue-light);
  direction: ltr;
  font-weight: 800;
}

.settings-theme-choices { margin-top: 15px; }
.settings-theme-choices button { min-height: 82px; }
.settings-theme-choices button > span strong,
.settings-theme-choices button > span small { display: block; }
.settings-theme-choices button > span small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.settings-system-button {
  display: grid;
  width: 100%;
  min-height: 72px;
  grid-template-columns: 44px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 11px;
  margin-top: 15px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  text-align: right;
}

.settings-system-button strong,
.settings-system-button small { display: block; }
.settings-system-button strong { font-size: 14px; }
.settings-system-button small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.settings-system-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue-light);
  font-size: 21px;
}
.settings-system-arrow { color: var(--blue-light); font-size: 18px; }

.entry-back-button {
  margin: 0 2px 12px;
  padding: 8px 3px;
  border: 0;
  background: transparent;
  color: var(--blue-light);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.entry-back-button::before {
  content: "‹";
  display: inline-block;
  margin-inline-end: 5px;
  font-size: 17px;
  line-height: .5;
  transform: rotate(180deg);
  vertical-align: -2px;
}

.hero-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 240px;
  height: 240px;
  left: -45px;
  bottom: -70px;
  border: 1px solid rgba(127, 204, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgba(127, 204, 255, 0.025), 0 0 0 68px rgba(127, 204, 255, 0.02);
}

.hero-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  width: 64%;
}

.hero-badge {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 6px 11px;
  border: 1px solid rgba(135, 209, 255, 0.2);
  border-radius: 999px;
  background: rgba(50, 154, 228, 0.1);
  color: var(--blue-light);
  font-size: 13px;
  font-weight: 600;
}

.hero-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.28;
  letter-spacing: -0.04em;
}

.hero-copy p {
  max-width: 280px;
  margin-bottom: 0;
  color: #a9bfd0;
  font-size: 15px;
  line-height: 1.9;
}

.score-orbit {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 150px;
  height: 150px;
  transform: translateY(-50%);
}

.orbit-ring {
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(129, 205, 255, 0.3);
  border-radius: 50%;
  animation: spin 18s linear infinite;
}

.orbit-ring::before,
.orbit-ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(129, 205, 255, 0.1);
  border-radius: inherit;
}

.orbit-ring::after {
  inset: 36px;
  background: radial-gradient(circle, rgba(39, 142, 216, 0.3), rgba(21, 66, 101, 0.12));
}

.orbit-score {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #d6f0ff;
  font-size: 28px;
  font-weight: 700;
  text-shadow: 0 0 28px rgba(66, 178, 255, 0.5);
}

.orbit-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue-light);
  box-shadow: 0 0 16px rgba(126, 211, 255, 0.75);
}

.dot-a { top: 11px; right: 43px; }
.dot-b { bottom: 28px; right: 13px; width: 6px; height: 6px; }
.dot-c { bottom: 16px; left: 38px; width: 5px; height: 5px; opacity: 0.6; }

@keyframes spin { to { transform: rotate(360deg); } }

.resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(98, 216, 170, 0.2);
  border-radius: 18px;
  background: rgba(52, 162, 121, 0.09);
}

.resume-card strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.tiny-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.small-primary {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 1px solid rgba(93, 224, 172, 0.24);
  border-radius: 12px;
  background: rgba(74, 208, 156, 0.13);
  color: #a8f7d5;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.setup-panel,
.round-panel {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(150deg, rgba(13, 40, 66, 0.9), rgba(6, 25, 43, 0.93));
  box-shadow: 0 20px 60px rgba(0, 4, 10, 0.26), inset 0 1px 0 rgba(255,255,255,0.045);
  backdrop-filter: blur(20px);
}

.section-heading,
.panel-topline,
.question-heading,
.section-title-row,
.sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-heading > div,
.question-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading h3,
.question-heading h3,
.panel-topline h2,
.sheet-heading h2 {
  margin: 0;
}

.section-heading h3,
.question-heading h3 {
  font-size: 18px;
}

.step-number,
.step-badge {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(100, 186, 248, 0.25);
  border-radius: 10px;
  background: rgba(45, 143, 211, 0.12);
  color: var(--blue-light);
  font-size: 13px;
  font-weight: 700;
}

.step-badge.feeding {
  border-color: rgba(246, 184, 75, 0.26);
  background: rgba(246, 184, 75, 0.09);
  color: #ffd588;
}

.count-pill,
.hint {
  color: var(--muted);
  font-size: 13px;
}

.count-pill {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.025);
}

.player-inputs {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.player-input-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 9px;
  animation: row-in 0.3s ease both;
}

@keyframes row-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.player-index {
  display: grid;
  width: 42px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,0.025);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.player-name-input {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3, 17, 30, 0.48);
  color: var(--text);
  outline: 0;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.player-name-input::placeholder { color: #5f788b; }

.player-name-input:focus {
  border-color: rgba(77, 180, 255, 0.5);
  background: rgba(6, 28, 48, 0.75);
  box-shadow: 0 0 0 4px rgba(52, 155, 229, 0.08);
}

.remove-player {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 21px;
}

.remove-player:not(:disabled):hover { background: rgba(255, 109, 124, 0.08); color: var(--danger); }
.remove-player:disabled { opacity: 0.24; cursor: not-allowed; }

.add-player-button {
  display: flex;
  width: 100%;
  height: 47px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 12px;
  border: 1px dashed rgba(105, 184, 238, 0.28);
  border-radius: 15px;
  background: rgba(44, 135, 198, 0.045);
  color: var(--blue-light);
  cursor: pointer;
  font-size: 15px;
}

.add-player-button:disabled { opacity: 0.35; cursor: not-allowed; }

.plus { font-size: 19px; font-weight: 400; }

.main-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(127, 211, 255, 0.18);
  border-radius: 17px;
  background: linear-gradient(135deg, #198bdc, #287fc2);
  color: #fff;
  box-shadow: 0 14px 34px rgba(20, 113, 179, 0.25), inset 0 1px 0 rgba(255,255,255,0.18);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s, filter 0.18s, opacity 0.18s;
}

.main-button:active { transform: scale(0.985); }
.main-button:hover { filter: brightness(1.08); }
.main-button:disabled { opacity: 0.36; cursor: not-allowed; filter: grayscale(0.25); box-shadow: none; }

.main-button svg,
.icon-button svg,
.undo-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.start-button { margin-top: 18px; }

.privacy-note {
  margin: 17px 0 0;
  color: var(--muted-2);
  text-align: center;
  font-size: 12px;
}

.game-screen { padding-bottom: 116px; }

.game-header {
  position: sticky;
  z-index: 20;
  top: 0;
  margin: -22px -18px 0;
  padding: max(21px, env(safe-area-inset-top)) 20px 16px;
  background: linear-gradient(180deg, rgba(4,17,31,0.97) 70%, rgba(4,17,31,0));
  backdrop-filter: blur(14px);
}

.header-actions { display: flex; gap: 8px; }

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(11, 39, 65, 0.7);
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover { color: var(--text); border-color: var(--line-bright); }
.scoreboard-section { margin-top: 4px; scroll-margin-top: 92px; }

.section-title-row {
  min-height: 38px;
  margin-bottom: 10px;
  padding-inline: 3px;
  color: #bdceda;
  font-size: 15px;
  font-weight: 600;
}

.section-title-row > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(86, 227, 165, 0.08), 0 0 14px rgba(86, 227, 165, 0.45);
}

.leader-text {
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 500;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.player-score-card {
  position: relative;
  overflow: hidden;
  min-height: 101px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(14, 44, 72, 0.82), rgba(7, 27, 46, 0.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  transition: transform 0.25s, border-color 0.25s, background 0.25s;
}

.player-score-card::after {
  content: "";
  position: absolute;
  width: 64px;
  height: 64px;
  left: -22px;
  top: -23px;
  border-radius: 50%;
  background: var(--player-color);
  filter: blur(34px);
  opacity: 0.16;
}

.player-score-card.leader {
  border-color: rgba(86, 227, 165, 0.24);
  background: linear-gradient(145deg, rgba(21, 67, 73, 0.66), rgba(7, 31, 47, 0.92));
}

.player-score-card.score-pop { animation: score-pop 0.55s ease; }

@keyframes score-pop {
  0% { transform: scale(1); }
  42% { transform: scale(1.035); border-color: rgba(111, 202, 255, 0.55); }
  100% { transform: scale(1); }
}

.score-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.score-name {
  overflow: hidden;
  color: #c7d6e0;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crown {
  display: inline-flex;
  padding: 3px 7px;
  border: 1px solid rgba(86, 227, 165, 0.17);
  border-radius: 999px;
  color: #86edbd;
  font-size: 10px;
}

.score-number {
  direction: ltr;
  margin-top: 9px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.score-number.positive { color: #ffe1a8; }
.score-number.negative { color: #8ff0c2; }
.score-number.zero { color: #f2f8fc; }

.round-panel {
  margin-top: 18px;
  scroll-margin-top: 92px;
  transition: border-color .28s ease, box-shadow .28s ease, background .28s ease;
}

.panel-topline { align-items: flex-end; }
.panel-topline h2 { margin-top: 3px; font-size: 21px; }

.text-button {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.text-button:hover { color: var(--blue-light); }

.choice-scroll {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  margin: 16px -24px 0;
  padding: 0 24px 7px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.choice-scroll::-webkit-scrollbar { display: none; }

.player-choice {
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 90px;
  max-width: 145px;
  height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(5, 22, 38, 0.48);
  color: #b7c9d6;
  cursor: pointer;
  scroll-snap-align: start;
}

.player-choice-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--player-color);
  box-shadow: 0 0 12px color-mix(in srgb, var(--player-color) 55%, transparent);
}

.player-choice-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-choice.selected {
  border-color: color-mix(in srgb, var(--player-color) 55%, #fff 5%);
  background: color-mix(in srgb, var(--player-color) 14%, rgba(5, 22, 38, 0.9));
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--player-color) 16%, transparent);
}

.player-choice:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.divider {
  height: 1px;
  margin: 20px 0;
  background: linear-gradient(90deg, transparent, var(--line-bright), transparent);
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.type-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 11px 6px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(5, 22, 38, 0.48);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.type-card:active { transform: scale(0.97); }

.type-icon {
  display: grid;
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
  place-items: center;
  border-radius: 11px;
  background: rgba(255,255,255,0.045);
  font-size: 15px;
  font-weight: 700;
}

.type-name { font-size: 14px; font-weight: 700; }
.type-card small { direction: ltr; color: var(--muted); font-size: 10px; }

.type-card.hand .type-icon { color: var(--cyan); }
.type-card.super .type-icon { color: #bba7ff; }
.type-card.super-shape .type-icon { color: #ffd27a; }

.type-card.hand.selected { border-color: rgba(46, 214, 195, 0.44); background: rgba(46, 214, 195, 0.09); }
.type-card.super.selected { border-color: rgba(159, 124, 255, 0.42); background: rgba(159, 124, 255, 0.09); }
.type-card.super-shape.selected { border-color: rgba(246, 184, 75, 0.44); background: rgba(246, 184, 75, 0.09); }

.bonus-pill {
  direction: ltr;
  min-width: 50px;
  padding: 5px 10px;
  border: 1px solid rgba(246, 184, 75, 0.18);
  border-radius: 999px;
  background: rgba(246, 184, 75, 0.08);
  color: #ffd383;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.question-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.choice-scroll.compact { margin-top: 11px; }

.round-preview {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid rgba(96, 189, 255, 0.15);
  border-radius: 17px;
  background: rgba(4, 18, 32, 0.5);
}

.round-preview.empty { border-style: dashed; }

.preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #c3d5e1;
  font-size: 13px;
  font-weight: 600;
}

.preview-title small { color: var(--muted-2); font-size: 10px; }

.preview-rows {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.preview-rows > p {
  margin: 5px 0 3px;
  color: var(--muted-2);
  text-align: center;
  font-size: 11px;
}

.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.preview-player {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.preview-player span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delta {
  direction: ltr;
  font-weight: 700;
}

.delta.plus { color: #ffd68b; }
.delta.minus { color: #87edbb; }

.confirm-button { margin-top: 14px; }

.history-section { margin-top: 22px; scroll-margin-top: 92px; }

.undo-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,0.025);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.undo-button svg { width: 15px; height: 15px; }
.undo-button:disabled { opacity: 0.3; cursor: not-allowed; }

.history-list {
  display: grid;
  gap: 8px;
}

.empty-history {
  padding: 26px 15px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted-2);
  text-align: center;
  font-size: 12px;
}

.history-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(9, 32, 53, 0.64);
  animation: row-in 0.35s ease both;
}

.history-round {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: rgba(255,255,255,0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.history-main { min-width: 0; }
.history-main strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.history-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.history-type {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.history-type.hand { background: rgba(46,214,195,.1); color: #81eadc; }
.history-type.super { background: rgba(159,124,255,.1); color: #c7b8ff; }
.history-type.super-shape { background: rgba(246,184,75,.1); color: #ffd17c; }

.backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: rgba(0, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; } }

.bottom-sheet {
  position: fixed;
  z-index: 100;
  right: 50%;
  bottom: 0;
  width: min(100%, 640px);
  max-height: 90vh;
  max-height: min(90dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 22px max(28px, calc(env(safe-area-inset-bottom) + 16px));
  border: 1px solid var(--line-bright);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: linear-gradient(155deg, #0c2a46, #061828);
  box-shadow: 0 -20px 70px rgba(0, 5, 10, 0.5);
  transform: translateX(50%);
  animation: sheet-up 0.32s cubic-bezier(.2,.8,.2,1);
}

@keyframes sheet-up {
  from { opacity: 0; transform: translate(50%, 24px); }
  to { opacity: 1; transform: translate(50%, 0); }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: rgba(197, 222, 239, 0.22);
}

.sheet-heading { margin-bottom: 18px; }
.sheet-heading h2 { margin-top: 3px; font-size: 22px; }
.close-sheet,
.close-editor { font-size: 25px; line-height: 1; }

.sheet-action {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: #dce8ef;
  cursor: pointer;
  font-size: 15px;
}

.sheet-action.danger { color: #ff9ca6; }

.score-editor-rows {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
}

.score-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 10px;
}

.score-edit-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.score-edit-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(2,14,25,.55);
  color: #fff;
  text-align: center;
  direction: ltr;
}

.dialog {
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 36px), 370px);
  padding: 26px;
  border: 1px solid var(--line-bright);
  border-radius: 24px;
  background: linear-gradient(155deg, #0d2d4b, #061a2b);
  box-shadow: var(--shadow);
  text-align: center;
  transform: translate(-50%, -50%);
  animation: dialog-in 0.25s ease;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.97); }
}

.dialog-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 17px;
  background: rgba(255,109,124,.09);
  color: #ff9ca6;
  font-size: 24px;
}

.dialog h2 { margin-bottom: 8px; font-size: 18px; }
.dialog p { margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.dialog-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }

.secondary-button,
.danger-button {
  min-height: 46px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
}

.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: #c4d3dd; }
.danger-button { border: 1px solid rgba(255,109,124,.2); background: rgba(255,109,124,.13); color: #ff9da8; }

.toast {
  position: fixed;
  z-index: 120;
  right: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  min-width: 190px;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border: 1px solid rgba(113, 216, 173, 0.22);
  border-radius: 14px;
  background: rgba(12, 50, 56, 0.96);
  box-shadow: 0 12px 36px rgba(0,0,0,.3);
  color: #b9f6d9;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 14px);
  transition: opacity .22s, transform .22s;
}

.toast.show { opacity: 1; transform: translate(50%, 0); }
.toast.error { border-color: rgba(255,109,124,.25); background: rgba(64, 27, 39, .97); color: #ffb7bf; }

@media (min-width: 560px) {
  .app-shell { padding-inline: 26px; }
  .scoreboard { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .round-panel, .setup-panel { padding: 28px; }
  .choice-scroll { margin-inline: -28px; padding-inline: 28px; }
}

@media (max-width: 400px) {
  .app-shell { padding-inline: 13px; }
  .hero-card { min-height: 220px; padding: 24px; }
  .hero-copy { width: 72%; }
  .score-orbit { left: -4px; transform: translateY(-50%) scale(.82); }
  .setup-panel, .round-panel { padding: 19px 16px; }
  .choice-scroll { margin-inline: -16px; padding-inline: 16px; }
  .type-grid { gap: 6px; }
  .type-card { min-height: 104px; padding-inline: 3px; }
  .type-name { font-size: 13px; }
  .entry-mode-button { min-height: 116px; padding-inline: 8px; }
  .entry-mode-button strong { font-size: 16px; }
}

@media (max-width: 520px) {
  .entry-mode-chooser { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-mode-button.account-entry { grid-column: 1 / -1; min-height: 104px; }
  .account-auth-card,
  .account-dashboard { padding: 18px 15px; }
  .account-auth-card { border-radius: 24px; }
  .account-panel-heading {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 11px;
  }
  .account-lock-icon { width: 44px; height: 44px; border-radius: 14px; }
  .account-panel-heading h2 { margin-top: 1px; font-size: 25px; line-height: 1.45; }
  .account-panel-heading p { font-size: 13px; line-height: 1.75; }
  .account-auth-modes { margin-top: 17px; }
  .account-auth-modes button { min-width: 0; min-height: 68px; padding: 8px; }
  .account-auth-modes button strong { font-size: 13px; }
  .account-auth-modes button small { font-size: 9px; }
  .account-auth-form { width: 100%; gap: 12px; margin-top: 14px; }
  .account-auth-form label {
    display: flex !important;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }
  .account-auth-form label > span {
    display: block;
    width: 100%;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
  }
  .account-auth-form input {
    display: block;
    width: 100% !important;
    min-width: 0;
    min-height: 54px;
    padding-inline: 15px;
    font-size: 18px;
    text-align: center;
  }
  .account-passcode-note { margin: 0; font-size: 12px; line-height: 1.75; }
  .account-submit { min-height: 56px; margin-top: 2px; font-size: 17px; }
  .account-dashboard-head { display: grid; }
  .account-logout { justify-self: start; }
  .account-lounge-actions { grid-template-columns: 1fr 1fr; }
  .account-lounge-actions .account-lounge-start { grid-column: 1 / -1; }
  .account-lounge-editor { padding: 16px 12px; }
  .settings-page-header { grid-template-columns: 46px minmax(0, 1fr) 46px; }
  .settings-back-button,
  .settings-header-mark { width: 46px; height: 46px; }
  .settings-intro-card { min-height: 132px; padding: 18px 16px; }
  .settings-suit { width: 54px; height: 66px; }
  .settings-intro-card h2 { font-size: 21px; }
  .settings-page-card { padding: 16px 13px; }
}

@media (min-width: 521px) {
  .entry-mode-chooser { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (display-mode: standalone) {
  .app-shell { padding-bottom: max(38px, env(safe-area-inset-bottom)); }
}

/* Expanded game controls */

.setup-options {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.option-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.option-heading h3 {
  margin: 0;
  font-size: 17px;
}

.option-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(2, 14, 25, 0.42);
}

.segmented-control button {
  min-height: 39px;
  padding: 5px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.segmented-control button.selected {
  background: rgba(52, 151, 222, 0.16);
  color: var(--blue-light);
  box-shadow: inset 0 0 0 1px rgba(105, 196, 255, 0.13);
}

.setting-input,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 17, 30, 0.38);
}

.setting-input > span,
.toggle-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.setting-input input {
  width: 92px;
  height: 38px;
  border: 1px solid var(--line-bright);
  border-radius: 11px;
  background: rgba(2, 13, 23, 0.65);
  color: #fff;
  text-align: center;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

.toggle-row {
  position: relative;
  cursor: pointer;
}

.toggle-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-control {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 25px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  transition: background .2s, border-color .2s;
}

.toggle-control::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #7b92a4;
  transition: transform .2s, background .2s;
}

.toggle-row input:checked + .toggle-control {
  border-color: rgba(67, 179, 255, 0.42);
  background: rgba(34, 144, 220, 0.26);
}

.toggle-row input:checked + .toggle-control::after {
  background: var(--blue-light);
  transform: translateX(-19px);
}

.past-games-section {
  margin-top: 22px;
}

.past-games-list {
  display: grid;
  gap: 8px;
}

.past-game-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(9, 32, 53, 0.64);
  color: inherit;
  text-align: right;
  cursor: pointer;
}

.past-game-trophy {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: rgba(246, 184, 75, .1);
  font-size: 18px;
}

.past-game-main {
  min-width: 0;
}

.past-game-main strong,
.past-game-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.past-game-main strong { font-size: 13px; }
.past-game-main small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.past-game-date { color: var(--muted); font-size: 10px; direction: ltr; }

.timer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin: 0 0 14px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(8, 31, 52, 0.68);
}

.timer-bar > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.timer-bar span { color: var(--muted); font-size: 10px; }
.timer-bar strong { direction: ltr; font-size: 15px; font-variant-numeric: tabular-nums; }
.timer-bar i { width: 1px; height: 22px; background: var(--line); }

.timer-bar.no-timer > div,
.timer-bar.no-timer > i { display: none; }

.end-rule-badge {
  margin-inline-start: auto;
  padding: 5px 8px;
  border: 1px solid rgba(94, 190, 255, .17);
  border-radius: 999px;
  background: rgba(51, 145, 210, .08);
  color: var(--blue-light) !important;
  font-size: 10px !important;
}

.streak-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid rgba(246, 184, 75, .18);
  border-radius: 16px;
  background: linear-gradient(110deg, rgba(246,184,75,.1), rgba(102,57,29,.06));
}

.streak-flame { font-size: 21px; }
.streak-banner strong,
.streak-banner small { display: block; }
.streak-banner strong { color: #ffd183; font-size: 12px; }
.streak-banner small { margin-top: 2px; color: #b9a98c; font-size: 10px; }

button.player-score-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
}

.player-score-card:active { transform: scale(.98); }

.manual-adjust-section {
  margin-top: 18px;
}

.adjustments-toggle {
  display: flex;
  width: 100%;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 13px;
  border: 1px dashed var(--line-bright);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  color: #bed0dc;
  cursor: pointer;
  font-size: 12px;
}

.adjustments-toggle b {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  place-items: center;
  border-radius: 8px;
  background: rgba(65, 167, 238, .1);
  color: var(--blue-light);
  font-size: 15px;
}

.adjustments-toggle small { color: var(--muted); font-size: 10px; }

.adjustments-panel {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 15, 27, .42);
}

.adjustments-panel > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.adjustment-rows {
  display: grid;
  gap: 7px;
}

.adjustment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
  gap: 10px;
}

.adjustment-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}

.adjustment-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(1, 11, 20, .6);
  color: #fff;
  direction: ltr;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.finish-action { color: #ffd589; }

.edit-round-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.edit-round-form label {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: #c7d7e1;
  font-size: 13px;
}

.edit-round-form select {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #071b2e;
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3, 19, 33, .48);
}

.stat-card span,
.stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: 10px; }
.stat-card strong { direction: ltr; margin-top: 4px; font-size: 20px; font-variant-numeric: tabular-nums; }

.details-subtitle {
  margin: 0 0 10px;
  color: #cbd9e2;
  font-size: 14px;
}

.player-rounds-list {
  display: grid;
  gap: 7px;
  padding-bottom: 5px;
}

.player-round-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(3, 18, 31, .4);
  font-size: 11px;
}

.player-round-item div { min-width: 0; }
.player-round-item strong,
.player-round-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-round-item small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.player-round-item > span { direction: ltr; font-weight: 700; font-variant-numeric: tabular-nums; }

.results-sheet { max-height: 92vh; }
.result-close { position: absolute; top: 18px; left: 18px; }

.champion-hero {
  padding: 10px 0 22px;
  text-align: center;
}

.champion-hero .trophy {
  display: block;
  margin-bottom: 7px;
  font-size: 46px;
  filter: drop-shadow(0 10px 20px rgba(246,184,75,.25));
}

.champion-hero small { color: #e5bd6b; font-size: 11px; font-weight: 700; }
.champion-hero h2 { margin: 5px 0 3px; font-size: 28px; }
.champion-hero p { margin: 0; color: var(--blue-light); direction: ltr; font-size: 16px; font-weight: 700; }

.final-ranking {
  display: grid;
  gap: 7px;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 18, 31, .45);
}

.rank-row:first-child {
  border-color: rgba(246,184,75,.23);
  background: rgba(246,184,75,.07);
}

.rank-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  direction: ltr;
  font-size: 12px;
  font-weight: 700;
}

.rank-player { min-width: 0; }
.rank-player strong,
.rank-player small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-player strong { font-size: 13px; }
.rank-player small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.rank-player small { white-space: normal; line-height: 1.65; }
.rank-score { direction: ltr; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 400px) {
  .segmented-control button { font-size: 11px; }
  .timer-bar { gap: 8px; padding-inline: 10px; }
  .timer-bar strong { font-size: 13px; }
  .end-rule-badge { max-width: 85px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Mobile game navigation and score feedback */

.game-bottom-nav {
  position: fixed;
  z-index: 60;
  right: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  width: min(calc(100% - 22px), 606px);
  min-height: 68px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(150, 201, 236, .19);
  border-radius: 22px;
  background: rgba(6, 25, 43, .94);
  box-shadow: 0 14px 44px rgba(0, 4, 10, .52), inset 0 1px 0 rgba(255,255,255,.055);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transform: translateX(50%);
}

.bottom-nav-button {
  display: flex;
  min-width: 0;
  min-height: 54px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 2px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #768fa2;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}

.bottom-nav-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav-button.active {
  background: linear-gradient(145deg, rgba(52, 160, 232, .17), rgba(38, 109, 169, .08));
  color: #9bdcff;
  box-shadow: inset 0 0 0 1px rgba(107, 196, 255, .09);
}

.bottom-nav-button:active { transform: scale(.96); }

.score-number {
  font-variant-numeric: tabular-nums;
  transition: color .2s ease;
}

.score-change {
  position: absolute;
  z-index: 3;
  left: 13px;
  bottom: 11px;
  direction: ltr;
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  animation: score-change-float 1.45s cubic-bezier(.2,.8,.2,1) both;
}

.score-change.increase {
  background: rgba(255, 91, 111, .13);
  color: #ff8292;
}

.score-change.decrease {
  background: rgba(68, 224, 157, .12);
  color: #67e7ad;
}

@keyframes score-change-float {
  0% { opacity: 0; transform: translateY(7px) scale(.86); }
  16%, 70% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-9px) scale(.96); }
}

/* Clear type identity: turquoise, purple, and gold */

.type-card.hand.selected {
  border-color: rgba(46, 225, 207, .72);
  background: linear-gradient(150deg, rgba(46, 214, 195, .19), rgba(9, 47, 55, .35));
  box-shadow: 0 0 24px rgba(46, 214, 195, .12), inset 0 0 0 1px rgba(128, 255, 240, .08);
}

.type-card.super.selected {
  border-color: rgba(171, 135, 255, .72);
  background: linear-gradient(150deg, rgba(159, 124, 255, .2), rgba(42, 31, 78, .35));
  box-shadow: 0 0 24px rgba(159, 124, 255, .14), inset 0 0 0 1px rgba(215, 200, 255, .08);
}

.type-card.super-shape.selected {
  border-color: rgba(255, 195, 76, .76);
  background: linear-gradient(150deg, rgba(246, 184, 75, .2), rgba(71, 47, 13, .34));
  box-shadow: 0 0 24px rgba(246, 184, 75, .14), inset 0 0 0 1px rgba(255, 228, 165, .08);
}

.round-panel.type-hand {
  border-color: rgba(46, 214, 195, .3);
  box-shadow: 0 19px 58px rgba(0,0,0,.23), inset 0 1px 0 rgba(106, 255, 236, .06);
}

.round-panel.type-super {
  border-color: rgba(159, 124, 255, .3);
  box-shadow: 0 19px 58px rgba(0,0,0,.23), inset 0 1px 0 rgba(205, 190, 255, .06);
}

.round-panel.type-super-shape {
  border-color: rgba(246, 184, 75, .34);
  box-shadow: 0 19px 58px rgba(0,0,0,.23), inset 0 1px 0 rgba(255, 225, 158, .06);
}

.round-panel.type-hand .confirm-button {
  background: linear-gradient(135deg, #23cbb8, #158899);
}

.round-panel.type-super .confirm-button {
  background: linear-gradient(135deg, #9272f7, #6444c9);
}

.round-panel.type-super-shape .confirm-button {
  background: linear-gradient(135deg, #f0b548, #c47a22);
}

/* Overview statistics sheet */

.stats-overview-sheet { padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px)); }

.stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -7px 0 13px;
}

.stats-legend span {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.stats-legend .hand { background: rgba(46,214,195,.1); color: #7be9dc; }
.stats-legend .super { background: rgba(159,124,255,.1); color: #c6b6ff; }
.stats-legend .super-shape { background: rgba(246,184,75,.1); color: #ffd17c; }

.stats-overview-list {
  display: grid;
  gap: 9px;
}

.stats-overview-card {
  display: grid;
  width: 100%;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(3, 18, 31, .48);
  color: inherit;
  text-align: right;
  cursor: pointer;
}

.stats-overview-card:first-child {
  border-color: rgba(86, 227, 165, .2);
  background: linear-gradient(145deg, rgba(23, 70, 67, .36), rgba(3, 18, 31, .48));
}

.stats-player-heading,
.stats-player-identity {
  display: flex;
  align-items: center;
}

.stats-player-heading { justify-content: space-between; gap: 10px; }
.stats-player-identity { min-width: 0; gap: 9px; }

.stats-player-identity i {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  direction: ltr;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.stats-player-identity strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-player-heading > b {
  direction: ltr;
  color: #eaf6fc;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.stats-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.stats-breakdown > span {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 7px 3px;
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  text-align: center;
}

.stats-breakdown small { color: var(--muted); font-size: 9px; }
.stats-breakdown em { direction: ltr; font-size: 14px; font-style: normal; font-weight: 700; }
.stats-breakdown .hand em { color: #65e2d3; }
.stats-breakdown .super em { color: #b9a3ff; }
.stats-breakdown .super-shape em { color: #f7c66e; }
.stats-breakdown .feeding em { color: #9bdcff; }

body:has(#gameScreen:not(.hidden)) .toast {
  bottom: max(90px, calc(env(safe-area-inset-bottom) + 82px));
}

@media (max-width: 360px) {
  .bottom-nav-button { font-size: 10px; }
  .game-bottom-nav { width: calc(100% - 14px); }
  .score-change { left: 9px; bottom: 8px; }
}

/* The round entry card is the main action surface */

.round-panel {
  --round-accent: #55bfff;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: rgba(91, 190, 255, .36);
  background:
    radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--round-accent) 14%, transparent), transparent 34%),
    linear-gradient(150deg, rgba(15, 52, 84, .98), rgba(5, 24, 42, .98));
  box-shadow:
    0 26px 76px rgba(0, 5, 12, .42),
    0 0 0 1px rgba(89, 188, 255, .045),
    inset 0 1px 0 rgba(255,255,255,.08);
}

.round-panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  right: 9%;
  left: 9%;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, transparent, var(--round-accent), transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--round-accent) 48%, transparent);
}

.round-panel::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: -100px;
  right: -95px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: var(--round-accent);
  filter: blur(92px);
  opacity: .09;
  pointer-events: none;
}

.round-panel > * { position: relative; z-index: 1; }

.round-panel .panel-topline .tiny-label {
  display: inline-flex;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--round-accent) 30%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--round-accent) 10%, transparent);
  color: color-mix(in srgb, var(--round-accent) 65%, white);
  font-weight: 700;
}

.round-panel .panel-topline h2 {
  margin-top: 7px;
  font-size: 23px;
}

.round-panel.type-hand { --round-accent: #2ed6c3; }
.round-panel.type-super { --round-accent: #a27fff; }
.round-panel.type-super-shape { --round-accent: #f6b84b; }

/* Editable game rules */

.rules-action {
  color: #9bdcff;
  font-weight: 700;
}

.rules-editor-note {
  margin: -6px 0 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.rules-editor-rows {
  display: grid;
  gap: 10px;
}

.rule-type-card {
  --rule-color: var(--cyan);
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--rule-color) 25%, var(--line));
  border-radius: 17px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--rule-color) 8%, rgba(3,18,31,.75)), rgba(3,18,31,.62));
}

.rule-type-card.super { --rule-color: var(--violet); }
.rule-type-card.super-shape { --rule-color: var(--gold); }

.rule-type-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}

.rule-type-heading > span {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rule-color) 12%, transparent);
  color: var(--rule-color);
  font-size: 13px;
  font-weight: 800;
}

.rule-type-heading strong { font-size: 14px; }

.rule-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.rule-fields label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.rule-fields label > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-fields input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(1, 12, 22, .66);
  color: #fff;
  direction: ltr;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rule-fields input:focus {
  border-color: color-mix(in srgb, var(--rule-color) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rule-color) 9%, transparent);
}

.rules-editor-actions {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 8px;
  margin-top: 14px;
}

.rules-editor-actions .secondary-button,
.rules-editor-actions .main-button { min-height: 50px; }

@media (max-width: 360px) {
  .rule-fields { gap: 5px; }
  .rule-type-card { padding-inline: 10px; }
  .rule-fields input { font-size: 14px; }
}

/* Rest-house rules are selected before the game starts */

.setup-rules {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.setup-rules .option-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reset-setup-rules {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.setup-rules-grid { margin-top: 14px; }

.setup-rules-footnote {
  margin: 10px 2px 0;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.7;
}

.setup-rules .rule-type-card {
  background: linear-gradient(145deg, color-mix(in srgb, var(--rule-color) 7%, rgba(3,18,31,.7)), rgba(3,18,31,.52));
}

/* Live spectator rooms */

.join-room-card {
  display: grid;
  gap: 13px;
  margin: 12px 0 0;
  padding: 15px;
  border: 1px solid rgba(88, 194, 255, .2);
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(18, 60, 92, .58), rgba(6, 27, 46, .72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.join-room-copy,
.join-room-form {
  display: flex;
  align-items: center;
}

.join-room-copy { gap: 10px; }

.join-room-icon {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(75, 197, 255, .17);
  border-radius: 13px;
  background: rgba(49, 161, 221, .09);
  color: #7ed7ff;
  font-size: 17px;
}

.join-room-copy strong,
.join-room-copy small { display: block; }
.join-room-copy strong { font-size: 14px; }
.join-room-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.join-room-form { gap: 8px; }

.join-room-form input {
  min-width: 0;
  height: 47px;
  flex: 1 1 auto;
  padding: 0 14px;
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  background: rgba(2, 14, 25, .62);
  color: #fff;
  direction: ltr;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .18em;
}

.join-room-form input::placeholder { color: #4d687c; }

.join-room-form button {
  min-width: 82px;
  height: 47px;
  border: 1px solid rgba(103, 202, 255, .2);
  border-radius: 14px;
  background: linear-gradient(135deg, #218fd5, #2879b7);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.join-room-form button:disabled { opacity: .55; cursor: wait; }
.room-sharing-toggle { margin-top: 11px; }

.room-share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(85, 215, 169, .2);
  border-radius: 16px;
  background: linear-gradient(110deg, rgba(43, 155, 119, .12), rgba(8, 43, 51, .2));
}

.room-share-bar > div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.room-share-bar span { color: #a9c8bc; font-size: 11px; }
.room-share-bar strong { color: #9af0ca; direction: ltr; font-size: 17px; letter-spacing: .12em; }

.room-share-bar button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(102, 229, 183, .16);
  border-radius: 11px;
  background: rgba(72, 204, 155, .08);
  color: #aff2d5;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.room-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5de5ac;
  box-shadow: 0 0 12px rgba(93, 229, 172, .58);
}

.room-share-bar.sync-error {
  border-color: rgba(255, 109, 124, .24);
  background: rgba(76, 25, 38, .22);
}

.room-share-bar.sync-error .room-live-dot { background: #ff7b8b; box-shadow: 0 0 12px rgba(255, 93, 112, .5); }

.viewer-screen { padding-bottom: 36px; }

.viewer-header {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
}

.viewer-header h1 { margin: 0; font-size: 21px; }
.viewer-header h1 span { direction: ltr; letter-spacing: .08em; }

.viewer-live-status {
  padding: 6px 9px;
  border: 1px solid rgba(86, 227, 165, .2);
  border-radius: 999px;
  background: rgba(86, 227, 165, .08);
  color: #89ebbe;
  font-size: 10px;
  font-weight: 700;
}

.viewer-live-status.ended { border-color: rgba(246,184,75,.2); background: rgba(246,184,75,.08); color: #ffd17c; }
.viewer-live-status.offline { border-color: rgba(255,109,124,.22); background: rgba(255,109,124,.08); color: #ff9ca8; }

.viewer-readonly-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
  padding: 12px 13px;
  border: 1px solid rgba(101, 188, 248, .15);
  border-radius: 16px;
  background: rgba(22, 64, 96, .34);
}

.viewer-readonly-note > span { color: var(--blue-light); }
.viewer-readonly-note strong,
.viewer-readonly-note small { display: block; }
.viewer-readonly-note strong { font-size: 12px; }
.viewer-readonly-note small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.viewer-scoreboard-section { margin-top: 3px; }
.viewer-history-section { margin-top: 23px; }
.viewer-score-card { cursor: default; }
.viewer-updated-at { color: var(--muted-2); direction: ltr; font-size: 10px; }

@media (max-width: 390px) {
  .room-share-bar { align-items: flex-start; }
  .room-share-bar > div { flex-wrap: wrap; }
  .room-share-bar button { max-width: 105px; }
  .viewer-header { grid-template-columns: 42px minmax(0, 1fr) auto; }
}

@media (max-width: 559px) {
  .join-room-card { overflow: hidden; }

  .join-room-form {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 8px;
  }

  .join-room-form input,
  .join-room-form button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .choice-scroll,
  .choice-scroll.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    margin: 14px 0 0;
    padding: 0;
    scroll-snap-type: none;
  }

  .player-choice {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 46px;
    padding: 8px 10px;
  }

  .player-choice-name {
    min-width: 0;
    overflow: visible;
    line-height: 1.35;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
