:root {
  --green: #12372A;
  --green-2: #2F6B52;
  --green-soft: #E6F0EA;
  --red: #C8102E;
  --red-dark: #9E0C24;
  --red-soft: #FCEBEE;
  --gold: #E9B44C;
  --gold-soft: #FBF1DC;
  --ground: #FBF7F2;
  --ink: #1F2A24;
  --ink-2: #3D4742;
  --muted: #5B6660;
  --line: #EADFD3;
  --field: #DCD2C6;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'DM Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.45; }
body.dark { background: var(--green); color: #fff; }
a { color: var(--red); }
a:hover { color: var(--red-dark); }
.app { max-width: 480px; margin: 0 auto; padding: 0 16px 120px; }
h1, h2 { margin: 0; font-family: var(--display); line-height: 1.1; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header bits */
.page-head { padding: 32px 4px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head .sub { font-size: 14px; color: var(--muted); }
body.dark .page-head .sub { color: #D6E4DC; }
.round { width: 44px; height: 44px; flex: none; border-radius: 22px; background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
body.dark .round { background: rgba(255,255,255,.12); color: #fff; }

/* hero for logged-out pages */
.hero { margin: 0 -16px; background: var(--green); color: #fff; padding: 48px 24px 60px; position: relative; overflow: hidden; }
.hero h1 { font-size: 38px; margin: 8px 0; }
.hero p { color: #D6E4DC; }
.hero .flake { position: absolute; right: -14px; top: 18px; opacity: .5; }
.lift { margin-top: -30px; position: relative; }

/* cards */
.card { background: #fff; border-radius: 20px; padding: 18px; box-shadow: 0 1px 2px rgba(18,55,42,.04); }
.card.raised { box-shadow: 0 6px 24px rgba(18,55,42,.10); }
.card.dashed { border: 1.5px dashed var(--field); box-shadow: none; }
.card.green { background: var(--green); color: #fff; }
.card h2 + * { margin-top: 10px; }
body.dark .card { color: var(--ink); }

/* forms */
label { display: block; font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--field); border-radius: 12px; padding: 0 14px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
input[readonly] { background: #F3ECE3; color: var(--ink-2); }
textarea { padding: 12px 14px; min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-top: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--red); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cols label { margin-top: 14px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin-top: 18px;
  border: none; border-radius: 14px; background: var(--red); color: #fff; font: inherit; font-weight: 700; font-size: 16px;
  text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--red-dark); color: #fff; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #0B261C; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--field); }
.btn.ghost:hover { background: var(--ground); color: var(--ink); }
.btn.outline-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn.small { width: auto; min-height: 40px; margin: 0; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.linkbtn { background: none; border: none; padding: 8px; min-height: 40px; font: inherit; font-size: 14px; font-weight: 700; color: var(--red); cursor: pointer; }
.center { text-align: center; }

.flash { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 500; font-size: 15px; }
.flash.error { background: var(--red-soft); color: var(--red-dark); }
.alert { background: var(--red-soft); color: var(--red-dark); border-radius: 16px; padding: 14px 16px; font-size: 15px; }

/* home */
.count { display: flex; gap: 10px; margin-top: 12px; }
.count div { flex: 1; background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px; text-align: center; }
.count strong { display: block; font-family: var(--display); font-size: 30px; line-height: 1.1; }
.count span { font-size: 12px; color: #D6E4DC; }
.facts { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; color: #D6E4DC; }
.facts strong { color: #fff; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 19px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; background: var(--green); }
.avatar.c1 { background: var(--red); } .avatar.c2 { background: var(--gold); color: var(--ink); }
.avatar.c3 { background: var(--green-2); } .avatar.c4 { background: var(--red-dark); }
.avatar.pending { background: transparent; color: var(--muted); border: 1.5px dashed #B9AC9C; }
.tile { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.tile:hover { color: var(--ink); }
.tile.hot { border: 2px solid var(--red); }
.tile .txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tile .txt span { font-size: 14px; color: var(--muted); }
.ico { width: 48px; height: 48px; flex: none; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--green-soft); color: var(--green); }
.ico.red { background: var(--red-soft); color: var(--red); }
.ico.gold { background: var(--gold-soft); color: #7A5A12; }

/* lists */
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EFE6DB; }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .grow span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.status-ok { font-size: 13px; font-weight: 700; color: var(--green-2); white-space: nowrap; }
.status-wait { font-size: 13px; font-weight: 700; color: var(--red-dark); white-space: nowrap; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item .ico { width: 52px; height: 52px; }
.item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .grow span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 14px; font-weight: 500; }
.pill form { display: inline; }
.pill button { width: 32px; height: 32px; border: none; border-radius: 16px; background: transparent; color: var(--green); font-size: 18px; cursor: pointer; }

/* match */
.unwrap > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; padding: 40px 8px; }
.unwrap > summary::-webkit-details-marker { display: none; }
.unwrap[open] > summary { display: none; }
.present { width: 200px; height: 200px; border-radius: 28px; background: var(--red); position: relative; box-shadow: 0 16px 40px rgba(0,0,0,.35); transition: transform .2s; }
.unwrap > summary:hover .present { transform: rotate(-3deg) scale(1.02); }
.present::before { content: ""; position: absolute; left: 88px; top: 0; width: 24px; height: 100%; background: var(--gold); }
.present::after { content: ""; position: absolute; top: 88px; left: 0; height: 24px; width: 100%; background: var(--gold); }
.tag { background: var(--ground); color: var(--ink); border-radius: 24px; padding: 26px 20px 24px; text-align: center; position: relative; }
.tag::before { content: ""; position: absolute; top: 14px; left: 50%; margin-left: -9px; width: 18px; height: 18px; border-radius: 9px; border: 3px solid var(--green); }
.tag .eyebrow { color: var(--red-dark); display: block; margin-top: 16px; }
.tag h1 { font-size: 44px; margin: 8px 0; }
.on-dark { color: #D6E4DC; }

/* chat */
.segmented { display: flex; gap: 6px; background: #F3ECE3; border-radius: 12px; padding: 4px; }
.segmented a { flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.segmented a[aria-current] { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.thread { display: flex; flex-direction: column; gap: 4px; padding: 16px 0; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.meta.mine { align-self: flex-end; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 48px; height: 48px; border-radius: 22px; padding: 12px 16px; }
.send { width: 48px; height: 48px; flex: none; border: none; border-radius: 24px; background: var(--red); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* tab bar */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); }
nav.tabs .in { width: 100%; max-width: 480px; display: flex; justify-content: space-around; }
nav.tabs a { min-width: 54px; flex: 1; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; text-decoration: none; color: var(--muted); }
nav.tabs a[aria-current] { color: var(--red); font-weight: 700; }

/* voting */
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.option-row { display: flex; align-items: center; gap: 4px; }
.grow-form { flex: 1; }
.option { position: relative; overflow: hidden; width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px; border: 1px solid var(--field); border-radius: 12px; background: #fff; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; text-align: left; }
.option .bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green-soft); z-index: 0; }
.option .label, .option .n { position: relative; z-index: 1; }
.option .n { font-size: 13px; color: var(--muted); white-space: nowrap; }
.option.mine { border: 2px solid var(--red); font-weight: 700; }
.option.mine .bar { background: var(--red-soft); }
.suggest { margin-top: 6px; }
.suggest .composer input { flex: 1; }
.suggest .composer .btn.small { min-height: 48px; }
.version { text-align: center; font-size: 12px; color: var(--muted); margin: 28px 0 0; opacity: .8; }
body.dark .version { color: #9FB3A8; }
