/* TeyvatMarket - UI
 *
 * Layout model (app shell):
 *   #app is fixed to the viewport. The document itself never scrolls, so mobile browser
 *   bars never collapse/expand and the viewport height stays stable.
 *   Rows: #topbar (fixed height) / #subbar (optional toolbar: search, tabs) / #view (the ONLY
 *   scroll container) / #dock (optional: chat composer) / #bottomnav (fixed height).
 *   Every control has an explicit height; text that could grow is clamped or ellipsised.
 *
 * Fonts: Inter 4 (18pt optical cut for UI text, 28pt cut for the banner title) is bundled and preloaded with font-display:block so text never reflows
 * from a fallback font. (BlinkMacSystemFont must not be used: it resolves to serif on Android.)
 */
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:block;src:url(/fonts/inter4-regular.woff) format("woff")}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:block;src:url(/fonts/inter4-medium.woff) format("woff")}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:block;src:url(/fonts/inter4-semibold.woff) format("woff")}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:block;src:url(/fonts/inter4-bold.woff) format("woff")}
@font-face{font-family:"Inter";font-style:normal;font-weight:800;font-display:block;src:url(/fonts/inter4-extrabold.woff) format("woff")}
@font-face{font-family:"Inter Display";font-style:normal;font-weight:800;font-display:block;src:url(/fonts/inter4-display-extrabold.woff) format("woff")}

:root{
  --bg:#0e1013; --surface:#191b20; --surface-2:#21242c; --surface-3:#282c36;
  --line:#2a2e37; --line-2:#363b46; --line-3:#4a5160;
  --text:#e8eaee; --text-2:#b9bec8; --muted:#8b919c;
  --purple:#7c88d6; --purple-d:#5f6ece; --violet:#9fa8e1; --pink:#e8eaee;
  --blue:#5d6ccd; --cyan:#495ac7; --gold:#dab935; --green:#4abd93; --red:#e58484; --orange:#e09557;
  --r-sm:6px; --r:8px; --r-lg:10px; --r-xl:12px;
  /* shell metrics (fixed) */
  --top-h:60px;          /* header bar, excluding the status-bar safe area */
  --nav-h:62px;          /* bottom tab pill */
  --nav-pad:8px;         /* space around the tab pill */
  --content-max:1096px;
  --gutter:max(12px, calc((100% - var(--content-max)) / 2));
  --shadow:0 10px 30px -12px #000c;
  --font:"Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display:"Inter Display", var(--font);
  --half:124px;          /* card: image height = details height (image is exactly half the card) */
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;height:100%;overflow:hidden;overscroll-behavior:none}
body{margin:0;height:100%;overflow:hidden;overscroll-behavior:none;color:var(--text);
  font-family:var(--font);font-size:15px;line-height:1.45;-webkit-font-smoothing:antialiased;
  background:var(--bg)}
a{color:inherit;text-decoration:none}
a,button,input,select,textarea,label{touch-action:manipulation}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
svg{display:block;flex:none}
img{max-width:100%;-webkit-user-drag:none}
h1,h2,h3{font-weight:800;letter-spacing:-.02em;margin:0}
.hidden{display:none!important}
:focus-visible{outline:2px solid var(--violet);outline-offset:2px}
/* app chrome isn't text to select on long-press */
#topbar,#bottomnav,#subbar,.btn,.tab,.card,.nav-item,.chip,.badge,.pill{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* ================================ app shell ================================ */
#app{position:fixed;inset:0;display:flex;flex-direction:column;overflow:hidden}
#topbar{flex:none;height:calc(var(--top-h) + env(safe-area-inset-top));padding:env(safe-area-inset-top) var(--gutter) 0;
  display:flex;align-items:center;position:relative;z-index:3}
#subbar{flex:none;padding:0 var(--gutter) 10px;position:relative;z-index:2;border-bottom:1px solid transparent}
#subbar:empty{display:none}
#view{flex:1 1 auto;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  scrollbar-gutter:stable;padding:4px var(--gutter) 20px;outline:none}
#dock{flex:none;padding:8px var(--gutter);border-top:1px solid var(--line);background:#111317}
#dock:empty{display:none}
#bottomnav{flex:none;height:calc(var(--nav-h) + var(--nav-pad) * 2 + env(safe-area-inset-bottom));
  padding:var(--nav-pad) var(--gutter) calc(var(--nav-pad) + env(safe-area-inset-bottom))}
/* while the on-screen keyboard is up, give its space to the content (native tab-bar behaviour) */
#topbar,#subbar,#dock,#bottomnav{overflow:hidden;scrollbar-gutter:stable}
html.kb-open #bottomnav{display:none}

/* ---------------- top bar ---------------- */
.top-row{display:flex;align-items:center;gap:10px;width:100%;height:42px;min-width:0}
.brand{display:flex;align-items:center;gap:9px;min-width:0;flex:1;height:42px}
.brand img{width:36px;height:36px}
.brand .bt{min-width:0;overflow:hidden}
.brand b{display:block;height:23px;font-size:19px;line-height:23px;font-weight:800;letter-spacing:-.03em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand b span{color:#7784d5}
.brand small{display:block;height:14px;font-size:10.5px;line-height:14px;color:#bbc1e3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.icon-btn{position:relative;flex:none;width:40px;height:40px;border-radius:50%;border:1px solid var(--line-2);display:grid;place-items:center;background:var(--surface)}
.icon-btn svg{width:18px;height:18px}
.icon-btn.purple{background:var(--purple-d);border-color:var(--purple)}
.icon-btn.plain{border-color:transparent;background:none;width:36px}
.top-title{flex:1;min-width:0;height:22px;line-height:22px;text-align:center;font-size:16px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ---------------- hero ---------------- */
.hero{position:relative;height:164px;border-radius:var(--r-xl);overflow:hidden;isolation:isolate;padding:0 18px;
  display:flex;flex-direction:column;justify-content:center;border:1px solid var(--line-2);background:linear-gradient(135deg,#2a2f38,#1a1c22 55%,#23272f)}
.hero .hero-bg{position:absolute;inset:0;z-index:-2;background-size:cover;background-position:right center}
.hero.has-img::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#191c22f2 0%,#191c22c7 40%,#191c2200 72%)}
.hero-txt{position:relative;width:60%;max-width:440px}
.hero h1{font-family:var(--font-display);font-size:21px;line-height:25px;max-height:75px;margin-bottom:7px;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
.hero p{margin:0;font-size:12px;line-height:17px;max-height:34px;color:#cdd1ef;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.hero .stars,.hero .orb{position:absolute;pointer-events:none;z-index:-1}
.hero .stars{inset:0;background-image:radial-gradient(2px 2px at 22% 28%,#ffffffcc,transparent),radial-gradient(2px 2px at 72% 16%,#ffffffb0,transparent),radial-gradient(1.5px 1.5px at 86% 68%,#ffffff99,transparent),radial-gradient(1.5px 1.5px at 52% 86%,#ffffff88,transparent)}
.hero .orb{right:-60px;top:-110px;width:260px;height:260px;border-radius:50%;filter:blur(34px);
  background:conic-gradient(from 200deg,#99a3e04d,#7c88d64d,#8994db4d,#99a3e04d)}
.hero .hero-logo{position:absolute;right:18px;top:50%;width:112px;height:112px;margin-top:-56px;z-index:-1;opacity:.95;filter:drop-shadow(0 0 22px #7c88d6aa)}
@media(min-width:720px){
  .hero{height:220px;padding:0 28px}
  .hero h1{font-size:28px;line-height:33px;max-height:99px}
  .hero p{font-size:14px;line-height:20px;max-height:40px}
  .hero .hero-logo{width:140px;height:140px;margin-top:-70px;right:36px}
}

/* ---------------- section head ---------------- */
.section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;height:40px;margin:10px 2px 4px}
.section-head h2{display:flex;align-items:center;gap:7px;font-size:17px;line-height:22px;white-space:nowrap}
.section-head h2 svg{width:17px;height:17px}
.section-head a,.link{color:var(--violet);font-weight:700;font-size:14px;display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
.section-head a svg{width:16px;height:16px}

/* ---------------- cards (box style from the design) ---------------- */
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
@media(min-width:720px){.grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}}
@media(min-width:1000px){.grid{grid-template-columns:repeat(auto-fill,minmax(300px,1fr))}}

.card{container-type:inline-size;position:relative;display:flex;flex-direction:column;min-width:0;overflow:hidden;
  border:1px solid #383d4a;border-radius:6px;background:#131519;transition:border-color .18s}
@media(hover:hover){.card:hover{border-color:#515fbf}}
/* the cover keeps its shape at every width: height always follows width */
.card .cover{position:relative;display:block;flex:none;width:100%;height:var(--half);background-size:cover;background-position:center 22%;background-color:#242830}
.card .cover::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,#13151900 50%,#131519d9 100%)}
.badges{position:absolute;left:7px;top:7px;z-index:1;display:flex;gap:4px}
.badge{flex:none;height:20px;padding:0 6px;border-radius:4px;border:1px solid;font-size:10.5px;line-height:18px;font-weight:700;white-space:nowrap;backdrop-filter:blur(6px)}
.badge.ar{background:#1a1d23e6;border-color:#3a4bba;color:#848fd9}
.badge.srv{background:#22252de6;border-color:#6674d0;color:#bdc3ea}
.badge.sold{background:#331118e6;border-color:#e58484;color:#f0b1b1}
.badge.rsv{background:#332811e6;border-color:#ddb242;color:#eddc9a}
.heart{position:absolute;right:4px;top:4px;z-index:2;width:30px;height:30px;display:grid;place-items:center}
.heart svg{width:19px;height:19px;fill:none;stroke:#fff;stroke-width:2;filter:drop-shadow(0 1px 3px #000c)}
.heart.on svg{fill:#6472cf;stroke:#6472cf}

.avatars{position:absolute;z-index:1;left:7px;right:7px;bottom:6px;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
.av{display:grid;place-items:center;aspect-ratio:1;border-radius:4px;overflow:hidden;border:1px solid #ffffff45;
  font-size:12px;font-weight:800;color:#fff;text-shadow:0 1px 3px #0009}
.av.pic{background:#2b3039}
.av img{width:100%;height:100%;object-fit:cover;display:block}

.card .body{display:flex;flex-direction:column;flex:none;height:var(--half);min-width:0;padding:8px 8px 8px}
.card .ct{display:block;min-width:0}
/* title: up to 2 lines; the details half has a fixed height, so cards stay uniform and spare space sits above the price */
.card h3{max-height:32px;font-size:12.5px;line-height:16px;font-weight:600;letter-spacing:-.01em;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}

.meta{display:grid;grid-template-columns:minmax(0,auto) minmax(0,auto);grid-auto-rows:14px;justify-content:space-between;gap:4px 6px;
  margin-top:6px;font-size:10px;line-height:14px;color:#d2d6ee}
.meta>span{display:flex;align-items:center;gap:4px;min-width:0;height:14px}
.meta svg{width:12px;height:12px;color:#c5caed}
.lbl{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lbl b{font-weight:inherit}

.buyrow{display:flex;align-items:center;justify-content:space-between;gap:6px;height:30px;margin-top:auto}
.card .price{flex:none;height:30px;font-size:16px;line-height:30px;font-weight:700;letter-spacing:-.02em;color:#6e7bd2;white-space:nowrap}
.buyrow .btn{flex:1 1 0;max-width:56%;min-width:0;height:30px;padding:0 6px;gap:4px;border-radius:5px;font-size:11.5px;font-weight:600}
.buyrow .btn svg{width:14px;height:14px}
.buyrow .btn.primary{background:var(--purple-d);color:#fff}
.buyrow .pill{flex:none}

/* Full wording from the design by default; fitCards() (app.js) switches a card to the short
   wording only when the full text doesn't fit on this device. Sizes never change - only words. */
.lbl .lf{display:inline}.lbl .ls{display:none}
.card.m-short .lbl.m .lf,.card.b-short .lbl.b .lf{display:none}
.card.m-short .lbl.m .ls,.card.b-short .lbl.b .ls{display:inline}
.card.m-tiny .meta svg{display:none}.card.m-tiny .meta>span{gap:0}
.card.m-tight .meta{letter-spacing:-.03em;column-gap:2px}.card.m-tight .meta>span{gap:3px}.card.m-tight .meta svg{width:11px;height:11px}
@container (min-width:300px){.card h3{max-height:16px;-webkit-line-clamp:1}}
/* wide cards (tablet/desktop) get taller halves - still exactly 50/50 */
@media(min-width:1000px){.grid{--half:136px}.card h3{font-size:13.5px}.meta{font-size:11px}.card .price{font-size:18px}}
@container (max-width:172px){
  .card .body{padding:8px 7px 9px}
  .meta{column-gap:3px;letter-spacing:-.015em}.meta>span{gap:3px}
  .card .price{font-size:15px}
  .buyrow .btn{padding:0 5px;font-size:11px}
}

/* ---------------- buttons ---------------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:0;max-width:100%;overflow:hidden;height:44px;padding:0 14px;white-space:nowrap;
  border-radius:var(--r);border:1px solid transparent;font-size:14px;line-height:20px;font-weight:700;
  transition:transform .08s,filter .15s,opacity .15s}
.btn:active{transform:scale(.97)}
.btn[disabled]{opacity:.5;pointer-events:none}
.btn svg{width:16px;height:16px}
.btn.primary{background:var(--purple-d);color:#fff}
.btn.blue{height:50px;font-size:16px;background:var(--purple-d);color:#fff}
.btn.ghost{border-color:var(--line-3);color:var(--text);background:transparent}
.btn.danger{background:#712b2b;border-color:#d75c5c;color:#f7d1d1}
.btn.good{background:#125341;border-color:#28a179;color:#d7f4e5}
.btn.sm{height:32px;padding:0 11px;font-size:12.5px;border-radius:var(--r-sm)}
.btn.block{display:flex;width:100%}
@media(hover:hover){.btn:hover{filter:brightness(1.1)}}

/* ---------------- listing detail ---------------- */
.gallery{position:relative;width:100%;aspect-ratio:16/10;border-radius:var(--r-lg);overflow:hidden;border:1px solid var(--line-2);background:var(--surface)}
.gallery img{display:block;width:100%;height:100%;object-fit:cover}
.gallery .nav{position:absolute;top:50%;width:38px;height:38px;margin-top:-19px;border-radius:50%;
  background:#0e1013cc;border:1px solid var(--line-2);display:grid;place-items:center;backdrop-filter:blur(6px)}
.gallery .nav.l{left:10px}.gallery .nav.r{right:10px}
.gallery .nav svg{width:19px;height:19px}
.gallery .count{position:absolute;right:10px;bottom:10px;height:26px;padding:0 11px;border-radius:13px;font-size:12.5px;line-height:24px;font-weight:700;
  background:#0e1013cc;border:1px solid var(--line-2);backdrop-filter:blur(6px)}
.thumbs{display:flex;gap:8px;height:74px;padding:10px 0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:none}
.thumbs::-webkit-scrollbar{display:none}
.thumbs img{flex:none;width:72px;height:54px;object-fit:cover;border-radius:var(--r-sm);border:2px solid var(--line);opacity:.8;cursor:pointer}
.thumbs img.on{border-color:#7985d5;opacity:1}

.title-row{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 12px;margin:12px 0}
.title-row h1{flex:1 1 60%;min-width:0;font-size:19px;line-height:24px;overflow-wrap:anywhere}
.title-row .price{font-size:23px;line-height:28px;font-weight:800;letter-spacing:-.02em;white-space:nowrap;color:var(--cyan)}
.chips{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:14px}
.chip{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border-radius:17px;font-size:12.5px;font-weight:600;white-space:nowrap;
  border:1px solid var(--line-2);background:var(--surface)}
.chip svg{width:16px;height:16px}

.panel{border:1px solid var(--line);border-radius:var(--r-xl);background:var(--surface);padding:16px;margin-top:16px}
.panel h2{font-size:17px;line-height:22px;margin-bottom:12px}
.panel h3{font-size:14.5px;line-height:19px;margin-bottom:10px}
.desc{color:var(--text-2);font-size:14px;line-height:1.6;white-space:pre-wrap;overflow-wrap:break-word}

.hl-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.hl{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:5px;height:108px;padding:12px 4px 0;text-align:center;
  border:1px solid var(--line);border-radius:var(--r);background:#15171c;overflow:hidden}
.hl .ic{flex:none;width:40px;height:40px;border-radius:50%;display:grid;place-items:center}
.hl .ic svg{width:20px;height:20px}
.hl b{font-size:15.5px;line-height:19px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hl span{font-size:10.5px;line-height:13px;color:var(--muted)}

.seller-row{display:flex;align-items:center;gap:11px;min-width:0}
.seller-row .av{width:42px;height:42px;border-radius:50%;font-size:17px;flex:none}
.seller-row>div{min-width:0}

@media(min-width:820px){
  .detail-cols{display:grid;grid-template-columns:1.2fr 1fr;grid-template-areas:"g i" "o i";gap:0 24px;align-items:start}
  .detail-cols .g{grid-area:g}
  .detail-cols .i{grid-area:i;position:sticky;top:8px}
  .detail-cols .o{grid-area:o}
}

/* ---------------- forms ---------------- */
.field{margin-bottom:13px;min-width:0}
.field label{display:block;height:18px;font-size:12px;line-height:18px;font-weight:600;color:var(--muted);margin-bottom:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.input{display:block;width:100%;height:46px;padding:0 13px;border-radius:var(--r);border:1px solid var(--line-2);background:#121418;
  font-size:16px;line-height:22px;outline:none;transition:border-color .15s,box-shadow .15s}
.input:focus{border-color:var(--purple);box-shadow:0 0 0 3px #7c88d633}
textarea.input{height:112px;padding:11px 13px;resize:none;overflow-y:auto}
input[type=file].input{padding:0 8px;line-height:44px;font-size:13px}
select.input{appearance:none;-webkit-appearance:none;padding-right:34px;
  background-image:linear-gradient(45deg,transparent 50%,#9298c0 50%),linear-gradient(135deg,#9298c0 50%,transparent 50%);
  background-position:calc(100% - 17px) 50%,calc(100% - 12px) 50%;background-size:5px 5px,5px 5px;background-repeat:no-repeat}
.row2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.row3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.check{display:flex;align-items:center;gap:9px;min-height:30px;font-size:14px}
.check input{width:19px;height:19px;accent-color:var(--purple);flex:none}
.hint{font-size:11.5px;color:var(--muted);margin-top:4px;line-height:1.4}
.err{color:#f0b1b1;font-size:13px;line-height:18px;margin:7px 0}
.err:empty{margin:0}
.auth-card{max-width:430px;margin:16px auto}

/* toolbars (live in #subbar so they stay put while the list scrolls) */
.tabs{display:flex;gap:5px;height:44px;padding:4px;border:1px solid var(--line);border-radius:var(--r);
  background:#121418;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{flex:1 0 auto;height:34px;padding:0 13px;border-radius:var(--r-sm);font-size:12.5px;line-height:34px;font-weight:700;color:var(--muted);text-align:center;white-space:nowrap}
.tab.on{background:var(--purple-d);color:#fff}
.filters{display:flex;align-items:center;gap:7px;height:34px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:none}
.filters::-webkit-scrollbar{display:none}
.filters .input,.filters .btn{flex:none;width:auto;height:34px;padding:0 12px;font-size:12.5px;border-radius:17px}
.filters select.input{padding-right:30px;background-position:calc(100% - 14px) 50%,calc(100% - 9px) 50%}
.toolbar>*+*{margin-top:8px}
.searchbar{display:flex;gap:8px;height:44px}
.searchbar .input{height:44px;border-radius:22px;padding-left:16px}
.searchbar .btn{flex:none;width:52px;height:44px;padding:0;border-radius:22px}
.result-count{height:30px;font-size:12px;line-height:30px;color:var(--muted)}

.empty{text-align:center;color:var(--muted);padding:46px 16px}
.empty svg{width:48px;height:48px;margin:0 auto 12px;opacity:.5}
.empty p{margin:0 0 14px}

/* ---------------- rows / lists ---------------- */
.list{display:flex;flex-direction:column;gap:9px}
.row{display:flex;align-items:center;gap:11px;min-width:0;height:74px;padding:0 11px;border:1px solid var(--line);border-radius:var(--r-lg);background:#181a20;text-align:left;overflow:hidden}
.row.wrap{height:auto;min-height:74px;padding:11px;flex-wrap:wrap}
.row .thumb{flex:none;width:52px;height:52px;border-radius:var(--r);background-size:cover;background-position:center;background-color:var(--surface-3)}
.row .grow{flex:1;min-width:0}
.row .grow b{display:block;height:20px;font-size:14px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .grow small{display:block;height:16px;margin-top:1px;font-size:11.5px;line-height:16px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row.wrap .grow small{height:auto;white-space:normal}

.pill{display:inline-block;height:20px;padding:0 8px;border-radius:10px;font-size:10.5px;line-height:18px;font-weight:700;white-space:nowrap;border:1px solid}
.pill.pending_payment,.pill.pending{background:#332811;border-color:#ddb242;color:#eddc9a}
.pill.payment_submitted,.pill.reserved{background:#1c1e25;border-color:#6270ce;color:#c9ceee}
.pill.paid,.pill.delivered,.pill.active{background:#0d3329;border-color:#4abd93;color:#b2e8cf}
.pill.completed,.pill.sold{background:#292d36;border-color:#99a3e0;color:#d3d7f2}
.pill.cancelled,.pill.expired,.pill.rejected,.pill.hidden,.pill.banned{background:#331118;border-color:#e58484;color:#f7d1d1}
.pill.disputed{background:#331c11;border-color:#e09557;color:#f2d6b6}
.unread{display:grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:#6472cf;color:#fff;font-size:11px;line-height:20px;font-weight:800}

/* ---------------- chat ---------------- */
.chat-head{height:56px;padding:0 10px;margin:0}
.chat-head .thumb{width:40px;height:40px}
.msgs{display:flex;flex-direction:column;gap:7px;padding:4px 0}
.msg{max-width:82%;padding:9px 13px;border-radius:17px;font-size:14px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.msg.me{align-self:flex-end;background:var(--purple-d);border-bottom-right-radius:5px}
.msg.them{align-self:flex-start;background:var(--surface-2);border:1px solid var(--line);border-bottom-left-radius:5px}
.msg time{display:block;margin-top:2px;font-size:10.5px;line-height:14px;opacity:.6}
.composer{display:flex;gap:8px;height:44px}
.composer .input{height:44px;border-radius:22px}
.composer .btn{flex:none;width:44px;height:44px;padding:0;border-radius:50%}

/* ---------------- bottom nav ---------------- */
#bottomnav .inner{display:flex;height:var(--nav-h);border:1px solid var(--line-2);border-radius:24px;overflow:hidden;
  background:#181a1ff2;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.nav-item{position:relative;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  font-size:11.5px;line-height:15px;font-weight:600;color:var(--text-2)}
.nav-item svg{width:23px;height:23px}
.nav-item.on{color:#fff;background:radial-gradient(90px 46px at 50% 110%,#5b6acc66,transparent)}
.nav-item.on svg{color:var(--violet)}
.nav-item.on::after{content:"";position:absolute;bottom:6px;width:34px;height:3px;border-radius:3px;background:var(--purple)}
.nav-item .unread{position:absolute;top:8px;left:calc(50% + 8px)}

/* ---------------- toast / modal (overlays: never move the layout) ---------------- */
#toasts{position:fixed;left:0;right:0;top:calc(env(safe-area-inset-top) + var(--top-h) + 6px);z-index:100;
  display:flex;flex-direction:column;align-items:center;gap:7px;pointer-events:none;padding:0 12px}
.toast{pointer-events:auto;max-width:100%;padding:10px 16px;border-radius:var(--r);font-size:14px;line-height:20px;font-weight:600;
  background:var(--surface-3);border:1px solid var(--line-2);box-shadow:var(--shadow);animation:pop .18s ease-out}
.toast.err{background:#3f2020;border-color:#d75c5c}
.toast.ok{background:#104436;border-color:#28a179}
@keyframes pop{from{opacity:0;transform:translateY(-8px)}}

.modal-bg{position:fixed;inset:0;z-index:90;display:flex;align-items:flex-end;justify-content:center;background:#000a;animation:fade .15s;overscroll-behavior:contain}
.modal{width:100%;max-width:520px;max-height:90%;overflow-y:auto;overscroll-behavior:contain;padding:18px 18px calc(18px + env(safe-area-inset-bottom));
  background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-xl) var(--r-xl) 0 0}
.modal h2{font-size:18px;line-height:23px;margin-bottom:12px}
@media(min-width:700px){.modal-bg{align-items:center}.modal{border-radius:var(--r-xl)}}
@keyframes fade{from{opacity:0}}

.spinner{width:30px;height:30px;margin:48px auto;border-radius:50%;border:3px solid var(--line-2);border-top-color:var(--purple);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------------- misc ---------------- */
.note{padding:11px 13px;border-radius:var(--r);font-size:13px;line-height:1.5;color:#d4d8f2;background:#1f232a;border:1px solid var(--line-2)}
.note.warn{background:#251c0d;border-color:#804420;color:#eddc9a}
.note svg{display:inline;vertical-align:-3px;width:16px;height:16px;margin-right:5px}
.cred{margin:10px 0;padding:12px;border:1px dashed var(--green);border-radius:var(--r);background:#0e1013}
.cred div{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:34px;font-size:13.5px}
.cred code{padding:4px 8px;border-radius:6px;background:var(--surface-2);font-size:13px;overflow-wrap:anywhere;user-select:all}
.steps{display:flex;gap:5px;height:4px;margin:4px 0 14px}
.steps i{flex:1;height:4px;border-radius:2px;background:var(--line)}
.steps i.on{background:linear-gradient(90deg,#5f6ece,#495ac7)}
.imgpick{display:flex;flex-wrap:wrap;gap:8px}
.imgpick .ph{position:relative;flex:none;width:70px;height:70px;border-radius:var(--r);border:1px solid var(--line-2);background-size:cover;background-position:center}
.imgpick .ph button{position:absolute;right:-6px;top:-6px;width:21px;height:21px;border-radius:50%;background:#d75c5c;color:#fff;font-size:13px;line-height:21px}
.imgpick .add{display:grid;place-items:center;border:1.5px dashed var(--line-2);color:var(--muted);font-size:26px;cursor:pointer}
.stat-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
@media(min-width:700px){.stat-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
.stat{height:78px;padding:13px;border:1px solid var(--line);border-radius:var(--r-lg);background:#181a20;overflow:hidden}
.stat b{display:block;height:30px;font-size:20px;line-height:30px;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat span{display:block;font-size:11.5px;line-height:16px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.footer{padding:24px 16px 0;text-align:center;font-size:12px;color:var(--muted)}

.chip.charchip{padding:0 13px 0 4px}
.av.sm{width:28px;height:28px;border-radius:50%;font-size:12px}
.av.xs{width:22px;height:22px;border-radius:50%;font-size:10px;border:0}
.pickchips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.pickchip{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 10px 0 4px;border-radius:15px;border:1px solid var(--line-2);background:var(--surface);font-size:12px;font-weight:600;white-space:nowrap}
.chargrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:10px;margin-top:14px}
.charcell{position:relative;display:flex;flex-direction:column;align-items:center;gap:6px;padding:8px;border:1px solid var(--line);border-radius:var(--r);background:#181a20;text-align:center;font-size:13px}
.charcell img{display:block;width:100%;aspect-ratio:1;object-fit:cover;border-radius:6px}
.charcell b{display:block;max-width:100%;height:18px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.charcell .btn{position:absolute;top:4px;right:4px;width:28px;height:28px;padding:0}
.charcell .btn svg{width:14px;height:14px}
.heroprev{height:110px;border-radius:var(--r);border:1px dashed var(--line-2);background:#121418 center/cover no-repeat;display:grid;place-items:center;font-size:12.5px;color:var(--muted);text-align:center;padding:10px}

.browse-all{height:46px;margin-top:14px;border-color:#4a5162;color:#d8dcf3}
.browse-all svg{width:16px;height:16px}

.contact-btns{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px}
.contact-btns .btn{height:46px}
.btn.wa{background:#128c4a;border-color:#25d366;color:#fff}
.btn.ig{background:#c13584;border-color:#d6249f;color:#fff}
.btn.wa svg,.btn.ig svg{width:18px;height:18px}
.panel.contact h3{margin-bottom:10px}

@media(prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* Google sign-in: fixed-height slot so the button loading in never shifts the form */
.gbox{display:flex;align-items:center;justify-content:center;height:44px;margin-bottom:4px;overflow:hidden}
.gfail{font-size:12.5px;color:var(--muted);text-align:center}
.or-sep{display:flex;align-items:center;gap:10px;height:36px;font-size:12px;color:var(--muted)}
.or-sep::before,.or-sep::after{content:"";flex:1;height:1px;background:var(--line-2)}

/* calm theme: flat surfaces, one accent, no glow */
.btn.primary:hover,.btn.blue:hover{filter:brightness(1.08)}
.stack-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
@media (max-width:380px){.stack-actions{grid-template-columns:1fr}}
.paid-ok{display:flex;gap:12px;align-items:flex-start;padding:14px;margin:4px 0 14px;border-radius:var(--r-lg);background:#16261f;border:1px solid #2f6b52}
.paid-ok svg{width:22px;height:22px;color:var(--green);margin-top:1px}
.paid-ok b{display:block;font-size:15px}.paid-ok span{display:block;color:var(--text-2);font-size:13px;margin-top:2px}
.msg.sys{align-self:center;max-width:92%;background:var(--surface-2);border:1px solid var(--line-2);color:var(--text-2);font-size:12.5px;text-align:center;border-radius:var(--r)}
