:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #2f7cf6);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg2); color: var(--text); font: 16px/1.35 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; }

header#top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
#clubs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; }
#clubs::-webkit-scrollbar { display: none; }
.pill { flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 9px 16px; min-height: 40px; }
.pill.on { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
#banner { padding: 8px 14px; font-size: 14px; background: var(--bg2); color: var(--hint); }
#banner.closed { background: #fdecea; color: #b3261e; }
#banner.open { color: #1b7f3b; }

#grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 12px calc(86px + var(--safe-b)); }
.card { background: var(--bg); border-radius: var(--radius); overflow: hidden; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; }
.card .ph { aspect-ratio: 1 / 1; background: #fff center / contain no-repeat; border-bottom: 1px solid var(--line); }
.card .meta { padding: 10px 12px 12px; }
.card .t { font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card .p { margin-top: 6px; font-weight: 700; }
@media (min-width: 640px) { #grid { grid-template-columns: repeat(3, 1fr); max-width: 900px; margin: 0 auto; } }

#cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 10px 12px calc(10px + var(--safe-b)); background: linear-gradient(transparent, var(--bg2) 40%); }
.btn { width: 100%; min-height: 50px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 16px; padding: 0 16px; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--bg2); color: var(--text); }
.btn.small { min-height: 40px; width: auto; padding: 0 14px; }

.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 94vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .2s; }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sheet header h2 { margin: 0; font-size: 18px; }
.x { border: 0; background: var(--bg2); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }
.sheet .body { overflow-y: auto; padding: 8px 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet footer { padding: 10px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery .g { flex: 0 0 86%; scroll-snap-align: center; aspect-ratio: 1 / 1; border-radius: var(--radius); background: var(--bg2) center / contain no-repeat; }
.gallery.single .g { flex-basis: 100%; }
.price { font-size: 22px; font-weight: 700; margin: 12px 0 4px; }
.desc { color: var(--hint); font-size: 14px; white-space: pre-line; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link { background: none; border: 0; color: var(--accent); padding: 4px 0; font-size: 14px; }
.opt { margin-top: 16px; }
.opt h3 { margin: 0 0 8px; font-size: 14px; color: var(--hint); font-weight: 500; }
.opt h4 { margin: 10px 0 6px; font-size: 13px; color: var(--hint); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; min-height: 42px; padding: 8px 14px; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.chip small { opacity: .7; margin-left: 4px; }
input[type=text], textarea { width: 100%; border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 12px; padding: 12px; font: inherit; }
textarea { resize: none; min-height: 72px; }
.qty { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.qty button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); font-size: 20px; }
.qty b { min-width: 24px; text-align: center; font-size: 18px; }

.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line .ph { width: 56px; height: 56px; border-radius: 10px; background: #fff center / contain no-repeat; border: 1px solid var(--line); }
.line .t { font-size: 14px; }
.line .o { font-size: 12px; color: var(--hint); margin-top: 2px; }
.line .r { text-align: right; font-weight: 600; white-space: nowrap; }
.line .mini { display: inline-flex; gap: 8px; align-items: center; margin-top: 6px; }
.line .mini button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); }
.sum { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; padding: 14px 0 6px; }
.field { margin-top: 12px; }
.field label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 6px; }
.note { font-size: 13px; color: var(--hint); margin-top: 10px; }
.ok { text-align: center; padding: 20px 6px; }
.ok .big { font-size: 44px; }
.pay { background: var(--bg2); border-radius: var(--radius); padding: 12px 14px; margin: 14px 0; text-align: left; white-space: pre-line; }
.err { color: #b3261e; font-size: 14px; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 20; font-size: 14px; }
.zoom { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; align-items: center; justify-content: center; }
.zoom img { max-width: 100%; max-height: 100%; touch-action: pinch-zoom; }

/* ---- admin ---- */
select { width: 100%; border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 12px; padding: 12px; font: inherit; }
.agroup { margin-top: 18px; }
.agroup h3 { margin: 0 0 8px; font-size: 15px; }
.arow { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.arow input[type=text] { flex: 1; min-width: 0; }
.aitem { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: var(--bg2); border-radius: var(--radius); padding: 8px; margin-bottom: 8px; text-align: left; }
.aitem .ph { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 10px; background: #fff center / contain no-repeat; border: 1px solid var(--line); }
.aitem .grow { flex: 1; min-width: 0; }
.aitem .t { font-size: 14px; }
.aitem .o { font-size: 12px; color: var(--hint); margin-top: 2px; }
.aitem .chev { font-size: 22px; color: var(--hint); padding: 0 6px; }
.chk { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 15px; }
.chk input { width: 22px; height: 22px; }
.sec { margin: 22px 0 6px; font-size: 15px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.tile .pic { position: absolute; inset: 0; background: #fff center / contain no-repeat; }
.tile .main, .tile .num { position: absolute; top: 4px; left: 4px; font-size: 11px; background: rgba(0, 0, 0, .6); color: #fff; padding: 2px 6px; border-radius: 8px; }
.tile .tb { position: absolute; left: 0; right: 0; bottom: 0; display: flex; background: rgba(0, 0, 0, .55); }
.tile .tb button { flex: 1; border: 0; background: none; color: #fff; padding: 8px 0; font-size: 14px; }
.tile.add { display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 600; border-style: dashed; cursor: pointer; }
.optbox { background: var(--bg2); border-radius: var(--radius); padding: 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.optbox textarea, .optbox input[type=text], .optbox select { background: var(--bg); }
