:root {
  color-scheme: light dark;
  --bg: #f7f5ef; --surface: #fffefa; --text: #263c31; --muted: #65756a;
  --accent: #35644b; --accent-hover: #254c37; --line: #dedfd4; --soft: #edf2e8;
  --warning: #fff2d6; --warning-text: #704b12; --danger: #a23832;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.5; background: var(--bg); color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { min-height: 46px; border: 1px solid transparent; border-radius: 10px; padding: 10px 17px; cursor: pointer; background: var(--accent); color: #fff; font-weight: 650; }
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .46; cursor: not-allowed; }
button.secondary { color: var(--text); background: var(--soft); border-color: var(--line); }
button.quiet { color: var(--text); background: transparent; padding: 9px 12px; }
button.danger, .danger { color: var(--danger); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #bd8a34; outline-offset: 3px; }
label { display: flex; flex-direction: column; gap: 7px; font-size: .9rem; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: 11px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font-weight: 400; }
textarea { resize: vertical; overflow-wrap: anywhere; }
input:disabled, select:disabled { opacity: .65; }
h1, h2, h3, p { margin-top: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 6vw, 2.8rem); line-height: 1.12; font-weight: 750; letter-spacing: -.055em; margin-bottom: 14px; }
h2 { font-size: 1.15rem; line-height: 1.3; margin-bottom: 12px; letter-spacing: -.02em; }
h3 { font-size: 1rem; margin-bottom: 5px; }
p { margin-bottom: 16px; }
small { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 3px; overflow-wrap: anywhere; }
.app-shell { max-width: 850px; margin: auto; }
.app-header { display: flex; align-items: center; justify-content: space-between; min-height: 84px; padding: max(16px, env(safe-area-inset-top)) 24px 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.5rem; font-weight: 800; letter-spacing: -.06em; color: var(--text); }
.brand-dot { color: #ae7f39; }
main { padding: 24px 24px 110px; }
.home { max-width: 520px; margin: 20px auto 0; }
.home h1 { font-size: clamp(2.8rem, 9vw, 4rem); margin: 18px 0; }
.intro { font-size: 1.05rem; color: var(--muted); max-width: 440px; }
.eyebrow { font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); margin-bottom: 12px; }
.section-heading { margin: 18px 0 28px; }
.section-heading > p:last-child { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 22px; margin: 18px 0; }
.stack { display: flex; flex-direction: column; gap: 17px; }
.stack > h2, .stack > p { margin-bottom: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.row > div:first-child { min-width: 0; }
.row p { margin-bottom: 0; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.compact { gap: 5px; }
.compact button { font-size: .8rem; padding: 8px 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.muted { color: var(--muted); font-size: .9rem; }
.segmented { display: flex; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); margin: 28px 0 20px; }
.segmented button { width: 50%; color: var(--muted); background: transparent; }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 5px #0000000c; }
.code-input { font-size: 1.7rem; font-weight: 700; letter-spacing: .25em; text-transform: uppercase; }
.room-code { font-size: 3rem; line-height: 1.4; font-weight: 800; letter-spacing: .22em; padding-left: .22em; font-variant-numeric: tabular-nums; }
.share-card { text-align: center; }
.share-card .actions { justify-content: center; }
.share-link { display: block; overflow-wrap: anywhere; font-size: .88rem; margin-bottom: 20px; }
.qr { margin: 15px auto; max-width: 310px; }
.qr canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 8px; }
.people, .item-list, .plain-list { list-style: none; padding: 0; margin: 0; }
.people > li, .item-list > li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.people > li:first-child, .item-list > li:first-child { border-top: 0; padding-top: 5px; }
.people > li > div:first-child, .item-list > li > div:first-child { min-width: 0; }
.people .actions { justify-content: flex-end; }
.plain-list li { padding: 7px 0; }
.presence { display: inline-block; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: #939c92; margin-right: 5px; }
.presence.online { background: #3a9465; }
.connection-status { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); margin: -4px 0 14px; }
.connection-status > span:nth-child(2) { flex: 1; }
.connection-status button { font-size: .78rem; flex-shrink: 0; }
.banner { padding: 13px 15px; border-radius: 10px; margin-bottom: 16px; font-size: .9rem; }
.notice { background: var(--soft); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.warning { background: var(--warning); color: var(--warning-text); border-radius: 8px; padding: 12px; }
.sync-status { color: var(--muted); font-size: .8rem; }
.helper { background: var(--soft); }
.suggestion { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 18px; }
.shuffle strong { animation: nudge .15s alternate infinite; }
@keyframes nudge { to { opacity: .35; transform: translateY(-3px); } }
.category-heading { margin: 28px 0 8px; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.pick-card { margin: 12px 0; }
.pick-card.selected { border-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stepper button { width: 44px; padding: 8px; font-size: 1.2rem; }
.stepper output { min-width: 24px; text-align: center; font-weight: 700; }
.note-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 15px; }
.note-form label { flex: 1; min-width: 0; font-size: .78rem; }
.note-form button { font-size: .8rem; }
.total-bar { display: flex; justify-content: space-between; gap: 15px; padding: 20px 0 6px; margin: 18px 0; border-top: 1px solid var(--line); font-size: 1.05rem; }
.total-bar strong { white-space: nowrap; }
.payment { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.payment button { min-width: 100px; }
.paid { color: var(--accent) !important; }
details summary { cursor: pointer; min-height: 32px; }
details summary > span { display: block; color: var(--muted); font-size: .9rem; margin-top: 6px; }
details[open] summary { margin-bottom: 16px; }
details p:last-child { margin-bottom: 0; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); width: min(100%, 850px); background: var(--surface); border-top: 1px solid var(--line); z-index: 5; }
.bottom-nav button { padding: 10px 3px; min-height: 48px; color: var(--muted); background: transparent; font-size: .76rem; border-radius: 8px; white-space: nowrap; }
.bottom-nav .active { color: var(--accent); background: var(--soft); }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .7rem; margin-top: 40px; }
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: min(94vw, 600px); max-height: 90dvh; padding: 24px; }
dialog::backdrop { background: #10251caa; }
dialog header { margin-bottom: 15px; }
dialog header h2 { margin: 0; }
dialog section, dialog details, dialog form { margin-top: 20px; }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog .actions { margin-top: 12px; }
video { display: block; width: 100%; max-height: 330px; background: #000; border-radius: 10px; margin: 16px 0; }
.copy-fallback { position: fixed; z-index: 20; bottom: 75px; left: 50%; transform: translateX(-50%); width: min(92vw, 600px); box-shadow: 0 8px 60px #0005; }
.copy-fallback button { margin-top: 10px; }
.skip-link { position: absolute; z-index: 99; left: 10px; top: -80px; background: var(--surface); padding: 12px; }
.skip-link:focus { top: 10px; }
.empty { padding: 35px 20px; text-align: center; }
button.big { min-height: 64px; font-size: 1.2rem; }
.with-dice { display: flex; gap: 8px; }
.with-dice .dice { flex-shrink: 0; width: 50px; padding: 0; font-size: 1.3rem; }
@media (max-width: 440px) {
  main { padding: 18px 16px 100px; }
  .app-header { padding-left: 16px; padding-right: 16px; }
  .card { padding: 17px; }
  .people > li { flex-wrap: wrap; gap: 10px; }
  .people > li > .actions { width: 100%; justify-content: flex-start; }
  .stepper { gap: 4px; }
  .form-grid { gap: 10px; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171e1a; --surface: #202a23; --text: #e6e9df; --muted: #acb7ac; --accent: #8fbf95; --accent-hover: #add0ad; --line: #3b473d; --soft: #293a2d; --warning: #3a301d; --warning-text: #efd39a; --danger: #f1a099; }
  button { color: #17241b; }
  .brand-dot { color: #dbb878; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }
