:root {
  --bg: #ffffff; --fg: #111111; --mute: #767676; --line: #e6e6e6; --soft: #f3f3f3;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0e0e; --fg: #f2f2f2; --mute: #8d8d8d; --line: #262626; --soft: #1a1a1a; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }

.page {
  max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
h1 { font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); display: flex; align-items: center; gap: 6px; }
.between { justify-content: space-between; }
.between b { color: var(--fg); font-size: 16px; letter-spacing: 0; }
.mute { color: var(--mute); font-size: 14px; }
.center { text-align: center; align-self: center; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 10px; }

.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.label .i { width: 15px; height: 15px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; margin-left: -10px; }

input {
  width: 100%; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--soft); color: var(--fg); font: inherit; font-size: 17px; outline: none;
}
input:focus { border-color: var(--fg); }
input[type=range] { height: 32px; padding: 0; border: 0; background: none; accent-color: var(--fg); }
.code-in { text-transform: uppercase; letter-spacing: .2em; font-weight: 600; }
.join { display: flex; gap: 8px; }
.join .btn { width: auto; padding: 0 20px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 54px;
  border: 1.5px solid var(--fg); border-radius: 16px; font-weight: 600;
}
.btn.primary { background: var(--fg); color: var(--bg); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .4; }
.two { display: flex; gap: 8px; }

.seg { display: flex; padding: 3px; gap: 3px; background: var(--soft); border-radius: 14px; }
.seg button { flex: 1; height: 42px; border-radius: 11px; font-weight: 600; color: var(--mute); }
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place { width: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sw { display: flex; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; flex: none; }
.sw.sm { width: 28px; height: 28px; border-radius: 8px; }
.sw i { flex: 1; }
.sw.hidden { background: var(--soft); align-items: center; justify-content: center; color: var(--mute); }
.row.locked { color: var(--mute); }
.thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; }
.thumb.lg { width: 88px; height: 88px; border-radius: 16px; }

.hero-code { font-size: 52px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.logo { width: 80px; height: 80px; margin-top: 24px; border-radius: 22%; }
.timer { display: flex; align-items: center; gap: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* themed: the screen takes on the target colour(s) */
.themed { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.hero { position: relative; flex: 1 0 42vh; display: flex; flex-direction: column; }
.hero > div { flex: 1; display: flex; align-items: flex-end; padding: 16px 20px; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.hero > div:first-child { padding-top: calc(max(16px, env(safe-area-inset-top)) + 56px); }
.hero > div:last-of-type { padding-bottom: 44px; }
.bar { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; height: 44px; }
.sheet {
  position: relative; margin-top: -24px; background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 24px 16px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px;
}
.sheet > * { width: 100%; max-width: 528px; margin: 0 auto; }
.stat { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.big { font-size: 60px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.big small { font-size: 24px; font-weight: 600; }
.msg { font-weight: 600; }
.shoot { height: 64px; font-size: 18px; border: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

select {
  width: 100%; height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--soft); color: var(--fg); font: inherit;
}
.collage { width: 100%; border-radius: 16px; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600;
  max-width: calc(100% - 32px); z-index: 10;
}
