/* ===== MedSim — Frontend styles =====
   ปรับสีแบรนด์ได้ที่ตัวแปรใน :root */
:root {
  --navy-900: #071e3a;
  --navy-800: #0b2a4a;
  --blue-700: #0f4c9c;
  --blue-600: #1463b8;
  --blue-100: #e3effc;
  --teal-500: #14b8c4;
  --teal-600: #0e98a3;
  --teal-100: #dff6f8;
  --ink: #14233a;
  --muted: #5a6b82;
  --line: #dde6f0;
  --bg: #f5f9fd;
  --white: #fff;
  --ok: #178a55;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(11, 42, 74, .08);
  --shadow-lg: 0 16px 40px rgba(11, 42, 74, .14);
  --font: 'Prompt', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--white); line-height: 1.65; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--teal-600); }
h1, h2, h3, h4 { line-height: 1.3; color: var(--navy-800); margin: 0 0 .5em; font-weight: 600; }
p { margin: 0 0 1em; }
.container { width: min(1180px, 100% - 40px); margin-inline: auto; }
.section { padding: 72px 0; }
.section.alt { background: var(--bg); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0; }
.eyebrow { color: var(--teal-600); font-weight: 600; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; display: block; margin-bottom: 6px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
:focus-visible { outline: 3px solid var(--teal-500); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy-800); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; border: 2px solid transparent;
  font: 500 1rem var(--font); cursor: pointer; transition: transform .15s, background .2s, box-shadow .2s; text-decoration: none; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--blue-600), var(--teal-500)); color: #fff; box-shadow: 0 6px 18px rgba(20, 99, 184, .3); }
.btn-primary:hover { color: #fff; box-shadow: 0 10px 24px rgba(20, 99, 184, .38); }
.btn-outline { border-color: var(--blue-600); color: var(--blue-600); background: transparent; }
.btn-outline:hover { background: var(--blue-100); }
.btn-light { background: #fff; color: var(--navy-800); }
.btn-light:hover { color: var(--blue-600); }
.btn-ghost-light { border-color: rgba(255,255,255,.6); color: #fff; }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

/* Header */
.topbar { background: var(--navy-900); color: #cfe0f3; font-size: .85rem; }
.topbar .container { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; flex-wrap: wrap; }
.topbar a { color: #cfe0f3; }
.topbar a:hover { color: #fff; }
.header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header .container { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy-800); font-weight: 700; font-size: 1.25rem; }
.brand:hover { color: var(--navy-800); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--blue-700), var(--teal-500)); display: grid; place-items: center; color: #fff; }
.brand.has-logo { gap: 0; }
.brand-logo { height: 46px; width: auto; display: block; }
.footer .brand-logo { height: 42px; background: #fff; padding: 8px 14px; border-radius: 10px; }
@media (max-width: 640px) { .brand-logo { height: 36px; } }
.brand small { display: block; font-weight: 400; font-size: .7rem; color: var(--muted); margin-top: -4px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink); padding: 8px 14px; border-radius: 999px; font-weight: 500; }
.nav a:hover, .nav a.active { background: var(--blue-100); color: var(--blue-600); }
.nav-tools { display: flex; align-items: center; gap: 10px; }
.lang { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: 500 .85rem var(--font); cursor: pointer; color: var(--muted); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .nav { position: absolute; top: 72px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 12px 20px 20px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; }
  .header .btn-quote { display: none; }
}

/* Hero */
.hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(1200px 500px at 85% -10%, rgba(20,184,196,.45), transparent 60%), linear-gradient(135deg, var(--navy-900), var(--blue-700)); }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 84px 0 96px; position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.3rem); letter-spacing: -.01em; }
.hero h1 em { font-style: normal; color: #7ff0f7; }
.hero p { color: #d3e4f7; font-size: 1.15rem; max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-art { position: relative; aspect-ratio: 1; max-width: 460px; margin-inline: auto; width: 100%; }
.hero-art svg { width: 100%; height: 100%; }
.hero-badge { position: absolute; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(8px); padding: 10px 16px; border-radius: 14px; font-size: .9rem; }
.hero-badge b { display: block; font-size: 1.4rem; color: #7ff0f7; }
.hero::after { content: ''; position: absolute; inset: auto 0 0 0; height: 40px; background: linear-gradient(to top, #fff, transparent); opacity: .0; }
@media (max-width: 900px) { .hero .container { grid-template-columns: 1fr; padding: 56px 0 64px; } .hero-art { max-width: 320px; } }

/* Feature grid */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; transition: box-shadow .2s, transform .2s; }
.feature:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.feature .ico { width: 52px; height: 52px; border-radius: 14px; background: var(--teal-100); color: var(--teal-600); display: grid; place-items: center; font-size: 1.5rem; margin-bottom: 14px; }
.feature h3 { font-size: 1.1rem; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Supplier logos */
.section-sub { color: var(--muted); margin: 8px 0 0; }
.supplier-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.supplier-logo { display: flex; align-items: center; justify-content: center; height: 96px; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
.supplier-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (hover: hover) {
  .supplier-logo:hover { border-color: var(--teal-500); box-shadow: var(--shadow); }
}
@media (max-width: 900px) { .supplier-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .supplier-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .supplier-logo { height: 72px; padding: 10px; } }

/* Category tiles */
.cat-tile { position: relative; display: block; border-radius: var(--radius); padding: 26px; color: #fff; overflow: hidden; min-height: 170px;
  background: linear-gradient(140deg, var(--blue-700), var(--navy-800)); transition: transform .2s, box-shadow .2s; }
.cat-tile:nth-child(2n) { background: linear-gradient(140deg, var(--teal-600), var(--blue-700)); }
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: #fff; }
.cat-tile .emoji { font-size: 2.2rem; display: block; margin-bottom: 10px; }
.cat-tile h3 { color: #fff; font-size: 1.1rem; margin-bottom: 4px; }
.cat-tile p { color: rgba(255,255,255,.82); font-size: .88rem; margin: 0; }

/* Product cards */
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.pcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.pcard-img { aspect-ratio: 4/3; background: linear-gradient(135deg, var(--blue-100), var(--teal-100)); display: grid; place-items: center; font-size: 3rem; overflow: hidden; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tag { display: inline-block; background: var(--teal-100); color: var(--teal-600); border-radius: 999px; padding: 2px 12px; font-size: .78rem; font-weight: 500; align-self: flex-start; }
.pcard h3 { font-size: 1.05rem; margin: 4px 0 0; }
.pcard h3 a { color: var(--navy-800); }
.pcard p { color: var(--muted); font-size: .92rem; margin: 0; flex: 1; }
.pcard-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Filter bar */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 28px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 8px 18px; font: 500 .92rem var(--font); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--teal-500); }
.chip.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.search { border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; font: 1rem var(--font); min-width: 240px; background: #fff; }

/* Page hero */
.page-hero { background: linear-gradient(135deg, var(--navy-900), var(--blue-700)); color: #fff; padding: 52px 0; }
.page-hero h1 { color: #fff; margin: 0 0 6px; font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.page-hero p { color: #cfe0f3; margin: 0; }
.crumbs { font-size: .88rem; color: #a9c4e2; margin-bottom: 10px; }
.crumbs a { color: #cfe0f3; }

/* Product detail */
.detail { display: grid; grid-template-columns: 1.05fr 1fr; gap: 44px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.gallery-main { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, var(--blue-100), var(--teal-100)); display: grid; place-items: center; font-size: 5rem; border: 1px solid var(--line); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumbs button { width: 76px; height: 60px; border: 2px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; background: #fff; }
.thumbs button.active { border-color: var(--teal-500); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.spec-table { width: 100%; border-collapse: collapse; margin: 8px 0 24px; }
.spec-table th, .spec-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table th { width: 38%; color: var(--muted); font-weight: 500; background: var(--bg); }
.video-wrap { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; margin-top: 8px; }
.video-wrap iframe { width: 100%; height: 100%; border: 0; }
.prose { max-width: 72ch; white-space: pre-line; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }

/* Forms */
.form { display: grid; gap: 16px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form .row { grid-template-columns: 1fr; } }
label { font-weight: 500; font-size: .92rem; display: grid; gap: 6px; }
input, select, textarea { font: 1rem var(--font); padding: 12px 14px; border: 1px solid #c8d6e6; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(20,184,196,.35); border-color: var(--teal-500); }
textarea { min-height: 130px; resize: vertical; }
.hp { position: absolute; left: -9999px; }
.notice { padding: 12px 16px; border-radius: 10px; font-size: .95rem; }
.notice.ok { background: #e4f6ec; color: #0e6b40; }
.notice.err { background: #fdecec; color: #a12626; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.info-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 14px; }
.info-list li { display: flex; gap: 14px; align-items: start; }
.info-list .ico { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--teal-100); display: grid; place-items: center; }
.map { border: 0; width: 100%; height: 300px; border-radius: var(--radius); }

/* News */
.news-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.news-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.news-cover { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--teal-100), var(--blue-100)); display: grid; place-items: center; font-size: 2.4rem; }
.news-cover img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 18px 20px 22px; }
.news-meta { font-size: .82rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 10px; }
.news-body h3 { font-size: 1.05rem; }
.news-body h3 a { color: var(--navy-800); }
.news-body p { color: var(--muted); font-size: .92rem; margin: 0; }

/* CTA band */
.cta-band { background: linear-gradient(135deg, var(--blue-700), var(--teal-600)); color: #fff; border-radius: 22px; padding: 44px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 4px; }
.cta-band p { color: #e0f4f6; margin: 0; }

/* Stats / timeline */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
.stat { text-align: center; padding: 22px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.stat b { display: block; font-size: 2rem; color: var(--blue-600); }
.stat span { color: var(--muted); font-size: .9rem; }
.timeline { border-left: 3px solid var(--teal-500); padding-left: 24px; display: grid; gap: 22px; max-width: 720px; }
.timeline div { position: relative; }
.timeline div::before { content: ''; position: absolute; left: -33px; top: 7px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--teal-500); }
.timeline b { color: var(--blue-600); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Footer */
.footer { background: var(--navy-900); color: #b9cde4; padding: 56px 0 0; margin-top: 0; }
.footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 36px; padding-bottom: 36px; }
@media (max-width: 900px) { .footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer .cols { grid-template-columns: 1fr; } }
.footer h4 { color: #fff; font-size: 1rem; }
.footer a { color: #b9cde4; display: block; padding: 3px 0; }
.footer a:hover { color: #7ff0f7; }
.footer .brand { color: #fff; margin-bottom: 12px; }
.footer .copy { border-top: 1px solid rgba(255,255,255,.12); padding: 18px 0; font-size: .85rem; text-align: center; }
.admin-link { opacity: .55; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; grid-column: 1/-1; }
.skeleton { background: linear-gradient(90deg, #eef3f9 25%, #e1eaf4 37%, #eef3f9 63%); background-size: 400% 100%; animation: sk 1.4s infinite; border-radius: var(--radius); min-height: 280px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* =====================================================================
   INTERACTIVE FEATURES
   ===================================================================== */

/* ---- Scroll reveal (ซ่อนเฉพาะเมื่อ JS ทำงาน และผู้ใช้ไม่ปิดแอนิเมชัน) ---- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2,.7,.2,1) var(--d, 0ms), transform .7s cubic-bezier(.2,.7,.2,1) var(--d, 0ms); will-change: opacity, transform; }
.js .reveal[data-reveal="left"] { transform: translateX(-34px); }
.js .reveal[data-reveal="right"] { transform: translateX(34px); }
.js .reveal[data-reveal="zoom"] { transform: scale(.94); }
.js .reveal.in { opacity: 1; transform: none; }
/* การ์ดที่มี hover transform ของตัวเอง ให้คืนค่าเมื่อเสร็จ reveal */
.js .reveal.in.pcard:hover, .js .reveal.in.feature:hover, .js .reveal.in.news-card:hover, .js .reveal.in.cat-tile:hover { transform: translateY(-3px); transition-delay: 0ms; }

/* ---- Hero extras ---- */
.hero::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px); background-size: 26px 26px; mask-image: linear-gradient(to bottom, #000 30%, transparent); pointer-events: none; }
.hero-art .pulse { transform-origin: 200px 200px; animation: pulse 3.2s ease-out infinite; }
.hero-art .pulse.p2 { animation-delay: 1.6s; }
@keyframes pulse { 0% { transform: scale(.55); opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }
.hero-art .ecg-line { stroke-dasharray: 480; stroke-dashoffset: 480; animation: ecg 3.6s linear infinite; }
@keyframes ecg { 0% { stroke-dashoffset: 480; } 55%, 100% { stroke-dashoffset: 0; } }
.hero-badge { animation: floaty 5s ease-in-out infinite; }
.hero-badge:nth-of-type(2) { animation-delay: -2.4s; }
@keyframes floaty { 50% { transform: translateY(-9px); } }

/* ---- Counter strip ---- */
.counter-band { background: linear-gradient(135deg, var(--navy-900), var(--blue-700)); color: #fff; padding: 46px 0; position: relative; overflow: hidden; }
.counter-band::before { content: ''; position: absolute; width: 520px; height: 520px; right: -140px; top: -260px; background: radial-gradient(circle, rgba(20,184,196,.4), transparent 65%); }
.counter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 24px; position: relative; text-align: center; }
.counter-grid b { display: block; font-size: clamp(2.2rem, 5vw, 3.1rem); font-weight: 700; color: #7ff0f7; line-height: 1.15; font-variant-numeric: tabular-nums; }
.counter-grid span { color: #cfe0f3; font-size: .95rem; }
.stat b { font-variant-numeric: tabular-nums; }

/* ---- Image zoom ---- */
.zoombox { position: relative; overflow: hidden; cursor: zoom-in; touch-action: manipulation; }
.zoombox img { transition: transform .25s ease-out; will-change: transform; }
.zoombox.zooming { cursor: zoom-out; }
.zoombox.zooming img { transform: scale(var(--zoom, 2.4)); transition: transform .15s ease-out; }
.zoom-hint { position: absolute; right: 12px; bottom: 12px; background: rgba(11,42,74,.78); color: #fff; font-size: .78rem; padding: 4px 12px; border-radius: 999px; pointer-events: none; transition: opacity .2s; z-index: 2; }
.zoombox.zooming .zoom-hint { opacity: 0; }

/* ---- Gallery tabs (รูป / 360° / ไฮไลต์) ---- */
.gtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.gtab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 16px; font: 500 .88rem var(--font); cursor: pointer; color: var(--muted); }
.gtab.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.gallery-main.has-stage { display: block; position: relative; font-size: 1rem; }
.gallery-main .zoombox, .gallery-main .stage { width: 100%; height: 100%; }
.gallery-main .zoombox img { object-fit: contain; }

/* ---- 360 viewer ---- */
.v360 { position: relative; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; user-select: none; background: #fff; }
.v360.grabbing { cursor: grabbing; }
.v360-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.v360-hint { position: absolute; left: 12px; bottom: 14px; background: rgba(11,42,74,.78); color: #fff; font-size: .8rem; padding: 4px 12px; border-radius: 999px; }
.v360-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(20,99,184,.15); }
.v360-bar i { display: block; height: 100%; background: var(--teal-500); }

/* ---- Hotspots ---- */
.stage { position: relative; }
.hs-pin { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 3px solid #fff; background: linear-gradient(135deg, var(--blue-600), var(--teal-500)); color: #fff; font: 600 .8rem var(--font); cursor: pointer; z-index: 3; box-shadow: 0 4px 12px rgba(11,42,74,.35); display: grid; place-items: center; padding: 0; }
.hs-pin::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--teal-500); animation: ring 2.2s ease-out infinite; pointer-events: none; }
.hs-pin.active { background: var(--navy-800); }
.hs-pin.active::after, .hs-pin:hover::after { animation: none; opacity: 0; }
.hs-pin:hover { transform: scale(1.12); }
@keyframes ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.hs-pop { position: absolute; z-index: 5; width: min(290px, 78%); background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); transform: translate(var(--tx, 20px), var(--ty, -14px)); animation: popin .18s ease-out; }
.hs-pop[hidden] { display: none; }
.hs-pop.dock { left: 10px !important; right: 10px; top: auto !important; bottom: 10px; width: auto; transform: none; }
.hs-pop h4 { font-size: 1rem; margin: 0 22px 6px 0; }
.hs-pop p { font-size: .9rem; color: var(--muted); margin: 0 0 8px; line-height: 1.55; }
.hs-link { font-size: .88rem; font-weight: 500; }
.hs-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; }
@keyframes popin { from { opacity: 0; scale: .96; } }

/* ---- Skill Lab ---- */
.lab-wrap { max-width: 980px; margin: 0 auto; }
.lab-stage { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-lg); background: #dcebf9; aspect-ratio: 16/9; }
.lab-stage svg { width: 100%; height: 100%; display: block; }
.lab-stage .ecg { stroke-dasharray: 260; animation: ecg2 2.8s linear infinite; }
@keyframes ecg2 { from { stroke-dashoffset: 260; } to { stroke-dashoffset: -260; } }
.lab-note { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 14px; }
@media (max-width: 560px) { .hs-pin { width: 26px; height: 26px; margin: -13px 0 0 -13px; font-size: .72rem; } .lab-stage { aspect-ratio: 4/3; } .lab-stage svg { height: 100%; width: auto; min-width: 100%; object-fit: cover; } }

/* ---- Compare checkbox on cards ---- */
.pcard-img { position: relative; }
.cmp-toggle { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 8px; font: 500 .8rem var(--font); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--ink); box-shadow: 0 2px 8px rgba(11,42,74,.12); }
.cmp-toggle input { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--blue-600); cursor: pointer; }
.cmp-toggle:has(input:checked) { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.cmp-toggle:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.cmp-toggle:has(input:focus-visible) { outline: 3px solid var(--teal-500); outline-offset: 2px; }
.cmp-detail { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 500; }
.cmp-detail input { width: 18px; height: 18px; padding: 0; accent-color: var(--blue-600); }

/* ---- Compare tray ---- */
.tray { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 140%); width: min(760px, calc(100% - 24px)); background: var(--navy-900); color: #fff; border-radius: 18px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; z-index: 45; box-shadow: 0 16px 44px rgba(7,30,58,.45); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.tray.show { transform: translate(-50%, 0); }
.tray-items { display: flex; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.tray-chip { background: rgba(255,255,255,.1); border-radius: 999px; padding: 4px 6px 4px 14px; font-size: .85rem; display: inline-flex; gap: 6px; align-items: center; max-width: 100%; }
.tray-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.tray-chip button { border: 0; background: rgba(255,255,255,.18); color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; line-height: 1; }
.tray-hint { color: #9fc3e6; font-size: .85rem; }
.tray .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
@media (max-width: 560px) { .tray { flex-wrap: wrap; } .tray .btn { width: 100%; } }

/* ---- Compare page ---- */
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.cmp-table { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; }
.cmp-table thead th:first-child { width: 190px; }
.cmp-head .pcard-img { overflow: hidden; }
.cmp-head .pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.cmp-table th, .cmp-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp-table tbody th { width: 190px; background: var(--bg); color: var(--muted); font-weight: 500; font-size: .92rem; position: sticky; left: 0; }
.cmp-table thead th { vertical-align: bottom; background: #fff; }
.cmp-head { display: grid; gap: 8px; }
.cmp-head .pcard-img { aspect-ratio: 16/10; border-radius: 12px; font-size: 2.2rem; }
.cmp-head h3 { font-size: 1rem; margin: 0; }
.cmp-head h3 a { color: var(--navy-800); }
.cmp-table tr.sec th { background: var(--navy-800); color: #fff; font-size: .85rem; letter-spacing: .04em; }
.cmp-table tr.sec td { background: var(--navy-800); }
.cmp-table tr.diff td, .cmp-table tr.diff th { background-image: linear-gradient(90deg, rgba(20,184,196,.1), rgba(20,184,196,.1)); }
.cmp-table tr.diff th { background-color: var(--teal-100); color: var(--teal-600); }
.cmp-table .best { color: var(--ok); font-weight: 600; }
.rate { display: flex; align-items: center; gap: 10px; }
.rate-bar { flex: 1; max-width: 130px; height: 8px; border-radius: 99px; background: var(--blue-100); overflow: hidden; }
.rate-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-600), var(--teal-500)); border-radius: 99px; transform-origin: left; animation: grow .9s ease-out both; }
@keyframes grow { from { transform: scaleX(0); } }
.rate b { font-size: .9rem; min-width: 30px; }
.rm-col { border: 0; background: none; color: var(--muted); cursor: pointer; font: .82rem var(--font); text-decoration: underline; padding: 0; justify-self: start; }
.toggle-diff { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.toggle-diff input { width: 18px; height: 18px; padding: 0; accent-color: var(--blue-600); }

/* ---- Product finder ---- */
.finder { max-width: 820px; margin: 0 auto; }
.finder-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: clamp(22px, 4vw, 40px); }
.fprog { height: 6px; background: var(--blue-100); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.fprog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue-600), var(--teal-500)); transition: width .45s ease; }
.fstep-label { color: var(--muted); font-size: .88rem; margin-bottom: 16px; }
.fq { font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 0 0 6px; }
.fq-sub { color: var(--muted); margin: 0 0 22px; }
.fopts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.fopt { text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 18px; cursor: pointer; font: inherit; color: var(--ink); display: grid; gap: 4px; transition: border-color .15s, transform .15s, box-shadow .15s, background .15s; }
.fopt:hover { border-color: var(--teal-500); transform: translateY(-2px); box-shadow: var(--shadow); }
.fopt .ic { font-size: 1.9rem; }
.fopt b { color: var(--navy-800); font-size: 1.02rem; }
.fopt small { color: var(--muted); font-size: .86rem; line-height: 1.45; }
.fopt.sel { border-color: var(--blue-600); background: var(--blue-100); }
.fnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.fslide { animation: slidein .35s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } }
.fres-top { text-align: center; }
.fres-top .badge-pick { display: inline-block; background: linear-gradient(135deg, var(--blue-600), var(--teal-500)); color: #fff; padding: 4px 16px; border-radius: 999px; font-size: .82rem; font-weight: 600; margin-bottom: 10px; }
.fres-list { display: grid; gap: 16px; margin: 22px 0; }
.fres { display: grid; grid-template-columns: 150px 1fr; gap: 18px; border: 1px solid var(--line); border-radius: 16px; padding: 14px; align-items: center; }
.fres.best { border: 2px solid var(--teal-500); background: linear-gradient(180deg, var(--teal-100), #fff 60%); }
.fres .pcard-img { border-radius: 12px; aspect-ratio: 4/3; font-size: 2.4rem; }
.fres h3 { margin: 0 0 4px; font-size: 1.1rem; }
.fres p { color: var(--muted); margin: 0 0 10px; font-size: .92rem; }
.match { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; color: var(--teal-600); margin-bottom: 6px; }
.match .rate-bar { width: 90px; }
.why { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.why span { background: var(--blue-100); color: var(--blue-700); padding: 2px 10px; border-radius: 999px; font-size: .78rem; }
.fnote { font-size: .85rem; color: var(--muted); }
@media (max-width: 560px) { .fres { grid-template-columns: 1fr; } }
.finder-teaser { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; background: linear-gradient(135deg, var(--teal-100), var(--blue-100)); border-radius: 22px; padding: clamp(24px, 4vw, 44px); border: 1px solid #c9e6ea; }
.finder-teaser h2 { margin-bottom: 6px; }
.finder-steps { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 20px; }
.finder-steps span { background: #fff; border-radius: 999px; padding: 6px 14px; font-size: .88rem; font-weight: 500; box-shadow: 0 2px 8px rgba(11,42,74,.07); }
.finder-teaser .ill { font-size: 6rem; text-align: center; filter: drop-shadow(0 12px 18px rgba(11,42,74,.2)); }
@media (max-width: 760px) { .finder-teaser { grid-template-columns: 1fr; } .finder-teaser .ill { display: none; } }

/* =====================================================================
   EXTRAS — ส่วนเสริมสำหรับการต่อหน้าเว็บเข้ากับลูกเล่น (การ์ด/แกลเลอรี/ตัวช่วยเลือก)
   ===================================================================== */
.pcard-link { display: contents; }
body.has-tray { padding-bottom: 96px; }
.aud-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.aud-chips .tag { background: var(--blue-100); color: var(--blue-700); }
.gallery-main.has-stage .stage { position: relative; }
.gallery-main.has-stage.hot { overflow: visible; }
.cmp-bar { display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cmp-bar .acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .nav a { padding: 12px 14px; } }
@media (min-width: 901px) and (max-width: 1160px) { .nav a { padding: 8px 10px; font-size: .94rem; } .header .btn-quote { display: none; } }
