/* UDOU — A "White Shelf" (light) / B "Night Konbini" (dark).
   Products bring the color; the interface stays quiet. See docs/udou-redesign/. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-blur: rgba(255, 255, 255, 0.92);
  --backdrop: #f2f2f2;
  --sheet: #ffffff;
  --text: #111111;
  --text-2: #8a8a8a;
  --text-3: #b8b8b8;
  --line: #ececec;
  --line-strong: #dedede;
  --accent: #111111;
  --on-accent: #ffffff;
  --like: #111111;
  --unread: #ff3b30;
  --danger: #d92d20;
  --skeleton: #f1f1f1;
  --tile: #f3f3f3;
  --tile-glow: none;
  --scan-hit: #ffffff;
  --burst: #ffffff;
  --shadow-lift: 0 6px 18px rgba(0, 0, 0, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", monospace;
  --nav-h: 64px;
  --top-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f12;
  --bg-blur: rgba(14, 15, 18, 0.9);
  --backdrop: #08090b;
  --sheet: #17181c;
  --text: #ffffff;
  --text-2: #9a9ca3;
  --text-3: #5d6068;
  --line: #22242a;
  --line-strong: #31343b;
  --accent: #d4ff3f;
  --on-accent: #0e0f12;
  --like: #d4ff3f;
  --unread: #d4ff3f;
  --danger: #ff6b5e;
  --skeleton: #1c1d22;
  /* Late-night fridge: a cool light from above, falling off toward the shelf edges. */
  --tile: radial-gradient(120% 95% at 50% 6%, #eef2f6 0%, #d8dde4 48%, #a2a9b5 100%);
  --tile-glow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --scan-hit: #d4ff3f;
  --burst: #d4ff3f;
  --shadow-lift: 0 6px 22px rgba(212, 255, 63, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
a, button, label, input, textarea { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Page frame ---------- */

.app {
  position: relative;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
}
.app.no-nav { padding-bottom: var(--safe-b); }
@media (min-width: 560px) {
  html, body { background: var(--backdrop); }
  .app { box-shadow: 0 0 0 1px var(--line); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 6px 0 16px;
  background: var(--bg-blur);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}
.topbar.has-back { padding-left: 4px; }
.topbar .title { flex: 1; font-size: 16px; font-weight: 700; text-align: center; margin-right: 44px; }
.topbar .spacer { flex: 1; }
.topbar .end { margin-left: auto; display: flex; align-items: center; }
.wordmark { display: block; height: 19px; width: auto; color: var(--text); }
.wordmark path { fill: currentColor; }

/* ---------- Icons ---------- */

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon.solid { fill: currentColor; }
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: none;
}
.icon-btn:active { opacity: 0.6; }
html[data-unread="on"] .dot { display: block; }
[data-bell] { display: none; }
html[data-auth="in"] [data-bell] { display: inline-grid; }
.dot {
  display: none;
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unread);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- Product photos (white packshots melt into the tile) ---------- */

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--tile);
  box-shadow: var(--tile-glow);
  isolation: isolate;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.28s ease-out;
  /* Anything lighter than the tile (the white of a packshot) takes the tile's color, so no seam shows. */
  mix-blend-mode: darken;
}
.tile img.ready { opacity: 1; }
.tile.pad img { padding: 9%; }
/* Someone's own photo is a picture, not a packshot: it fills the square and keeps its own light. */
.tile.photo img, .tile.shot img { object-fit: cover; mix-blend-mode: normal; }
.tile .ph { position: absolute; inset: 0; margin: auto; width: 34%; height: 25%; color: #111; opacity: 0.14; }

.avatar {
  position: relative;
  display: block;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--tile);
  box-shadow: var(--tile-glow);
  isolation: isolate;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: darken; }
.avatar.product img { object-fit: contain; padding: 5%; }
.avatar.none { display: grid; place-items: center; color: #8d9098; }
.avatar.none .icon { width: 56%; height: 56%; stroke-width: 1.6; }

/* ---------- Tag row (stories position) ---------- */

.tagrow {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 16px 14px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.tagrow::-webkit-scrollbar { display: none; }
.tagchip {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 66px;
  scroll-snap-align: start;
}
.tagchip .ring {
  display: block;
  width: 66px;
  height: 66px;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid transparent;
}
.tagchip .tile { width: 100%; height: 100%; border-radius: 50%; }
.tagname {
  max-width: 100%;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tagchip[aria-pressed="true"] .ring { border-color: var(--accent); }
.tagchip[aria-pressed="true"] .tagname { font-weight: 700; }
.tagchip.sk-chip .ring { background: var(--skeleton); border: 0; }

/* ---------- Feed post ---------- */

.post { padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.post-head { display: flex; align-items: center; gap: 10px; padding: 0 16px 10px; }
.who { display: grid; min-width: 0; line-height: 1.3; }
.who .name { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.who time { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.post-photo { position: relative; display: block; margin: 0 16px; aspect-ratio: 1; border-radius: 6px; }
.post-body { padding: 12px 16px 0; }
.product-name { font-size: 15px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.brand { margin-top: 1px; font-size: 12.5px; color: var(--text-2); }
.note { margin: 3px 0 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 6px; font-size: 14px; color: var(--text-2); }
.tags a:active { color: var(--text); }
.actions { display: flex; align-items: center; padding: 4px 6px 0; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.act .icon { width: 25px; height: 25px; }
.act:active .icon { transform: scale(0.88); }
.act.liked .icon { fill: var(--like); stroke: var(--like); }
.act.liked .icon { animation: pop 0.35s ease-out; }
.act[aria-disabled="true"] { cursor: default; }
.act[aria-disabled="true"] .icon { opacity: 0.45; }
.act-end { margin-left: auto; }
@keyframes pop { 40% { transform: scale(1.22); } 100% { transform: scale(1); } }

.burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 2; }
.burst .icon {
  width: 104px;
  height: 104px;
  fill: var(--burst);
  stroke: none;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.22));
  animation: burst 0.8s ease-out forwards;
}
@keyframes burst {
  0% { transform: scale(0.3); opacity: 0; }
  18% { transform: scale(1.12); opacity: 1; }
  32% { transform: scale(0.94); }
  72% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.02); opacity: 0; }
}

.feed-end { display: grid; place-items: center; padding: 28px 16px 8px; color: var(--text-3); }
.feed-end .end-mark { width: 30px; height: 22px; color: var(--text-3); }
.loader { display: grid; place-items: center; height: 72px; }
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeletons keep the layout still while the first page loads. */
.sk { background: var(--skeleton); border-radius: 4px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.55; } }
.sk-line { height: 12px; margin-top: 8px; }

/* ---------- Empty and error states ---------- */

.state { display: grid; justify-items: center; gap: 14px; padding: 72px 32px 40px; text-align: center; }
.state .glyph { width: 64px; height: 47px; color: var(--text-3); }
.state .icon { width: 40px; height: 40px; color: var(--text-3); stroke-width: 1.5; }
.state p { margin: 0; font-size: 15px; color: var(--text-2); }
.state .btn { width: auto; min-width: 200px; padding: 0 24px; }

/* ---------- Bottom navigation ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  margin: 0 auto;
  padding: 0 24px var(--safe-b);
  background: var(--bg-blur);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
  view-transition-name: tabbar;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* The scan button rises above the bar, so slide far enough to hide it too. */
body[data-nav="off"] .tabbar { transform: translateY(calc(100% + 40px)); }
.tab .icon.on, .tab[aria-current] .icon.off { display: none; }
.tab[aria-current] .icon.on { display: block; }
.tab { justify-self: center; display: grid; place-items: center; width: 64px; height: 52px; color: var(--text); }
.tab .icon { width: 27px; height: 27px; }
.tab:active { opacity: 0.6; }
.tab .avatar { width: 30px; height: 30px; }
.tab[aria-current="page"] .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }
.scanbtn {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-top: -20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 5px var(--bg), var(--shadow-lift);
  transition: transform 0.15s ease-out;
}
.scanbtn:active { transform: scale(0.94); }
.scanbtn svg { width: 30px; height: 22px; fill: currentColor; }

/* ---------- Buttons and fields ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:disabled { opacity: 0.32; cursor: default; }
.btn-line { border: 1px solid var(--line-strong); }
.btn-google {
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.btn-google svg { width: 20px; height: 20px; }
.btn-text { width: auto; height: 44px; padding: 0 8px; font-size: 14px; font-weight: 400; color: var(--text-2); letter-spacing: 0.02em; }
.btn .spinner { width: 18px; height: 18px; border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }

.field {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming the page */
}
.field::placeholder { color: var(--text-3); }
.field:focus { outline: none; border-color: var(--text); }
textarea.field { height: auto; min-height: 104px; padding: 12px 14px; line-height: 1.6; resize: none; }
.field.mono { font-family: var(--mono); letter-spacing: 0.12em; }
.label { display: block; margin: 20px 0 8px; font-size: 12.5px; color: var(--text-2); }
.counter { margin-top: 6px; font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }

.toggles { display: flex; gap: 4px; overflow-x: auto; margin: 14px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.toggles::-webkit-scrollbar { display: none; }
.toggle { flex: none; height: 36px; padding: 0 12px; border-radius: 6px; font-size: 15px; color: var(--text); }
.toggle[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }

.segment { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segment button { display: grid; justify-items: center; gap: 4px; padding: 10px 0 8px; font-size: 12px; color: var(--text-2); }
.segment button + button { border-left: 1px solid var(--line-strong); }
.segment button[aria-pressed="true"] { color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.segment .icon { width: 22px; height: 22px; }

/* ---------- Sheet ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.38);
  opacity: 0;
  transition: opacity 0.22s ease-out;
}
.scrim.open { opacity: 1; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  max-width: 480px;
  max-height: 90dvh;
  margin: 0 auto;
  overflow-y: auto;
  padding: 8px 16px calc(16px + var(--safe-b));
  background: var(--sheet);
  border-radius: 12px 12px 0 0;
  transform: translateY(102%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  overscroll-behavior: contain;
}
.sheet.open { transform: none; }
.grabber { width: 36px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: var(--line-strong); }
.sheet-title { margin: 4px 0 16px; font-size: 16px; font-weight: 700; text-align: center; }
.sheet-note { margin: 12px 0 0; font-size: 12px; color: var(--text-2); text-align: center; }
.menu { display: grid; margin: -6px -16px 0; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 22px; font-size: 16px; text-align: left; }
.menu-item:active { background: var(--skeleton); }
.menu-item .icon { width: 22px; height: 22px; stroke-width: 1.8; }
.menu-item.danger { color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:disabled { opacity: 0.5; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 28px);
  z-index: 60;
  max-width: calc(100% - 48px);
  padding: 11px 18px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Profile ---------- */

.profile { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 8px 16px 20px; }
.profile .avatar { width: 92px; height: 92px; }
.profile-name { font-size: 20px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.profile-bio { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile .icon-btn { align-self: start; margin-top: 2px; }
.points { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; padding: 0 10px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid > a { aspect-ratio: 1; }
.grid > a:active { opacity: 0.85; }

/* ---------- Several products in one post: a small shelf ---------- */

.shelf { overflow: hidden; background: var(--bg); }
.collage { display: grid; gap: 2px; width: 100%; height: 100%; }
.collage.n2 { grid-template-columns: 1fr 1fr; }
.collage.n3, .collage.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.collage.n3 > :first-child { grid-row: span 2; }
.collage > .tile { width: 100%; height: 100%; min-height: 0; }
.collage .tile.pad img { padding: 12%; }
.collage .rest { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(17, 17, 17, 0.42); color: #fff; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-list { display: grid; margin: 2px -16px 4px; }
.item-line { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; padding: 8px 16px; }
.item-line:active { background: var(--skeleton); }
.item-line .tile { width: 52px; height: 52px; border-radius: 6px; }
.item-line .name { white-space: normal; font-size: 14.5px; line-height: 1.4; }
.item-line .brand { font-size: 12px; }
.item-line .go { width: 16px; height: 16px; color: var(--text-3); stroke-width: 2.4; }
.grid .stack { position: absolute; top: 6px; right: 6px; color: #111; opacity: 0.72; }
.grid .stack .icon { width: 16px; height: 16px; stroke-width: 2.2; }

/* ---------- Barcode page (/b/:jan) ---------- */

a.product-name { display: block; }
a.product-name .go { width: 15px; height: 15px; margin-left: 2px; vertical-align: -2px; color: var(--text-3); stroke-width: 2.4; }
a.product-name:active { opacity: 0.6; }
/* Everything on the page fits the first screen, so the photo gives up height on short phones. */
.item .detail-photo { aspect-ratio: auto; height: clamp(168px, calc(100svh - 500px), 358px); }
.item-head { padding: 14px 16px 0; }
.item-name { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.item-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; font-size: 13px; color: var(--text-2); }
.item-sub .jan { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); letter-spacing: 0.06em; }
.item-rows { margin-top: 14px; border-top: 1px solid var(--line); }
.item-row {
  display: grid;
  grid-template-columns: 22px 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.item-row:active { background: var(--skeleton); }
.item-row > .icon { width: 22px; height: 22px; stroke-width: 1.8; }
.item-row .avatar { width: 40px; height: 40px; }
.item-row .cap { font-size: 11.5px; color: var(--text-2); }
.item-row time { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.item-stats { display: grid; grid-template-columns: 1fr 1fr; padding: 12px 16px 16px; text-align: center; }
.item-stats > div { display: grid; gap: 1px; }
.item-stats > div + div { border-left: 1px solid var(--line); }
.item-stats .cap { font-size: 12px; color: var(--text-2); }
.item-stats b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-cta { width: auto; margin: 0 16px; }
.item-cta .cta-mark { width: 22px; height: 16px; }
.shop-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  margin: 4px 16px 10px;
  font-size: 13.5px;
  color: var(--text-2);
}
.shop-link .icon { width: 16px; height: 16px; stroke-width: 1.8; }
.item + .grid { margin-top: 2px; }
.grid > a { position: relative; }
.grid .likes {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: #111;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}
.grid .likes .icon { width: 12px; height: 12px; stroke-width: 2.2; }

/* ---------- Post detail and comments ---------- */

.detail-photo { margin: 4px 16px 0; aspect-ratio: 1; border-radius: 6px; }
.detail-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.comments { margin-top: 8px; padding: 6px 0 12px; border-top: 1px solid var(--line); }
.comment { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 10px 6px 10px 16px; }
.comment-more { display: grid; place-items: center; width: 36px; height: 32px; margin-top: -4px; color: var(--text-3); }
.comment-more .icon { width: 18px; height: 18px; }
.comment .avatar { width: 30px; height: 30px; }
.comment .meta { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.comment .meta b { font-weight: 700; }
.comment .meta time { color: var(--text-2); font-size: 12px; }
.comment p { margin: 1px 0 0; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.pending { opacity: 0.5; }
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 8px calc(8px + var(--safe-b)) 16px;
  background: var(--bg-blur);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.composer .field { height: 44px; border-radius: 10px; padding: 0 14px; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.composer .send:disabled { opacity: 0.3; }
.composer .send .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.composer .btn { height: 44px; }
.app.has-composer { padding-bottom: calc(76px + var(--safe-b)); }

/* ---------- Notifications ---------- */

.notice { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; }
.notice .avatar { width: 42px; height: 42px; }
.notice .text { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.notice .text b { font-weight: 700; }
.notice .quote { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
.notice time { display: block; font-size: 12px; color: var(--text-2); }
.notice .tile { width: 48px; height: 48px; border-radius: 4px; }
.notice.unread::before { content: ""; position: absolute; left: 5px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--unread); }

/* ---------- Scan ---------- */

.scan { position: fixed; inset: 0; overflow: hidden; background: #000; color: #fff; }
.scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; justify-content: space-between; padding: calc(10px + var(--safe-t)) 12px 0; }
.glass {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
}
.glass[aria-pressed="true"] { background: #fff; color: #111; }
.frame {
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: 2;
  width: min(74vw, 320px);
  aspect-ratio: 1.55;
  transform: translate(-50%, -50%);
  transition: transform 0.25s ease-out;
}
.frame i { position: absolute; width: 30px; height: 30px; border: 3.5px solid #fff; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.35)); }
.frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.frame.hit { transform: translate(-50%, -50%) scale(0.94); }
.frame.hit i { border-color: var(--scan-hit); }
.scan-bottom { position: absolute; left: 16px; bottom: calc(24px + var(--safe-b)); z-index: 3; }
.scan-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 32px; text-align: center; }
.scan-off .icon { width: 44px; height: 44px; stroke-width: 1.4; opacity: 0.7; }
.scan-off .btn { width: 240px; background: #fff; color: #111; }
.scan .sheet { max-height: 64dvh; }

/* Photo mode: the same camera, a square to frame the thing, one shutter. */
.shot-guide { position: absolute; left: 50%; top: 45%; z-index: 2; width: min(84vw, 400px); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; }
.shot-guide i { position: absolute; width: 34px; height: 34px; border: 3px solid #fff; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.35)); }
.shot-guide i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.shot-guide i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.shot-guide i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.shot-guide i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.scan.shooting .frame, .scan.shooting .scan-bottom, .scan.shooting .torch { display: none; }
.shot-thumb { position: absolute; top: calc(10px + var(--safe-t)); right: 12px; z-index: 3; width: 52px; height: 52px; border-radius: 6px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92); }
.shot-thumb img { padding: 6%; }
.shutter { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); z-index: 3; width: 78px; height: 78px; margin-left: -39px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, 0.18); }
.shutter::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; transition: inset 0.12s; }
.shutter:active::after { inset: 9px; }
.flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
.flash.on { animation: shutter-flash 0.36s ease-out; }
@keyframes shutter-flash { from { opacity: 0.85; } to { opacity: 0; } }
.found.with-shot { grid-template-columns: 116px 1fr; }
.found .tile.shot { width: 116px; height: 116px; }
/* Gathering several products: the tray under the camera, and the strip in the post sheet. */
.tray { position: absolute; left: 72px; right: 16px; bottom: calc(24px + var(--safe-b)); z-index: 3; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 10px 0 8px; border-radius: 12px; background: rgba(0, 0, 0, 0.42); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: #fff; }
.tray-items { display: flex; gap: 4px; }
.tray-items .tile { width: 40px; height: 40px; border-radius: 6px; }
.tray-items .tile.arrive { animation: tray-in 0.36s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes tray-in { from { transform: translateY(-120px) scale(2.2); opacity: 0; } }
.tray-count { margin-left: auto; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tray .icon { width: 20px; height: 20px; }
.scan.shooting .tray { display: none; }
.basket { display: flex; gap: 10px; overflow-x: auto; margin: -4px -16px 0; padding: 10px 16px 2px; scrollbar-width: none; }
.basket::-webkit-scrollbar { display: none; }
.basket-item { position: relative; flex: none; }
.basket-item .tile { width: 72px; height: 72px; border-radius: 6px; }
.basket-x { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--text); color: var(--bg); box-shadow: 0 0 0 2px var(--sheet); }
.basket-x .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.basket-sum { display: flex; gap: 8px; align-items: baseline; min-width: 0; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.basket-sum b { flex: none; color: var(--text); font-size: 15px; }
.basket-sum span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.found.with-shot + .basket { margin-top: 6px; }
.row .more-mark { width: 26px; height: 18px; }
.visibility { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; border-bottom: 1px solid var(--line); }
.visibility button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; font-size: 14px; color: var(--text-2); }
.visibility button[aria-pressed="true"] { color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.visibility .icon { width: 18px; height: 18px; }
.photo-state { display: flex; align-items: center; gap: 6px; margin: 8px 16px 0; font-size: 12.5px; color: var(--text-2); }
.photo-state .icon { width: 15px; height: 15px; }

.found { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
.found .tile { width: 76px; height: 76px; border-radius: 6px; }
.found .product-name { font-size: 16px; }
.found .jan { margin-top: 2px; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); letter-spacing: 0.08em; }
.sk-found .tile { background: var(--skeleton); box-shadow: none; }
.sheet .field { margin-top: 16px; }
.sheet .btn-primary { margin-top: 16px; }
.miss { display: grid; justify-items: center; gap: 6px; padding: 6px 0 4px; text-align: center; }
.miss .icon { width: 34px; height: 34px; color: var(--text-3); stroke-width: 1.5; }
.miss p { margin: 4px 0 0; font-size: 15px; }
.miss .jan { font-family: var(--mono); font-size: 12px; color: var(--text-3); letter-spacing: 0.08em; }
.row { display: flex; gap: 8px; margin-top: 16px; }
.row .btn { margin-top: 0; }
.row .btn-line { width: 52px; flex: none; }

/* ---------- Sign-in ---------- */

.hero { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.hero .tile { aspect-ratio: 1; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--bg) 100%); }
.signin { display: grid; justify-items: center; gap: 12px; padding: 4px 28px calc(40px + var(--safe-b)); text-align: center; }
.signin .wordmark { height: 38px; }
.signin .tagline { margin: 2px 0 26px; font-size: 14px; color: var(--text-2); letter-spacing: 0.04em; }
.signin .error { margin: 0 0 8px; font-size: 13px; color: var(--danger); }
.form { padding: 4px 20px 32px; }

/* ---------- Settings ---------- */

.avatar-edit { position: relative; display: block; width: 104px; height: 104px; margin: 8px auto 4px; }
.avatar-edit .avatar { width: 104px; height: 104px; }
.avatar-edit .badge { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 3px var(--bg); }
.avatar-edit .badge svg { width: 17px; height: 13px; fill: currentColor; }
.settings-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Text pages and credits ---------- */

.doc { padding: 8px 20px 24px; font-size: 14.5px; line-height: 1.8; }
.doc h2 { margin: 28px 0 6px; font-size: 15px; }
.doc p, .doc ul { margin: 0 0 10px; color: var(--text); }
.doc ul { padding-left: 1.2em; }
.doc .updated { color: var(--text-2); font-size: 13px; }

.credits { padding: 20px 16px 12px; font-size: 11px; line-height: 1.7; color: var(--text-3); text-align: center; }
.credits p { margin: 0; }
.credits a { color: var(--text-2); }
.credits .credit-rakuten, .credits .credit-affiliate { display: none; }
html[data-rakuten="on"] .credits .credit-rakuten { display: inline; }
html[data-affiliate="on"] .credits .credit-affiliate { display: block; }
.sheet .credits { padding: 10px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Screen changes ---------- */

/* Forward slides in from the right, back slides out to the right, tabs cross-fade; the product photo
   flies between list and detail (view-transition-name: hero, set by the router). */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.3s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
html[data-motion="push"]::view-transition-old(root) { animation-name: vt-leave-left; }
html[data-motion="push"]::view-transition-new(root) { animation-name: vt-enter-right; }
html[data-motion="pop"]::view-transition-old(root) { animation-name: vt-leave-right; }
html[data-motion="pop"]::view-transition-new(root) { animation-name: vt-enter-left; }
html[data-motion="tab"]::view-transition-old(root) { animation: vt-fade-out 0.14s ease-out both; }
html[data-motion="tab"]::view-transition-new(root) { animation: vt-fade-in 0.2s ease-out both; }
::view-transition-group(hero) { animation-duration: 0.36s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-group(tabbar) { animation-duration: 0.28s; }
@keyframes vt-enter-right { from { transform: translateX(32%); opacity: 0; } }
@keyframes vt-leave-left { to { transform: translateX(-12%); opacity: 0; } }
@keyframes vt-enter-left { from { transform: translateX(-12%); opacity: 0; } }
@keyframes vt-leave-right { to { transform: translateX(32%); opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
@keyframes vt-fade-out { to { opacity: 0; } }
/* Browsers without View Transitions still get a soft entrance. */
.view.enter-push { animation: vt-enter-right 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.view.enter-pop { animation: vt-enter-left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.view.enter-tab { animation: vt-fade-in 0.2s ease-out; }

/* ---------- Freshness ---------- */

.ptr { display: grid; place-items: center; height: 0; overflow: hidden; transition: height 0.2s ease-out; }
.ptr.busy { height: 56px; }
.post.arrive { animation: arrive 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes arrive { from { opacity: 0; transform: translateY(-10px); } }
.post.pending .post-photo img { opacity: 0.55; }
.sending { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; }
.post.failed .sending { display: none; }
.post-status { display: flex; align-items: center; gap: 4px; padding: 6px 12px 6px 16px; font-size: 13px; color: var(--danger); }
.post-status span { flex: 1; }
.post-status .btn { width: auto; height: 36px; padding: 0 16px; font-size: 14px; }

