/* Bet67: iPhone-style, dark only. */

:root {
  color-scheme: dark;

  --bg: #000000;
  --card: #1c1c1e;
  --label: #ffffff;
  --label-2: #98989f;
  --separator: rgba(84, 84, 88, 0.55);
  --fill: rgba(118, 118, 128, 0.24);
  --on-label: #000000;
  --up: #30d158;
  --down: #ff453a;
  --bar: rgba(22, 22, 24, 0.82);
  --shadow-sheet: none;

  --radius-card: 22px;
  --radius-control: 16px;
  --gutter: 20px;
  --tabbar: 58px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}


*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 17px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1,
h2,
p,
ol,
ul {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--label) 55%, transparent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- views */

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) calc(env(safe-area-inset-right) + var(--gutter))
    calc(env(safe-area-inset-bottom) + 40px) calc(env(safe-area-inset-left) + var(--gutter));
  animation: view-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.shell .view {
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--tabbar) + 40px);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
}

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  margin-top: 12px;
}

.summary {
  min-height: 1.35em;
  margin: 6px 0 24px;
  color: var(--label-2);
}

.offline {
  margin: -8px 0 20px;
  font-size: 15px;
  color: var(--down);
}

.view h2 {
  margin: 36px 4px 12px;
}

.sections > section:first-child h2 {
  margin-top: 8px;
}

/* ------------------------------------------------------------- tab bar */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  border-top: 1px solid var(--separator);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.tabbar button {
  flex: 1;
  max-width: 180px;
  height: var(--tabbar);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--label-2);
  cursor: pointer;
}

.tabbar button[aria-current="page"] {
  color: var(--label);
}

.tab-icon {
  position: relative;
  display: grid;
}

.tab-label {
  font-size: 11px;
  font-weight: 500;
}

.badge {
  position: absolute;
  top: -5px;
  left: 15px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--down);
  color: #fff;
  font: 600 12px/18px var(--font-round);
  text-align: center;
}

/* ----------------------------------------------------------------- join */

.join {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 36px;
}

.join-head {
  display: grid;
  gap: 12px;
}

/* A poker chip drawn with two rings. */
.chip {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 50%;
  border: 5px solid var(--label);
  background: radial-gradient(circle, var(--label) 0 34%, transparent 36%);
}

.lede {
  color: var(--label-2);
  max-width: 32ch;
}

.lede.wide {
  max-width: none;
}

.join-form {
  display: grid;
  gap: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 13px;
  background: var(--fill);
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.segmented button[aria-selected="true"] {
  background: #636366;
  font-weight: 600;
}

/* --------------------------------------------------------------- fields */

.fields {
  overflow: hidden;
}

.fields.inset {
  background: var(--fill);
  border-radius: var(--radius-control);
}

.fields input,
.fields select {
  display: block;
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline-offset: -3px;
  -webkit-appearance: none;
  appearance: none;
}

.fields > * + * {
  border-top: 1px solid var(--separator);
}

.fields input::placeholder {
  color: var(--label-2);
}

.pin {
  -webkit-text-security: disc;
}

.hint,
.form-error,
.demo-note {
  font-size: 13px;
  line-height: 1.4;
  color: var(--label-2);
  padding: 0 4px;
}

.hint.flush {
  padding: 0;
}

.form-error {
  color: var(--down);
}

.form-error:empty {
  display: none;
}

.field-label {
  font-size: 15px;
  font-weight: 600;
}

/* -------------------------------------------------------------- buttons */

.button {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.button:active {
  transform: scale(0.98);
  opacity: 0.7;
}

.button:disabled {
  opacity: 0.45;
}

.button.primary {
  background: var(--label);
  color: var(--on-label);
}

.button.quiet {
  background: var(--fill);
}

.button.plain {
  font-weight: 500;
}

.danger {
  color: var(--down);
}

.round-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  cursor: pointer;
}

.text-button {
  flex: none;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.choices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.choice {
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--fill);
  font: 600 16px/1 var(--font-round);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.choice[aria-pressed="true"] {
  background: var(--label);
  color: var(--on-label);
}

/* ---------------------------------------------------------------- lists */

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fill);
  font: 600 17px/1 var(--font-round);
}

.avatar.me {
  background: var(--label);
  color: var(--on-label);
}

.avatar.large {
  width: 72px;
  height: 72px;
  font-size: 30px;
}

.profile-button {
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.list {
  overflow: hidden;
}

.list > li {
  position: relative;
  background: var(--card);
}

.list > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 18px;
  border-top: 1px solid var(--separator);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 18px;
}

.row-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.row-button:active {
  background: var(--fill);
}

.row.empty,
.empty-card {
  color: var(--label-2);
  font-size: 15px;
}

.empty-card {
  padding: 20px 18px;
}

.rank {
  flex: none;
  width: 22px;
  font: 600 17px/1 var(--font-round);
  font-variant-numeric: tabular-nums;
  color: var(--label-2);
}

.rank.lead {
  color: var(--label);
}

.who {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub,
time {
  font-size: 14px;
  color: var(--label-2);
}

.wrap {
  white-space: normal;
  overflow-wrap: anywhere;
}

.sub.warn {
  color: var(--down);
}

.score,
.delta {
  flex: none;
  font: 600 19px/1.2 var(--font-round);
  font-variant-numeric: tabular-nums;
}

.score.muted {
  color: var(--label-2);
}

.change {
  flex: none;
  display: grid;
  gap: 1px;
  justify-items: end;
}

.delta {
  font-size: 17px;
}

.delta.up {
  color: var(--up);
}

.delta.down {
  color: var(--down);
}

/* ----------------------------------------------------------- challenges */

.cards {
  display: grid;
  gap: 16px;
}

.vote-card {
  overflow: hidden;
}

.proof-frame {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--fill);
  cursor: zoom-in;
}

.proof {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.proof:not([src]) {
  visibility: hidden;
}

.proof-missing {
  padding: 28px 18px;
  background: var(--fill);
  color: var(--label-2);
  font-size: 15px;
}

.proof-full {
  width: 100%;
  max-height: 70dvh;
  border-radius: 14px;
  object-fit: contain;
}

.vote-body {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.vote-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vote-note {
  font-size: 15px;
}

.vote-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.vote-actions .button {
  min-height: 50px;
}

.vote-actions .button.quiet[aria-pressed="true"] {
  background: var(--down);
  color: #fff;
}

.vote-actions .button.primary[aria-pressed="false"] {
  background: var(--fill);
  color: var(--label);
}

.photo-pick {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 16px;
  border: 2px dashed var(--separator);
  border-radius: var(--radius-control);
  color: var(--label-2);
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
}

.photo-pick.has-photo {
  padding: 0 0 12px;
  border-style: solid;
}

.photo-pick.has-photo .icon {
  display: none;
}

:focus-visible + .photo-pick {
  outline: 3px solid color-mix(in srgb, var(--label) 55%, transparent);
  outline-offset: 2px;
}

.row.taken .name {
  color: var(--label-2);
}

.trophy-count {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--label-2);
}

.trophy-count .icon {
  width: 20px;
  height: 20px;
}

.trophy-count.on {
  color: var(--label);
}

.proof-holder {
  width: 100%;
}

.button .icon {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
}

/* ------------------------------------------------------------ stand tab */

.beg-button,
.hall-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  padding: 14px 18px;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.beg-button {
  margin-bottom: 16px;
  border: 1.5px solid var(--label);
}

.hall-button {
  margin-top: 16px;
}

.begs:not(:empty) {
  margin-bottom: 24px;
}

.view .begs h2 {
  margin-top: 0;
}

.beg-button:active,
.hall-button:active {
  opacity: 0.7;
}

.pill-button {
  flex: none;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 22px;
  background: var(--label);
  color: var(--on-label);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pill-button:disabled {
  opacity: 0.45;
}

.choices.four {
  grid-template-columns: repeat(4, 1fr);
}

.hall-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  margin: 10px 0;
  text-align: left;
}

.hall-grid .wide {
  grid-column: 1 / -1;
  text-align: center;
}

.hall-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.hall-item .proof {
  border-radius: 14px;
  aspect-ratio: 1;
  background: var(--fill);
}

.hall-item .proof:not([src]) {
  visibility: visible;
}

.hall-item .name {
  font-size: 15px;
}

/* ----------------------------------------------------------- casino tab */

.casino-mode {
  margin: 18px 0 20px;
}

.casino-mode + .list + .hint {
  margin-top: 12px;
}

/* -------------------------------------------------------- install hint */

.install {
  position: fixed;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar) + 12px);
  left: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 456px;
  margin: 0 auto;
  padding: 10px 6px 10px 16px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
  font-size: 15px;
}

.install p {
  flex: 1;
}

.install-icon .icon {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
}

.install-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--label-2);
  cursor: pointer;
}

/* ---------------------------------------------------------------- sheet */

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 16px);
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--card);
  color: var(--label);
  box-shadow: var(--shadow-sheet);
  text-align: center;
  overflow-y: auto;
}

.sheet[open] {
  display: grid;
  justify-items: center;
  gap: 6px;
  animation: sheet-in 0.42s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.4);
  animation: fade-in 0.3s;
}

.sheet.closing {
  animation: sheet-out 0.24s ease-in forwards;
}

.sheet.closing::backdrop {
  animation: fade-out 0.24s forwards;
}

.grabber {
  width: 36px;
  height: 5px;
  margin-bottom: 18px;
  border-radius: 3px;
  background: var(--fill);
}

.sheet h2 {
  margin-top: 10px;
  font-size: 22px;
}

.sheet-points {
  margin-bottom: 20px;
  color: var(--label-2);
  font-family: var(--font-round);
}

.sheet-form {
  text-align: left;
}

.sheet-form[open] {
  justify-items: stretch;
}

.sheet-form .grabber {
  justify-self: center;
  margin-bottom: 8px;
}

.sheet-body {
  display: grid;
  gap: 14px;
}

.sheet-body h2 {
  margin: 0;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

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

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar) + 20px);
  z-index: 10;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 40px);
  padding: 12px 18px;
  border-radius: 22px;
  background: var(--label);
  color: var(--on-label);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  ::backdrop {
    animation: none !important;
    transition: none !important;
  }
}
