/* The Cheese Log — warm parchment / cheese-board aesthetic. No build, no deps. */
:root {
  --bg: #faf5e9;
  --bg-2: #f3ead6;
  --card: #fffdf7;
  --ink: #3b2f1c;
  --ink-soft: #806f50;
  --line: #e6dcc4;
  --gold: #cf962b;
  --gold-deep: #a6701a;
  --rind: #e0a64c;
  --blue: #6b87a8;
  --danger: #b4472f;
  --shadow: 0 2px 10px rgba(80, 60, 20, .10);
  --shadow-lg: 0 10px 34px rgba(80, 60, 20, .18);
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
a { color: var(--gold-deep); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px 80px; }

/* header */
header.app {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 245, 233, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Georgia, serif; font-weight: 700; font-size: 21px; }
.brand .logo { width: 54px; height: 54px; display: block; flex-shrink: 0; filter: drop-shadow(0 2px 5px rgba(80, 60, 20, .32)); }

/* compact account avatar (replaces the wide @handle chip) */
.avatarbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); font: 700 15px Georgia, serif; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; position: relative; }
.avatarbtn:hover { border-color: var(--gold); }
.avatarbtn.premium { background: linear-gradient(140deg, #f3c759, #cf962b); color: #43320f; border-color: var(--gold-deep); }
.avatarbtn.premium::after { content: "✦"; position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; font-size: 9px; display: flex; align-items: center; justify-content: center; color: var(--gold-deep); background: var(--bg); border-radius: 50%; box-shadow: 0 0 0 1px var(--gold); }

/* Ask = AI chat bubble */
.askbtn { display: inline-flex; align-items: center; justify-content: center; }
.askbtn svg { display: block; }

/* hero logo on empty-shelf + sign-in */
.herologo { display: block; margin: 0 auto; filter: drop-shadow(0 3px 9px rgba(80, 60, 20, .30)); }
.empty .herologo { width: 116px; height: 116px; margin-bottom: 8px; }
.authhero { text-align: center; margin: -4px 0 10px; }
.authhero .herologo { width: 86px; height: 86px; margin-bottom: 8px; }
.authhero .authbrand { font-family: Georgia, serif; font-weight: 700; font-size: 23px; color: var(--ink); }
.authhero .authtag { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-top: 2px; }
.brand small { display: block; font: 400 11px/1 sans-serif; color: var(--ink-soft); letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }
.bar .spacer { flex: 1; }
.iconbtn { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: 15px; }
.iconbtn:hover { background: var(--bg-2); }
.cloud { font: inherit; font-size: 12px; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.cloud:hover { background: var(--bg-2); }
.cloud::before { content: "● "; color: #b9a06a; }
.cloud.online { color: var(--gold-deep); border-color: var(--gold); }
.cloud.online::before { color: #6f9a5a; }

/* cheesemonger chat */
.askmsg { display: flex; margin: 10px 0; }
.askmsg.you { justify-content: flex-end; }
.askmsg .bubble { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; box-shadow: var(--shadow); }
.askmsg.you .bubble { background: var(--gold); color: #43320f; border-bottom-right-radius: 4px; }
.askmsg.mongr .bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.askmsg .bubble.err { background: #fbeae5; border-color: #e3c4ba; color: var(--danger); }
.askmsg .bubble p { margin: 0 0 8px; } .askmsg .bubble p:last-child { margin: 0; }
.askmsg .bubble ul { margin: 4px 0; padding-left: 20px; } .askmsg .bubble li { margin: 2px 0; }

/* signed-out sign-up banner */
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff6e3; border: 1px solid var(--gold); border-radius: var(--r); padding: 12px 16px; margin: 20px 0; box-shadow: var(--shadow); }
.banner span { flex: 1; min-width: 200px; font-size: 14px; }
/* persistent "Go Pro" bar under the header — gold/foil so it reads as an upgrade */
.protop { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; border: none; border-bottom: 1px solid var(--gold); background: linear-gradient(100deg, #f3c759, #e0a64c); color: #43320f; font: inherit; font-size: 13.5px; padding: 9px 16px; cursor: pointer; text-align: center; }
.protop:hover { background: linear-gradient(100deg, #f6d06a, #e6ad52); }
.protop b { font-weight: 700; }
.protop .protop-arrow { font-weight: 700; font-size: 16px; margin-left: 2px; }
@media (max-width: 520px) { .protop { font-size: 12.5px; padding: 8px 12px; } }

/* private toggle */
.privrow { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 16px; cursor: pointer; }
.privrow input { width: auto; }

/* feed */
.feeditem { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.feeditem .who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.feeditem .av { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: #43320f; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: Georgia, serif; }
.feeditem .who b { font-size: 14px; }
.feeditem .who .h { color: var(--ink-soft); font-size: 12px; }
.feeditem h3 { margin: 2px 0; font-size: 18px; }
.feeditem .when { margin-left: auto; font-size: 11px; color: var(--ink-soft); }
.feeditem img.fp { width: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; margin-top: 8px; }

/* friends modal bits */
.frrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bg-2); }
.frrow .av { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #43320f; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: Georgia, serif; }
.frrow .nm { flex: 1; }
.frrow .nm small { color: var(--ink-soft); display: block; }
.handlebox { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px dashed var(--rind); border-radius: 10px; padding: 8px 12px; margin: 10px 0; font-size: 14px; }
.handlebox b { font-family: Georgia, serif; }
.sectlabel { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 16px 0 6px; }

/* tabs */
nav.tabs { display: flex; gap: 4px; max-width: 1000px; margin: 0 auto; padding: 0 16px; }
nav.tabs button {
  flex: 1; max-width: 200px; background: none; border: none; cursor: pointer;
  padding: 12px 8px; color: var(--ink-soft); font-weight: 600; font-size: 15px;
  border-bottom: 3px solid transparent;
}
nav.tabs button.active { color: var(--gold-deep); border-bottom-color: var(--gold); }

/* stats strip */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; flex: 1; min-width: 120px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .12s, transform .12s; }
.stat:hover { border-color: var(--gold); transform: translateY(-1px); }
.stat:focus-visible { outline: 2px solid var(--rind); }
.statlist { margin-top: 4px; }
.statrow { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--bg-2); cursor: pointer; }
.statrow:last-child { border-bottom: 0; }
.statrow:hover { background: var(--bg-2); }
.statmain { flex: 1; min-width: 0; }
.statmain small { display: block; color: var(--ink-soft); }
.stat .n { font-family: Georgia, serif; font-size: 26px; font-weight: 700; color: var(--gold-deep); }
.stat .l { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }

/* controls row */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--rind); border-color: var(--rind); }
.toolbar input.search { flex: 1; min-width: 180px; }
.toolbar select { width: auto; }

/* buttons */
.btn { background: var(--gold); color: #43320f; border: none; border-radius: 10px; padding: 11px 18px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.btn:hover { background: var(--gold-deep); color: #fff; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn.block { width: 100%; padding: 14px; font-size: 16px; }
.btn.sm { padding: 7px 12px; font-size: 14px; }
.btn.danger { background: none; color: var(--danger); border: 1px solid #e3c4ba; }

/* shelf grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cardx { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .12s; display: flex; flex-direction: column; }
.cardx:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.cardx .thumb { height: 130px; display: flex; align-items: center; justify-content: center; background: var(--bg-2); }
.cardx .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cardx .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.cardx h3 { margin: 0; font-size: 17px; line-height: 1.2; }
.cardx .meta { font-size: 12px; color: var(--ink-soft); }
.cardx .note { font-size: 13px; color: var(--ink); opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cardx .date { font-size: 11px; color: var(--ink-soft); margin-top: auto; }

/* stars */
.stars { display: inline-flex; gap: 2px; font-size: 18px; color: #d9c9a0; user-select: none; }
.stars .on { color: var(--gold); }
.stars.big { font-size: 30px; gap: 4px; }
.stars.input span { cursor: pointer; }

/* chips / tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft); cursor: pointer; }
.chip.on { background: var(--gold); color: #43320f; border-color: var(--gold); font-weight: 600; }
.chip.suggest { border-style: dashed; }
.chip .x { margin-left: 6px; opacity: .6; }
.tagline { font-size: 12px; color: var(--ink-soft); margin: 10px 0 4px; }

/* form card */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.row2 { display: flex; gap: 12px; flex-wrap: wrap; }
.row2 > .field { flex: 1; min-width: 150px; }
.row3 { display: flex; gap: 8px; flex-wrap: wrap; }
.row3 > * { flex: 1; min-width: 96px; }
.row3 :disabled { opacity: .65; cursor: not-allowed; }

/* autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 280px; overflow: auto; }
.ac-list .opt { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--bg-2); }
.ac-list .opt:last-child { border-bottom: none; }
.ac-list .opt:hover, .ac-list .opt.hl { background: var(--bg-2); }
.ac-list .opt b { font-weight: 700; }
.ac-list .opt small { color: var(--ink-soft); }

/* selected cheese info */
.cheeseinfo { background: var(--bg); border: 1px dashed var(--rind); border-radius: 12px; padding: 12px 14px; margin-top: 8px; font-size: 13px; }
.cheeseinfo .nm { font-family: Georgia, serif; font-weight: 700; font-size: 16px; }
.cheeseinfo .tt { color: var(--ink-soft); }

/* photo */
.photoprev { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-top: 8px; border: 1px solid var(--line); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(40, 30, 10, .45); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; z-index: 100; overflow: auto; }
.modal { background: var(--card); border-radius: 18px; max-width: 560px; width: 100%; box-shadow: var(--shadow-lg); padding: 20px; }
.modal .close { float: right; }

/* browse rows */
.brow { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.brow .gist { flex: 1; min-width: 0; }
.browactions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.brow h3 { margin: 0 0 3px; font-size: 16px; }
.brow .meta { font-size: 12px; color: var(--ink-soft); }
.brow .tt { font-size: 12.5px; color: var(--ink); opacity: .8; margin-top: 4px; }

/* misc */
.empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; }
.empty .big { font-size: 46px; }
.hide { display: none !important; }
.muted { color: var(--ink-soft); font-size: 12.5px; }
.center { text-align: center; }
.wedge { font-size: 52px; }

/* "user-added" badge on community (member-contributed) cheeses */
.commbadge { display: inline-block; font-size: 11px; font-weight: 600; vertical-align: 1px;
  padding: 1px 7px; border-radius: 999px; background: #eef2f7; color: #4a6079;
  border: 1px solid #d4ddea; letter-spacing: .02em; white-space: nowrap; }

/* Scan a menu (premium) */
.scanbtn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.scanhint { margin: 7px 2px 18px; }
.scanloading { text-align: center; padding: 34px 12px; }
.scanloading .big { font-size: 48px; }
.scanloading h2 { margin: 12px 0 4px; }
.scanrow { display: flex; align-items: flex-start; gap: 11px; padding: 12px 2px; border-bottom: 1px solid var(--bg-2); }
.scanrow.sel { }
.scanpick { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 3px; accent-color: var(--gold); }
.scanmain { flex: 1; min-width: 0; }
.scanname { font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scannameinput { font: inherit; font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; width: 100%; max-width: 210px; }
.scannameinput:focus { outline: 2px solid var(--rind); border-color: var(--rind); }
.scanmeta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.scanchip { font-size: 10.5px; padding: 1px 8px; border-radius: 999px; vertical-align: 1px; white-space: nowrap; }
.scanchip.matched { background: #e9f4e0; color: #3b6d11; border: 1px solid #cfe6bf; }
.scanchip.new { background: #eef2f7; color: #4a6079; border: 1px solid #d4ddea; }
.scandetails { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.scandetails select, .scandetails input { font-size: 12px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: auto; flex: 1; min-width: 84px; }
.scanstars { font-size: 16px; flex: 0 0 auto; margin-top: 1px; }
/* Community rating badge (★ avg (count)) */
.comrating { font-size: 12.5px; color: var(--gold-deep); white-space: nowrap; }
.comrating small { color: var(--ink-soft); }

/* Wishlist (below the shelf) */
.wishlist { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
.wishrow { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--bg-2); }
.wishrow:last-child { border-bottom: 0; }
.wishmain { flex: 1; min-width: 0; }
.iconbtn.sm { padding: 5px 9px; font-size: 14px; }

/* Reverse pairing panel (Ask tab) */
.pairpanel { background: var(--bg); border: 1px dashed var(--rind); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.pairrow { display: flex; align-items: center; gap: 11px; padding: 10px 2px; border-bottom: 1px solid var(--bg-2); }
.pairrow:last-child { border-bottom: 0; }
.pairmain { flex: 1; min-width: 0; }

.scannote { font-size: 12.5px; color: var(--ink-soft); font-style: italic; margin-top: 4px; line-height: 1.4; }
.scantags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.scantag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft); cursor: pointer; }
.scantag.on { background: var(--gold); color: #43320f; border-color: var(--gold); font-weight: 600; }

/* Ask-tab chat header (question count + New chat) */
.askhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

/* ============================ PREMIUM ============================ */
/* Brand becomes PROmagerie when premium */
#brandName .pro {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 800;
}

/* Account chip turns to gold foil when premium */
.cloud.premium {
  color: #5a3d05; font-weight: 700;
  background: linear-gradient(135deg, #fbe9b8, #f3c759 55%, #e0a64c);
  border-color: var(--gold-deep);
  box-shadow: 0 1px 6px rgba(166, 112, 26, .35);
}
.cloud.premium::before { content: "✦ "; color: #a6701a; }

/* Lock / sparkle indicator on the Ask tab + pair buttons */
nav.tabs button .tabmark { font-size: 11px; margin-left: 1px; vertical-align: 1px; opacity: .85; }
.btn.locked { position: relative; opacity: .92; }
.btn.locked::after {
  content: "✦"; position: absolute; top: -6px; right: -6px;
  font-size: 11px; background: var(--gold-deep); color: #fff;
  width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%;
  box-shadow: var(--shadow);
}

/* Rich premium gate (the upsell card on the Ask tab) */
.premgate { max-width: 520px; margin: 24px auto; text-align: center; }
.premgate .foil {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: 30px 26px 28px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 247, 222, .9), transparent 60%),
    linear-gradient(160deg, #fffdf7, #fbf2dc);
  border: 1.5px solid var(--gold);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.premgate .foil::before {
  content: ""; position: absolute; top: 0; left: -60%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-18deg); animation: foilsheen 4.5s ease-in-out infinite;
}
@keyframes foilsheen { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.premgate .crown { font-size: 50px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(166, 112, 26, .3)); }
.premgate h2 { margin: 10px 0 4px; font-family: Georgia, serif; }
.premgate .lead { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.prem-badge {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: #5a3d05; padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #fbe9b8, #f3c759 55%, #e0a64c);
  box-shadow: 0 1px 5px rgba(166, 112, 26, .3);
}
.prem-perks { list-style: none; text-align: left; margin: 4px auto 18px; max-width: 340px; display: grid; gap: 9px; }
.prem-perks li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.prem-perks li::before { content: "🧀"; flex: 0 0 auto; }
.prem-teaser { margin: 14px auto 0; max-width: 360px; }
.prem-teaser .sectlabel { text-align: center; }
.prem-teaser .chip { width: 100%; box-sizing: border-box; text-align: left; cursor: default; opacity: .6; position: relative; padding-right: 28px; }
.prem-teaser .chip::after { content: "🔒"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); opacity: .8; }

/* Premium status card in Settings */
.prem-status {
  display: flex; gap: 12px; align-items: center; margin-top: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(160deg, #fffaf0, #fbf0d6); border: 1px solid var(--gold);
  box-shadow: var(--shadow);
}
.prem-status .ico { font-size: 26px; }
.prem-status b { display: block; }
.prem-status small { color: var(--ink-soft); }

/* ===== Unlock celebration ===== */
.celebrate { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(40, 30, 10, .55); padding: 24px; overflow: hidden; }
.celebrate .card {
  position: relative; z-index: 2; max-width: 420px; width: 100%; text-align: center;
  background: radial-gradient(120% 80% at 50% -10%, #fff7de, #fffdf7 60%);
  border: 1.5px solid var(--gold); border-radius: 22px; padding: 34px 28px 28px;
  box-shadow: var(--shadow-lg); animation: popin .5s cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes popin { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.celebrate .crown { font-size: 64px; line-height: 1; animation: crownpop 2.4s ease-in-out infinite; }
@keyframes crownpop { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.celebrate h2 { font-family: Georgia, serif; margin: 12px 0 6px; }
.celebrate p { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
.confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .brand { font-size: 16px; gap: 6px; }
  .brand .logo { width: 44px; height: 44px; }
  .brand { font-size: 17px; }     /* wordmark stays visible alongside the big medallion */
  .bar { gap: 5px; padding: 10px 12px; }
  .bar .iconbtn { padding: 6px 8px; font-size: 15px; border-radius: 9px; }
  .cloud { font-size: 12px; padding: 5px 10px; }            /* full @handle, no truncation */
  body.authed #menuBtn { display: none; }                   /* gear is redundant on mobile — the chip opens Settings */
  .slideover { width: 100%; }
  nav.tabs { gap: 0; padding: 0 8px; }
  nav.tabs button { font-size: 13px; padding: 12px 4px; }
  .wrap { padding: 0 12px 80px; }

  /* Browse rows: stack the cheese info, then a full-width row of actions */
  .brow { flex-direction: column; align-items: stretch; gap: 10px; }
  .browactions { flex-direction: row; flex-wrap: wrap; }
  .browactions .btn { flex: 1; }
}

/* ---- My Board ---------------------------------------------------------- */
.btn.xs { padding: 4px 9px; font-size: 12px; }
.iconbtn.xs { padding: 3px 7px; font-size: 13px; border-radius: 8px; }
.cellartag { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--gold-deep); border: 1px solid var(--gold); border-radius: 6px; padding: 1px 5px; vertical-align: middle; }
.boardslot { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 10px 34px; margin-bottom: 10px; box-shadow: var(--shadow); }
.bslotnum { position: absolute; left: 10px; top: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-2); color: var(--ink-soft); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.bpair { display: flex; flex-direction: column; gap: 8px; }
.bcell { display: flex; align-items: center; gap: 8px; }
.bcell .bico { font-size: 18px; flex-shrink: 0; }
.bcell .binfo { flex: 1; min-width: 0; }
.bcell .binfo b { display: block; overflow: hidden; text-overflow: ellipsis; }
.bcell .binfo small { display: block; color: var(--ink-soft); font-size: 12px; }
.bplace { align-self: flex-start; border-style: dashed; color: var(--ink-soft); }
.bpairempty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bpairempty .ghost { color: var(--ink-soft); }
.bcell.pairing { opacity: .75; }
.bcell.pairing .bico { animation: bpulse 1s ease-in-out infinite; }
@keyframes bpulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.bslotfoot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); }
.accomp { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; }
.accomp small { display: block; color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.savedboard { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; }
.savedboard .sbinfo { flex: 1; min-width: 0; }
.savedboard .sbinfo small { display: block; color: var(--ink-soft); font-size: 12px; }
.savedboard .sbactions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- cellar card on the Pair tab -------------------------------------- */
.cellarcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.cellarcard .cellarhead { font-size: 15px; }
.cellarcard .cellarhead .linkbtn,
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-deep, #8a6a1f); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.cellarcard .cellarhead .linkbtn:hover, .linkbtn:hover { opacity: .8; }
/* cellar-browse modal pager */
.cbpager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }
.cbpager .muted { font-size: 12.5px; }
.cellarcard .howto { margin: 2px 0 12px; padding-left: 20px; display: grid; gap: 5px; }
.cellarcard .howto li { font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.cellarcard .howto li b { color: var(--ink); }

/* ---- toast ------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 12px); background: var(--ink); color: #fff7e6; font-size: 13px; padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .25s, transform .25s; z-index: 300; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- header overlays: ＋ menu + Ask/Social slide-overs ----------------- */
.iconbtn.gated { position: relative; }
.iconbtn.gated::after { content: "🔒"; position: absolute; right: -3px; top: -5px; font-size: 9px; }
.popmenu { position: fixed; top: 56px; right: 12px; z-index: 260; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; min-width: 196px; display: flex; flex-direction: column; }
.popmenu button { font: inherit; font-size: 14.5px; text-align: left; background: none; border: none; color: var(--ink); padding: 12px 16px; cursor: pointer; }
.popmenu button + button { border-top: 1px solid var(--line); }
.popmenu button:hover { background: var(--bg-2); }
#soBackdrop { position: fixed; inset: 0; background: rgba(40, 30, 10, .38); z-index: 240; opacity: 0; transition: opacity .25s; }
#soBackdrop.show { opacity: 1; }
.slideover { position: fixed; top: 0; right: 0; height: 100%; width: min(460px, 100%); background: linear-gradient(180deg, var(--bg), var(--bg-2)); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 250; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .26s ease; }
.slideover.open { transform: translateX(0); }
.slideover .sohead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.slideover .sohead h2 { margin: 0; font-size: 20px; }
.slideover .sobody { flex: 1; overflow: auto; padding: 16px 18px 28px; -webkit-overflow-scrolling: touch; }
.slideover .subtabs { display: flex; gap: 0; padding: 0 18px; border-bottom: 1px solid var(--line); }
.slideover .subtabs button { font: inherit; font-weight: 600; font-size: 14px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--ink-soft); padding: 10px 14px; cursor: pointer; }
.slideover .subtabs button.active { color: var(--ink); border-bottom-color: var(--gold); }
