/* Golden Recipe Set 19 — Prismatic Tour
   token ทั้งหมดตาม docs/DESIGN-SYSTEM.md หัวข้อ 11 (ชื่อและค่าตรงเอกสาร)
   ค่ามือถืออยู่ใน :root ค่าเดสก์ท็อปทับใน @media (min-width: 1024px) */

/* ฟอนต์โฮสต์เองใน design/fonts/ — Prompt (Thai + Latin), SIL OFL 1.1, ดู fonts/Prompt-OFL.txt
   น้ำหนัก 400 500 600 700 800 900 ไม่มี URL ภายนอกตอนรัน */
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-thai-400.d10643e148.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-latin-400.76f4b0e556.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-thai-500.3ed6cc86f3.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-latin-500.b098584154.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-thai-600.a7f3d9ca1d.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-latin-600.8808aa3340.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-thai-700.6709b03617.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-latin-700.54eb2e1925.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-thai-800.627142bc82.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-latin-800.a0b254ddd5.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-thai-900.54e3037520.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}
@font-face {
  font-family: "Prompt";
  src: url("/assets/Prompt-latin-900.7f86745673.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  /* ---------- 2. ชุดสี ---------- */
  /* พื้นเวที */
  --color-canvas: #0A0B14;
  --color-surface: #12141F;
  --color-surface-raised: #1A1D2C;
  --color-overlay: #23273A;
  --color-panel: #151829;
  --color-footer: #121426;
  --color-footer-border: #2E3349;
  --color-scrim: rgba(10, 11, 20, 0.72);
  /* scrim ของภาพปก KV (เดิมเขียนตรงใน public.css .hero__scrim — GATE2 L7 ย้ายเข้า token ในเฟส 4) */
  --hero-scrim-v: linear-gradient(180deg, rgba(10, 11, 20, 0.72) 0%, rgba(10, 11, 20, 0.28) 28%, rgba(10, 11, 20, 0.18) 52%, rgba(10, 11, 20, 0.82) 100%);
  --hero-scrim-h: linear-gradient(90deg, rgba(10, 11, 20, 0.58) 0%, rgba(10, 11, 20, 0.2) 45%, rgba(10, 11, 20, 0.28) 100%);
  --hero-scrim-desk-h: linear-gradient(90deg, rgba(10, 11, 20, 0.82) 0%, rgba(10, 11, 20, 0.55) 32%, rgba(10, 11, 20, 0.18) 58%, rgba(10, 11, 20, 0.32) 100%);
  --hero-scrim-desk-v: linear-gradient(180deg, rgba(10, 11, 20, 0.55) 0%, rgba(10, 11, 20, 0.12) 30%, rgba(10, 11, 20, 0.08) 62%, rgba(10, 11, 20, 0.72) 100%);

  /* ข้อความ */
  --color-text-primary: #F3F4FA;
  --color-text-secondary: #C2C6D9;
  --color-text-muted: #9499B3;
  --color-text-invert: #0A0B14;

  /* เส้น */
  --color-border: #2E3349;
  --color-divider: #23273A;
  --color-border-strong: #7078A0;

  /* ปริซึม */
  --color-prism-cyan: #4FE3F0;
  --color-prism-violet: #A78BFF;
  --color-prism-magenta: #FF5FC4;
  --color-prism-gold: #FFD166;
  --gradient-prism: linear-gradient(110deg, #4FE3F0 0%, #A78BFF 35%, #FF5FC4 68%, #FFD166 100%);
  --color-accent: #4FE3F0;
  --color-focus: #FFD166;

  /* ป้าย tier — ค่า RGB จากภาพอ้างอิงของ Dos (ตัวอักษรสว่างบนพื้นหกเหลี่ยมมืด ไม่ใช่ตัวอักษรมืดบนพื้นสว่าง) */
  --color-tier-s: #D6BFFF;         --color-tier-s-border: #AABAFF; --color-tier-s-end: #FDF0E2;
  --color-tier-s-fill: #391E5C;    --color-tier-s-letter: #F9FAFF;
  --color-tier-s-grad: linear-gradient(90deg, #AABAFF 0%, #D6BFFF 50%, #FDF0E2 100%);
  --color-tier-a: #FFC016;         --color-tier-a-border: #FFEF30; --color-tier-a-end: #FF8302;
  --color-tier-a-fill: #392209;    --color-tier-a-letter: #FFFEF8;
  --color-tier-a-grad: linear-gradient(180deg, #FFEF30 0%, #FFC016 50%, #FF8302 100%);
  --color-tier-b: #BFECFF;         --color-tier-b-border: #F5FCFE; --color-tier-b-end: #7AAEDB;
  --color-tier-b-fill: #26325C;    --color-tier-b-letter: #F8FCFF;
  --color-tier-b-grad: linear-gradient(180deg, #F5FCFE 0%, #BFECFF 50%, #7AAEDB 100%);
  --color-tier-c: #A7692C;         --color-tier-c-border: #D48B43; --color-tier-c-end: #935B25;
  --color-tier-c-fill: #3B220A;    --color-tier-c-letter: #FFFEF6;
  --color-tier-c-grad: linear-gradient(180deg, #D48B43 0%, #A7692C 50%, #935B25 100%);
  --color-tier-x: #0D9BBC;         --color-tier-x-border: #2FF0F7; --color-tier-x-end: #085E98;
  --color-tier-x-fill: #0E3552;    --color-tier-x-letter: #EAFCFE;
  --color-tier-x-grad: linear-gradient(180deg, #2FF0F7 0%, #0D9BBC 50%, #085E98 100%);
  --color-tier-text: #F9FAFF;

  /* กรอบแชมเปี้ยนตามราคา */
  --color-cost-1: #9AA3B8;
  --color-cost-2: #3DDC84;
  --color-cost-3: #4DA3FF;
  --color-cost-4: #C77DFF;
  --color-cost-5: #FFC542;
  --color-cost-7: #FF7ADB;
  --gradient-cost-7: conic-gradient(from 210deg, #4FE3F0, #A78BFF, #FF5FC4, #FFD166, #4FE3F0);

  /* ป้ายย่อยของ tier */
  --color-sub-down: #FF7A7A;
  --color-sub-plus: #FFD166;
  --color-sub-up: #3DDC84;
  --color-sub-text: #0A0B14;

  /* สถานะหลังบ้าน */
  --color-status-draft: #FFB454;    --color-status-draft-bg: #33240C;
  --color-status-preview: #6CB8FF;  --color-status-preview-bg: #10263D;
  --color-status-publish: #3DDC84;  --color-status-publish-bg: #0E2E1E;
  --color-warning: #FFC542;         --color-warning-bg: #33290A;
  --color-danger: #FF7A7A;          --color-danger-bg: #3A1418;
  --color-success: #3DDC84;         --color-success-bg: #0E2E1E;

  /* ---------- 4. ตัวอักษร (ค่ามือถือ) ---------- */
  --font-body: "Prompt", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --font-display: "Prompt", "Noto Sans Thai", system-ui, sans-serif;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-display: 700;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;

  --text-display-xl: clamp(48px, 6.25vw, 120px);  --leading-display-xl: 1.0;
  --text-display: 28px;    --leading-display: 1.1;
  --text-h1: 24px;         --leading-h1: 1.3;
  --text-h2: 20px;         --leading-h2: 1.35;
  --text-h3: 16px;         --leading-h3: 1.4;
  --text-body: 16px;       --leading-body: 1.7;
  --text-body-sm: 14px;    --leading-body-sm: 1.65;
  --text-label: 12px;      --leading-label: 1.2;
  --text-hex-name: 12px;   --leading-hex-name: 1.3;
  --text-helper: 13px;     --leading-helper: 1.5;
  --text-button: 15px;     --leading-button: 1.0;
  /* เพิ่มในรอบต้นแบบ (หัวข้อ 11.1) */
  --text-code: 24px;       --leading-code: 1.0;

  /* ---------- 5. ระยะ มุม เงา ความกว้าง เส้น ---------- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;
  /* ช่องโฆษณา (DESIGN-SYSTEM 15.4) ความสูงของกรอบมาจากข้อมูล minHeightPx ไม่ใช่ token */
  --ad-label-h: 20px;
  --ad-gap-mobile: var(--space-4);
  --ad-gap-desktop: var(--space-6);
  --ad-max-w-top-desktop: 728px;
  --ad-max-w-top-mobile: 320px;
  --ad-max-w-wide-desktop: 970px;
  --ad-max-w-wide-mobile: 300px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.6);
  --glow-prism: 0 0 24px rgba(79, 227, 240, 0.25), 0 0 48px rgba(255, 95, 196, 0.15);

  --frame-max: 1920px;
  --content-max: 1600px;
  --content-mobile-max: 600px;
  --gutter-mobile: 10px;
  --admin-content-max: 1440px;
  --admin-drawer: 480px;

  --line-hair: 1px;
  --line-strong: 2px;
  --line-focus: 3px;

  --tap-min: 44px;

  /* จังหวะการเคลื่อนไหว */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 140ms;

  /* ---------- 6. เรขาคณิต hex (ค่ามือถือ) ---------- */
  --hex-clip: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  --hex-row-pitch: 0.8667;
  --u: min(0.8px, calc(100vw / 2133.33));

  /* W = min(100vw, 600px) − 20px (หัวข้อ 6) */
  --layout-w: calc(min(100vw, var(--content-mobile-max)) - 2 * var(--gutter-mobile));

  --hex-tier: clamp(72px, calc((var(--layout-w) - 104px) / 3), 96px);
  --hex-panel: 150px;
  --hex-roster: min(96px, calc((var(--layout-w) - 32px) / 3));
  --hex-board: calc(var(--layout-w) / 7.5);
  /* --hex-frame คิดต่อ hex จาก --hex-size ดูกฎ .hex ท้ายไฟล์ */
  --hex-frame: max(2px, calc(var(--hex-tier) * 0.033));

  /* ---------- 11.1 token เลย์เอาต์คอมโพเนนต์ (เพิ่มในรอบต้นแบบ) ---------- */
  --hex-emblem-ratio: 0.3;
  --hex-emblem-min: 28px;

  --layout-header-h: 60px;
  --layout-hero-h: 540px;
  --tier-label-w: 272px;
  --tier-label-h: 87px;
  --tier-arrow: 36px;
  --gap-hex-tier: 16px;
  --gap-hex-roster: 16px;
  --panel-head-min-h: 270px;
  --copy-btn-w: 165px;
  --copy-btn-h: 44px;
  --tab-lv-w: auto;
  --tab-lv-h: 30px;
  --trait-chip-w: 42px;
  --trait-chip-h: 28px;
  --trait-chip-bronze: #985C3A;
  --trait-chip-bronze-ink: #FFFFFF;
  --trait-chip-silver: #B9C4D0;
  --trait-chip-silver-ink: #131721;
  --trait-chip-gold: #EBC675;
  --trait-chip-gold-ink: #23170B;
  --trait-chip-prismatic: linear-gradient(120deg, #C5D8FF, #E4C4FA, #BCEBE0);
  --trait-chip-prismatic-ink: #1D1830;
  --trait-chip-neutral: #363C49;
  --trait-chip-neutral-ink: #F1F2F5;
  --icon-trait: 24px;
  --icon-ui: 20px;
  --build-block-w: 268px;
  --build-champ: 64px;
  --item-slot: 36px;
  --order-icon: 64px;
  --order-arrow: 16px;
  --augment-size: 72px;
  --tooltip-max: 240px;

  /* ชิ้นส่วนทรง Figma (design/shapes/) */
  --logo-h: 28px;
  --logo-text: 18px;
  --about-btn-h: 40px;
  --hero-title: clamp(56px, 18vw, 80px);
  --plaque-w: 256px;
  --plaque-text: 26px;
  --hero-credit: 16px;
  --creator-w: 162px;
  --creator-h: 54px;
  --creator-avatar: 36px;
  --creator-text: 15px;
  --panel-letter: 180px;
  --flourish-w: 64px;
  --footer-avatar: 32px;

  --admin-sidebar: 240px;
  --admin-row-h: 44px;
  --admin-tier-badge: 48px;
  --admin-card-hex: 56px;
  --admin-card-w: 112px;
  --admin-mini-hex: 28px;
  --admin-login-w: 400px;
  --totp-cell-w: 44px;
  --totp-cell-h: 52px;
}

@media (min-width: 1024px) {
  :root {
    --text-display: 32px;
    --text-h1: 28px;
    --text-h2: 20px;
    --text-h3: 16px;
    --text-hex-name: 12px;

    --layout-w: calc(1600 * var(--u));

    --hex-tier: calc(120 * var(--u));
    --hex-panel: calc(216 * var(--u));
    --hex-roster: calc(120 * var(--u));
    --hex-board: calc(120 * var(--u));

    --layout-header-h: 64px;
    --layout-hero-h: calc(700 * var(--u));
    --tier-label-w: calc(228 * var(--u));
    --tier-label-h: calc(150 * var(--u));
    --tier-arrow: calc(36 * var(--u));
    --gap-hex-tier: calc(16 * var(--u));
    --gap-hex-roster: calc(24 * var(--u));
    --panel-head-min-h: calc(317 * var(--u));
    --copy-btn-w: max(165px, calc(235 * var(--u)));
    --copy-btn-h: max(44px, calc(60 * var(--u)));
    --tab-lv-w: calc(200 * var(--u));
    --tab-lv-h: max(44px, calc(56 * var(--u)));
    --build-block-w: max(268px, calc(269 * var(--u)));
    --build-champ: calc(100 * var(--u));
    --order-icon: calc(100 * var(--u));
    --order-arrow: calc(24 * var(--u));
    --augment-size: max(64px, calc(96 * var(--u)));

    --logo-h: max(28px, calc(40 * var(--u)));
    --logo-text: max(18px, calc(28 * var(--u)));
    --about-btn-h: max(40px, calc(52 * var(--u)));
    --hero-title: max(72px, calc(144 * var(--u)));
    --plaque-w: max(260px, calc(440 * var(--u)));
    --plaque-text: max(26px, calc(48 * var(--u)));
    --hero-credit: max(16px, calc(28 * var(--u)));
    --creator-w: max(180px, calc(355 * var(--u)));
    --creator-h: max(56px, calc(116 * var(--u)));
    --creator-avatar: max(40px, calc(76 * var(--u)));
    --creator-text: max(16px, calc(36 * var(--u)));
    --panel-letter: max(180px, calc(320 * var(--u)));
    --flourish-w: max(64px, calc(90 * var(--u)));
    --footer-avatar: max(32px, calc(40 * var(--u)));

    --admin-row-h: 40px;
  }
}

/* --hex-frame ต้องคิดจากขนาดของ hex แต่ละตัว: ทุกองค์ประกอบ hex ตั้ง --hex-size
   จาก --hex-tier / --hex-panel / --hex-roster / --hex-board แล้วได้กรอบ 3.3% ไม่ต่ำกว่า 2px */
.hex, .cell, .mini-hex {
  --hex-frame: max(2px, calc(var(--hex-size) * 0.033));
}

/* หน้าบ้าน Prismatic Tour — ทรงและผังตาม Figma ZE852 (docs/figma-ref/FIGMA-LAYOUT.md)
   ผิวเป็น token ใน tokens.css เท่านั้น (mobile first, จุดตัดเดียว 1024) */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--color-canvas);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
  background: var(--color-canvas);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  font-synthesis: none;
  word-break: normal;
  overflow-wrap: anywhere;
}

img { display: block; max-width: 100%; }
svg { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--color-accent); text-underline-offset: 0.2em; }

:focus-visible {
  outline: var(--line-focus) solid var(--color-focus);
  outline-offset: var(--line-focus);
}

.sr-only {
  position: absolute !important;
  width: var(--line-hair); height: var(--line-hair);
  margin: calc(-1 * var(--line-hair)); padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon { width: var(--icon-ui); height: var(--icon-ui); fill: none; stroke: currentColor; }

.frame { position: relative; max-width: var(--frame-max); margin-inline: auto; }
.container { width: var(--layout-w); max-width: 100%; margin-inline: auto; min-width: 0; }

.skip-link {
  position: absolute; left: var(--space-2); top: calc(-1 * var(--space-20));
  z-index: 100; padding: var(--space-3) var(--space-4);
  background: var(--color-accent); color: var(--color-text-invert);
  border-radius: var(--radius-md); font-weight: var(--weight-semibold);
}
.skip-link:focus { top: var(--space-2); }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-5);
  border: var(--line-hair) solid transparent; border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: var(--text-button); font-weight: var(--weight-semibold);
  line-height: var(--leading-button); text-decoration: none; cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}
.btn .icon { width: var(--icon-ui); height: var(--icon-ui); }
.btn--primary { background: var(--color-accent); color: var(--color-text-invert); }
.btn--secondary { background: var(--color-surface-raised); color: var(--color-text-primary); border-color: var(--color-border-strong); }
.btn--danger { background: var(--color-danger); color: var(--color-text-invert); }
.btn:hover, .btn.is-hover { filter: brightness(1.12); }
.btn.is-focus { outline: var(--line-focus) solid var(--color-focus); outline-offset: var(--line-focus); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--color-surface-raised); color: var(--color-border-strong);
  border-color: var(--color-border); cursor: not-allowed; filter: none;
}

/* เม็ดยาขอบทองของ Figma (About Us, คัดลอกรหัสทีม, โซเชียล) */
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--about-btn-h); padding: 0 var(--space-6);
  background: var(--color-surface-raised); color: var(--color-prism-gold);
  border: var(--line-strong) solid var(--color-prism-gold); border-radius: var(--radius-pill);
  font-family: var(--font-display); font-size: var(--text-button); font-weight: var(--weight-display);
  line-height: var(--leading-button); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: filter 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .pill-btn:hover { filter: brightness(1.15); } }
.pill-btn[aria-current="page"] { background: var(--color-prism-gold); color: var(--color-text-invert); }
.pill-btn--gold {
  background: var(--color-prism-gold); color: var(--color-text-invert);
  border-color: color-mix(in srgb, var(--color-prism-gold) 60%, var(--color-text-primary));
  font-family: var(--font-body); font-weight: var(--weight-semibold);
}
.pill-btn .icon { width: var(--icon-ui); height: var(--icon-ui); }

/* ---------- ป้ายข้อมูลตัวอย่าง ---------- */
.sample-badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--color-warning-bg); color: var(--color-warning);
  border: var(--line-hair) solid var(--color-warning); border-radius: var(--radius-pill);
  font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-label);
}

/* ---------- 1. แถบบน: ทับขอบบนของภาพปก ไม่มีพื้นของตัวเอง ---------- */
.site-header { position: absolute; top: 0; left: 0; right: 0; z-index: 30; }
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  height: var(--layout-header-h);
}
.logo {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min);
  color: var(--color-text-primary); text-decoration: none; white-space: nowrap;
}
.logo__mark { width: var(--logo-h); height: var(--logo-h); color: var(--color-prism-gold); }
.logo__text {
  font-family: var(--font-display); font-weight: var(--weight-display);
  font-size: var(--logo-text); line-height: 1; letter-spacing: 0.02em;
}

/* ---------- 2. ภาพปก ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: var(--layout-hero-h);
  display: flex; align-items: flex-end;
  background: var(--color-canvas);
}
.hero::after { /* ขอบล่างจางลงสู่ canvas */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%; z-index: -1;
  background: linear-gradient(to bottom, transparent, var(--color-canvas));
  pointer-events: none;
}

/* ภาพปก: KV ทางการของ Set 19 เต็มกรอบ มี scrim ให้ตัวอักษรอ่านได้ */
.hero__art {
  position: absolute; inset: 0; z-index: -2; overflow: hidden;
}
.hero__kv {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  display: block;
}
.hero__scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: var(--hero-scrim-v), var(--hero-scrim-h);
}

.hero__inner { padding-block: calc(var(--layout-header-h) + var(--space-4)) var(--space-6); }
.hero__content { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; }
.hero__title {
  font-family: var(--font-display); font-weight: var(--weight-display);
  font-size: var(--hero-title); line-height: var(--leading-display-xl);
  color: var(--color-text-primary); letter-spacing: -0.01em;
  text-shadow: 0 var(--space-1) var(--space-6) var(--color-scrim);
}

/* ป้ายแพตช์: ป้ายแขวนมี hook สี่มุม (patch-plaque.svg) */
.plaque {
  position: relative; display: grid; place-items: center;
  width: var(--plaque-w); aspect-ratio: 360 / 96;
}
.plaque__shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plaque__board { fill: url(#plaque-fill) var(--color-surface-raised); stroke: var(--color-prism-gold); stroke-width: 4; }
.plaque__inner { fill: none; stroke: color-mix(in srgb, var(--color-prism-gold) 40%, transparent); stroke-width: 1.2; }
.plaque__hooks path { fill: none; stroke: var(--color-prism-gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.plaque__text {
  position: relative; color: var(--color-prism-gold);
  font-family: var(--font-display); font-weight: var(--weight-display);
  font-size: var(--plaque-text); line-height: 1; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.hero__credit {
  font-size: var(--hero-credit); font-weight: var(--weight-semibold); line-height: var(--leading-h2);
  color: var(--color-text-primary);
}
.hero__credit em { font-style: normal; color: var(--color-prism-gold); }

/* ชิปผู้จัดทำ: กรอบมนขอบทอง รูปซ้าย ชื่อขวา */
.creators { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }
.creator {
  display: inline-flex; align-items: center; gap: var(--space-3);
  width: var(--creator-w); min-height: var(--creator-h); padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  color: var(--color-text-primary); text-decoration: none;
  border: var(--line-strong) solid var(--color-prism-gold); border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 var(--line-hair) color-mix(in srgb, var(--color-prism-gold) 35%, transparent);
}
@media (hover: hover) and (pointer: fine) { a.creator:hover { background: var(--color-surface-raised); } }
.creator__avatar {
  display: grid; place-items: center; flex: none;
  width: var(--creator-avatar); height: var(--creator-avatar); border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-prism-cyan), var(--color-prism-violet));
  color: var(--color-text-invert); font-family: var(--font-display); font-weight: var(--weight-display);
}
.creator__avatar--b { background: linear-gradient(135deg, var(--color-prism-magenta), var(--color-prism-gold)); }
.creator__avatar > img, .footer__avatar > img {
  width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; border-radius: inherit;
}
.credit-avatar--toongcha, .credit-avatar--cursedzxz { overflow: hidden; }
.credit-avatar--toongcha > img { transform: scale(1.5); transform-origin: 45% 15%; }
.credit-avatar--cursedzxz > img { transform: scale(1.8); transform-origin: 52% 32%; }
.creator__name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--creator-text); font-weight: var(--weight-semibold); line-height: var(--leading-h3);
}

/* ---------- 3. เวลาอัปเดต ---------- */
.meta-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2) var(--space-3);
  padding-block: var(--space-3) var(--space-2);
  font-size: var(--text-body-sm); font-weight: var(--weight-semibold); line-height: var(--leading-helper);
  color: var(--color-prism-gold);
}

/* ---------- 4. แถบค้นหาและตัวกรอง (บาง ไม่มีพื้นการ์ด) ---------- */
.filters {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2);
  min-width: 0;
}
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search .icon { position: absolute; left: var(--space-3); color: var(--color-text-muted); pointer-events: none; }
.search input {
  width: 100%; min-width: 0; height: var(--tap-min);
  padding: 0 var(--space-4) 0 var(--space-10);
  background: var(--color-surface); color: var(--color-text-primary);
  border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-pill);
  font-size: var(--text-body); line-height: var(--leading-label);
}
.search input::placeholder { color: var(--color-text-muted); }
.search input:focus-visible { border-color: var(--color-accent); }
.filters__chips {
  position: relative; /* Keep the absolute screen-reader label inside the chip scroller. */
  display: flex; gap: var(--space-2); min-width: 0;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: var(--line-focus); margin: calc(-1 * var(--line-focus));
  scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent;
}
.chip-group { display: flex; flex: none; }
.chip-row { display: flex; flex-wrap: nowrap; gap: var(--space-2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2); flex: none;
  min-height: var(--tap-min); padding: 0 var(--space-3);
  background: transparent; color: var(--color-text-primary);
  border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-pill);
  font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-label);
  cursor: pointer; white-space: nowrap;
}
.chip__icon { width: var(--icon-trait); height: var(--icon-trait); }
.chip__check { display: none; width: var(--space-4); height: var(--space-4); }
.chip[aria-pressed="true"], .chip.is-selected {
  background: var(--color-overlay); color: var(--color-prism-gold);
  border-color: var(--color-prism-gold);
}
.chip[aria-pressed="true"] .chip__check, .chip.is-selected .chip__check { display: block; }
.chip.is-focus { outline: var(--line-focus) solid var(--color-focus); outline-offset: var(--line-focus); }
@media (hover: hover) and (pointer: fine) { .chip:hover { filter: brightness(1.12); } }
.chip__tier { /* หกเหลี่ยมขอบทึบแบบเดียวกับป้าย tier */
  position: relative; isolation: isolate;
  display: inline-grid; place-items: center;
  width: calc(var(--icon-trait) * 1.15); height: var(--icon-trait);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: var(--tier-edge);
  color: var(--tier-letter-color); font-family: var(--font-display); font-weight: var(--weight-extrabold);
}
.chip__tier::before {
  content: ""; position: absolute; inset: var(--line-strong); z-index: -1;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: var(--tier-fill);
}
.chip__tier--s, .tier-badge--s, .panel__letter--s {
  --tier-edge: var(--color-tier-s); --tier-fill: var(--color-tier-s-fill); --tier-letter-color: var(--color-tier-s-letter);
}
.chip__tier--a, .tier-badge--a, .panel__letter--a {
  --tier-edge: var(--color-tier-a); --tier-fill: var(--color-tier-a-fill); --tier-letter-color: var(--color-tier-a-letter);
}
.chip__tier--b, .tier-badge--b, .panel__letter--b {
  --tier-edge: var(--color-tier-b); --tier-fill: var(--color-tier-b-fill); --tier-letter-color: var(--color-tier-b-letter);
}
.chip__tier--c, .tier-badge--c, .panel__letter--c {
  --tier-edge: var(--color-tier-c-border); --tier-fill: var(--color-tier-c-fill); --tier-letter-color: var(--color-tier-c-letter);
}
.chip__tier--x, .tier-badge--x, .panel__letter--x {
  --tier-edge: var(--color-tier-x); --tier-fill: var(--color-tier-x-fill); --tier-letter-color: var(--color-tier-x-letter);
}
.filter-empty { padding: var(--space-8) 0; text-align: center; color: var(--color-text-secondary); }

/* ---------- 5. วิธีใช้ (ลิงก์พับได้) ---------- */
.howto { margin-block: var(--space-1) var(--space-4); font-size: var(--text-body-sm); line-height: var(--leading-body-sm); }
.howto summary {
  display: inline-flex; align-items: center; min-height: var(--tap-min);
  color: var(--color-accent); cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em;
}
.howto__body { padding: var(--space-2) 0 var(--space-3); color: var(--color-text-secondary); }
.howto__body ol { list-style: decimal; padding-inline-start: var(--space-6); display: grid; gap: var(--space-1); }

/* ---------- 6. แถว tier ---------- */
.tiers { display: grid; grid-template-columns: minmax(0, 1fr); }
.tier-row { padding-block: var(--space-5); min-width: 0; scroll-margin-top: var(--space-4); }
.tier-row + .tier-row { border-top: var(--line-hair) solid var(--color-divider); }
.tier-row[hidden] { display: none; }
.tier-row__inner {
  display: grid;
  grid-template-columns: var(--tier-arrow) minmax(0, 1fr) var(--tier-arrow);
  grid-template-areas: "label label label" "prev track next";
  row-gap: var(--space-5);
  align-items: center;
  --hex-size: var(--hex-tier);
}

/* ป้าย tier: รูปทรงและตัวอักษร SVG จาก Figma */
.tier-badge {
  grid-area: label; justify-self: center;
  position: relative; display: block;
  width: var(--tier-label-w); max-width: 100%; height: var(--tier-label-h);
  color: var(--tier-fill); /* หกเหลี่ยมในทึบสีมืด (fill="currentColor" ใน symbol) */
}
.tier-badge__svg {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  stroke: var(--tier-edge); fill: var(--tier-edge);
}
.tier-badge__svg--desk { display: none; }
.tier-badge__glyph { fill: var(--tier-letter-color); stroke: none; }

/* ลูกศรเลื่อนแถว: ข้าวหลามตัดทอง */
.tier-arrow {
  position: relative; display: inline-grid; place-items: center;
  width: var(--tier-arrow); height: var(--tier-arrow);
  padding: 0; background: none; border: 0; color: var(--color-prism-gold); cursor: pointer;
}
.tier-arrow::before { /* พื้นที่กด 44 */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: max(var(--tap-min), 100%); height: max(var(--tap-min), 100%);
  transform: translate(-50%, -50%);
}
.tier-arrow svg {
  width: 100%; height: 100%;
  color: var(--color-surface-raised); stroke: var(--color-prism-gold); stroke-width: 1.5;
}
.tier-arrow:enabled:is(:active, :focus-visible) svg { color: var(--color-prism-gold); }
@media (hover: hover) and (pointer: fine) {
  .tier-arrow:enabled:hover svg { color: var(--color-prism-gold); }
}
.tier-arrow:disabled { opacity: 0.35; cursor: default; }
.tier-arrow--prev { grid-area: prev; justify-self: start; }
.tier-arrow--next { grid-area: next; justify-self: end; }
.tier-arrow[hidden] { display: none; }

.tier-track {
  grid-area: track; min-width: 0;
  display: grid; grid-template-columns: repeat(3, var(--hex-size));
  justify-content: center;
  column-gap: var(--gap-hex-tier); row-gap: var(--space-4);
}

.tier-item {
  position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0;
}
.tier-item.is-offpage, .tier-item.is-filtered { display: none; }
.tier-item.is-selected .hex::before {
  content: ""; position: absolute; inset: calc(-1 * var(--line-strong));
  clip-path: var(--hex-clip); background: var(--color-prism-gold); pointer-events: none;
}

/* ---------- 7. hex ปลายชี้ขึ้น ตราวงกลมที่จุดล่าง ---------- */
.hex {
  position: relative; display: block; flex: none;
  width: var(--hex-size); height: var(--hex-size);
  padding: 0; border: 0; background: transparent;
  color: inherit; text-decoration: none; cursor: pointer;
  --emblem: max(var(--hex-emblem-min), calc(var(--hex-size) * var(--hex-emblem-ratio)));
  transition: transform 0.15s ease;
}
.hex--static { cursor: default; }
.hex:focus-visible, .hex.is-focus { outline: var(--line-focus) solid var(--color-focus); outline-offset: var(--line-focus); border-radius: var(--radius-md); }
@media (hover: hover) and (pointer: fine) {
  a.hex:hover, button.hex:hover { transform: translateY(calc(-1 * var(--line-strong))); }
  a.hex:hover .hex__frame, button.hex:hover .hex__frame { filter: brightness(1.15); }
}
.hex.is-hover { transform: translateY(calc(-1 * var(--line-strong))); }
.hex.is-hover .hex__frame { filter: brightness(1.15); }

.hex--cost-1 { --hex-color: var(--color-cost-1); }
.hex--cost-2 { --hex-color: var(--color-cost-2); }
.hex--cost-3 { --hex-color: var(--color-cost-3); }
.hex--cost-4 { --hex-color: var(--color-cost-4); }
.hex--cost-5 { --hex-color: var(--color-cost-5); }
.hex--cost-7 { --hex-color: var(--color-cost-7); }

.hex__frame {
  position: absolute; inset: 0;
  clip-path: var(--hex-clip);
  background: var(--hex-color, var(--color-cost-1));
}
.hex__frame::before {
  content: ""; position: absolute;
  inset: calc(var(--hex-frame) - var(--line-hair));
  clip-path: var(--hex-clip); background: var(--color-canvas);
}
.hex__img, .hex__placeholder {
  position: absolute; top: var(--hex-frame); left: var(--hex-frame);
  width: calc(100% - 2 * var(--hex-frame)); height: calc(100% - 2 * var(--hex-frame));
  clip-path: var(--hex-clip);
}
.hex__img { object-fit: cover; background: var(--color-surface-raised); }
.hex__placeholder {
  display: grid; place-items: center; padding: 0 var(--space-2);
  background: var(--color-surface-raised); color: var(--color-text-secondary);
  font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-label);
  text-align: center;
}

/* ตรา: วงกลมซ้อนที่จุดล่างสุดของ hex (ไม่ยื่นครึ่งวง) ช่องว่างมีชื่อจนกว่าจะมีรูปตรา */
.hex__emblem {
  position: absolute; left: 50%; bottom: calc(var(--hex-size) * -0.02); transform: translateX(-50%);
  display: grid; place-items: center;
  width: var(--emblem); height: var(--emblem); border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: var(--line-strong) solid var(--hex-color, var(--color-border-strong));
  box-shadow: 0 0 0 var(--line-hair) var(--color-canvas);
  font-size: max(9px, calc(var(--emblem) * 0.3)); font-weight: var(--weight-semibold); line-height: 1;
  letter-spacing: -0.02em; white-space: nowrap; overflow: hidden;
}
.hex__sub {
  position: absolute; top: 0; right: calc(100% / 12);
  width: 25%; height: 25%;
}
.hex__sub svg { display: block; width: 100%; height: 100%; stroke: none; }
@media (max-width: 767px) {
  .hex__sub { right: 6px; width: 20px; height: 20px; }
}

.hex__name {
  display: block; width: var(--hex-size); margin-top: var(--space-1);
  font-size: var(--text-hex-name); font-weight: var(--weight-medium); line-height: var(--leading-hex-name);
  color: var(--color-text-secondary); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 8. tooltip ---------- */
.tip {
  position: absolute; z-index: 20; bottom: calc(100% + var(--space-2)); left: 50%; transform: translateX(-50%);
  display: none; width: max-content; max-width: var(--tooltip-max);
  padding: var(--space-3); gap: var(--space-1);
  background: var(--color-overlay); color: var(--color-text-primary);
  border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-3);
  font-size: var(--text-body-sm); line-height: var(--leading-body-sm); text-align: start;
  pointer-events: none;
}
.tip__title { font-weight: var(--weight-semibold); }
.tip__traits, .tip__meta { color: var(--color-text-secondary); }
.cost-badge {
  justify-self: start; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm);
  color: var(--color-text-invert); font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-label);
}
.cost-badge--1 { background: var(--color-cost-1); }
.cost-badge--2 { background: var(--color-cost-2); }
.cost-badge--3 { background: var(--color-cost-3); }
.cost-badge--4 { background: var(--color-cost-4); }
.cost-badge--5 { background: var(--color-cost-5); }
.cost-badge--7 { background: var(--color-cost-7); }

.roster__item:hover .tip, .roster__item:focus-within .tip, .roster__item.is-open .tip { display: grid; }

/* ---------- 9. แผงรายละเอียด (โครง Desktop-2) ---------- */
.panel-wrap { margin-top: var(--space-5); scroll-margin-top: var(--space-4); }
.panel-wrap[hidden] { display: none; }
.panel-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}
.copy-btn { width: var(--copy-btn-w); height: var(--copy-btn-h); max-width: 100%; padding: 0 var(--space-4); font-size: var(--text-button); }
.copy-status {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-body-sm); line-height: var(--leading-body-sm); color: var(--color-success);
}
.copy-status:empty { display: none; }
.copy-status--error { color: var(--color-danger); }
.copy-status .icon { width: var(--space-4); height: var(--space-4); }
.copy-btn:disabled,
.copy-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; filter: none; }
.copy-btn:disabled:hover,
.copy-btn[aria-disabled="true"]:hover { filter: none; }

.panel {
  position: relative; isolation: isolate; overflow: clip;
  padding: var(--space-6) 0 var(--space-8);
  background: var(--color-canvas);
  border: var(--line-hair) solid var(--color-border);
}
/* แผงไม่ใช่ปุ่ม: ไม่วาดวงทองรอบทั้งแผง (ปุ่ม/ลิงก์ในแผงยังมี :focus-visible ของทั้งไซต์ตามปกติ) */
.panel:focus, .panel:focus-visible, .panel:target { outline: none; }

/* ตัวอักษร tier จางเป็นพื้นหัวแผง มุมซ้ายบน */
.panel__letter { position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none; }
.panel__letter-svg {
  display: block; width: calc(var(--panel-letter) * 0.9); height: var(--panel-letter); overflow: visible;
  font-family: var(--font-display); font-weight: var(--weight-black); font-size: var(--panel-letter);
  opacity: 0.32;
}
.panel__letter-svg text {
  fill: var(--tier-letter-color, var(--color-text-muted)); fill-opacity: 0.35;
  stroke: var(--tier-edge, var(--color-text-muted)); stroke-width: 2; stroke-linejoin: bevel;
  paint-order: stroke fill;
}
.panel__letter::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-block-start: var(--line-hair) solid color-mix(in srgb, var(--tier-edge) 40%, var(--color-canvas));
  border-inline-start: var(--line-hair) solid color-mix(in srgb, var(--tier-edge) 40%, var(--color-canvas));
  background: color-mix(in srgb, var(--tier-edge) 8%, var(--color-canvas));
  clip-path: polygon(0 0, 100% 0, 100% 24%, 24% 100%, 0 100%);
}

/* กากบาททอง ไม่มีพื้นปุ่ม */
.panel__close {
  position: absolute; top: var(--space-2); right: var(--space-2); z-index: 2;
  display: grid; place-items: center; width: var(--tap-min); height: var(--tap-min);
  color: var(--color-prism-gold); text-decoration: none;
}
.panel__close .icon { width: calc(var(--icon-ui) * 1.3); height: calc(var(--icon-ui) * 1.3); }
.panel__close:hover { filter: brightness(1.2); }

.panel__grid {
  display: grid; min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "cond" "traits" "roster" "rest";
  row-gap: var(--space-8);
}
.panel__grid[hidden] { display: none; }
.panel__grid > * { min-width: 0; }

.panel-head {
  grid-area: head;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  min-height: var(--panel-head-min-h); justify-content: center; text-align: center;
  --hex-size: var(--hex-panel);
}
.panel-head .hex { margin-bottom: var(--space-2); }
.panel-head .sample-badge { order: 9; }
.panel-head__title { font-size: var(--text-h2); font-weight: var(--weight-semibold); line-height: var(--leading-h2); }
.panel-head__meta { font-size: var(--text-helper); line-height: var(--leading-helper); color: var(--color-text-muted); }
.panel-head__emblem { font-size: var(--text-body-sm); line-height: var(--leading-body-sm); color: var(--color-text-secondary); }

.panel-head, .panel-cond, .lite-note { margin-inline: var(--space-4); }
.panel-cond { grid-area: cond; display: grid; gap: var(--space-2); align-content: start; }
.cond-title { font-size: var(--text-h3); font-weight: var(--weight-semibold); line-height: var(--leading-h3); color: var(--color-prism-gold); }
.panel-cond p { font-size: var(--text-body-sm); line-height: var(--leading-body-sm); color: var(--color-text-secondary); }
.panel-traits { grid-area: traits; position: relative; }
.panel-roster { grid-area: roster; position: relative; }
.panel-rest { grid-area: rest; display: grid; row-gap: var(--space-8); min-width: 0; }
.panel-rest > section { min-width: 0; padding-top: var(--space-6); border-top: var(--line-hair) solid var(--color-divider); }
.panel-rest > section:first-child { border-top: 0; padding-top: 0; }
.lite-note {
  padding: var(--space-4); border: var(--line-hair) dashed var(--color-border-strong);
  border-radius: var(--radius-md); color: var(--color-text-secondary); text-align: center;
}

/* หัวข้อส่วน: ข้อความกลาง ลายเถาทองขนาบสองข้าง */
.section-title {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-size: var(--text-h3); font-weight: var(--weight-semibold); line-height: var(--leading-h3);
  text-align: center; color: var(--color-text-primary);
}
.flourish { width: var(--flourish-w); aspect-ratio: 90 / 28; height: auto; color: var(--color-prism-gold); }
.section-title .flourish { color: color-mix(in srgb, var(--color-prism-gold) 65%, var(--color-canvas)); }
.flourish--end { transform: scaleX(-1); }

/* ชิป trait สีตามขั้นเปิด: ไอคอน + ตัวเลข บรรทัดเดียว (ชื่อและขั้นเปิดเป็น tooltip)
   แถวเลื่อนแนวนอนบนมือถือ ทูลทิปจึงยึดกับ .panel-traits ไม่ใช่ชิป จะได้ไม่ถูก overflow ตัด
   พื้นที่แตะสูง --tap-min แต่แถวกินที่เท่าความสูงชิป */
.traits {
  --chip-w: var(--trait-chip-w); --chip-h: var(--trait-chip-h); --chip-icon: 16px; --chip-text: 14px; --chip-gap: 4px; --chip-pad: 5px; --chip-radius: 6px;
  --chip-touch: calc((var(--tap-min) - var(--chip-h)) / 2);
  display: flex; flex-wrap: nowrap; gap: 6px; margin-block: calc(-1 * var(--chip-touch)); padding-inline: var(--space-2);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.traits::-webkit-scrollbar { display: none; }
.traits--compact { --chip-w: 34px; --chip-h: 22px; --chip-icon: 13px; --chip-text: 12px; --chip-gap: 2px; --chip-pad: 4px; --chip-radius: 4px; gap: 4px; }
.traits--dense { --chip-w: 24px; --chip-icon: 11px; --chip-text: 11px; --chip-gap: 1px; --chip-pad: 2px; gap: 2px; }
.trait { flex: none; padding-block: var(--chip-touch); }
.trait:first-child { margin-inline-start: auto; }
.trait:last-child { margin-inline-end: auto; }
.trait:focus-visible { outline: none; }
.trait:focus-visible .trait__plate { box-shadow: 0 0 0 2px var(--color-canvas), 0 0 0 4px var(--color-focus); }
.trait__plate {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: var(--chip-gap);
  min-width: var(--chip-w); height: var(--chip-h); padding-inline: var(--chip-pad); border-radius: var(--chip-radius);
  background: var(--trait-chip-neutral); color: var(--trait-chip-neutral-ink);
  font-size: var(--chip-text); font-weight: var(--weight-bold); line-height: 1; font-variant-numeric: tabular-nums;
}
.trait__icon { width: var(--chip-icon); height: var(--chip-icon); flex: none; }
.trait--bronze .trait__plate { background: var(--trait-chip-bronze); color: var(--trait-chip-bronze-ink); }
.trait--silver .trait__plate { background: var(--trait-chip-silver); color: var(--trait-chip-silver-ink); }
.trait--gold .trait__plate { background: var(--trait-chip-gold); color: var(--trait-chip-gold-ink); }
.trait--prismatic .trait__plate { background: var(--trait-chip-prismatic); color: var(--trait-chip-prismatic-ink); }
.trait--silver .trait__icon, .trait--gold .trait__icon, .trait--prismatic .trait__icon { filter: brightness(0); }
.trait__name {
  position: absolute; z-index: 20; bottom: calc(100% + var(--space-2)); left: 50%; transform: translateX(-50%);
  display: none; padding: var(--space-1) var(--space-2);
  background: var(--color-overlay); border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-sm);
  font-size: var(--text-label); text-align: center; white-space: nowrap; pointer-events: none;
}
.trait__steps { display: block; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.trait__step { color: var(--color-prism-gold); font-weight: var(--weight-bold); }
.trait:focus-visible .trait__name, .trait.is-open .trait__name, html:not(.js) .trait:focus .trait__name { display: block; }
@media (hover: hover) { .trait:hover .trait__name { display: block; } }
.trait.is-dismissed .trait__name { display: none !important; }
/* แสงกวาดรอบเดียวตอนชี้หรือโฟกัส เฉพาะแถวในแผง (การ์ดมุมมองแถวไม่มี) */
@media (prefers-reduced-motion: no-preference) {
  .panel-traits .trait--prismatic .trait__plate::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%); pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  }
  .panel-traits .trait--prismatic:focus-visible .trait__plate::after { animation: trait-sweep 600ms var(--ease-in-out); }
  @media (hover: hover) and (pointer: fine) {
    .panel-traits .trait--prismatic:hover .trait__plate::after { animation: trait-sweep 600ms var(--ease-in-out); }
  }
  @keyframes trait-sweep { to { transform: translateX(100%); } }
}

/* แถวตัวละคร */
.roster {
  display: flex; justify-content: safe center; gap: var(--gap-hex-roster);
  overflow-x: auto; padding: var(--space-1);
  --hex-size: var(--hex-roster);
}
.roster__item { display: flex; flex: 0 0 var(--hex-size); flex-direction: column; align-items: center; }
.roster__name {
  display: block; width: var(--hex-size); margin-top: var(--space-1);
  font-size: var(--text-hex-name); font-weight: var(--weight-medium); line-height: var(--leading-hex-name);
  color: var(--color-text-secondary); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* แท็บเลเวลและ Flex: เม็ดยาโค้งมน พื้นเข้ม แท็บที่เลือกพื้นทอง */
.lv-tabs {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  column-gap: var(--space-2); margin: 0 auto var(--space-6);
  row-gap: max(var(--space-2), var(--tap-min) - var(--tab-lv-h));
  padding-block: max(0px, (var(--tap-min) - var(--tab-lv-h)) / 2);
  width: 100%; max-width: 100%;
}
.lv-tabs[hidden] { display: none; }
.lv-tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  flex: none; min-height: var(--tab-lv-h); padding: 0 var(--space-4);
  border: var(--line-hair) solid transparent; border-radius: var(--radius-pill);
  background: var(--color-surface-raised); color: var(--color-text-muted);
  font-family: var(--font-display); font-size: var(--text-button); font-weight: var(--weight-display); line-height: var(--leading-button);
  white-space: nowrap; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: scale 0.15s cubic-bezier(0.23, 1, 0.32, 1);
}
.lv-tab::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: max(var(--tap-min), 100%); transform: translateY(-50%); }
.lv-tab[aria-selected="true"] {
  background: var(--color-prism-gold); border-color: var(--color-prism-gold); color: var(--color-text-invert);
}
@media (hover: hover) and (pointer: fine) {
  .lv-tab:not([aria-selected="true"]):hover { color: var(--color-text-primary); }
}
@media (prefers-reduced-motion: no-preference) {
  .lv-tab:active { scale: 0.96; }
  /* เฉพาะการคลิก/แตะ (app.js) ปุ่มลูกศรสลับทันที */
  .lv-tabs--pointer ~ .lv-panel { transition: opacity 0.15s cubic-bezier(0.23, 1, 0.32, 1), transform 0.15s cubic-bezier(0.23, 1, 0.32, 1); }
  @starting-style { .lv-tabs--pointer ~ .lv-panel:not([hidden]) { opacity: 0; transform: translateY(4px); } }
}
.lv-panel + .lv-panel { margin-top: var(--space-8); }
.js .lv-panel + .lv-panel { margin-top: 0; }
.lv-panel[hidden] { display: none; }
.lv-panel__title { margin-bottom: var(--space-3); text-align: center; font-family: var(--font-display); font-weight: var(--weight-medium); color: var(--color-text-secondary); }
.js .lv-panel__title { position: absolute; width: var(--line-hair); height: var(--line-hair); overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lv-comment {
  max-width: 48em; margin: var(--space-5) auto 0; padding: 0 var(--space-4);
  text-align: center; font-size: var(--text-body-sm); line-height: var(--leading-body-sm); color: var(--color-text-secondary);
}
.lv-list {
  --hex-size: var(--hex-board);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: var(--space-3); margin: 0; padding: 0; list-style: none;
}
.lv-list__item { position: relative; flex: none; }
.lv-empty {
  margin: var(--space-8) 0 0; text-align: center;
  font-family: var(--font-display); font-size: var(--text-h3);
  color: var(--color-text-muted);
}

/* บอร์ด 4 × 7: ช่องว่างเป็นเส้นขอบหกเหลี่ยม */
.board { --hex-size: var(--hex-board); width: calc(var(--hex-size) * 7.5); max-width: 100%; margin-inline: auto; overflow: hidden; }
.board__row { display: flex; }
.board__row + .board__row { margin-top: calc(var(--hex-size) * (var(--hex-row-pitch) - 1)); }
.board__row:nth-child(even) { padding-inline-start: calc(var(--hex-size) / 2); }
.cell { position: relative; flex: none; width: var(--hex-size); height: var(--hex-size); }
.cell:not(.cell--unit)::before, .cell:not(.cell--unit)::after { content: ""; position: absolute; clip-path: var(--hex-clip); }
.cell:not(.cell--unit)::before { inset: 4%; background: color-mix(in srgb, var(--color-prism-violet) 30%, var(--color-border)); }
.cell:not(.cell--unit)::after { inset: calc(4% + var(--line-strong)); background: var(--color-canvas); }
.cell--unit .hex__frame { inset: 2%; }
.cell--unit .hex__img, .cell--unit .hex__placeholder { top: calc(2% + var(--hex-frame)); left: calc(2% + var(--hex-frame)); width: calc(96% - 2 * var(--hex-frame)); height: calc(96% - 2 * var(--hex-frame)); }
.hex__stars, .cell__stars {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; gap: 0; padding: 0 var(--space-1);
  background: var(--color-canvas); border-radius: var(--radius-pill);
  pointer-events: none;
}
.hex__stars svg, .cell__stars svg { width: calc(var(--hex-size) * 0.16); height: calc(var(--hex-size) * 0.16); fill: var(--color-prism-gold); stroke: none; }
.cell__items {
  position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%); z-index: 1;
  display: flex; gap: var(--line-hair);
}

/* ไอเทม: กรอบสี่เหลี่ยมทอง (ไม่ใช่ hex) ช่องว่างมีชื่อจนกว่าจะมีรูป */
.item-slot {
  display: inline-grid; place-items: center; flex: none;
  width: var(--item-slot); height: var(--item-slot);
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  border: var(--line-strong) solid var(--color-prism-gold); border-radius: var(--line-strong);
  font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-label);
}
.item-slot--xs { width: calc(var(--hex-size) * 0.22); height: calc(var(--hex-size) * 0.22); border-width: var(--line-hair); }
.item-slot--lg { width: var(--order-icon); height: var(--order-icon); }

/* คำอธิบายประกอบใต้การออกไอเทม: รูปตัวละครสี่เหลี่ยมขอบทอง ► ข้อความ */
.builds {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, var(--build-block-w)));
  justify-content: center; gap: var(--space-6);
}
.build { display: grid; gap: var(--space-3); min-width: 0; justify-items: center; }
.build__note { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.build__note-champ {
  width: calc(var(--build-champ) * 0.7); height: calc(var(--build-champ) * 0.7); flex: none; object-fit: cover;
  border: var(--line-strong) solid var(--color-prism-gold); border-radius: var(--line-strong);
}
.build__arrow { width: var(--space-4); height: var(--space-4); color: var(--color-prism-gold); }
.build__note p { font-size: var(--text-body-sm); font-weight: var(--weight-semibold); line-height: var(--leading-body-sm); color: var(--color-text-primary); }

/* ===== GRB-12 การออกไอเทม (ต้นแบบ v6c) เริ่ม =====
   มือถือ: <details> ต่อตัวถือ · ตั้งแต่ 768px: ตารางเต็มความกว้าง ขนาดไอคอนคิดจากความกว้างของ .gear (cqi) */
.gear {
  --gear-item: 44px; --gear-bis: 48px; --gear-part: 16px; --gear-recipe-gap: 4px; --gear-slot-gap: 6px;
  --gear-wash: color-mix(in srgb, var(--color-prism-gold) 8%, transparent);
  container-type: inline-size; margin-inline: var(--space-2);
}
.gear + .builds { margin-top: var(--space-6); }
.gear-table { display: none; }
.gear-holders { display: grid; gap: var(--space-3); }

.gear-item {
  flex: none; display: block; width: var(--gear-item); height: var(--gear-item); padding: 0;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.gear-item--bis { width: var(--gear-bis); height: var(--gear-bis); }
.gear-item img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; outline: 1px solid rgb(255 255 255 / 0.1); outline-offset: -1px; }
.gear-item--bis img { box-shadow: 0 0 0 1px var(--color-prism-gold); }
.gear-item--noimg {
  background: var(--color-surface-raised); border: var(--line-hair) dashed var(--color-border-strong); color: var(--color-text-secondary);
  font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: 1;
}
.gear-item[data-tip] img { outline-color: var(--color-prism-gold); }
.gear-item:active img { outline-color: var(--color-text-primary); }
.gear-item:focus-visible, .gear-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.gear-recipe { display: flex; flex: none; align-items: center; gap: var(--gear-recipe-gap); }
.gear-recipe__parts { display: grid; grid-template: repeat(2, var(--gear-part)) / var(--gear-part); gap: 2px; }
.gear-recipe__part { display: block; width: 100%; height: 100%; border-radius: 2px; background: var(--color-surface-raised); }
.gear-portrait { flex: none; object-fit: cover; border: var(--line-strong) solid var(--hex-color, var(--color-border-strong)); border-radius: var(--radius-sm); }
.gear-portrait--noimg { display: grid; place-items: center; background: var(--color-surface-raised); font-size: var(--text-label); font-weight: var(--weight-semibold); }
.gear-name { display: block; font-weight: var(--weight-semibold); line-height: 1.3; }
.gear-role { display: block; color: var(--color-prism-gold); font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-label); }

.gear-holder {
  min-width: 0; background: var(--color-surface);
  border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-md);
}
.gear-holder[open] {
  border-color: color-mix(in srgb, var(--color-prism-gold) 30%, var(--color-border));
}
.gear-holder__head {
  display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: 10px var(--space-3);
  border-radius: calc(var(--radius-md) - var(--line-hair)); list-style: none; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.gear-holder__head::-webkit-details-marker { display: none; }
.gear-holder__head:focus-visible { outline-offset: -4px; }
.gear-holder__head:active, .gear-tabs [role="tab"]:active { background-color: var(--color-surface-raised); }
.gear-holder__head .gear-portrait { width: 36px; height: 36px; }
.gear-holder__id { flex: 1; min-width: 0; }
.gear-holder__chev { flex: none; width: 20px; height: 20px; color: var(--color-text-muted); }
.gear-holder[open] .gear-holder__chev { color: var(--color-prism-gold); transform: rotate(180deg); }
.gear-holder__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: 0 var(--space-3) var(--space-5); }

.gear-tabs { display: flex; flex-wrap: nowrap; justify-content: center; gap: 0 var(--space-1); border-bottom: var(--line-hair) solid var(--color-border); }
html:not(.js) .gear-tabs { display: none; }
.gear-tabs [role="tab"] {
  position: relative; min-width: var(--tap-min); min-height: var(--tap-min); padding: var(--space-1) var(--space-2);
  background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--color-text-secondary); cursor: pointer;
  font-size: var(--text-helper); font-weight: var(--weight-semibold); line-height: var(--leading-helper); white-space: nowrap;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.gear-tabs [aria-selected="true"] { color: var(--color-prism-gold); }
.gear-tabs [aria-selected="true"]::after {
  content: ""; position: absolute; inset: auto 4px -1px; height: 2px; border-radius: var(--radius-pill); background: var(--color-prism-gold);
}
.gear-grid { display: grid; grid-template-columns: calc(var(--gear-bis) + var(--gear-recipe-gap) + var(--gear-part)) minmax(0, 1fr); column-gap: var(--space-3); align-items: start; }
.gear-panes { display: grid; gap: var(--space-3); min-width: 0; }
.gear-bis, .gear-pane { display: grid; grid-template-rows: 18px; grid-auto-rows: var(--gear-bis); row-gap: 7px; align-items: center; }
.js .gear-pane[data-off] { display: none; }
.gear-label { align-self: end; color: var(--color-prism-gold); font-size: var(--text-label); font-weight: var(--weight-bold); line-height: var(--leading-label); letter-spacing: 0.06em; }
.gear-bis .gear-label { width: var(--gear-bis); text-align: center; }
.gear-label--pane { letter-spacing: 0; }
.js .gear-label--pane { visibility: hidden; }
.gear-slot { display: flex; align-items: center; gap: var(--gear-slot-gap); min-width: 0; height: 100%; }

@media (width < 390px) {
  .gear-tabs { margin-inline: calc(-1 * var(--space-2)); column-gap: 2px; }
  .gear-tabs [role="tab"] { flex: none; padding-inline: var(--space-1); }
}
@media (width < 350px) {
  .gear { --gear-item: 36px; --gear-bis: 40px; --gear-slot-gap: 4px; --gear-recipe-gap: 2px; }
  .gear-tabs [role="tab"] { font-size: var(--text-label); }
}

@media (width >= 768px) {
  .gear {
    --gear-item: clamp(36px, 5.72cqi, 56px); --gear-bis: calc(var(--gear-item) + 4px); --gear-part: clamp(16px, 2.4cqi, 24px);
    --gear-recipe-gap: clamp(2px, 0.4cqi, 4px); --gear-slot-gap: clamp(4px, 0.6cqi, 6px); --gear-pad: clamp(6px, 1.4cqi, 16px);
    margin-inline: 0;
  }
  .gear-holders { display: none; }
  .gear-table {
    display: table; width: 100%; table-layout: fixed; border-collapse: collapse;
    border: var(--line-hair) solid var(--color-border-strong); background: var(--color-panel); font-size: var(--text-helper); line-height: var(--leading-helper);
  }
  .gear-col--champion { width: 16%; }
  .gear-col--bis { width: 14%; }
  .gear-col--subs { width: 34%; }
  .gear-col--specials { width: 25%; }
  .gear-col--emblems { width: 11%; }
  .gear-table thead { background: var(--color-tier-s-fill); color: var(--color-prism-gold); }
  .gear-table thead th {
    padding: 8px var(--gear-pad); font-weight: var(--weight-semibold); text-align: center;
    box-shadow: inset 0 calc(-1 * var(--line-hair)) var(--color-tier-s-border);
  }
  .gear-table td, .gear-champion { padding: 6px var(--gear-pad); vertical-align: middle; border-inline: var(--line-hair) solid var(--color-divider); }
  .gear-table tbody tr:first-child > * { border-top: var(--line-hair) solid var(--color-border-strong); }
  .gear-table tbody tr + tr td { border-top: var(--line-hair) solid var(--color-divider); }
  .gear-table tbody tr:nth-child(2) td { background: rgb(255 255 255 / 0.025); }
  .gear-champion { text-align: center; background: var(--color-surface); }
  .gear-champion .gear-portrait { display: block; width: clamp(56px, 9cqi, 88px); height: auto; aspect-ratio: 1; margin: 0 auto var(--space-1); }
  .gear-champion .gear-portrait--noimg { display: grid; }
  .gear-group { display: flex; align-items: center; gap: var(--gear-slot-gap); min-height: var(--gear-bis); }
  .gear-cell--bis .gear-group, .gear-cell--emblem .gear-group { justify-content: center; }
  .gear-cell--emblem .gear-group { flex-wrap: wrap; }
  @media (hover: hover) and (pointer: fine) { .gear-table tbody tr:hover td { background: var(--gear-wash); } }
}
@media (hover: hover) and (pointer: fine) {
  .gear-holder__head:hover { background-color: rgb(255 255 255 / 0.035); }
  .gear-holder__head:hover .gear-holder__chev, .gear-tabs [aria-selected="false"]:hover { color: var(--color-text-primary); }
  .gear-item:hover img { outline-color: var(--color-text-secondary); }
}
/* ชื่อไอเทม: กล่องเดียวท้าย body ที่ app.js สร้างและวางตำแหน่ง */
.gear-tip {
  position: fixed; z-index: 40; inset: 0 auto auto 0; width: max-content; max-width: min(16rem, calc(100% - 16px)); padding: var(--space-1) var(--space-2);
  visibility: hidden; opacity: 0; pointer-events: none;
  background: var(--color-overlay); border: var(--line-hair) solid var(--color-border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  color: var(--color-text-primary); font-size: var(--text-helper); font-weight: var(--weight-semibold); line-height: var(--leading-helper);
}
.gear-tip[data-visible] { visibility: visible; opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .gear-holder__chev { transition: transform 140ms var(--ease-out); }
  .gear-item img { transition: transform 100ms var(--ease-out); }
  .gear-item:active:not(:focus-visible) img { transform: scale(0.96); }
  .gear-tip[data-visible] { transition: opacity 125ms var(--ease-out); }
}
/* ===== GRB-12 การออกไอเทม จบ ===== */

/* ลำดับการออกไอเทม: ช่องสี่เหลี่ยมเรียงแถว คั่นด้วยลูกศรเล็ก */
.order { display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: var(--space-4) 0; }
.order__item { display: flex; align-items: flex-start; }
.order__item::before {
  content: ""; flex: none; align-self: flex-start;
  width: 0; height: 0; margin: calc(var(--order-icon) / 2 - var(--space-1)) var(--space-2) 0;
  border-block: var(--space-1) solid transparent; border-inline-start: var(--space-2) solid var(--color-prism-gold);
}
.order__item:nth-child(3n + 1)::before { visibility: hidden; }
.order__body { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); width: var(--order-icon); }
.order__name {
  font-size: var(--text-label); line-height: var(--leading-helper); color: var(--color-text-secondary); text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* AUGMENT: ไอคอนวง + ชื่อใต้ */

/* UNLOCK: แชมเปี้ยนที่ต้องปลดล็อก + วิธีปลด แทรกก่อน AUGMENT */
.unlocks {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.unlocks,
.unlock,
.unlock__body {
  min-width: 0;
}
.unlock {
  display: grid;
  grid-template-columns: var(--hex-roster) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-4);
  border-bottom: var(--line-hair) solid var(--color-divider);
}
.unlock__hex { --hex-size: var(--hex-roster); width: var(--hex-size); justify-self: center; }
.unlock__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-h3);
  line-height: var(--leading-h3);
  color: var(--color-text-primary);
  overflow-wrap: anywhere;
}
.unlock__cond {
  margin: var(--space-1) 0 0;
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}
@media (min-width: 720px) {
  .unlocks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
}

.augments { display: grid; grid-template-columns: repeat(3, var(--augment-size)); justify-content: center; gap: var(--space-5) var(--space-6); }
.aug { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); min-width: 0; }
.aug__slot {
  width: var(--augment-size); height: var(--augment-size); border-radius: 50%;
  background: var(--color-surface);
  border: var(--line-strong) solid color-mix(in srgb, var(--color-prism-violet) 70%, var(--color-text-primary));
  box-shadow: inset 0 0 0 var(--space-1) var(--color-canvas), inset 0 0 0 calc(var(--space-1) + var(--line-hair)) color-mix(in srgb, var(--color-prism-gold) 50%, transparent);
}
.aug__name {
  width: 100%; font-size: var(--text-label); font-weight: var(--weight-semibold); line-height: var(--leading-helper); color: var(--color-text-primary); text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 12. ส่วนท้าย: พื้นทึบเต็มกว้าง ---------- */
.site-footer {
  margin-top: var(--space-16); background: var(--color-footer);
  border-top: var(--line-strong) solid var(--color-footer-border); /* แยกจาก canvas #0A0B14 ให้ชัด */
}
.footer__main { display: grid; gap: var(--space-8); padding-block: var(--space-10); text-align: center; justify-items: center; }
.footer__brand { display: grid; gap: var(--space-3); justify-items: center; max-width: 36em; }
.footer__brand p { font-size: var(--text-body-sm); line-height: var(--leading-body-sm); color: var(--color-text-muted); }
.footer__social { display: grid; gap: var(--space-6); grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; max-width: 420px; text-align: start; }
.footer__col { display: grid; gap: var(--space-1); align-content: start; min-width: 0; }
.footer__head {
  display: flex; align-items: center; gap: var(--space-2);
  padding-bottom: var(--space-2); margin-bottom: var(--space-1);
  border-bottom: var(--line-hair) solid var(--color-border);
  font-size: var(--text-body-sm); font-weight: var(--weight-semibold); line-height: var(--leading-h3);
}
.footer__avatar {
  display: grid; place-items: center; flex: none;
  width: var(--footer-avatar); height: var(--footer-avatar); border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-prism-cyan), var(--color-prism-violet));
  color: var(--color-text-invert); font-family: var(--font-display); font-weight: var(--weight-display); font-size: var(--text-label);
}
.footer__avatar--b { background: linear-gradient(135deg, var(--color-prism-magenta), var(--color-prism-gold)); }
.footer__col a {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min);
  color: var(--color-text-secondary); text-decoration: none; font-size: var(--text-body-sm);
}
.footer__col a:hover { color: var(--color-text-primary); }
.social-ico {
  display: grid; place-items: center; flex: none;
  width: var(--space-6); height: var(--space-6); border-radius: 50%;
  background: var(--color-overlay); color: var(--color-text-primary);
}
.social-ico svg { width: 70%; height: 70%; fill: none; }
.footer__bottom { background: var(--color-footer); border-top: var(--line-hair) solid var(--color-footer-border); }
.footer__bottom-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-1) var(--space-4);
  padding-block: var(--space-2);
  font-size: var(--text-helper); line-height: var(--leading-helper); color: var(--color-text-muted);
}
.footer__bottom a { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--color-text-muted); }

/* ---------- 13. แถบตัวอย่างสไตล์ (เฉพาะต้นแบบ) ---------- */
.styleguide { margin-top: var(--space-16); padding: var(--space-8) var(--space-4); background: var(--color-surface); border-radius: var(--radius-lg); border: var(--line-hair) solid var(--color-border); }
.styleguide > h2 { font-size: var(--text-h1); font-weight: var(--weight-semibold); line-height: var(--leading-h1); margin-bottom: var(--space-2); }
.styleguide > p { color: var(--color-text-secondary); margin-bottom: var(--space-8); }
.sg-block + .sg-block { margin-top: var(--space-10); }
.sg-block > h3 { font-size: var(--text-h3); font-weight: var(--weight-semibold); line-height: var(--leading-h3); margin-bottom: var(--space-4); color: var(--color-text-primary); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--space-20) * 2), 1fr)); gap: var(--space-3); }
.swatch { display: grid; gap: var(--space-1); min-width: 0; }
.swatch__chip { height: var(--space-12); border-radius: var(--radius-sm); border: var(--line-hair) solid var(--color-border); }
.swatch code { font-size: var(--text-label); line-height: var(--leading-helper); color: var(--color-text-secondary); }
.type-scale { display: grid; gap: var(--space-4); }
.type-scale > div { display: grid; gap: var(--space-1); padding-bottom: var(--space-3); border-bottom: var(--line-hair) solid var(--color-divider); min-width: 0; }
.type-scale code { font-size: var(--text-label); color: var(--color-text-muted); line-height: var(--leading-helper); }
.sg-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; }
.sg-item { display: grid; gap: var(--space-2); justify-items: center; min-width: 0; }
.sg-item > small { font-size: var(--text-label); line-height: var(--leading-helper); color: var(--color-text-muted); text-align: center; }
.sg-hexes { --hex-size: var(--hex-roster); }
.sg-selected .hex { filter: drop-shadow(0 0 var(--space-2) var(--color-prism-gold)); }

/* ---------- 14. About Us (โครง Desktop-3 / Mobile-3) ---------- */
.about {
  padding-top: calc(var(--layout-header-h) + var(--space-6));
  background:
    radial-gradient(ellipse 60% 30% at 80% 10%, color-mix(in srgb, var(--color-prism-violet) 18%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 25% at 15% 55%, color-mix(in srgb, var(--color-prism-cyan) 12%, transparent), transparent 70%);
}
.about-row { display: grid; gap: var(--space-6); padding-block: var(--space-8); text-align: center; }
.about-row .about-art { order: -1; }
.about-row__text { display: grid; gap: var(--space-4); justify-items: center; }
.about-row__title { font-size: var(--text-h2); font-weight: var(--weight-semibold); line-height: var(--leading-h2); color: var(--color-prism-gold); }
.about-row__body { font-size: var(--text-body-sm); line-height: var(--leading-body-sm); color: var(--color-text-secondary); max-width: 34em; }
.social-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.social-btn { /* กรอบมนเล็กขอบทองบาง ตามภาพ desktop-3a */
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--tap-min); min-width: 132px; padding: 0 var(--space-4) 0 var(--space-2);
  background: linear-gradient(to bottom, var(--color-surface-raised), var(--color-surface));
  color: var(--color-text-primary); text-decoration: none;
  border: var(--line-hair) solid var(--color-prism-gold); border-radius: var(--radius-sm);
  font-size: var(--text-body-sm); font-weight: var(--weight-semibold); line-height: 1;
}
.social-btn:hover { filter: brightness(1.15); }

/* ภาพตกแต่งปริซึม (แทนศิลป์เซ็ต 18) */
.about-art { position: relative; width: min(100%, 420px); aspect-ratio: 5 / 4; justify-self: center; }
.about-art > span { position: absolute; }
.about-art__glow { inset: 0; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--color-prism-violet) 45%, transparent), transparent 65%); }
.about-art__card {
  left: 10%; top: 12%; width: 34%; aspect-ratio: 3 / 4; transform: rotate(-12deg);
  display: grid; place-items: center; border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--color-prism-cyan), var(--color-prism-violet));
  border: var(--line-strong) solid color-mix(in srgb, var(--color-text-primary) 70%, transparent);
  box-shadow: var(--shadow-2);
}
.about-art__mono { font-family: var(--font-display); font-weight: var(--weight-display); font-size: 64px; line-height: 1; color: var(--color-text-invert); }
.about-art__portrait {
  left: 36%; top: 6%; width: 44%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; text-align: center; padding: var(--space-4);
  background: radial-gradient(circle at 50% 35%, var(--color-overlay), var(--color-surface));
  border: var(--line-strong) dashed var(--color-border-strong);
  color: var(--color-text-muted); font-size: var(--text-label); line-height: var(--leading-helper);
}
.about-art__prism {
  right: 6%; bottom: 8%; width: 30%; aspect-ratio: 1 / 0.9; clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(160deg, color-mix(in srgb, var(--color-text-primary) 85%, transparent), color-mix(in srgb, var(--color-prism-violet) 80%, transparent) 60%, var(--color-prism-magenta));
}
.about-art__ray {
  left: 0; bottom: 18%; width: 72%; height: 14%;
  clip-path: polygon(0 0, 100% 45%, 100% 55%, 0 100%);
  background: linear-gradient(to bottom, var(--color-prism-gold), var(--color-prism-magenta), var(--color-prism-violet), var(--color-prism-cyan));
  opacity: 0.7; filter: blur(var(--line-strong));
}
.about-art__gem { aspect-ratio: 1; clip-path: var(--hex-clip); background: var(--gradient-prism); opacity: 0.8; }
.about-art__gem--1 { left: 4%; bottom: 6%; width: 12%; }
.about-art__gem--2 { right: 4%; top: 8%; width: 9%; opacity: 0.6; }
.about-art--b .about-art__card { background: linear-gradient(150deg, var(--color-prism-magenta), var(--color-prism-gold)); transform: rotate(10deg); }

.donate { display: grid; justify-items: center; gap: var(--space-5); padding-block: var(--space-10) var(--space-6); text-align: center; }
.donate__title { font-size: var(--text-h1); font-weight: var(--weight-semibold); line-height: var(--leading-h1); color: var(--color-prism-gold); }
.donate__row { display: flex; align-items: center; gap: var(--space-3); }
.donate__flourish { --flourish-w: 72px; }
.donate-btn { /* หกเหลี่ยมยืดแนวนอน มี chevron ในปุ่ม */
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-width: 180px; height: 60px; padding: 0 var(--space-8);
  color: var(--color-prism-gold); text-decoration: none;
  font-family: var(--font-display); font-weight: var(--weight-display); font-size: var(--text-h2);
}
.donate-btn::before, .donate-btn::after {
  content: ""; position: absolute; z-index: -1;
  clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%);
}
.donate-btn::before { inset: 0; background: var(--color-prism-gold); }
.donate-btn::after { inset: var(--line-strong); background: linear-gradient(to bottom, var(--color-surface-raised), var(--color-canvas)); }
.donate-btn svg { width: 22px; height: 22px; }
.donate-btn__end { transform: scaleX(-1); }
.donate-btn:hover { filter: brightness(1.15); }

/* ---------- ผังเดสก์ท็อป ---------- */
@media (min-width: 1024px) {
  .about { padding-top: var(--layout-header-h); }
  .about-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center;
    gap: var(--space-12); padding-block: var(--space-12); text-align: start;
  }
  .about-row .about-art { order: 0; width: min(100%, calc(620 * var(--u) + 120px)); }
  .about-row__text { justify-items: start; }
  .about-row__title { font-size: max(24px, calc(40 * var(--u))); }
  .about-row__body { font-size: var(--text-body); line-height: var(--leading-body); }
  .social-btns { justify-content: flex-start; }
  .about-row--flip .about-art { order: -1; }
  .about-row--flip .about-row__text { justify-items: end; text-align: end; }
  .about-row--flip .social-btns { justify-content: flex-end; }

  /* ภาพปก: KV เต็มกว้าง ข้อความชิดซ้าย อาร์ตโทนขวา-กลาง บน */
  .hero { align-items: stretch; }
  .hero__kv { object-position: 62% 28%; }
  .hero__scrim {
    background: var(--hero-scrim-desk-h), var(--hero-scrim-desk-v);
  }
  /* ข้อความปกชิดใต้แถบบน ไม่จัดกลางแนวตั้ง (ปกยังสูงตาม --layout-hero-h จาก .hero) */
  .hero__inner { display: flex; align-items: flex-start; padding-block: calc(var(--layout-header-h) + var(--space-6)) var(--space-10); }
  .hero__content { align-items: flex-start; text-align: start; gap: var(--space-5); }
  .plaque { margin-inline-start: calc(-0.03 * var(--plaque-w)); }
  .creators { justify-content: flex-start; gap: var(--space-4); }

  .meta-bar { justify-content: flex-end; font-size: var(--text-h3); }

  .filters { grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); align-items: center; gap: var(--space-4); }

  /* แถว tier: ป้าย ◆ hex×9 ◆ */
  .tier-row { padding-block: calc(20 * var(--u)); }
  .tier-row__inner {
    display: flex; align-items: center; gap: calc(16 * var(--u));
    min-height: var(--tier-label-h);
  }
  .tier-badge { flex: none; }
  .tier-badge__svg--desk { display: block; }
  .tier-badge__svg--mob { display: none; }
  .tier-arrow--next { margin-inline-start: auto; }
  .tier-track { display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: var(--gap-hex-tier); }

  /* เดสก์ท็อป: ชื่อคอมพ์เป็น tooltip ตอนชี้หรือโฟกัส */
  .tier-item .hex__name {
    position: absolute; z-index: 20; bottom: calc(100% + var(--space-2)); left: 50%; transform: translateX(-50%);
    display: none; width: max-content; max-width: var(--tooltip-max); margin: 0;
    padding: var(--space-2) var(--space-3);
    background: var(--color-overlay); color: var(--color-text-primary);
    border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-3);
    font-size: var(--text-body-sm); line-height: var(--leading-label);
    pointer-events: none;
  }
  .tier-item:hover .hex__name, .tier-item:focus-within .hex__name { display: block; }

  /* แผง: hex+ชื่อซ้าย เงื่อนไขขวา */
  .panel { padding: calc(40 * var(--u)) calc(64 * var(--u)) calc(64 * var(--u)); }
  .panel__close { top: var(--space-4); right: var(--space-4); }
  .panel__grid {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "head cond" "traits traits" "roster roster" "rest rest";
    column-gap: var(--space-12); row-gap: var(--space-10);
  }
  .panel-head { margin-inline: calc(80 * var(--u)) 0; }
  .panel-cond { align-self: center; padding-inline-end: var(--space-16); margin-inline: 0; }
  .panel-rest { row-gap: var(--space-10); }

  .traits { overflow: visible; }
  .trait { position: relative; }
  .trait__name { bottom: calc(100% - var(--chip-touch) + var(--space-2)); }

  .lv-tab { flex: none; }

  .builds { grid-template-columns: repeat(3, var(--build-block-w)); }
  .order { display: flex; flex-wrap: wrap; }
  .order__item:nth-child(3n + 1)::before { visibility: visible; }
  .order__item:first-child::before { display: none; }
  .augments { grid-template-columns: repeat(5, var(--augment-size)); gap: var(--space-6) var(--space-8); }

  /* ส่วนท้าย: โลโก้+คำโปรยซ้าย โซเชียลสองคอลัมน์ขวา */
  .footer__main {
    grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    min-height: calc(320 * var(--u)); padding-block: var(--space-12);
    text-align: start; justify-items: stretch;
  }
  .footer__brand { justify-items: start; }
  .footer__social { grid-template-columns: repeat(2, minmax(160px, auto)); column-gap: var(--space-10); }

  .styleguide { padding: var(--space-10); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  a.hex:hover, button.hex:hover, .hex.is-hover { transform: none; }
}

/* ======================================================================
   เฟส 4: ส่วนที่ต้นแบบเฟส 2 ไม่มี (ไม่มี inline style ใน HTML ตาม CSP style-src 'self')
   ====================================================================== */

/* sprite SVG (เดิมใช้ style="position:absolute") ห้าม display:none เพราะ gradient จะไม่ทำงาน */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
/* จุดสีของ gradient ป้าย tier (เดิมเป็น style attribute บน <stop>) */
.tg-s-0 { stop-color: var(--color-tier-s-border); } .tg-s-1 { stop-color: var(--color-tier-s); } .tg-s-2 { stop-color: var(--color-tier-s-end); }
.tg-a-0 { stop-color: var(--color-tier-a-border); } .tg-a-1 { stop-color: var(--color-tier-a); } .tg-a-2 { stop-color: var(--color-tier-a-end); }
.tg-b-0 { stop-color: var(--color-tier-b-border); } .tg-b-1 { stop-color: var(--color-tier-b); } .tg-b-2 { stop-color: var(--color-tier-b-end); }
.tg-c-0 { stop-color: var(--color-tier-c-border); } .tg-c-1 { stop-color: var(--color-tier-c); } .tg-c-2 { stop-color: var(--color-tier-c-end); }
.tg-x-0 { stop-color: var(--color-tier-x-border); } .tg-x-1 { stop-color: var(--color-tier-x); } .tg-x-2 { stop-color: var(--color-tier-x-end); }
.plaque-0 { stop-color: var(--color-surface-raised); } .plaque-1 { stop-color: var(--color-surface); }

/* Mobile-2: เงื่อนไขการเล่นอยู่ใต้แถวตัวละคร (CHROME-CAPTURE 5 ข้อ 7, SPEC 1.3 ข้อ 2) */
.panel__grid { grid-template-areas: "head" "traits" "roster" "cond" "rest"; }
.panel-cond { text-align: center; padding-bottom: var(--space-6); border-bottom: var(--line-hair) solid var(--color-divider); }
.panel-loading { padding: var(--space-8) var(--space-4); text-align: center; color: var(--color-text-secondary); }

/* hex ที่เป็นลิงก์ไม่มีเส้นใต้ */
.tier-item .hex, .tier-item .hex:hover { text-decoration: none; }

/* แถบค้นหาแบบไม่มี JavaScript: ชิปเป็นลิงก์ query string และมีปุ่มค้นหา */
a.chip { text-decoration: none; }
.filters__submit {
  min-height: var(--tap-min); padding: 0 var(--space-4);
  background: var(--color-surface-raised); color: var(--color-prism-gold);
  border: var(--line-hair) solid var(--color-prism-gold); border-radius: var(--radius-pill);
  font: inherit; font-weight: var(--weight-semibold); cursor: pointer;
}
.js .filters__submit { display: none; }
.filters__clear { color: var(--color-accent); font-size: var(--text-body-sm); }

/* ตราที่ไม่มีรูป: ใช้ตัวย่อในวงกลม (DESIGN-SYSTEM 9) และรูปตราจริงเมื่อมี */
.hex__emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ช่องโฆษณา (DESIGN-SYSTEM 15.4) — มีเฉพาะเมื่อเปิดโฆษณา */
.ad-slot { display: grid; justify-items: center; margin-block: var(--ad-gap-mobile); }
.ad-slot__inner { width: 100%; max-width: var(--ad-max-w-wide-mobile); }
.ad-slot--top-below-hero .ad-slot__inner { max-width: var(--ad-max-w-top-mobile); }
.ad-slot__label {
  display: block; height: var(--ad-label-h); line-height: var(--ad-label-h);
  font-size: var(--text-label); color: var(--color-text-muted); text-align: start;
}
.ad-slot__box {
  display: block; overflow: hidden; width: 100%;
  background: var(--color-surface); border: var(--line-hair) solid var(--color-border); border-radius: var(--radius-sm);
}
.ad-slot__box ins { display: block; width: 100%; height: 100%; }
.tiers > .ad-slot { padding-block: var(--space-5); margin-block: 0; border-top: var(--line-hair) solid var(--color-divider); list-style: none; }

/* หน้า 404 / privacy / terms */
.page-plain { padding-top: calc(var(--layout-header-h) + var(--space-10)); padding-bottom: var(--space-16); min-height: 60vh; }
.page-plain h1 { font-size: var(--text-h1); font-weight: var(--weight-semibold); line-height: var(--leading-h1); color: var(--color-prism-gold); margin-bottom: var(--space-6); }
.page-plain p { max-width: 48em; color: var(--color-text-secondary); line-height: var(--leading-body); }
.page-plain p + p { margin-top: var(--space-4); }
.page-plain .pill-btn { margin-top: var(--space-8); }
.about-art__portrait-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }


/* เพิ่มเฟส 4: รูปจริงในช่องไอเทม/augment เมื่อมี, ร่องโลโก้ (เดิม style attribute), ชื่อกำกับ augment */
.item-slot img, .aug__slot img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.aug__slot--img { overflow: hidden; }
.logo__grooves { stroke: var(--color-canvas); }

/* สลับมุมมอง: อยู่ข้างช่องค้นหาบนมือถือ ท้ายแถบบนเดสก์ท็อป */
.filters { grid-template-columns: minmax(0, 1fr) auto; }
.filters__chips { grid-column: 1 / -1; }
.view-toggle { grid-area: 1 / 2; display: flex; }
.view-toggle__btn {
  display: grid; place-items: center; width: var(--tap-min); height: var(--tap-min);
  color: var(--color-text-muted); border: var(--line-hair) solid var(--color-border); background: var(--color-surface);
}
.view-toggle__btn:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.view-toggle__btn:last-child { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.view-toggle__btn[aria-pressed="true"] { position: relative; background: var(--color-overlay); color: var(--color-prism-gold); border-color: var(--color-prism-gold); }
.view-toggle__btn:focus-visible { position: relative; z-index: 1; }

/* มุมมองแถว: การ์ดละคอมพ์ ขอบสีตาม tier มือถือซ้อนบนล่าง เดสก์ท็อปซ้ายขวา */
.tier-row[data-tier="S"] { --row-tier: var(--color-tier-s); }
.tier-row[data-tier="A"] { --row-tier: var(--color-tier-a); }
.tier-row[data-tier="B"] { --row-tier: var(--color-tier-b); }
.tier-row[data-tier="C"] { --row-tier: var(--color-tier-c); }
.tier-row[data-tier="X"] { --row-tier: var(--color-tier-x); }
.tier-row__inner--list { display: block; min-height: 0; }
.tier-list { min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.tier-list__panel { --hex-size: initial; min-width: 0; } /* แผงไม่รับขนาด hex ของแถว เหมือนตอนอยู่ใต้แถวในมุมมองเดิม */
.tier-list .panel-wrap { margin-top: 0; }
.comp-row.is-filtered { display: none; }
.comp-row__link {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2) var(--space-4); align-items: center;
  padding: var(--space-3); background: var(--color-surface); color: inherit; text-decoration: none;
  border: var(--line-hair) solid var(--row-tier); border-inline-start-width: var(--line-focus); border-radius: var(--radius-md);
}
@media (hover: hover) and (pointer: fine) { .comp-row__link:hover { background: var(--color-surface-raised); } }
.comp-row.is-selected .comp-row__link { box-shadow: inset 0 0 0 var(--line-hair) var(--color-prism-gold); }
.comp-row__summary { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
/* ป้าย tier ขนาดหนึ่งแถว รูปทรงเดียวกับป้ายเดสก์ท็อปทุกขนาดจอ */
.comp-row__tier { --tier-label-h: 44px; --tier-label-w: calc(var(--tier-label-h) * 228 / 150); flex: none; }
.comp-row__tier .tier-badge__svg { display: block; }
.comp-row__identity { position: relative; flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.comp-row__name { font-weight: var(--weight-semibold); line-height: var(--leading-h3); }
/* ชิปในการ์ดไม่ใช่ปุ่ม (ทั้งการ์ดเป็นลิงก์) ทูลทิปยึดกับบล็อกชื่อ จะได้ไม่ถูก overflow ตัด */
.comp-row .traits { --chip-touch: 0px; padding-inline: 0; overflow-x: auto; overflow-y: hidden; }
.comp-row .trait { position: static; }
.comp-row .trait:first-child { margin-inline-start: 0; }
.comp-row .trait:last-child { margin-inline-end: 0; }
.comp-row .trait__name { left: 0; top: calc(100% + var(--space-1)); bottom: auto; transform: none; }
.comp-row__board {
  --hex-size: 44px;
  display: flex; align-items: center; gap: var(--space-1); min-width: 0;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.comp-row__board::-webkit-scrollbar { display: none; }
.comp-row__plus { flex: none; padding-inline: var(--space-1); color: var(--color-text-muted); font-weight: var(--weight-bold); }
.comp-unit { position: relative; flex: none; padding-block: calc(var(--hex-size) * 0.26) calc(var(--hex-size) * 0.18); }
.comp-unit .hex__placeholder { padding: 0; font-size: 9px; }
.comp-unit__stars { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: center; }
.comp-unit__stars svg { width: calc(var(--hex-size) * 0.26); height: calc(var(--hex-size) * 0.26); fill: var(--color-prism-gold); stroke: none; }
.comp-unit__items { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: var(--line-hair); }
.comp-unit .item-slot--xs { width: calc(var(--hex-size) * 0.3); height: calc(var(--hex-size) * 0.3); }
.comp-unit__level {
  position: absolute; top: calc(var(--hex-size) * 0.26); right: 0; display: grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--color-prism-gold); color: var(--color-text-invert); font-size: 10px; font-weight: var(--weight-bold); line-height: 1;
}

@media (min-width: 1024px) {
  .filters { grid-template-columns: minmax(200px, 320px) minmax(0, 1fr) auto; }
  .filters__chips { grid-column: 2; }
  .view-toggle { grid-area: 1 / 3; }
  .tier-list .builds { grid-template-columns: repeat(auto-fit, minmax(0, var(--build-block-w))); }
  /* คอลัมน์ซ้ายกว้างตามชิป (ชื่อไม่ดันความกว้าง) บอร์ดเหลือไม่ต่ำกว่า 30% แล้วเลื่อนในแถบของตัวเอง
     ชิปย่อเมื่อเกิน 6 และเกิน 10: 10 ชิปย่อ = 376px อยู่ในช่องชิปที่จอ 1024px */
  .comp-row__link { grid-template-columns: minmax(34%, max-content) minmax(30%, 1fr); }
  .comp-row__identity { flex-basis: auto; }
  .comp-row__name { width: 0; min-width: 100%; }
  .comp-row .traits:has(> :nth-child(7)) { --chip-w: 34px; --chip-h: 22px; --chip-icon: 13px; --chip-text: 12px; --chip-gap: 2px; --chip-pad: 4px; --chip-radius: 4px; gap: 4px; }
  .comp-row .traits:has(> :nth-child(11)) { --chip-w: 24px; --chip-icon: 11px; --chip-text: 11px; --chip-gap: 1px; --chip-pad: 2px; gap: 2px; }
  .comp-row__tier { --tier-label-h: max(48px, calc(72 * var(--u))); }
  .comp-row__board { --hex-size: max(36px, calc(56 * var(--u))); }
  .panel__grid { grid-template-areas: "head cond" "traits traits" "roster roster" "rest rest"; }
  .panel-cond { text-align: start; padding-bottom: 0; border-bottom: 0; }
  .ad-slot { margin-block: var(--ad-gap-desktop); }
  .ad-slot__inner { max-width: var(--ad-max-w-wide-desktop); }
  .ad-slot--top-below-hero .ad-slot__inner { max-width: var(--ad-max-w-top-desktop); }
  html:not(.js) .tier-track { flex-wrap: wrap; row-gap: var(--space-4); }
}

/* ======================================================================
   GRB-10 เฟส C: ลิงก์คอมพ์ โครงร่างแผง รายการโปรด แถบติดบน ปัดหน้า และไมโครอินเทอร์แอคชัน
   ====================================================================== */

.chip, .pill-btn, .tier-arrow, .view-toggle__btn, .fav-btn, a.hex, button.hex, .comp-row__link {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.chip, .lv-tab, .view-toggle__btn, .copy-btn, .copy-link { user-select: none; -webkit-user-select: none; }

/* ปุ่มที่ใช้ได้เฉพาะเมื่อมี JavaScript */
html:not(.js) .copy-link, html:not(.js) .chip--fav { display: none; }

.copy-link { flex: none; width: var(--copy-btn-h); height: var(--copy-btn-h); padding: 0; }

/* รายการโปรด: ดาวที่มุมซ้ายบนซึ่งหกเหลี่ยมเว้นว่าง ปุ่มวางทับโดยไม่กินที่ในผัง */
.chip--fav { justify-content: center; min-width: var(--tap-min); padding: 0; }
.chip--fav .icon, .fav-btn .icon { stroke-width: 2; stroke-linejoin: round; }
.chip--fav[aria-pressed="true"] .icon, .fav-btn[aria-pressed="true"] .icon { fill: currentColor; }
.comp-row, .panel-head { position: relative; }
.fav-btn {
  position: absolute; z-index: 1; top: calc(-1 * var(--space-3)); left: -10px;
  display: grid; place-items: center; width: var(--tap-min); height: var(--tap-min);
  padding: 0; border: 0; background: none; color: var(--color-text-secondary); cursor: pointer;
}
.fav-btn[aria-pressed="true"] { color: var(--color-prism-gold); }
.fav-btn:focus-visible { outline-offset: -8px; border-radius: 50%; }
.fav-btn::before { /* พื้นมืดหลังดาว ให้อ่านออกบนขอบหกเหลี่ยม */
  content: ""; grid-area: 1 / 1; width: 24px; height: 24px; border-radius: 50%;
  background: color-mix(in srgb, var(--color-canvas) 75%, transparent);
}
.fav-btn .icon { position: relative; grid-area: 1 / 1; width: 16px; height: 16px; }
/* จอสัมผัส: กล่องกด 28px ยื่นออกในช่องว่างระหว่างรายการ ทับแค่มุมที่หกเหลี่ยมถูกตัดและขอบว่างของการ์ด แตะรูปจึงเปิดคอมพ์เสมอ */
@media not all and (hover: hover) and (pointer: fine) {
  .tier-item > .fav-btn, .comp-row > .fav-btn { width: 28px; height: 28px; top: -16px; left: -16px; place-items: end; }
  .comp-row > .fav-btn { top: -12px; left: -10px; }
  .tier-item > .fav-btn::before, .comp-row > .fav-btn::before { width: 20px; height: 20px; }
  .tier-item > .fav-btn .icon, .comp-row > .fav-btn .icon { width: 14px; height: 14px; margin: 3px; }
  .tier-item > .fav-btn[aria-pressed="false"], .comp-row > .fav-btn[aria-pressed="false"] { color: var(--color-text-muted); }
  .tier-item > .fav-btn:focus-visible, .comp-row > .fav-btn:focus-visible { outline-offset: 0; }
}
.panel-head > .fav-btn {
  left: calc(50% - var(--hex-panel) / 2 - 10px);
  top: calc((var(--panel-head-min-h) - var(--hex-panel)) / 2 - var(--space-8));
}
@media (hover: hover) and (pointer: fine) {
  .tier-item > .fav-btn, .comp-row > .fav-btn { width: 32px; height: 32px; top: calc(-1 * var(--space-2)); left: calc(-1 * var(--space-2)); }
  .comp-row > .fav-btn { top: -6px; left: 0; }
  .fav-btn:focus-visible { outline-offset: -4px; }
  .fav-btn:hover { color: var(--color-prism-gold); }
  .view-toggle__btn:hover { color: var(--color-prism-gold); }
  .fav-btn[aria-pressed="false"] { opacity: 0; }
  .tier-item:hover > .fav-btn, .comp-row:hover > .fav-btn, .fav-btn:focus-visible, .panel-head > .fav-btn { opacity: 1; }
  .comp-row:hover { z-index: 2; } /* ทูลทิป trait ของการ์ดที่ชี้อยู่ต้องทับการ์ดถัดไป */
}

/* โครงร่างระหว่างรอแผง: ตัวกล่องอยู่ตำแหน่งเดียวกับ .panel (เว้นที่แถวปุ่มคัดลอกไว้) */
.panel-skeleton { margin-top: var(--space-5); padding-top: calc(var(--copy-btn-h) + var(--space-4)); scroll-margin-top: var(--space-4); }
.tier-list .panel-skeleton { margin-top: 0; }
.panel-skeleton::before {
  content: ""; display: block; min-height: var(--panel-head-min-h);
  background: var(--color-canvas);
  border: var(--line-hair) solid var(--color-border);
}

/* แท็บ LV: เม็ดยาทองเป็นชั้นใต้ข้อความของแท็บที่เลือก JS เลื่อนชั้นนี้มาจากแท็บเดิม */
.lv-tab { isolation: isolate; }
.lv-tab[aria-selected="true"] { z-index: 1; background: var(--color-surface-raised); border-color: transparent; }
.lv-tab[aria-selected="true"]::after {
  content: ""; position: absolute; inset: calc(-1 * var(--line-hair)); z-index: -1;
  border-radius: inherit; background: var(--color-prism-gold); transform-origin: 0 0; pointer-events: none;
}

/* แถวที่แบ่งหน้า: เบราว์เซอร์เลื่อนแนวตั้งและซูมได้ ส่วนแนวนอนเป็นการปัดหน้า (app.js) */
.tier-row.is-paged .tier-track { touch-action: pan-y pinch-zoom; }
.tier-row.is-paged .tier-track .hex { -webkit-touch-callout: none; }

@media (prefers-reduced-motion: no-preference) {
  .chip, .pill-btn, .view-toggle__btn, .hex, .comp-row__link { transition: transform var(--dur-press) var(--ease-out); }
  .fav-btn { transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out); }
  @media (hover: hover) and (pointer: fine) {
    .comp-row__link:hover { transform: translateY(calc(-1 * var(--line-hair))); }
  }
  .chip:active, .pill-btn:active:not(:disabled), .view-toggle__btn:active,
  a.hex:active, button.hex:active, .comp-row__link:active { transform: scale(0.98); }
  .fav-btn:active { transform: scale(0.95); }
  .panel-skeleton { animation: skeleton-pulse 900ms ease-in-out infinite alternate; }
  @keyframes skeleton-pulse { to { opacity: 0.6; } }
}

/* แถบค้นหาติดบนเดสก์ท็อป: ต่ำกว่าทูลทิป (z 20) พื้นเท่า canvas ระยะรอบนอกหักล้างกันจึงไม่ขยับผัง */
@media (min-width: 1024px) and (min-height: 480px) {
  .js .filters {
    position: sticky; top: 0; z-index: 15;
    margin: calc(-1 * var(--space-2)); padding: var(--space-2);
    background: var(--color-canvas);
  }
  .js:has(.filters) { scroll-padding-top: calc(var(--tap-min) + var(--space-8)); }
  .js:has(.filters__clear) { scroll-padding-top: calc(var(--tap-min) + var(--space-20)); }
}
