/* QuickTiob 2.0 – uses the TIOB HikaShop design tokens (hk-theme.css); fallbacks keep it working without them */
.qtb-modal, #qtb-toast {
	--q-pri: var(--hk-pri, #4f46e5);
	--q-pri-d: var(--hk-pri-d, #4338ca);
	--q-pri-l: var(--hk-pri-l, #eef2ff);
	--q-pri-b: var(--hk-pri-b, #c7d2fe);
	--q-ok: var(--hk-ok, #10b981);
	--q-ok-d: var(--hk-ok-d, #059669);
	--q-ok-l: var(--hk-ok-l, #ecfdf5);
	--q-bad: var(--hk-bad, #dc2626);
	--q-bad-l: var(--hk-bad-l, #fef2f2);
	--q-warn: var(--hk-warn, #d97706);
	--q-star: var(--hk-star, #f59e0b);
	--q-ink: var(--hk-ink, #0f172a);
	--q-txt: var(--hk-txt, #1f2937);
	--q-txt2: var(--hk-txt2, #475569);
	--q-mut: var(--hk-mut, #64748b);
	--q-line: var(--hk-line, #e5e7eb);
	--q-bg: var(--hk-bg, #f8fafc);
	--q-card: var(--hk-card, #fff);
	--q-r: var(--hk-r, 16px);
	--q-r-sm: var(--hk-r-sm, 10px);
	--q-ease: var(--hk-ease, cubic-bezier(.2, .7, .2, 1));
	--q-ring: var(--hk-ring, 0 0 0 3px rgba(99, 102, 241, .25));
	--q-tap: var(--hk-tap, 44px);
}

html.qtb-lock, html.qtb-lock body { overflow: hidden !important; }

.qtb-modal {
	position: fixed; inset: 0; z-index: 2147483000;
	display: none; align-items: center; justify-content: center;
	padding: 24px; font-family: inherit; line-height: 1.6; color: var(--q-txt);
}
.qtb-modal.is-open { display: flex; }
.qtb-modal *, .qtb-modal *::before, .qtb-modal *::after { box-sizing: border-box; }
.qtb-modal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.qtb-overlay {
	position: absolute; inset: 0;
	background: color-mix(in srgb, var(--q-ink) 62%, transparent);
	backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
	opacity: 0; transition: opacity .22s var(--q-ease);
}
.qtb-modal.is-in .qtb-overlay { opacity: 1; }

.qtb-dialog {
	position: relative; display: flex; flex-direction: column;
	width: min(1060px, 100%); max-height: min(92vh, 860px);
	background: var(--q-card); border-radius: calc(var(--q-r) + 6px);
	box-shadow: 0 30px 80px rgba(15, 23, 42, .28), 0 6px 18px rgba(15, 23, 42, .08);
	overflow: hidden; outline: none;
	opacity: 0; transform: translateY(18px) scale(.98);
	transition: opacity .22s var(--q-ease), transform .26s var(--q-ease);
}
.qtb-modal.is-in .qtb-dialog { opacity: 1; transform: none; }

/* top bar */
.qtb-bar {
	position: absolute; top: 0; inset-inline: 0; z-index: 6;
	display: flex; align-items: center; justify-content: space-between;
	gap: 8px; padding: 12px 14px; pointer-events: none;
}
.qtb-bar > * { pointer-events: auto; }
.qtb-handle { display: none; }
.qtb-nav {
	display: flex; align-items: center; gap: 2px;
	background: color-mix(in srgb, var(--q-card) 88%, transparent);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	border: 1px solid var(--q-line); border-radius: 999px; padding: 3px;
	box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}
.qtb-nav[hidden] { display: none; }
.qtb-pos { min-width: 54px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--q-mut); }
.qtb-navbtn, .qtb-close {
	display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; border: 0; border-radius: 999px;
	background: transparent; color: var(--q-ink); cursor: pointer; padding: 0;
	transition: background .18s var(--q-ease), color .18s var(--q-ease), transform .18s var(--q-ease);
}
.qtb-navbtn:hover:not(:disabled) { background: var(--q-pri-l); color: var(--q-pri); }
.qtb-navbtn:disabled { opacity: .3; cursor: default; }
.qtb-close {
	width: 40px; height: 40px; margin-inline-start: auto;
	background: color-mix(in srgb, var(--q-card) 88%, transparent);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	border: 1px solid var(--q-line); box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}
.qtb-close:hover { background: var(--q-bad); border-color: var(--q-bad); color: #fff; transform: rotate(90deg); }
.qtb-modal :focus-visible { outline: 2px solid var(--q-pri); outline-offset: 2px; }

.qtb-body { overflow: auto; overscroll-behavior: contain; min-height: 320px; scrollbar-width: thin; }

/* product */
.qtb { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); min-height: 540px; direction: rtl; }

.qtb-media {
	display: flex; flex-direction: column; gap: 12px;
	padding: 64px 22px 22px; background: var(--q-bg);
	border-inline-end: 1px solid var(--q-line);
}
.qtb-stage {
	position: relative; flex: 1; min-height: 340px; aspect-ratio: 1 / 1; max-height: 520px;
	display: flex; align-items: center; justify-content: center;
	background: var(--q-card); border-radius: var(--q-r); overflow: hidden;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px rgba(15, 23, 42, .05);
}
.qtb-img {
	position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
	padding: 18px; opacity: 0; transform: scale(.985);
	transition: opacity .3s var(--q-ease), transform .5s var(--q-ease);
}
.qtb-img.is-on { opacity: 1; transform: none; }
.qtb-stage:hover .qtb-img.is-on { transform: scale(1.03); }
.qtb-noimg { color: var(--q-line); }
.qtb-noimg svg { width: 72px; height: 72px; stroke-width: 1.2; }

.qtb-badges { position: absolute; top: 14px; inset-inline-start: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; z-index: 2; }
.qtb-badge { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; box-shadow: 0 4px 12px rgba(15, 23, 42, .12); }
.qtb-badge--off { background: var(--q-bad); }
.qtb-badge--free { background: var(--q-ok); }
.qtb-badge--new { background: var(--q-pri); }

.qtb-sl {
	position: absolute; top: 50%; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
	width: 38px; height: 38px; margin-top: -19px; padding: 0; border: 1px solid var(--q-line); border-radius: 999px;
	background: color-mix(in srgb, var(--q-card) 92%, transparent); color: var(--q-ink); cursor: pointer;
	opacity: 0; transition: opacity .2s var(--q-ease), background .18s var(--q-ease);
}
.qtb-sl--prev { right: 12px; transform: scaleX(-1); }
.qtb-sl--next { left: 12px; }
.qtb-stage:hover .qtb-sl, .qtb-sl:focus-visible { opacity: 1; }
.qtb-sl:hover { background: var(--q-pri); border-color: var(--q-pri); color: #fff; }
.qtb-counter { position: absolute; bottom: 12px; left: 12px; z-index: 2; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--q-ink) 70%, transparent); color: #fff; font-size: 12px; }
.qtb-counter b { font-weight: 700; }

.qtb-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.qtb-thumbs::-webkit-scrollbar { display: none; }
.qtb-thumb {
	flex: none; width: 64px; height: 64px; padding: 4px; border: 2px solid transparent; border-radius: var(--q-r-sm);
	background: var(--q-card); cursor: pointer; transition: border-color .18s var(--q-ease), transform .18s var(--q-ease);
	box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.qtb-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.qtb-thumb:hover { transform: translateY(-2px); }
.qtb-thumb.is-on { border-color: var(--q-pri); }

.qtb-info { display: flex; flex-direction: column; gap: 14px; padding: 64px 30px 26px; min-width: 0; }
.qtb-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--q-mut); }
.qtb-cat { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--q-pri-l); color: var(--q-pri); font-weight: 600; }
.qtb-cat svg { width: 14px; height: 14px; }
.qtb-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.qtb-title { margin: 0; font-size: clamp(19px, 2.2vw, 25px); line-height: 1.45; font-weight: 800; color: var(--q-ink); letter-spacing: -.2px; }

.qtb-rating { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--q-txt2); }
.qtb-rating b { color: var(--q-ink); }
.qtb-stars {
	--qtb-fill: 0%;
	position: relative; display: inline-block; font-size: 16px; letter-spacing: 2px; line-height: 1;
	color: var(--q-line); direction: rtl;
}
.qtb-stars::before { content: "★★★★★"; }
.qtb-stars::after { content: "★★★★★"; position: absolute; inset: 0 0 0 auto; width: var(--qtb-fill); overflow: hidden; color: var(--q-star); white-space: nowrap; }
.qtb-votes { color: var(--q-mut); font-size: 12.5px; }

.qtb-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.qtb-spec {
	display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center;
	padding: 9px 11px; border: 1px solid var(--q-line); border-radius: var(--q-r-sm); background: var(--q-card); min-width: 0;
	transition: border-color .18s var(--q-ease), background .18s var(--q-ease);
}
.qtb-spec:hover { border-color: var(--q-pri-b); background: var(--q-pri-l); }
.qtb-spec__ic { grid-row: 1 / 3; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--q-pri-l); color: var(--q-pri); }
.qtb-spec__ic svg { width: 18px; height: 18px; }
.qtb-spec dt { margin: 0; font-size: 11.5px; color: var(--q-mut); line-height: 1.4; }
.qtb-spec dd { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--q-ink); line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.qtb-desc { margin: 0; font-size: 14px; line-height: 1.95; color: var(--q-txt2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.qtb-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--q-mut); }
.qtb-meta span { display: inline-flex; align-items: center; gap: 5px; }
.qtb-meta svg { width: 15px; height: 15px; }

.qtb-buy { margin-top: auto; padding: 16px; border: 1px solid var(--q-line); border-radius: var(--q-r); background: var(--q-bg); display: flex; flex-direction: column; gap: 12px; }
.qtb-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.qtb-price__old { color: var(--q-mut); font-size: 13.5px; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--q-bad) 70%, transparent); }
.qtb-price__now { font-size: 24px; font-weight: 800; color: var(--q-ink); line-height: 1.3; }
.qtb-price__now.is-free { color: var(--q-ok-d); }
.qtb-price__save { padding: 2px 9px; border-radius: 999px; background: var(--q-bad-l); color: var(--q-bad); font-size: 12px; font-weight: 700; }

.qtb-actions { display: flex; gap: 8px; }
.qtb-btn {
	flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 18px; border: 0; border-radius: var(--q-r-sm);
	background: var(--q-ok); color: #fff; font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer;
	box-shadow: 0 8px 20px color-mix(in srgb, var(--q-ok) 28%, transparent);
	transition: background .18s var(--q-ease), transform .12s var(--q-ease), box-shadow .18s var(--q-ease);
}
.qtb-btn:hover { background: var(--q-ok-d); color: #fff; transform: translateY(-1px); }
.qtb-btn:active { transform: translateY(0); }
.qtb-btn.is-active { background: var(--q-ok-l); color: var(--q-ok-d); box-shadow: inset 0 0 0 1.5px var(--q-ok); }
.qtb-btn.is-active:hover { background: var(--q-bad-l); color: var(--q-bad); box-shadow: inset 0 0 0 1.5px var(--q-bad); }
.qtb-icon-btn {
	flex: none; display: inline-flex; align-items: center; justify-content: center;
	width: 48px; height: 48px; padding: 0; border: 1px solid var(--q-line); border-radius: var(--q-r-sm);
	background: var(--q-card); color: var(--q-txt2); cursor: pointer;
	transition: color .18s var(--q-ease), border-color .18s var(--q-ease), background .18s var(--q-ease), transform .12s var(--q-ease);
}
.qtb-icon-btn:hover { color: var(--q-pri); border-color: var(--q-pri-b); background: var(--q-pri-l); }
.qtb-btn--wish.is-active { color: var(--q-bad); border-color: color-mix(in srgb, var(--q-bad) 35%, transparent); background: var(--q-bad-l); }
.qtb-btn--wish.is-active svg { fill: currentColor; }
.qtb-btn--share.is-active { color: var(--q-ok-d); border-color: var(--q-ok); background: var(--q-ok-l); }
.qtb-btn.is-loading, .qtb-icon-btn.is-loading { pointer-events: none; opacity: .75; }
.qtb-btn.is-loading svg, .qtb-icon-btn.is-loading svg { animation: qtbSpin .8s linear infinite; }
@keyframes qtbSpin { to { transform: rotate(360deg); } }

.qtb-after { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; font-size: 12.5px; color: var(--q-mut); }
.qtb-after[hidden] { display: none; }
.qtb-checkout { color: var(--q-pri); font-weight: 700; text-decoration: none; }
.qtb-checkout:hover { color: var(--q-pri-d); text-decoration: underline; }

.qtb-more {
	display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--q-tap);
	border: 1.5px solid var(--q-pri-b); border-radius: var(--q-r-sm); color: var(--q-pri); font-weight: 700; font-size: 14px;
	text-decoration: none; transition: background .18s var(--q-ease), color .18s var(--q-ease), border-color .18s var(--q-ease);
}
.qtb-more svg { width: 18px; height: 18px; transition: transform .18s var(--q-ease); }
.qtb-more:hover { background: var(--q-pri); border-color: var(--q-pri); color: #fff; }
.qtb-more:hover svg { transform: translateX(-3px); }

/* skeleton + messages */
.qtb--skel .qtb-info { gap: 12px; }
.qtb-sk { display: block; height: 14px; width: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--q-line) 25%, var(--q-bg) 50%, var(--q-line) 75%); background-size: 200% 100%; animation: qtbSk 1.2s linear infinite; }
.qtb-sk--img { position: absolute; inset: 18px; width: auto; height: auto; border-radius: var(--q-r-sm); }
.qtb-sk--h { height: 26px; width: 85%; }
.qtb-sk--btn { height: 48px; margin-top: auto; }
.qtb-sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qtb-sk-grid .qtb-sk { height: 52px; }
@keyframes qtbSk { to { background-position: -200% 0; } }

.qtb-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; padding: 40px 24px; text-align: center; color: var(--q-txt2); font-size: 15px; }
.qtb-msg__ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 999px; background: var(--q-bad-l); color: var(--q-bad); font-weight: 800; font-size: 22px; }
.qtb-retry { min-height: 40px; padding: 0 18px; border: 1px solid var(--q-pri-b); border-radius: var(--q-r-sm); background: var(--q-pri-l); color: var(--q-pri); font: inherit; font-weight: 700; cursor: pointer; }

/* toast */
#qtb-toast {
	position: fixed; bottom: 24px; left: 50%; z-index: 2147483600;
	display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px);
	padding: 12px 18px; border-radius: 12px; background: var(--q-ink); color: #fff;
	font-size: 14px; font-weight: 600; line-height: 1.6; box-shadow: 0 14px 34px rgba(15, 23, 42, .25);
	opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
	transition: opacity .22s var(--q-ease), transform .22s var(--q-ease);
}
#qtb-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#qtb-toast.is-success { background: var(--q-ok-d); }
#qtb-toast.is-error { background: var(--q-bad); }
#qtb-toast a { color: #fff; font-weight: 800; text-decoration: underline; white-space: nowrap; }

/* tablet */
@media (max-width: 900px) {
	.qtb-info { padding: 60px 22px 22px; }
	.qtb-media { padding: 60px 16px 16px; }
	.qtb-specs { grid-template-columns: minmax(0, 1fr); }
}

/* mobile: bottom sheet */
@media (max-width: 700px) {
	.qtb-modal { padding: 0; align-items: flex-end; }
	.qtb-dialog { width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 22px 22px 0 0; transform: translateY(40px); }
	.qtb-modal.is-in .qtb-dialog { transform: none; }
	.qtb-bar { position: sticky; padding: 18px 12px 8px; background: var(--q-card); border-bottom: 1px solid var(--q-line); pointer-events: auto; touch-action: none; }
	.qtb-handle { display: block; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 999px; background: var(--q-line); }
	.qtb-nav, .qtb-close { box-shadow: none; }
	.qtb-body { min-height: 0; }
	.qtb { grid-template-columns: minmax(0, 1fr); min-height: 0; }
	.qtb-media { padding: 12px 12px 4px; border: 0; background: var(--q-card); }
	.qtb-stage { min-height: 0; aspect-ratio: 4 / 3; background: var(--q-bg); box-shadow: none; }
	.qtb-sl { opacity: 1; width: 34px; height: 34px; margin-top: -17px; }
	.qtb-thumb { width: 54px; height: 54px; }
	.qtb-info { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); gap: 12px; }
	.qtb-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.qtb-spec { grid-template-columns: minmax(0, 1fr); padding: 8px 10px; }
	.qtb-spec__ic { display: none; }
	.qtb-desc { -webkit-line-clamp: 3; font-size: 13.5px; }
	.qtb-buy { position: sticky; bottom: 0; z-index: 3; margin: 4px -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; border-width: 1px 0 0; background: var(--q-card); box-shadow: 0 -8px 20px rgba(15, 23, 42, .06); }
	.qtb-price__now { font-size: 20px; }
	.qtb-buy { order: 10; }
	.qtb-more { min-height: 42px; font-size: 13.5px; }
	.qtb-stage:hover .qtb-img.is-on { transform: none; }
	#qtb-toast { bottom: auto; top: calc(12px + env(safe-area-inset-top)); transform: translate(-50%, -16px); }
	#qtb-toast.is-on { transform: translate(-50%, 0); }
}

@media (max-width: 380px) {
	.qtb-specs { grid-template-columns: minmax(0, 1fr); }
	.qtb-btn { font-size: 14px; padding: 0 12px; }
}

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