:root {
  --primary: #0f766e; --primary-d: #0b5a54; --accent: #f59e0b; --danger: #dc2626;
  --bg: #f6f7f8; --card: #ffffff; --text: #17212b; --muted: #6b7785; --line: #e5e8eb;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
}
a { color: var(--primary); text-decoration: none; }
img, video { max-width: 100%; display: block; }
h1 { font-size: 1.45rem; margin: 18px 0 10px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
h3 { font-size: .95rem; margin: 0; font-weight: 600; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 14px 24px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.warn { color: var(--danger); font-size: .9rem; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--primary); color: #fff;
}
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.search { flex: 1; }
.search input {
  width: 100%; border: 0; border-radius: 999px; padding: 9px 14px; font-size: .95rem;
}
.cart-link { position: relative; color: #fff; font-size: 1.5rem; line-height: 1; }
.badge {
  position: absolute; top: -6px; right: -10px; background: var(--accent); color: #111;
  font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 6px;
}

.live-banner {
  display: block; background: var(--danger); color: #fff; text-align: center;
  padding: 8px 12px; font-weight: 600; font-size: .92rem;
}
.dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; margin-right: 4px; animation: pulse 1.2s infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

.messages { max-width: 1000px; margin: 10px auto 0; padding: 0 14px; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; background: #e0f2f1; }
.msg.error { background: #fee2e2; color: #7f1d1d; }
.msg.success { background: #dcfce7; color: #14532d; }

.btn {
  display: inline-block; border: 0; cursor: pointer; background: var(--primary); color: #fff;
  padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 1rem; text-align: center;
}
.btn:hover { background: var(--primary-d); }
.btn[disabled] { background: #9aa5b1; cursor: not-allowed; }
.btn.block { display: block; width: 100%; margin: 14px 0; }
.btn.small { padding: 8px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

.hero {
  margin-top: 14px; padding: 22px 18px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--primary), #115e59 60%, #134e4a);
}
.hero h1 { margin-top: 0; }
.hero .btn { background: var(--accent); color: #111; }

.livecard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0;
}
.livecard h2 { margin: 6px 0; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e0f2f1; color: var(--primary-d); }
.pill.red { background: #fee2e2; color: var(--danger); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.chip {
  white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); color: var(--text); font-size: .9rem;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; color: var(--text); border: 1px solid var(--line); display: block; }
.card-img { position: relative; aspect-ratio: 1; background: #eef1f3; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 10px 12px 12px; }
.price { margin: 4px 0 0; font-weight: 700; color: var(--primary-d); }
.price.big { font-size: 1.5rem; }
.ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 2.4rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #14b8a6, #0f766e); }
.ph.big { min-height: 260px; font-size: 5rem; border-radius: var(--radius); }
.tag.out { position: absolute; top: 8px; left: 8px; background: #111; color: #fff; font-size: .72rem; padding: 3px 8px; border-radius: 999px; }

.detail { display: grid; gap: 16px; margin-top: 14px; }
@media (min-width: 760px) { .detail { grid-template-columns: 1fr 1fr; } }
.detail-img img { width: 100%; border-radius: var(--radius); }
.options { display: grid; gap: 8px; margin: 14px 0; }
.opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.opt span { flex: 1; }
.opt.disabled { opacity: .5; }
.opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15, 118, 110, .2); }
.buyrow { display: flex; gap: 10px; }
.buyrow input { width: 76px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 1rem; }
.buyrow .btn { flex: 1; }

.cart { display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.line.bad { border-color: var(--danger); }
.line .thumb { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; }
.line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.line .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.line .info small { color: var(--muted); }
.line .info small.warn { color: var(--danger); }
.line .qty { display: flex; gap: 6px; }
.line .qty input { width: 58px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.line .lt { grid-column: 2 / 4; text-align: right; font-weight: 700; }

.totals { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 1.1rem; }

.form .field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form label { font-weight: 600; font-size: .9rem; }
.form input, .form select, .form textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: #fff;
}

.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; margin-top: 14px; aspect-ratio: 16 / 9; }
.player video { width: 100%; height: 100%; background: #000; }
.live-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #fff; background: rgba(0, 0, 0, .65); pointer-events: none; }

.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.hscroll .vcard { flex: 0 0 160px; }
.vgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .vgrid { grid-template-columns: repeat(4, 1fr); } }
.vcard { color: var(--text); display: block; }
.vthumb { position: relative; aspect-ratio: 9 / 16; background: #111; border-radius: var(--radius); overflow: hidden; margin-bottom: 6px; }
.vthumb img, .vthumb video { width: 100%; height: 100%; object-fit: cover; }
.play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); }

.rowlink { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
.rowlink span { color: var(--muted); font-size: .9rem; }
.pager { display: flex; align-items: center; justify-content: space-between; margin: 18px 0; gap: 8px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 2px; font-size: 1.15rem; color: var(--text); }
.tabbar a span { font-size: .68rem; color: var(--muted); }
@media (min-width: 900px) { body { padding-bottom: 0; } .tabbar { display: none; } }
