/* ============================================================
   Lubri — web-simulated iOS demo
   Light iOS system UI · brand yellow/gold accents
   ============================================================ */

:root {
  --tint:        #b8860b;         /* interactive gold (legible on white) */
  --tint-2:      #c79a1e;
  --yellow:      #fef100;         /* brand fill */
  --yellow-dk:   #f2d900;

  --bg-grouped:  #f2f2f7;         /* systemGroupedBackground */
  --bg-elevated: #ffffff;
  --fill-quaternary: rgba(116,116,128,.08);
  --separator:   rgba(60,60,67,.20);
  --separator-opaque: #e3e3e8;

  --label:       #1c1c1e;
  --label-2:     rgba(60,60,67,.6);   /* secondaryLabel */
  --label-3:     rgba(60,60,67,.35);  /* tertiaryLabel */

  --nav-h: 44px;
  --tab-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
          'Helvetica Neue', 'Segoe UI', Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--label);
  background: #d1d1d6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- Desktop stage + device frame ---------- */
.stage {
  height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(1000px 700px at 50% -10%, #fffbe6, transparent 60%),
    linear-gradient(160deg, #ececed, #d7d7db);
  padding: 24px;
}
.device {
  position: relative;
  width: 390px; height: 844px;
  background: var(--bg-grouped);
  border-radius: 55px;
  box-shadow:
    0 0 0 13px #1a1a1c,
    0 0 0 15px #2c2c2e,
    0 40px 90px -20px rgba(0,0,0,.55);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* fill the viewport on real phones */
@media (max-width: 480px) {
  .stage { padding: 0; }
  .device { width: 100vw; height: 100dvh; border-radius: 0; box-shadow: none; }
}

/* ---------- Status bar ---------- */
.statusbar {
  height: 54px; flex-shrink: 0; position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; padding-top: 12px;
  font-weight: 600; font-size: 15px; color: var(--label);
}
.sb-island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 118px; height: 33px; background: #000; border-radius: 20px;
}
.sb-time { font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.sb-right { display: flex; align-items: center; gap: 6px; }
.sb-ico { fill: var(--label); }
.sb-batt {
  width: 24px; height: 12px; border: 1px solid rgba(0,0,0,.35); border-radius: 3px;
  position: relative; display: inline-block; padding: 1.5px;
}
.sb-batt::after { content:''; position:absolute; right:-3px; top:3.5px; width:2px; height:5px; background:rgba(0,0,0,.35); border-radius:0 2px 2px 0; }
.sb-batt-fill { display:block; width:100%; height:100%; background: var(--label); border-radius: 1.5px; }

/* ---------- Screen host (nav stack) ---------- */
.screen-host { position: relative; flex: 1; overflow: hidden; }
.screen {
  position: absolute; inset: 0; background: var(--bg-grouped);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tab-h) + 24px);
  transition: transform .4s cubic-bezier(.32,.72,0,1), opacity .3s ease;
  will-change: transform;
}
.screen::-webkit-scrollbar { display: none; }
.screen.push-enter { transform: translateX(100%); box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.screen.push-active { transform: translateX(0); box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.screen.push-behind { transform: translateX(-25%); }
.screen.push-behind::after {
  content:''; position:absolute; inset:0; background:rgba(0,0,0,.06); pointer-events:none;
}
.screen.fade-swap { animation: fadeSwap .28s ease; }
@keyframes fadeSwap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* detail screens sit on plain background, not grouped */
.screen.plain { background: var(--bg-elevated); }

/* ---------- Nav bars ---------- */
.nav-large { padding: 4px 20px 6px; }
.nav-large h1 {
  font-size: 34px; font-weight: 800; letter-spacing: .37px; color: var(--label);
  line-height: 1.1;
}
.nav-large .nav-sub { font-size: 15px; color: var(--label-2); margin-top: 2px; }

/* compact nav bar with back button (detail screens) */
.nav-bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--nav-h); display: flex; align-items: center; gap: 4px;
  padding: 0 8px;
  background: rgba(249,249,251,.82); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--separator);
}
.nav-back {
  display: flex; align-items: center; gap: 3px; background: none; border: 0;
  color: var(--tint); font-size: 17px; padding: 6px 8px;
}
.nav-back svg { width: 12px; height: 20px; }
.nav-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 17px; font-weight: 600; color: var(--label);
  max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-action { margin-left: auto; background: none; border: 0; color: var(--tint); padding: 6px 10px; display: flex; align-items: center; }
.nav-action svg { width: 22px; height: 22px; }

/* ---------- Search bar (iOS) ---------- */
.searchbar { padding: 8px 16px 6px; }
.searchbar .field {
  display: flex; align-items: center; gap: 6px;
  background: rgba(118,118,128,.12); border-radius: 10px; padding: 8px 10px;
  color: var(--label-2);
}
.searchbar .field svg { width: 16px; height: 16px; fill: var(--label-2); flex-shrink: 0; }
.searchbar input {
  flex: 1; border: 0; background: none; outline: none; font-size: 17px; color: var(--label);
}
.searchbar input::placeholder { color: var(--label-2); }

/* ---------- Grouped lists ---------- */
.group-title {
  font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: .5px;
  color: var(--label-2); padding: 18px 32px 6px;
}
.group-title.fav { color: var(--tint); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.group-title.fav svg { width: 13px; height: 13px; fill: var(--tint); }

.inset {
  background: var(--bg-elevated); margin: 0 16px; border-radius: 12px; overflow: hidden;
}
.cell {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 16px; background: none; border: 0; text-align: left;
  position: relative; min-height: 56px;
  transition: background .12s;
}
.cell:active { background: rgba(0,0,0,.05); }
.cell + .cell::before {
  content: ''; position: absolute; top: 0; left: 60px; right: 0; height: .5px; background: var(--separator);
}
.cell .avatar-sm {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #4a3c00;
  background: linear-gradient(135deg, #fff7a8, var(--yellow));
}
.cell .avatar-sm.round { border-radius: 50%; }
.cell .avatar-sm.steel { background: linear-gradient(135deg, #dcebf6, #7fa9c9); color: #12303f; }
.cell .cell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cell .cell-title { display: block; font-size: 17px; color: var(--label); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .cell-sub { display: block; font-size: 13px; color: var(--label-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .cell-rank { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cell .star {
  width: 34px; height: 34px; border: 0; background: none; color: var(--label-3);
  display: grid; place-items: center; flex-shrink: 0;
}
.cell .star.on { color: var(--yellow-dk); }
.cell .star svg { width: 21px; height: 21px; }
.cell .chevron { color: var(--label-3); flex-shrink: 0; }
.cell .chevron svg { width: 8px; height: 14px; }

.empty-note { text-align: center; color: var(--label-2); padding: 40px; font-size: 15px; }

/* ---------- HOME ---------- */
.home-hero {
  margin: 8px 16px 4px; border-radius: 18px; overflow: hidden; position: relative;
  background: linear-gradient(150deg, #fffbe0, #fff);
  border: .5px solid var(--separator); padding: 20px;
}
.home-hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1; }
.home-hero h2 em { color: var(--tint); font-style: normal; }
.home-hero p { font-size: 14px; color: var(--label-2); margin-top: 6px; max-width: 30ch; }
.home-hero .drop-bg { position: absolute; right: 10px; top: 8px; width: 74px; height: auto; opacity: .95; }

/* Siri-style ask pill */
.ask-shell { position: relative; margin: 14px 16px 4px; border-radius: 100px; }
.ask-shell::before {
  content:''; position:absolute; inset:-5px; border-radius:inherit; z-index:0;
  background: conic-gradient(from 0deg, var(--yellow), #ffd36b, var(--tint-2), #fff6c0, var(--yellow-dk), var(--yellow));
  filter: blur(11px); opacity:.5; animation: spin 7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ask-bar {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 100px; padding: 7px 7px 7px 10px;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,.18);
}
.ask-orb {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: conic-gradient(from 0deg, var(--yellow), #ffcf5a, var(--tint-2), #fff3b0, var(--yellow));
  box-shadow: 0 0 0 3px rgba(254,241,0,.18);
  animation: orbFloat 3.6s ease-in-out infinite;
}
.ask-orb i { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 32%, #fff, transparent 70%); animation: orbPulse 2.2s ease-in-out infinite; }
@keyframes orbFloat { 0%,100%{transform:translateY(0) scale(1);} 50%{transform:translateY(-1px) scale(1.05);} }
@keyframes orbPulse { 0%,100%{opacity:.8;transform:scale(.85);} 50%{opacity:1;transform:scale(1.1);} }
.ask-bar input { flex: 1; border: 0; outline: none; background: none; font-size: 16px; color: var(--label); }
.ask-bar input::placeholder { color: var(--label-2); }
.ask-mic, .ask-send {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex-shrink: 0;
  display: grid; place-items: center; background: rgba(118,118,128,.12); color: var(--label-2);
}
.ask-send { background: var(--yellow); color: #16181d; }
.ask-mic svg, .ask-send svg { width: 17px; height: 17px; }
.ask-shell.listening .ask-orb { animation: orbListen 1s ease-in-out infinite; }
@keyframes orbListen { 0%,100%{box-shadow:0 0 0 3px rgba(254,241,0,.25);} 50%{box-shadow:0 0 0 4px rgba(254,241,0,.3), 0 0 0 12px rgba(254,241,0,0);} }

/* news list (iOS cards) */
.news-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
.news-cell .ntag {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 100px;
}
.ntag.amber { color: #8a6d00; background: rgba(254,241,0,.24); }
.ntag.steel { color: #2f5f80; background: rgba(61,109,148,.14); }
.ntag.green { color: #1f7a4d; background: rgba(47,158,99,.14); }
.news-cell .news-title { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--label); }
.news-cell .news-meta { font-size: 12px; color: var(--label-2); }

/* horizontal top-of-catalog cards */
.h-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 8px; scroll-snap-type: x mandatory; }
.h-scroll::-webkit-scrollbar { display: none; }
.top-card {
  flex: 0 0 150px; scroll-snap-align: start; background: var(--bg-elevated);
  border-radius: 14px; padding: 14px; border: .5px solid var(--separator);
}
.top-card .tc-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(254,241,0,.25); color: #8a6d00; margin-bottom: 10px; }
.top-card .tc-ico svg { width: 20px; height: 20px; }
.top-card .tc-name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.top-card .tc-meta { font-size: 12px; color: var(--label-2); margin-top: 4px; }

/* ---------- DETAIL (product) ---------- */
.detail-hero { padding: 8px 20px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.avatar-lg {
  width: 104px; height: 104px; border-radius: 50%; position: relative; margin-bottom: 14px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, #fffbc7, var(--yellow) 55%, var(--yellow-dk) 100%);
  box-shadow: 0 14px 30px -12px rgba(242,217,0,.6), inset 0 -8px 18px rgba(180,150,0,.25);
}
.avatar-lg::after { content:''; position:absolute; top:16px; left:22px; width:22px; height:22px; border-radius:50%; background:rgba(255,255,255,.7); filter:blur(4px); }
.avatar-lg span { font-size: 30px; font-weight: 800; color: #4a3c00; }
.avatar-lg.steel { background: radial-gradient(circle at 32% 28%, #eaf3fa, #7fa9c9 55%, #4d7999 100%); }
.avatar-lg.steel span { color: #12303f; }
.detail-hero .eyebrow { font-size: 13px; color: var(--tint); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.detail-hero .eyebrow .lnk { text-decoration: underline; }
.detail-hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin: 4px 0 8px; }
.detail-hero .desc { font-size: 15px; color: var(--label-2); line-height: 1.5; max-width: 34ch; }

/* metadata as iOS grouped rows */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 14px; }
.metric {
  background: var(--bg-elevated); border-radius: 14px; padding: 14px 16px; border: .5px solid var(--separator);
}
.metric .k { font-size: 12px; color: var(--label-2); text-transform: uppercase; letter-spacing: .3px; }
.metric .v { font-size: 22px; font-weight: 700; margin-top: 3px; }
.metric .v.gold { color: var(--tint); }

.offer-cell {
  margin: 0 16px 16px; border-radius: 14px; padding: 14px 16px;
  background: linear-gradient(100deg, rgba(254,241,0,.28), rgba(254,241,0,.08));
  border: .5px solid var(--yellow-dk); display: flex; align-items: center; gap: 12px;
}
.offer-cell .pct { font-size: 22px; font-weight: 800; color: #8a6d00; }
.offer-cell .ot { font-size: 13px; color: var(--label-2); flex: 1; }
.offer-cell .ot b { color: var(--label); }
.offer-cell .details { font-size: 13px; color: var(--tint); font-weight: 600; }

/* action buttons */
.actions { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.act-primary { display: grid; grid-template-columns: 1fr; gap: 10px; }
.btn-fill {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--yellow); color: #16181d; border: 0; border-radius: 14px;
  padding: 15px; font-size: 17px; font-weight: 600;
}
.btn-fill:active { filter: brightness(.94); }
.btn-fill svg { width: 20px; height: 20px; }
.btn-tinted {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(184,134,11,.12); color: var(--tint); border: 0; border-radius: 14px;
  padding: 14px; font-size: 16px; font-weight: 600;
}
.btn-tinted:active { filter: brightness(.96); }
.btn-tinted svg { width: 19px; height: 19px; }
.act-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.act-secondary .btn-tinted:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sec-label { font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: .5px; padding: 16px 16px 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; color: var(--label); background: rgba(118,118,128,.12); border-radius: 100px; padding: 6px 12px; }

/* brand card */
.brand-card {
  margin: 8px 16px 4px; background: var(--bg-elevated); border-radius: 18px;
  border: .5px solid var(--separator); padding: 20px; text-align: center;
}
.brand-card .avatar-lg { margin: 0 auto 12px; width: 84px; height: 84px; }
.brand-card .avatar-lg span { font-size: 24px; }
.brand-card .eyebrow { font-size: 12px; color: var(--tint); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.brand-card h1 { font-size: 24px; font-weight: 800; margin: 4px 0 8px; }
.brand-card .desc { font-size: 14px; color: var(--label-2); line-height: 1.5; }
.brand-card .bm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; text-align: left; margin-top: 16px; padding-top: 16px; border-top: .5px solid var(--separator); }
.brand-card .bm .k { font-size: 11px; color: var(--label-2); text-transform: uppercase; letter-spacing: .3px; }
.brand-card .bm .v { font-size: 15px; font-weight: 500; margin-top: 2px; }
.brand-card .bm .v a { color: var(--tint); text-decoration: none; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 25;
  height: calc(var(--tab-h) + 20px); padding-bottom: 20px;
  display: flex; align-items: stretch;
  background: rgba(249,249,251,.82); backdrop-filter: saturate(180%) blur(22px);
  border-top: .5px solid var(--separator);
}
.tabbar-item {
  flex: 1; background: none; border: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; color: #8e8e93; padding-top: 8px;
}
.tabbar-item.active { color: var(--tint); }
.tabbar-ico { width: 27px; height: 27px; display: grid; place-items: center; }
.tabbar-ico svg { width: 26px; height: 26px; }
.tabbar-label { font-size: 10px; font-weight: 500; letter-spacing: .1px; }

.home-indicator {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 140px; height: 5px; border-radius: 3px; background: #000; z-index: 40; opacity: .85;
}

/* ---------- Bottom sheet (chat / history) ---------- */
.sheet-scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 51;
  height: 88%; background: var(--bg-elevated);
  border-radius: 12px 12px 0 0; transform: translateY(100%);
  transition: transform .42s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
.sheet.open { transform: translateY(0); }
.sheet-grabber { width: 40px; height: 5px; border-radius: 3px; background: rgba(60,60,67,.3); margin: 8px auto 4px; flex-shrink: 0; }
.sheet-head {
  display: flex; align-items: center; padding: 6px 16px 12px; border-bottom: .5px solid var(--separator);
}
.sheet-head h3 { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.sheet-head .sheet-close { background: rgba(118,118,128,.12); border: 0; color: var(--label-2); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.sheet-head .sheet-close svg { width: 15px; height: 15px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg-grouped); }
.sheet-body::-webkit-scrollbar { display: none; }

.msg { display: flex; margin-bottom: 10px; }
.msg .b { max-width: 78%; padding: 9px 14px; border-radius: 20px; font-size: 15px; line-height: 1.35; }
.msg.user { justify-content: flex-end; }
.msg.user .b { background: var(--yellow); color: #16181d; border-bottom-right-radius: 6px; }
.msg.bot .b { background: var(--bg-elevated); color: var(--label); border: .5px solid var(--separator); border-bottom-left-radius: 6px; }
.msg.bot .b.muted { color: var(--label-2); font-size: 13px; }
.typing span { display:inline-block; width:7px; height:7px; border-radius:50%; background: var(--label-3); margin:0 2px; animation: blink 1.2s infinite; }
.typing span:nth-child(2){animation-delay:.2s;} .typing span:nth-child(3){animation-delay:.4s;}
@keyframes blink { 0%,80%,100%{opacity:.25;} 40%{opacity:1;} }

.hist-cell { background: var(--bg-elevated); border-radius: 12px; padding: 13px 15px; margin-bottom: 8px; border: .5px solid var(--separator); }
.hist-cell .q { font-size: 15px; }
.hist-cell .when { font-size: 12px; color: var(--label-2); margin-top: 4px; }

.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: .5px solid var(--separator); background: var(--bg-elevated); }
.sheet-foot input { flex: 1; border: .5px solid var(--separator); border-radius: 100px; padding: 9px 14px; font-size: 15px; outline: none; }
.sheet-foot button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--yellow); color: #16181d; display: grid; place-items: center; flex-shrink: 0; }
.sheet-foot button svg { width: 16px; height: 16px; }

/* iOS toast */
.ios-toast {
  position: absolute; left: 50%; bottom: calc(var(--tab-h) + 40px); transform: translateX(-50%) translateY(10px);
  background: rgba(30,30,32,.92); color: #fff; font-size: 14px; font-weight: 500;
  padding: 10px 18px; border-radius: 100px; z-index: 60; opacity: 0; transition: all .28s;
  backdrop-filter: blur(10px); white-space: nowrap;
}
.ios-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
