:root {
  --bg: #e8e3db;
  --cream: #FAF7F2;
  --ink: #121110;
  --red: #D62828;
  --line: rgba(0,0,0,.12);
  --muted: rgba(0,0,0,.5);
  --muted-2: rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button, input {
  font-family: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

.mono {
  font-family: 'DM Mono', monospace;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 22px 0;
}

.wordmark {
  font-family: 'Archivo Black', sans-serif;
  font-size: 32px;
  letter-spacing: -.05em;
  color: var(--ink);
}

.wordmark-accent { color: var(--red); }

.help-btn {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: 'Archivo Black', sans-serif;
  font-size: 15px;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.help-btn:hover { background: var(--ink); color: var(--cream); }

.round-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 22px 0;
}

.round-label {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.icon-btn {
  border: none;
  background: rgba(0,0,0,.07);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: background .12s ease;
}
.icon-btn:hover { background: rgba(0,0,0,.14); }
.icon-btn.light { background: rgba(250,247,242,.12); color: var(--cream); }
.icon-btn.light:hover { background: rgba(250,247,242,.24); }

/* ---------- Scores ---------- */
.scores {
  padding: 22px 22px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
}

.score-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.score-name span {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.score-val {
  font-family: 'Archivo Black', sans-serif;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -.04em;
}

.lead-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 10px 22px 0;
}

.score-name .score-tag {
  font-size: 9px;
  font-weight: 500;
  flex: none;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid rgba(0,0,0,.2);
  border-radius: 6px;
  padding: 2px 5px;
  margin-left: 2px;
}

/* 4+ players: tighter rows so up to 8 fit above the fold */
.scores.compact { gap: 6px; padding-top: 16px; }
.scores.compact .score-name span:not(.score-tag) { font-size: 20px; }
.scores.compact .score-val { font-size: 28px; }
.scores.compact .score-row { padding-bottom: 4px; border-bottom-width: 1.5px; }
.score-name span:not(.score-tag) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 210px;
}

.spacer { flex: 1; min-height: 20px; }

/* ---------- Add buttons ---------- */
.add-buttons {
  padding: 0 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.add-group { display: flex; flex-direction: column; gap: 6px; }

.add-group-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.add-btn {
  border: none;
  cursor: pointer;
  height: 56px;
  border-radius: 28px;
  color: var(--cream);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-align: left;
  padding: 0 26px;
  transition: transform .12s ease, background .12s ease;
  width: 100%;
}
.add-btn:active { transform: scale(.97); }
.add-btn:hover { filter: brightness(.93); }

/* ---------- Gallery launcher (plate) ---------- */
.plate-wrap {
  padding: 26px 22px max(26px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.plate {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.plate-bg {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, #efe3d4 0 8px, #e3d3bf 8px 16px);
}

.plate-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 14px;
  text-align: center;
}

.plate-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(0,0,0,.45);
}

.plate-name {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.plate-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
}

.plate-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 40px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  background: linear-gradient(to bottom, rgba(18,17,16,0) 0%, rgba(18,17,16,.55) 55%, rgba(18,17,16,.92) 100%);
  z-index: 1;
}

.plate-caption-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.plate-caption-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 3px;
}

.plate-caption-meta span:last-child {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(250,247,242,.82);
}

.plate-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Overlays / sheets ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18,17,16,.5);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.overlay.hidden { display: none; }

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--cream);
  border-radius: 26px 26px 0 0;
  padding: 22px 22px max(28px, env(safe-area-inset-bottom));
  animation: sheet .28s cubic-bezier(.2,.8,.25,1);
  max-height: 88vh;
  overflow-y: auto;
}

@keyframes sheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sheet-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sheet-title span {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
}

label.field-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.field-label-row .field-label {
  margin-bottom: 0;
}

.info-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 2px;
}
.info-btn:hover { color: var(--ink); }
.info-btn svg { flex: none; }

.text-input {
  width: 100%;
  height: 54px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  padding: 0 16px;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  margin-bottom: 8px;
}

.warning {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--red);
  margin-bottom: 8px;
}

.field-gap { height: 14px; }

.worth-row {
  display: flex;
  gap: 9px;
  margin-bottom: 20px;
}

.worth-btn {
  flex: 1;
  height: 50px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid rgba(0,0,0,.15);
  background: #fff;
  color: var(--ink);
  font-family: 'Archivo Black', sans-serif;
  font-size: 19px;
  letter-spacing: -.03em;
  transition: all .12s ease;
}

.photo-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.photo-picker {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  flex: none;
  background: repeating-linear-gradient(135deg, #efe3d4 0 6px, #e3d3bf 6px 12px);
  border: none;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  padding: 0;
}
.photo-picker img { width: 100%; height: 100%; object-fit: cover; }

.photo-picker-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(18,17,16,.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-hint {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.save-btn {
  width: 100%;
  height: 56px;
  border-radius: 28px;
  border: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  cursor: pointer;
  background: var(--ink);
  color: var(--cream);
}
.save-btn:disabled {
  cursor: not-allowed;
  background: rgba(0,0,0,.15);
  color: rgba(0,0,0,.4);
}

/* ---------- Full-screen overlays (gallery / history) ---------- */
.full-overlay {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 25;
  display: flex;
  flex-direction: column;
}
.full-overlay.hidden { display: none; }

.full-overlay-inner {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.full-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: max(24px, env(safe-area-inset-top)) 22px 16px;
}

.full-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 24px;
  letter-spacing: -.05em;
  color: var(--cream);
}

.full-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(250,247,242,.45);
  margin-top: 4px;
}

.full-body {
  flex: 1;
  overflow: auto;
  padding: 8px 22px max(30px, env(safe-area-inset-bottom));
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.food-card {
  background: var(--cream);
  border-radius: 14px;
  overflow: hidden;
  animation: pop .3s ease both;
  position: relative;
}

@keyframes pop {
  0% { transform: scale(.85); opacity: 0; }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

.food-card-photo {
  height: 104px;
  background: repeating-linear-gradient(135deg, #efe3d4 0 7px, #e3d3bf 7px 14px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 8px;
  position: relative;
}
.food-card-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.food-card-photo .eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
}
.food-card-photo .pts {
  font-family: 'Archivo Black', sans-serif;
  font-size: 19px;
  line-height: 1;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 6px rgba(0,0,0,.25);
}

.food-card-body { padding: 10px 11px 12px; }

.food-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  line-height: 1.15;
}

.food-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.food-card-meta span {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(0,0,0,.55);
}

.dot-sm { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(18,17,16,.55);
  color: var(--cream);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.delete-btn:hover { background: rgba(18,17,16,.8); }

.empty-state {
  color: rgba(250,247,242,.5);
  font-size: 14px;
  padding: 40px 4px;
  text-align: center;
}

/* ---------- History list ---------- */
.round-list { display: flex; flex-direction: column; gap: 10px; }

.round-item {
  background: var(--cream);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  border: none;
  text-align: left;
  width: 100%;
  animation: rise .25s ease both;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.round-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.round-item-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}

.round-item-dates {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(0,0,0,.45);
  margin-top: 4px;
}

.round-item-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
}

.round-item-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
}

/* ---------- New round sheet ---------- */
.new-round-copy {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ---------- Score guide sheet ---------- */
.score-guide-intro {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 18px;
}

.score-guide-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-guide-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.score-guide-num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Archivo Black', sans-serif;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-guide-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  padding-top: 4px;
}
.score-guide-text strong { font-weight: 700; }

.action-row {
  display: flex;
  gap: 10px;
}

.btn-secondary {
  flex: 1;
  height: 50px;
  border-radius: 25px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  flex: 1;
  height: 50px;
  border-radius: 25px;
  border: none;
  background: var(--ink);
  color: var(--cream);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.menu-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  border-radius: 14px;
  border: none;
  background: rgba(0,0,0,.05);
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.menu-item:hover { background: rgba(0,0,0,.09); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 13px;
  z-index: 60;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  animation: rise .2s ease both;
}
.toast.hidden { display: none; }

/* ---------- Screens ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.screen.hidden { display: none; }

.center-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 28px;
  text-align: center;
}

.loading-dots {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.setup-copy {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(0,0,0,.65);
  max-width: 320px;
}
.setup-copy code {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  background: rgba(0,0,0,.07);
  padding: 1px 5px;
  border-radius: 5px;
}

.setup-body { padding: 36px 22px 32px; }

.setup-invite {
  background: var(--ink);
  color: var(--cream);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 22px;
}

.setup-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -.04em;
  margin: 0 0 30px;
}

.link-btn {
  display: block;
  margin: 18px auto 0;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px;
}
.link-btn:hover { color: var(--ink); }
.link-btn.inline {
  display: inline;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}

/* ---------- Home ---------- */
.home-body { padding: 26px 22px 0; }

.section-label {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
}

.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.challenge-item {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  animation: rise .25s ease both;
  transition: transform .12s ease;
}
.challenge-item:active { transform: scale(.98); }

.challenge-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.challenge-item-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.challenge-item-score {
  font-family: 'Archivo Black', sans-serif;
  font-size: 24px;
  letter-spacing: -.04em;
  color: var(--ink);
  flex: none;
}

.challenge-item-meta {
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--muted);
  margin-top: 4px;
}

.challenge-item-dots {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}
.challenge-item-dots .dot-sm { width: 10px; height: 10px; }

.home-empty {
  background: var(--cream);
  border-radius: 16px;
  padding: 26px 20px;
  text-align: center;
}
.home-empty-art { font-size: 34px; }
.home-empty-title { font-size: 18px; font-weight: 700; margin-top: 6px; }
.home-empty-copy { font-size: 14px; line-height: 1.45; color: var(--muted); margin-top: 6px; }

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-actions .btn-secondary { flex: none; }

.home-footer {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 18px 22px max(22px, env(safe-area-inset-bottom));
}
.home-footer strong { color: var(--ink); }

/* ---------- Challenge header ---------- */
.challenge-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(20px, env(safe-area-inset-top)) 22px 0;
}

.challenge-title {
  flex: 1;
  min-width: 0;
  font-family: 'Archivo Black', sans-serif;
  font-size: 24px;
  letter-spacing: -.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-btn {
  flex: none;
  height: 34px;
  border-radius: 17px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}
.invite-btn:hover { background: #2b2926; }

/* ---------- Sheets: extras ---------- */
.who-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.who-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  border: 2px solid rgba(0,0,0,.15);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.code-input {
  font-family: 'DM Mono', monospace;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.invite-code {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: .18em;
  text-align: center;
  background: #fff;
  border: 2px dashed rgba(0,0,0,.25);
  border-radius: 14px;
  padding: 14px 8px;
}

.invite-link {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 10px 0 20px;
  word-break: break-all;
}

.sheet-note {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 14px 0 0;
}

.menu-item:disabled { opacity: .45; cursor: not-allowed; }

.round-item-winner {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  flex: none;
}

.captcha-box {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 70;
}

/* ---------- Landing page ---------- */
.landing {
  padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.landing-icon {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}

.landing-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -.04em;
  margin: 6px 0 0;
}

.landing-card {
  border-radius: 16px;
  padding: 16px 16px 12px;
  font-size: 14px;
  line-height: 1.5;
}
.landing-card p { margin: 6px 0 12px; }
.landing-card-title { font-size: 16px; font-weight: 700; }

.landing-invite { background: var(--ink); color: var(--cream); }
.landing-invite p { color: rgba(250,247,242,.75); }
.landing-invite .invite-code { background: var(--cream); color: var(--ink); border-color: transparent; }
.landing-invite .link-btn { color: rgba(250,247,242,.75); margin-top: 8px; }

.landing-inapp { background: #FFF1C9; border: 2px solid #F2B705; }

.landing-section { display: flex; flex-direction: column; }

.landing-h2 {
  font-family: 'Archivo Black', sans-serif;
  font-size: 22px;
  letter-spacing: -.03em;
  margin: 0 0 6px;
}

.landing-lead {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(0,0,0,.65);
  margin: 0 0 14px;
}

.install-tabs {
  display: flex;
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
}

.install-tab {
  flex: 1;
  min-width: 0;
  border: none;
  background: var(--cream);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 4px;
  cursor: pointer;
}
.install-tab + .install-tab { border-left: 2px solid var(--ink); }
.install-tab.active { background: var(--ink); color: var(--cream); }

.install-panel {
  background: var(--cream);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}
.install-panel .install-now-btn { margin-bottom: 4px; }

.install-or {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 10px;
}

.install-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.install-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 38px;
  font-size: 15px;
  line-height: 1.5;
  min-height: 26px;
}
.install-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Archivo Black', sans-serif;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
  color: #3E7BFA;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.08);
  font-weight: 700;
  vertical-align: 0;
}

.install-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 12px 0 0;
}

.install-done {
  font-size: 15px;
  line-height: 1.5;
  background: #E3F6E5;
  border-radius: 12px;
  padding: 14px 16px;
}

.install-keep {
  font-size: 14px;
  line-height: 1.5;
  background: #FFF1C9;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.install-keep .btn-secondary { margin: 10px 0; }

.landing-how {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.landing-how li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--cream);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
}
.landing-how-art { font-size: 22px; line-height: 1.2; }

.landing-footer { text-align: center; }
.landing-footer .link-btn { margin-top: 0; }
.landing-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin: 6px 0 0;
}

.btn-secondary.full { width: 100%; flex: none; }

.field-optional {
  text-transform: none;
  letter-spacing: 0;
}

/* Hide "install" links inside the installed app */
body.is-installed .browser-only { display: none !important; }

/* ---------- Onboarding tour ---------- */
.tour-sheet { padding-top: 18px; }

.tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-progress {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.tour-skip {
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 0 8px 12px;
}
.tour-skip:hover { color: var(--ink); }

.tour-art {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  margin: 6px 0 16px;
}

.tour-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 24px;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin: 0 0 10px;
}

.tour-body {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(0,0,0,.72);
  min-height: 150px;
}
.tour-body p { margin: 0 0 10px; }
.tour-body strong { color: var(--ink); }

.tour-scale {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tour-scale li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.tour-scale span {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Archivo Black', sans-serif;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tour-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 18px;
}
.tour-dots span {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: rgba(0,0,0,.18);
  transition: width .2s ease, background .2s ease;
}
.tour-dots span.active {
  width: 20px;
  background: var(--ink);
}

.invisible { visibility: hidden; }

.hidden { display: none !important; }

#installSheetPanel { background: none; padding: 0; margin-bottom: 18px; }
