/* VYB — fun, rounded, warm. Tokens first, dark mode via the same tokens. */
:root {
  --paper: #fff4de;      /* foam cream */
  --card: #ffffff;
  --ink: #2a1a10;        /* stout */
  --muted: #8a6f5a;
  --line: #f0dcc0;
  --amber: #f5a623;      /* the pint */
  --amber-deep: #d8861a;
  --cherry: #ef5b4c;
  --mint: #3fbf8f;
  --sky: #5aa9e6;
  --shadow: 0 6px 0 #f1dcb8;
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1f1510;
    --card: #2d1f17;
    --ink: #fff2dd;
    --muted: #c3a58d;
    --line: #4a3628;
    --amber: #f5a623;
    --amber-deep: #ffbf4d;
    --shadow: 0 6px 0 #150d09;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(100px + var(--safe-bottom)); }

/* splash while app.js loads */
.splash { display: grid; place-items: center; height: 70vh; }
.pint-logo { width: 72px; height: 96px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg);} 50% { transform: translateY(-8px) rotate(4deg);} }

/* pint glyph colours: custom properties inherit into the <use> clone */
.pint, .pint-logo { color: var(--ink); --beer: transparent; --foam: transparent; --shine: transparent; transition: color .15s; }
.pint.on, .pint-logo { --beer: var(--amber); --foam: #fff; --shine: rgba(255,255,255,.75); }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 16px 10px;
  background: var(--paper);
}
.bar h1 { font-size: 22px; font-weight: 900; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.bar .back { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; font-size: 30px; line-height: 1; padding: 0 0 5px; font-weight: 900; cursor: pointer; flex: none; }
.bar .back:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.wordmark { font-weight: 900; font-size: 22px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.wordmark.big { font-size: 34px; justify-content: center; display: block; line-height: 1.1; margin-top: 6px; }
.wordmark .pint-logo { width: 24px; height: 32px; animation: none; }
.tagline { color: var(--muted); font-size: 14px; margin-top: -4px; }

.wrap { padding: 8px 16px; }
h2 { font-size: 20px; font-weight: 900; margin: 22px 0 8px; }
h3 { font-size: 15px; font-weight: 800; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 10px 0; }
.card.link { display: block; text-decoration: none; cursor: pointer; transition: transform .08s; }
.card.link:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--line); }
.card.flat { box-shadow: none; border: 2px dashed var(--line); background: transparent; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; border-radius: 18px; border: 0;
  font-weight: 900; font-size: 17px; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line);
  transition: transform .08s, box-shadow .08s; text-decoration: none; width: 100%;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--amber); color: #2a1a10; box-shadow: 0 5px 0 var(--amber-deep); border-color: var(--amber-deep); }
.btn.primary:active { box-shadow: 0 1px 0 var(--amber-deep); }
.btn.cherry { background: var(--cherry); color: #fff; box-shadow: 0 5px 0 #c2402f; border-color: #c2402f; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; min-height: 44px; color: var(--muted); }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: 15px; border-radius: 14px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.stack { display: grid; gap: 10px; }

/* forms */
.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 14px; font-weight: 800; color: var(--muted); margin: 0 0 6px 4px; }
.input {
  width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--card); outline: none; font-weight: 700;
}
.input:focus { border-color: var(--amber); }
textarea.input { min-height: 90px; resize: vertical; }
.input.code { font-size: 28px; letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 900; }

/* chips / segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 2px solid var(--line); font-size: 14px; font-weight: 800; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.neg { border-color: var(--cherry); }
.chip .pm { color: var(--cherry); margin-right: 4px; }
.chip .x { border: 0; background: transparent; font-weight: 900; padding: 0 0 0 4px; cursor: pointer; color: var(--muted); font-size: 16px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; min-height: 46px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 900; cursor: pointer; }
.seg button.on { background: var(--amber); border-color: var(--amber-deep); color: #2a1a10; }

/* pub list */
.pub { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.pub .name { font-size: 19px; font-weight: 900; line-height: 1.2; }
.pub .area { color: var(--muted); font-size: 14px; }
.pub .minis { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.pub .minis b { color: var(--ink); }
.pub .status { grid-column: 1 / -1; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.badge.todo { background: #ffe1dc; color: #c2402f; }
.badge.done { background: #d8f5e8; color: #1f7f58; }
.badge.neutral { background: var(--line); color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.todo { background: #5a2a24; color: #ffb3a8; } .badge.done { background: #1f4a38; color: #9ee8c6; } }
.score { font-size: 34px; font-weight: 900; line-height: 1; display: flex; align-items: baseline; gap: 2px; }
.score small { font-size: 13px; color: var(--muted); font-weight: 800; }
.score.none { color: var(--muted); font-size: 22px; }
.medal { font-size: 22px; margin-right: 4px; }

/* rating control: a row of pints */
.crit { margin: 14px 0 6px; }
.crit .lbl { display: flex; justify-content: space-between; align-items: baseline; font-weight: 900; margin-bottom: 4px; }
.crit .lbl .avg { font-size: 13px; color: var(--muted); font-weight: 800; }
.pints { display: flex; gap: 4px; }
.pint-btn { flex: 1; min-width: 0; min-height: 60px; border: 0; background: transparent; padding: 4px 0 0; cursor: pointer; display: grid; justify-items: center; gap: 0; border-radius: 12px; transition: transform .1s; }
.pint-btn:active { transform: scale(1.12); }
.pint-btn .pint { width: 30px; height: 40px; }
.pint-btn .n { font-size: 11px; font-weight: 800; color: var(--muted); }
.pint-btn.on .n { color: var(--ink); }
.pint-btn.pop .pint { animation: pop .3s ease-out; }
@keyframes pop { 0% { transform: scale(1);} 40% { transform: scale(1.3) rotate(-6deg);} 100% { transform: scale(1);} }
.pints.wide .pint-btn .pint { width: 22px; height: 30px; }
.pint.on.neg { --beer: var(--cherry); --foam: #ffd9d4; }
.seg.sign { margin: 4px 0 6px; }
.seg.sign button { min-height: 38px; font-size: 14px; }
.seg.sign button.on.neg { background: var(--cherry); border-color: #c2402f; color: #fff; }
.icon-btn.on { background: var(--cherry); border-color: #c2402f; color: #fff; }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 12px 2px; cursor: pointer; font-size: 15px; }
.pick:active { background: var(--paper); }

/* breakdown table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table td:first-child, .table th:first-child { text-align: left; font-weight: 900; }
.table tr.avg td { font-weight: 900; border-top: 2px solid var(--ink); border-bottom: 0; }
.table .dash { color: var(--line); }

/* sticky bottom action */
.fab { position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 16px calc(14px + var(--safe-bottom)); background: linear-gradient(to top, var(--paper) 60%, transparent); z-index: 4; }
.fab .btn { max-width: 528px; margin: 0 auto; display: flex; }

/* invite code */
.code-box { font-size: 36px; letter-spacing: .25em; font-weight: 900; text-align: center; padding: 14px 0 6px; font-variant-numeric: tabular-nums; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px; font-weight: 800; font-size: 15px; z-index: 20; max-width: 90vw; text-align: center; animation: toastin .2s ease-out; }
.toast.bad { background: var(--cherry); color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px);} to { opacity: 1; transform: translate(-50%, 0);} }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .big { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.sortbar { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.sortbar::-webkit-scrollbar { display: none; }
.sortbar .chip { white-space: nowrap; flex: none; }
.members { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; font-size: 14px; color: #2a1a10; }
.member { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.crit-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.crit-row .input { flex: 1; min-height: 44px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 900; cursor: pointer; flex: none; }
.icon-btn[disabled] { opacity: .3; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { width: 54px; height: 32px; border-radius: 999px; border: 0; background: var(--line); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--mint); }
.switch.on::after { left: 26px; }
.note { white-space: pre-wrap; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--muted); font-weight: 800; }
