/* ============================================================
   FORMATIX — Formatix Community (UI v2 · docs/แผนปรับโฉมหน้าเว็บ.md ข้อ 10)
   C2: ใช้ได้ทุกจอ — กฎหลักคือจอคอม แล้วมีชั้นมือถือ/แท็บเล็ต/โหมดแอปทับทีหลัง
   C1 (สไลด์ Formatix Community): ฟีดคอลัมน์เดียว คั่นด้วยเส้น 1px เส้นเดียว
     ตัดออกแล้ว — แถบสลับซ้ายขวา · โฟกัสลึก (ย่อ/จาง/เบลอตอนไถ) · แสงตามสื่อรอบจอ · เส้นเวลา · กระจกที่หัวและกล่องเขียนโพสต์ · ตัวอักษรขนาดใหญ่เกิน
   กติกา: เนื้อหาของคนโพสต์ต้องเด่นที่สุด — รูปไม่ครอป ไม่มีอะไรวางทับ ดีไซน์ไม่แย่งสายตา
   ============================================================ */

/* เมนู 03 เรียก Formatix Community ทุกจอแล้ว (C2) */
.lbl-v1 { display: none; }
.lbl-v2 { display: inline; }

/* หน้าชุมชนเป็นพื้นเรียบ: ปิดลายจุดและแสงมุมจอของเว็บ ให้รูปของคนโพสต์เป็นสิ่งเดียวที่มีสี */
body[data-view="social"] .atmos { display: none; }

.sx {
  --sx-col: 720px;                                  /* ความกว้างของคอลัมน์อ่าน */
  --sx-mh: 560px;                                   /* ความสูงมากสุดของรูปในฟีด */
  position: relative;
  min-height: 100vh;
  padding: calc(var(--nav-space) + 6px) 20px 160px;
}
.sx > * {
  width: min(var(--sx-col), 100%);
  margin-inline: auto;
}
.sx.is-minimal { --sx-col: 900px; }   /* โปรไฟล์กว้างกว่าเล็กน้อย */

/* ---------- แถบบน: พื้นเรียบ ติดหัวจอ มีแค่เส้นคั่นเส้นเดียว ---------- */
.sx-bar {
  position: sticky;
  top: var(--sx-top, 72px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 10px;
  padding: 14px 0 12px;
  border-bottom: var(--hair);
  background: var(--bg);
}
.sx-title { margin: 0 8px 0 0; font: 700 20px/1 var(--font-brand); letter-spacing: .01em; white-space: nowrap; }
.sx-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
:is(.sx-tabs, .sx-sort) button {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--pill);
  color: var(--dim);
  font: 500 14.5px/1 var(--font-display);
  white-space: nowrap;
  transition: color var(--dur-2), background var(--dur-2);
}
:is(.sx-tabs, .sx-sort) button:hover { color: var(--ink); background: var(--surface-2); }
:is(.sx-tabs, .sx-sort) button.is-on { color: var(--ink); font-weight: 600; background: var(--surface-2); }
.sx-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.sx-sort { display: flex; gap: 4px; margin-left: auto; }
.sx-sort[hidden] { display: none; }
.sx-sort[hidden] + .sx-new { margin-left: auto; }
.sx-new { height: 36px; padding: 0 18px; border-radius: var(--pill); white-space: nowrap; }

/* ---------- เขียนโพสต์: กล่องพื้นเรียบ ไม่มีกระจกและเงา ---------- */
.sx-compose {
  margin: 14px auto 0;                              /* .sx > * จัดกึ่งกลางให้ — margin ย่อของกล่องนี้ต้องคง auto ไว้ */
  padding: 18px 20px 14px;
  border: var(--hair);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.sx-compose[hidden] { display: none; }
.sx-compose-row { display: flex; gap: 12px; }
.sx-compose textarea {
  flex: 1;
  min-height: 76px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 17px/1.65 var(--font-body);
  resize: vertical;
  outline: none;
}
.sx-compose-preview { position: relative; width: max-content; max-width: 100%; margin: 12px 0 0 52px; }
.sx-compose-preview[hidden] { display: none; }
.sx-compose-preview img { display: block; max-width: 100%; max-height: 260px; border-radius: var(--r-md); }
.sx-compose-preview .sx-act { position: absolute; top: 8px; right: 8px; height: 34px; padding: 0 10px; background: var(--surface); }
.sx-compose-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: var(--hair); }
.sx-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: transparent;
  color: var(--mute);
  font: 500 14px/1 var(--font-display);
  cursor: pointer;
}
.sx-count { margin-left: auto; color: var(--dim); font: 400 12px/1 var(--font-mono); }
.sx-ghost {
  height: 38px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink);
}
.sx-ghost:hover { border-color: var(--ink); }

/* ---------- ฟีด: แถวเรียงลงมา คั่นด้วยเส้นเดียว ไม่มีการ์ด ไม่มีเงา ---------- */
.sx-feed { margin: 0; padding: 0; list-style: none; }
.sx-band {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 0;
  border-top: var(--hair);
}
.sx-band:first-child { border-top: 0; }

/* รูปที่แนบ: กว้างเท่าคอลัมน์ สูงไม่เกิน 560px ไม่ครอป ไม่มีอะไรวางทับ */
.sx-media {
  margin: 2px 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  cursor: zoom-in;
}
.sx-media img { display: block; width: auto; height: auto; max-width: 100%; max-height: var(--sx-mh); margin-inline: auto; }
.sx-media:not(.is-ready) { aspect-ratio: 4 / 3; }
.sx-media:not(.is-ready) img { width: 100%; height: 100%; opacity: 0; }
.sx-media[hidden] { display: none; }

.sx-author { display: flex; align-items: center; gap: 12px; }
.sx-author > div { display: grid; gap: 1px; min-width: 0; }
.sx-author span { color: var(--dim); font-size: 13.5px; }
:is(.sx-author, .sx-sh-head, .sx-comments) .px-av { width: 42px; height: 42px; font-size: 17px; }
.sx-comments .px-av { width: 36px; height: 36px; font-size: 15px; }
.px-av.is-brand { background: none; border-radius: 0; }
.sx-hex { width: 100%; height: 100%; }
.sx-name { padding: 0; border: 0; background: none; color: var(--ink); font: 600 16px/1.3 var(--font-display); text-align: left; }
button.sx-name { cursor: pointer; }
button.sx-name:hover { color: var(--accent); }
.sx-verified { display: inline-grid; margin-left: 2px; vertical-align: -3px; color: var(--accent); }
.sx-tag { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.sx-tag.is-chip { display: inline-flex; align-self: flex-start; height: 30px; margin-bottom: 10px; padding: 0 13px; border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); border-radius: var(--pill); font: 500 13.5px/1 var(--font-display); align-items: center; }

/* ---------- ช่องของชุมชน (C3): ป้ายตัวหนังสือท้ายแถวคนโพสต์ ---------- */
.sx-chan { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.sx-chan button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--chan, var(--dim));
  font: 500 13.5px/1 var(--font-display);
  white-space: nowrap;
  cursor: pointer;
}
.sx-chan button:hover { text-decoration: underline; }
.sx-solved, .sx-stage {
  height: 22px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  color: var(--dim);
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: .04em;
}
.sx-solved.is-on { border-color: transparent; background: color-mix(in oklab, #11906A 18%, transparent); color: #11906A; }
/* สถานะไอเดียที่ทีมตั้ง: รอพิจารณา = เส้นขอบเทา · รับไว้ น้ำเงิน · กำลังทำ ส้ม · ปล่อยแล้ว เขียว · ไม่ทำ = เทาจาง */
.sx-stage { --st: var(--dim); }
.sx-stage[data-stage="accepted"] { --st: #3E6FD9; }
.sx-stage[data-stage="doing"]    { --st: #C26400; }
.sx-stage[data-stage="done"]     { --st: #11906A; }
.sx-stage[data-stage="accepted"], .sx-stage[data-stage="doing"], .sx-stage[data-stage="done"] { border-color: transparent; background: color-mix(in oklab, var(--st) 18%, transparent); }
.sx-stage { color: var(--st); }
.sx-stage[data-stage="declined"] { color: var(--dim); text-decoration: line-through; text-decoration-thickness: 1px; }
.sx-pinned { color: var(--accent); font-weight: 600; }
[data-chan="showcase"] { --chan: #0B93A6; }
[data-chan="qna"]      { --chan: #C26400; }
[data-chan="ideas"]    { --chan: #11906A; }
[data-chan="updates"]  { --chan: var(--accent); }
.sx-sh-head .sx-chan { align-self: center; }

/* เลือกช่องก่อนโพสต์ — บังคับเสมอ ยังไม่เลือก = ปุ่มโพสต์ปิดอยู่ */
.sx-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.sx-picks-lead { margin-right: 2px; color: var(--dim); font: 500 11.5px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; }
.sx-pick {
  display: grid;
  gap: 2px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.sx-pick b { color: var(--ink); font: 600 14px/1.3 var(--font-display); }
.sx-pick span { color: var(--dim); font-size: 12.5px; line-height: 1.3; }
.sx-pick:hover { border-color: var(--ink); }
.sx-pick.is-on { border-color: var(--chan, var(--accent)); background: color-mix(in oklab, var(--chan, var(--accent)) 10%, transparent); }
.sx-pick.is-on b { color: var(--chan, var(--accent)); }
.sx-rules { margin: 10px 0 0; color: var(--dim); font-size: 12.5px; line-height: 1.6; }
.sx-compose .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ปักคำตอบในช่องถาม–ตอบ (เจ้าของโพสต์เท่านั้น) */
.sx-c-flag { color: #11906A; font: 500 11.5px/1 var(--font-mono); letter-spacing: .04em; }
.sx-c-act.is-pin { width: auto; height: 28px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--pill); font: 500 12.5px/1 var(--font-display); }
.sx-c-act.is-pin.is-on { border-color: transparent; background: color-mix(in oklab, #11906A 16%, transparent); color: #11906A; }
.sx-c-act.is-pin + .sx-c-act { margin-left: 0; }
.sx-comments li.is-answer { padding: 12px 14px; border-radius: var(--r-md); background: color-mix(in oklab, #11906A 7%, transparent); }

/* ข้อความของโพสต์: ขนาดเดียวทั้งฟีด ตัดที่ 8 บรรทัดแล้วกดอ่านต่อ */
.sx-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font: 400 17px/1.65 var(--font-body);
  white-space: pre-line;
  overflow-wrap: anywhere;
  cursor: pointer;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
}
.sx-news-title { margin: 0; font: 600 21px/1.35 var(--font-display); letter-spacing: -.005em; cursor: pointer; }
.sx-news-desc {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--mute);
  font-size: 16px;
  line-height: 1.65;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* ---------- ปุ่มของโพสต์ + ถูกใจแตกหกเหลี่ยม (ตอบตอนกดเท่านั้น) ---------- */
.sx-acts { display: flex; align-items: center; gap: 2px; margin: 0 0 0 -12px; }
.sx-act {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--pill);
  color: var(--mute);
  font: 500 14.5px/1 var(--font-display);
  transition: background var(--dur-2), color var(--dur-2);
}
.sx-act:hover { background: var(--surface-2); color: var(--ink); }
.sx-act[data-sx-like].is-on { color: #e8487a; }
.sx-act[data-sx-like].is-on svg { fill: currentColor; animation: px-pop var(--dur-3) var(--ease-spring); }
.sx-act[data-sx-save].is-on { color: var(--accent); }
.sx-act[data-sx-save].is-on svg, .sx-pill.is-on svg { fill: currentColor; }
.sx-read { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--accent); font: 600 14.5px/1 var(--font-display); }
.sx-read:disabled { opacity: .35; cursor: default; }
.sx-spark {
  position: absolute;
  top: 50%; left: 22px;
  width: 9px; height: 9px;
  margin: -4.5px;
  background: var(--c);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  pointer-events: none;
  animation: sx-spark .72s var(--ease-out) forwards;
}
@keyframes sx-spark {
  from { transform: rotate(var(--a)) translateY(0) scale(.3); opacity: 1; }
  to { transform: rotate(var(--a)) translateY(-36px) scale(1.1); opacity: 0; }
}

.sx-empty { padding: 56px 0; color: var(--dim); font-size: 16px; list-style: none; }
.sx-skel {
  height: 260px;
  margin: 24px 0;
  border-radius: var(--r-lg);
  list-style: none;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: px-shine 1.4s linear infinite;
}
.sx-skel.is-hero { height: 180px; }
.sx-skel.is-sm { height: 80px; margin: 12px 0; }
.sx-end { height: 1px; }

/* ---------- โปรไฟล์: เต็มคอลัมน์ มินิมอล · กลิตช์เฉพาะชื่อและขอบรูป ---------- */
.sx-prof { display: flex; align-items: center; gap: clamp(24px, 2.6vw, 44px); padding: clamp(28px, 3vw, 48px) 0 clamp(24px, 2.4vw, 36px); }
.sx-prof-av { position: relative; flex: none; width: clamp(120px, 9vw, 164px); aspect-ratio: 1; }
.sx-prof-av::before,
.sx-prof-av::after { content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: .72; }
.sx-prof-av::before { background: var(--gl-a); transform: translate(-6px, -6px); animation: sx-ring-a .6s steps(1) 1; }
.sx-prof-av::after { background: var(--gl-b); transform: translate(6px, 6px); animation: sx-ring-b .6s steps(1) 1; }
.sx-prof-av > * {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  color: var(--mute);
  font: 700 clamp(40px, 3.4vw, 60px)/1 var(--font-display);
}
@keyframes sx-ring-a { 0% { transform: translate(-14px, 4px); } 30% { transform: translate(4px, -10px); } 60% { transform: translate(-6px, -6px); } }
@keyframes sx-ring-b { 0% { transform: translate(12px, -4px); } 30% { transform: translate(-4px, 10px); } 60% { transform: translate(6px, 6px); } }
.sx-prof-main { flex: 1; min-width: 0; }
.sx-prof-name {
  margin: 0;
  overflow-wrap: anywhere;
  font: 700 clamp(34px, 3.2vw, 56px)/1.1 var(--font-display);
  letter-spacing: -.025em;
  text-shadow: -3px 0 color-mix(in oklab, var(--gl-a) 75%, transparent), 3px 0 color-mix(in oklab, var(--gl-b) 80%, transparent);
}
.sx-prof-sub { margin: 12px 0 0; color: var(--mute); font-size: 17px; }
.sx-prof-stats { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 18px 0 0; color: var(--mute); font-size: 16px; }
.sx-prof-stats b { margin-right: 6px; color: var(--ink); font: 700 20px/1 var(--font-display); }
.sx-prof .sx-ghost { align-self: flex-start; margin-top: 12px; }
.sx-ghost.is-quiet { display: inline-flex; align-items: center; gap: 8px; border-color: var(--line); color: var(--mute); }
.sx-ghost.is-quiet:hover { border-color: var(--danger); color: var(--danger); }
.sx-ptabs { display: flex; gap: 28px; margin-bottom: 4px; border-bottom: var(--hair); }
.sx-ptabs button { position: relative; padding: 0 0 12px; color: var(--dim); font: 500 17px/1.2 var(--font-display); }
.sx-ptabs button.is-on { color: var(--ink); font-weight: 600; }
.sx-ptabs button.is-on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.sx-prof-missing { padding: 100px 0; }
.sx-prof-missing h2 { margin: 0 0 20px; font: 700 32px/1.25 var(--font-display); }

/* ---------- แผ่นอ่าน: พื้นหลังมืดลงเฉย ๆ ไม่เบลอทั้งจอ · รูปขนาดจริง ไม่มีแสงซ้อนหลัง ---------- */
.sx-today { display: grid; place-items: center; padding: clamp(28px, 6vh, 64px) 20px; }
.sx-today .layer-scrim { background: rgba(6, 6, 12, .62); -webkit-backdrop-filter: none; backdrop-filter: none; }
.sx-sheet {
  position: relative;
  z-index: 1;
  width: min(880px, calc(100vw - 64px));
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
.sx-today.is-open .sx-sheet { opacity: 1; transform: none; }
/* ปุ่มปิดอยู่ในแถบหัวเหนือรูปและเลื่อนไปกับหัว (ไม่ติดลอย — ลอยแล้วจะทับรูปตอนเลื่อนอ่าน) · ปิดได้อีกทางด้วย Esc / คลิกพื้นหลัง / ปัดลง */
.sx-x {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
}
.sx-x:hover { background: var(--surface-3); }
.sx-sh-head { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 18px 76px 14px 24px; }
.sx-sh-head > div { display: grid; gap: 1px; }
.sx-sh-head span { color: var(--dim); font-size: 13.5px; }
/* D4: หัวแผ่นอ่านมีปุ่มบันทึก/แก้ไขเป็นเม็ดเล็ก · ป้าย "แก้ไขแล้ว" ต่อท้ายเวลา · ฟอร์มแก้ไขแทนที่ข้อความในที่เดิม */
.sx-sh-head .sx-sh-tools { display: flex; gap: 8px; flex: none; }
.sx-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: transparent;
  color: var(--mute);
  font: 500 13.5px/1 var(--font-display);
  cursor: pointer;
  transition: border-color var(--dur-2), color var(--dur-2);
}
.sx-pill b { font-weight: 500; }
.sx-pill svg { width: 16px; height: 16px; }
.sx-pill:hover { border-color: var(--ink); color: var(--ink); }
.sx-pill.is-on { border-color: color-mix(in oklab, var(--accent) 55%, transparent); color: var(--accent); }
.sx .sx-edited, .sx-today .sx-edited { color: var(--dim); font-style: normal; }
.sx-edit { display: grid; gap: 10px; margin: 2px 0 4px; padding: 12px 14px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.sx-edit:focus-within { border-color: var(--accent); }
.sx-edit textarea { width: 100%; min-height: 96px; padding: 2px 0; border: 0; background: transparent; color: var(--ink); font: 400 17px/1.65 var(--font-body); resize: vertical; outline: none; }
.sx-edit-bar { display: flex; align-items: center; gap: 8px; }
.sx-edit-bar .sx-count { margin-right: auto; margin-left: 0; }
.sx-edit-bar .btn { height: 36px; padding: 0 18px; border-radius: var(--pill); }
.sx-sh-media { position: relative; display: flex; align-items: center; justify-content: center; max-height: 72vh; margin: 0; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.sx-sh-img { display: block; flex: none; width: auto; height: auto; max-width: 100%; max-height: 72vh; }
.sx-sh-media.is-zoom { max-height: none; cursor: zoom-out; }
.sx-sh-media.is-zoom .sx-sh-img { max-height: none; }
.sx-sh-in { padding: 24px clamp(24px, 3vw, 36px) 36px; }
.sx-sh-text { margin: 0 0 16px; font: 400 17px/1.7 var(--font-body); white-space: pre-line; overflow-wrap: anywhere; }
.sx-sh-title { margin: 0 0 16px; font: 700 26px/1.3 var(--font-display); letter-spacing: -.01em; }
.sx-sh-in > p { margin: 0 0 1em; color: var(--mute); font-size: 17px; line-height: 1.75; }
.sx-sh .sx-read[data-sx-open] { display: none; }
.sx-sh-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.sx-sh-cta .btn { height: 44px; gap: 8px; padding: 0 20px; border-radius: var(--pill); }
.sx-sh-nav { display: flex; justify-content: space-between; margin-top: 26px; padding-top: 16px; border-top: var(--hair); }
.sx-sh-nav .sx-read { margin: 0; }
.sx-comments { margin-top: 24px; padding-top: 20px; border-top: var(--hair); }
.sx-comments h3 { margin: 0 0 14px; color: var(--dim); font: 500 12px/1.3 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; }
.sx-comments ol { display: grid; gap: 16px; margin: 0 0 20px; padding: 0; list-style: none; }
.sx-comments li { display: flex; gap: 12px; }
.sx-c-body { flex: 1; min-width: 0; }
.sx-c-head { display: flex; align-items: center; gap: 10px; }
.sx-c-head .sx-name { font-size: 15px; }
.sx-c-head span { color: var(--dim); font-size: 13px; }
.sx-c-act { display: grid; place-items: center; width: 32px; height: 32px; margin-left: auto; border-radius: 50%; color: var(--dim); }
.sx-c-act:hover { background: var(--surface-2); color: var(--ink); }
.sx-c-body p { margin: 4px 0 0; font-size: 16px; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.sx-c-form { display: flex; align-items: flex-end; gap: 10px; padding: 7px 7px 7px 18px; border: 1px solid var(--line-strong); border-radius: 26px; }
.sx-c-form textarea { flex: 1; min-height: 38px; padding: 8px 0 0; border: 0; background: transparent; color: var(--ink); font: 400 16px/1.6 var(--font-body); resize: none; outline: none; }
.sx-c-form .btn { height: 38px; padding: 0 18px; border-radius: var(--pill); }
.sx-muted { color: var(--dim); }

/* ---------- Credits · Feedback · Information (แผงเดิมของ Other ในหน้าตาชุมชน) ---------- */
.sx-info { padding-top: 8px; }
.sx-info .ohead { display: flex; align-items: baseline; gap: 14px; margin: 24px 0 16px; padding-top: 16px; border-top: var(--hair); }
.sx-info .ohead h3 { font: 700 22px/1.3 var(--font-display); }
.sx-info .people { grid-template-columns: minmax(0, 1fr); gap: 0; }
.sx-info .person {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  border: 0;
  border-top: var(--hair);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.sx-info .person:hover { transform: none; box-shadow: none; }
.sx-info .person-ph { flex: none; width: 72px; aspect-ratio: 1; border-radius: 50%; }
.sx-info .person-ph span { font-size: 26px; }
.sx-info .person-ph::after { display: none; }
.sx-info .person-body { padding: 0; }
.sx-info .person-name { font-size: 19px; }
.sx-info .person-go { position: static; margin-left: auto; }
.sx-info .fb-big { font-size: clamp(30px, 3vw, 44px); }
.sx-info .about-lead p { font: 600 clamp(20px, 1.8vw, 28px)/1.45 var(--font-display); letter-spacing: -.01em; }

/* ============================================================
   C2 — มือถือ / แท็บเล็ต / โหมดแอป (ทุกจอที่ไม่ใช่ UI v2 คือ < 1024px หรือโหมดแอป)
   ใช้ไฟล์และ API ชุดเดียวกับจอคอม ต่างกันแค่การจัดวาง:
   คอลัมน์เดียวเต็มกว้าง ขอบ 16px · ชิปหมวดเลื่อนแนวนอนแถวเดียว · เปิดโพสต์เต็มจอ
   · เขียนโพสต์เป็นแผ่นขึ้นจากด้านล่าง · ปุ่ม + ลอยเหนือแถบเมนูล่างที่เว็บมีอยู่แล้ว
   ============================================================ */
/* view-in (style.css) เติม transform ค้างไว้ (fill: both) → ตัว view กลายเป็นกรอบของ position: fixed
   ปุ่ม + ลอย และแผ่นเขียนโพสต์จะหลุดตำแหน่ง — หน้านี้ไม่ต้องมีแอนิเมชันเข้าหน้าอยู่แล้ว */
html:not([data-ui="v2"]) #view-social.is-on { animation: none; }

html:not([data-ui="v2"]) .sx {
  --sx-col: 100%;
  --sx-mh: 68vh;
  --sx-top: var(--nav-space);
  min-height: auto;
  padding: calc(var(--nav-space) + 10px) var(--gutter) 24px;
}
html:not([data-ui="v2"]) .sx.is-minimal { --sx-col: 100%; }

/* แถบบน: แถวชื่อ+การเรียง แล้วชิปหมวดเลื่อนแนวนอนอีกแถว */
html:not([data-ui="v2"]) .sx-bar {
  gap: 8px 10px;
  margin: 0 calc(-1 * var(--gutter)) 2px;
  padding: 8px var(--gutter) 6px;
}
html:not([data-ui="v2"]) .sx-title { order: 1; margin: 0; font-size: 17px; }
html:not([data-ui="v2"]) .sx-sort { order: 2; margin-left: auto; }
html:not([data-ui="v2"]) .sx-tabs {
  order: 3;
  flex: 1 0 100%;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
html:not([data-ui="v2"]) .sx-tabs::-webkit-scrollbar { display: none; }
html:not([data-ui="v2"]) .sx-sep { display: none; }
html:not([data-ui="v2"]) :is(.sx-tabs, .sx-sort) button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--mute);
  font-size: 14px;
}
html:not([data-ui="v2"]) :is(.sx-tabs, .sx-sort) button.is-on { border-color: transparent; background: var(--ink); color: var(--bg); }

/* ปุ่มเขียนโพสต์: ลอยมุมล่างขวา เหนือแถบเมนูล่างของเว็บ */
html:not([data-ui="v2"]) .sx-new {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
  z-index: 69;
  height: 48px;
  padding: 0 20px;
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .55);
}
html:not([data-ui="v2"]) body.has-layer .sx-new { display: none; }

/* เขียนโพสต์: แผ่นขึ้นจากด้านล่าง เต็มกว้าง */
html:not([data-ui="v2"]) .sx-compose {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 71;
  width: auto;
  max-height: 88vh;
  margin: 0;
  padding: 16px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-top: var(--hair);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 50px -22px rgba(0, 0, 0, .65);
  animation: sx-rise var(--dur-3) var(--ease-out);
}
@keyframes sx-rise { from { transform: translateY(100%); } }
html:not([data-ui="v2"]) .sx-compose textarea { font-size: 16px; }   /* 16px = iOS ไม่ซูมหน้าเองตอนพิมพ์ */
html:not([data-ui="v2"]) .sx-compose-preview { margin-left: 0; }
html:not([data-ui="v2"]) .sx-compose-preview img { max-height: 200px; }

/* ฟีด: แถวแน่นขึ้น ปุ่มกดง่ายขึ้น */
html:not([data-ui="v2"]) .sx-band { gap: 10px; padding: 18px 0; }
html:not([data-ui="v2"]) .sx-text { font-size: 16px; -webkit-line-clamp: 6; }
html:not([data-ui="v2"]) .sx-news-title { font-size: 19px; }
html:not([data-ui="v2"]) .sx-news-desc { font-size: 15px; -webkit-line-clamp: 2; }
html:not([data-ui="v2"]) .sx-media { margin: 0; border-radius: var(--r-md); }
html:not([data-ui="v2"]) :is(.sx-author, .sx-sh-head) .px-av { width: 38px; height: 38px; font-size: 15px; }
html:not([data-ui="v2"]) .sx-name { font-size: 15px; }
html:not([data-ui="v2"]) .sx-acts { gap: 0; margin-left: -10px; }
html:not([data-ui="v2"]) .sx-act { height: 40px; padding: 0 10px; font-size: 14px; }
html:not([data-ui="v2"]) .sx-read { font-size: 14px; }
html:not([data-ui="v2"]) .sx-skel { height: 180px; margin: 18px 0; }

/* โปรไฟล์: เรียงลงมา ไม่ล้นจอ */
html:not([data-ui="v2"]) .sx-prof { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px 0 18px; }
html:not([data-ui="v2"]) .sx-prof-av { width: 96px; }
html:not([data-ui="v2"]) .sx-prof-name { font-size: 30px; }
html:not([data-ui="v2"]) .sx-prof-sub { margin-top: 8px; font-size: 15px; }
html:not([data-ui="v2"]) .sx-prof-stats { gap: 6px 22px; margin-top: 14px; font-size: 15px; }
html:not([data-ui="v2"]) .sx-prof-stats b { font-size: 18px; }
html:not([data-ui="v2"]) .sx-ptabs { gap: 20px; }
html:not([data-ui="v2"]) .sx-ptabs button { font-size: 15.5px; }
html:not([data-ui="v2"]) .sx-prof-missing { padding: 60px 0; }
html:not([data-ui="v2"]) .sx-prof-missing h2 { font-size: 24px; }

/* เปิดโพสต์ = เต็มจอ (ปิดด้วยปุ่ม X / ปัดลง / ปุ่มย้อนกลับของเครื่อง) */
html:not([data-ui="v2"]) .sx-today { place-items: stretch; padding: 0; }
html:not([data-ui="v2"]) .sx-sheet {
  width: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: translateY(20px);
}
html:not([data-ui="v2"]) .sx-x { top: calc(10px + env(safe-area-inset-top)); right: 12px; }
html:not([data-ui="v2"]) .sx-sh-head { min-height: 0; padding: calc(12px + env(safe-area-inset-top)) 64px 12px var(--gutter); }
html:not([data-ui="v2"]) .sx-sh-media, html:not([data-ui="v2"]) .sx-sh-img { max-height: 64vh; }
html:not([data-ui="v2"]) .sx-sh-in { padding: 18px var(--gutter) calc(48px + env(safe-area-inset-bottom)); }
html:not([data-ui="v2"]) .sx-sh-title { font-size: 22px; }
html:not([data-ui="v2"]) .sx-sh-text, html:not([data-ui="v2"]) .sx-sh-in > p { font-size: 16px; }
html:not([data-ui="v2"]) .sx-c-form textarea { font-size: 16px; }

/* แผง Credits / Feedback / Information ใช้หน้าตามือถือเดิมของมันเอง */
html:not([data-ui="v2"]) .sx-info .people { grid-template-columns: 1fr; }
html:not([data-ui="v2"]) .sx-info .person-ph { width: 56px; }

/* ---------- ลดการเคลื่อนไหว ---------- */
html.motion-off :is(.sx, .sx-today) * { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  :is(.sx, .sx-today) * { animation: none !important; transition: none !important; }
}

/* ช่อง (C3) บนมือถือ: ป้ายช่องเล็กลง ตัวเลือกช่องเรียงเต็มกว้าง */
html:not([data-ui="v2"]) .sx-chan { gap: 6px; }
html:not([data-ui="v2"]) .sx-chan button { font-size: 13px; }
html:not([data-ui="v2"]) .sx-solved, html:not([data-ui="v2"]) .sx-stage { height: 20px; padding: 0 8px; font-size: 11px; }
html:not([data-ui="v2"]) .sx-picks { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; gap: 8px; }
html:not([data-ui="v2"]) .sx-picks-lead { grid-column: 1 / -1; margin: 0; }
html:not([data-ui="v2"]) .sx-pick { padding: 10px 12px; }
html:not([data-ui="v2"]) .sx-c-act.is-pin { height: 30px; }

/* D4 บนมือถือ: ป้ายช่อง + ปุ่มบันทึก/แก้ไขมาอยู่แถวใต้ชื่อในแผ่นอ่าน · แถวปุ่มของโพสต์แคบลงให้พอดีจอ */
html:not([data-ui="v2"]) .sx-sh-head { flex-wrap: wrap; row-gap: 10px; }
html:not([data-ui="v2"]) .sx-sh-head .sx-chan { order: 4; margin-left: 0; }
html:not([data-ui="v2"]) .sx-sh-head .sx-sh-tools { order: 5; margin-left: auto; }
html:not([data-ui="v2"]) .sx-pill { height: 38px; }
html:not([data-ui="v2"]) .sx-act { padding: 0 9px; }
html:not([data-ui="v2"]) .sx-edit textarea { font-size: 16px; }
html:not([data-ui="v2"]) .sx-edit-bar .btn { height: 40px; }

/* ============================================================
   D1 — จอคอม 3 คอลัมน์: รางช่องซ้าย · ฟีดกลาง · แผงข้อมูลชุมชนขวา
   รางซ้ายแทนแท็บ 8 อันที่หัว (แท็บชุดเดิมยังอยู่สำหรับมือถือ/แท็บเล็ต/โหมดแอป)
   ฟีดกว้างคงที่ ~680px — ที่เพิ่มคือสองข้างที่ใช้งานได้จริง ไม่ใช่ของตกแต่ง
   ชื่อคลาสใช้ sx-cols / sx-ftop เพราะ sx-grid / sx-top ถูกหน้าร้านค้า (store.css) ใช้แล้ว
   ============================================================ */
.sx { --sx-wide: 1280px; --sx-bar-h: 64px; }
.sx > :is(.sx-bar, .sx-cols) { width: min(var(--sx-wide), 100%); }

/* หัว: ชื่อ + ปุ่มเขียนโพสต์ + รูปของฉัน (แท็บและการเรียงย้ายไปรางซ้าย/หัวฟีด) */
html[data-ui="v2"] .sx-bar { flex-wrap: nowrap; min-height: var(--sx-bar-h); margin-bottom: 18px; }
html[data-ui="v2"] .sx-bar > :is(.sx-tabs, .sx-sort) { display: none; }
html[data-ui="v2"] .sx-bar .sx-new { margin-left: auto; }
.sx-new-short { display: none; }
.sx-me { display: inline-flex; flex: none; align-items: center; justify-content: center; padding: 0; border-radius: 50%; }
.sx-me[hidden] { display: none; }
.sx-me:hover { opacity: .85; }

/* 3 คอลัมน์ */
.sx-cols {
  display: grid;
  grid-template-columns: 232px minmax(0, 680px) 296px;
  gap: 0 36px;
  justify-content: center;
  align-items: start;
}
.sx-main { min-width: 0; }

/* รางซ้าย */
.sx-rail {
  position: sticky;
  top: calc(var(--sx-top, 72px) + var(--sx-bar-h) + 18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sx-rail-nav { display: flex; flex-direction: column; gap: 2px; }
.sx-rail-lead, .sx-box h2 { margin: 0 0 6px 12px; color: var(--dim); font: 500 12px/1 var(--font-mono); letter-spacing: .08em; }
.sx-ri {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r-md);
  color: var(--mute);
  font: 500 15px/1 var(--font-display);
  text-align: left;
  transition: color var(--dur-2), background var(--dur-2);
}
.sx-ri:hover { color: var(--ink); background: var(--surface-2); }
.sx-ri.is-on { color: var(--ink); font-weight: 600; background: color-mix(in oklab, var(--accent) 10%, transparent); }
.sx-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--chan, var(--dim)); }
[data-chan="all"] { --chan: var(--ink); }
.sx-ri.is-plain { padding-left: 32px; }
.sx-rail-rules { margin: 0 0 0 12px; color: var(--dim); font: 400 13.5px/1.6 var(--font-body); }
.sx-rail-rules summary { cursor: pointer; color: var(--mute); font: 500 14px/1.4 var(--font-display); }
.sx-rail-rules summary:hover { color: var(--ink); }
.sx-rail-rules ol { margin: 10px 0 0; padding-left: 20px; }
.sx-rail-rules li + li { margin-top: 6px; }

/* แผงขวา: เลื่อนไปกับหน้า (สูงกว่าจอแล็ปท็อป ถ้าตรึงไว้ท้ายแผงจะถูกตัดทิ้ง) · รางซ้ายต่างหากที่ตรึง */
.sx-side { display: flex; flex-direction: column; gap: 16px; }
.sx-box { padding: 18px 20px 20px; border: var(--hair); border-radius: var(--r-lg); background: var(--surface); }
.sx-box h2 { margin: 0 0 10px; }
.sx-box p { margin: 0; color: var(--mute); font: 400 14.5px/1.65 var(--font-body); }
.sx-chlist { margin: 0; padding: 0; list-style: none; }
.sx-chlist li + li { margin-top: 2px; }
.sx-chlist button { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 9px 10px; border-radius: var(--r-md); text-align: left; transition: background var(--dur-2); }
.sx-chlist button:hover { background: var(--surface-2); }
.sx-chlist b { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 600 14.5px/1.3 var(--font-display); }
.sx-chlist span { padding-left: 18px; color: var(--dim); font: 400 13px/1.5 var(--font-body); }

/* หัวฟีด: แถบเขียนโพสต์ → (กล่องเขียนโพสต์) → ชื่อช่อง + การเรียง */
.sx-feedtop { display: block; }
.sx-feedtop[hidden] { display: none; }
.sx-launch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: var(--hair);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.sx-launch[hidden] { display: none; }
.sx-launch .avatar { flex: none; }
.sx-launch-go {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: transparent;
  color: var(--dim);
  font: 400 15px/1 var(--font-body);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sx-launch-go:hover { border-color: var(--ink); color: var(--mute); }
.sx-launch-c {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid color-mix(in oklab, var(--chan) 40%, transparent);
  border-radius: var(--pill);
  background: transparent;
  color: var(--chan);
  font: 500 13.5px/1 var(--font-display);
  transition: background var(--dur-2);
}
.sx-launch-c:hover { background: color-mix(in oklab, var(--chan) 10%, transparent); }
.sx-feedtop .sx-compose { margin: 0 0 4px; }
.sx-ftop { display: flex; align-items: center; gap: 12px; padding: 16px 0 6px; }
.sx-feed-h { margin: 0; font: 600 17px/1.2 var(--font-display); letter-spacing: -.005em; }
.sx-ftop .sx-sort { margin-left: auto; }
.sx-ftop .sx-sort button { height: 30px; padding: 0 12px; font-size: 14px; }

/* โปรไฟล์ / Credits / Feedback / Information: รางซ้าย + คอลัมน์กว้างขึ้น ไม่มีแผงขวา */
.sx.is-minimal .sx-cols, .sx.is-info .sx-cols { grid-template-columns: 232px minmax(0, 1fr); }
.sx.is-minimal .sx-main, .sx.is-info .sx-main { width: min(900px, 100%); margin-inline: auto; }
.sx.is-minimal .sx-side, .sx.is-info .sx-side { display: none; }

@media (max-width: 1279px) {
  .sx-cols { grid-template-columns: 208px minmax(0, 1fr) 272px; gap: 0 24px; }
  .sx.is-minimal .sx-cols, .sx.is-info .sx-cols { grid-template-columns: 208px minmax(0, 1fr); }
}
@media (max-width: 1099px) {
  .sx-cols { grid-template-columns: 208px minmax(0, 720px); }
  .sx.is-minimal .sx-cols, .sx.is-info .sx-cols { grid-template-columns: 208px minmax(0, 1fr); }
  .sx-side { display: none; }
}

/* ---------- มือถือ / แท็บเล็ต / โหมดแอป: ไม่มีรางและแผงข้าง ใช้ชิปหมวดชุดเดิม ---------- */
html:not([data-ui="v2"]) .sx { --sx-wide: 100%; }
html:not([data-ui="v2"]) .sx-cols { display: block; }
html:not([data-ui="v2"]) .sx-main { width: auto; }
html:not([data-ui="v2"]) :is(.sx-rail, .sx-side, .sx-me, .sx-launch, .sx-ftop) { display: none; }
html:not([data-ui="v2"]) .sx-feedtop:not([hidden]) { display: contents; }   /* กล่องเขียนโพสต์ (แผ่นล่าง) อยู่ในนี้ */
html:not([data-ui="v2"]) .sx-new-long { display: none; }
html:not([data-ui="v2"]) .sx-new-short { display: inline; }
html:not([data-ui="v2"]) .sx > .sx-bar { width: auto; }   /* ให้พื้นหัวเต็มขอบจอ (margin ติดลบเท่า gutter) ชื่อกับปุ่มเรียงจะได้อยู่แถวเดียวกัน */

/* ============================================================
   D2 — ค้นหา · #แท็ก · ตัวกรองฟีด · ชิปสถานะถาม–ตอบ · คำตอบที่ปักในฟีด
   พื้นเรียบ เส้นบาง ไม่มีเงา/เบลอ/เรืองแสง — ใช้สีเน้นของธีมแค่ที่ตัวหนังสือกับไฮไลต์คำค้น
   ============================================================ */

/* #แท็กในข้อความโพสต์ */
.sx-hash { color: var(--accent); font-weight: 500; text-decoration: none; }
.sx-hash:hover, .sx-hash:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* ช่องค้นหาบนหัว: จอคอม = แถบค้นหากลางหัว + รายการที่ลงมาใต้แถบ */
.sx-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 420px; margin-left: 28px; }
.sx-s-btn, .sx-s-close { display: none; }
.sx-s-form {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--dim);
  transition: border-color var(--dur-2);
}
.sx-s-form:hover { border-color: var(--dim); }
.sx-s-form:focus-within { border-color: var(--accent); color: var(--mute); }
.sx-s-ic { display: inline-flex; flex: none; }
.sx-s-form input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 400 15px/1 var(--font-body);
  -webkit-appearance: none;
  appearance: none;
}
.sx-s-form input::placeholder { color: var(--dim); }
.sx-s-form input::-webkit-search-cancel-button { display: none; }
.sx-s-x { display: none; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: var(--dim); }
.sx-s-x:hover { background: var(--surface-2); color: var(--ink); }
.sx-search.has-q .sx-s-x { display: inline-flex; }

/* รายการผลลัพธ์ แบ่งกลุ่ม: โพสต์ · คน · แท็กและผลงาน */
.sx-sr {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(520px, calc(100vw - 2 * var(--gutter)));
  max-height: min(72vh, 540px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg);
}
.sx-sr.is-busy { opacity: .6; }
.sx-sr section + section { margin-top: 4px; padding-top: 4px; border-top: var(--hair); }
.sx-sr h3 { margin: 0; padding: 10px 10px 6px; color: var(--dim); font: 500 12px/1 var(--font-mono); letter-spacing: .08em; }
.sx-sr-row {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background var(--dur-2);
}
.sx-sr-row:hover, .sx-sr-row:focus-visible, .sx-sr-all:hover, .sx-sr-all:focus-visible { background: var(--surface-2); outline: 0; }
.sx-sr-row.has-lead { grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; align-items: center; }
.sx-sr-row.has-lead > :first-child { grid-row: 1 / span 2; }
.sx-sr-t { display: -webkit-box; overflow: hidden; color: var(--ink); font: 500 14.5px/1.45 var(--font-body); overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sx-sr-m { color: var(--dim); font: 400 12.5px/1.4 var(--font-body); }
.sx-sr mark { padding: 0 1px; border-radius: 3px; background: color-mix(in oklab, var(--accent) 22%, transparent); color: inherit; }
.sx-sr-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding: 12px 10px;
  border-top: var(--hair);
  border-radius: var(--r-md);
  color: var(--accent);
  font: 500 14px/1.3 var(--font-display);
  text-align: left;
}
.sx-sr-note { margin: 0; padding: 14px 12px; color: var(--mute); font: 400 14px/1.6 var(--font-body); }
.sx-sr-note + .sx-sr-note { padding-top: 0; color: var(--dim); font-size: 13px; }

/* แถบตัวกรองบนหัวฟีด (แท็ก · ผลงาน · คำค้น) — แทนหัว "ทั้งหมด + การเรียง" เมื่อกำลังกรอง */
.sx.is-filtering .sx-ftop { display: none; }
.sx-fbar { padding: 16px 0 8px; }
.sx-fbar[hidden] { display: none; }
.sx-fhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sx-fwhat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; margin: 0; }
.sx-fwhat span { color: var(--dim); font: 500 12px/1 var(--font-mono); letter-spacing: .08em; }
.sx-fwhat b { min-width: 0; color: var(--ink); font: 700 22px/1.2 var(--font-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.sx-fwhat em { color: var(--mute); font: 400 14px/1 var(--font-body); font-style: normal; }
.sx-fclear {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  color: var(--mute);
  font: 500 13px/1 var(--font-display);
  white-space: nowrap;
}
.sx-fclear:hover { border-color: var(--ink); color: var(--ink); }
.sx-fclear svg { width: 14px; height: 14px; }
.sx-fchans, .sx-status { display: flex; flex-wrap: wrap; gap: 8px; }
.sx-fchans { margin-top: 14px; }
.sx-fnote { margin: 12px 0 0; color: var(--dim); font: 400 12.5px/1.4 var(--font-body); }
.sx-fchans button, .sx-status button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  color: var(--mute);
  font: 500 14px/1 var(--font-display);
  white-space: nowrap;
  transition: color var(--dur-2), border-color var(--dur-2), background var(--dur-2);
}
.sx-fchans button:hover, .sx-status button:hover { border-color: var(--ink); color: var(--ink); }
.sx-fchans button.is-on, .sx-status button.is-on { border-color: var(--chan, var(--ink)); background: color-mix(in oklab, var(--chan, var(--ink)) 10%, transparent); color: var(--chan, var(--ink)); font-weight: 600; }
.sx-status { padding: 12px 0 4px; }
.sx-status[hidden] { display: none; }
.sx-status button i { color: var(--dim); font: 500 12px/1 var(--font-mono); font-style: normal; }
.sx-status button.is-on i { color: inherit; }

/* คำตอบที่เจ้าของคำถามปักไว้ โชว์ใต้คำถามในฟีด */
.sx-ans {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: color-mix(in oklab, #11906A 7%, transparent);
  cursor: pointer;
}
.sx-ans-h { display: inline-flex; align-items: center; gap: 6px; color: #11906A; font: 500 12px/1 var(--font-mono); letter-spacing: .04em; }
.sx-ans-h svg { width: 14px; height: 14px; }
.sx-ans p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--mute);
  font: 400 15px/1.6 var(--font-body);
  white-space: pre-line;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.sx-ans p b { color: var(--ink); font-weight: 600; }
/* ข้อความตอบจากทีมใต้ไอเดีย — โครงเดียวกับคำตอบที่ปักไว้ แต่ใช้สีหลักของเว็บ ไม่ใช่สีเขียวของ "แก้แล้ว" */
.sx-team { background: color-mix(in oklab, var(--accent) 7%, transparent); }
.sx-team .sx-ans-h { color: var(--accent); }
.sx-sh-in .sx-team { margin-top: 14px; cursor: default; }

/* ---------- มือถือ / แท็บเล็ต / โหมดแอป: แว่นขยายที่หัว กดแล้วเปิดเต็มจอ ---------- */
html:not([data-ui="v2"]) .sx-search { order: 2; flex: none; max-width: none; margin-left: auto; }
html:not([data-ui="v2"]) .sx-sort { margin-left: 0; }
html:not([data-ui="v2"]) .sx-s-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--mute);
}
html:not([data-ui="v2"]) .sx-s-btn:hover { background: var(--surface-2); color: var(--ink); }
html:not([data-ui="v2"]) .sx-search .sx-s-form { display: none; }
html:not([data-ui="v2"]) .sx-search.is-open {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: flex;
  flex-direction: column;
  max-width: none;
  margin: 0;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 0;
  background: var(--bg);
}
html:not([data-ui="v2"]) body.sx-find-open main { z-index: 72; }       /* main (z 2) กักลูกไว้ใต้แถบบน (z 60) กับแถบเมนูล่าง (z 70) — ยกทั้ง main ตอนเปิดค้นหา ให้แผงเต็มจอทับทั้งสอง */
html:not([data-ui="v2"]) body.sx-find-open { overflow: hidden; }
html:not([data-ui="v2"]) .sx-search.is-open .sx-s-btn { display: none; }
html:not([data-ui="v2"]) .sx-search.is-open .sx-s-form { display: flex; flex: none; height: 46px; padding-right: 4px; }
html:not([data-ui="v2"]) .sx-s-form input { font-size: 16px; }              /* 16px = iOS ไม่ซูมหน้าเองตอนพิมพ์ */
html:not([data-ui="v2"]) .sx-search.is-open .sx-s-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--pill);
  color: var(--accent);
  font: 500 14.5px/1 var(--font-display);
}
html:not([data-ui="v2"]) .sx-sr {
  position: static;
  flex: 1;
  width: auto;
  max-height: none;
  margin: 10px calc(-1 * var(--gutter)) 0;
  padding: 0 calc(var(--gutter) - 10px) calc(24px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
}
html:not([data-ui="v2"]) .sx-sr-row { padding: 12px 10px; }
html:not([data-ui="v2"]) .sx-fwhat b { font-size: 19px; }
html:not([data-ui="v2"]) .sx-fbar { padding-top: 14px; }
html:not([data-ui="v2"]) .sx-fchans, html:not([data-ui="v2"]) .sx-status { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); scrollbar-width: none; }
html:not([data-ui="v2"]) .sx-fchans::-webkit-scrollbar, html:not([data-ui="v2"]) .sx-status::-webkit-scrollbar { display: none; }
html:not([data-ui="v2"]) .sx-fchans button, html:not([data-ui="v2"]) .sx-status button { flex: none; height: 36px; }
html:not([data-ui="v2"]) .sx-ans { padding: 11px 12px; }
@media (max-width: 400px) {
  html:not([data-ui="v2"]) .sx-title { font-size: 16px; }
  html:not([data-ui="v2"]) .sx-bar { column-gap: 8px; }
  html:not([data-ui="v2"]) .sx-sort button { padding: 0 10px; }
}

/* ============================================================
   D3 — แผงขวามีตัวเลขจริง: สมาชิก · โพสต์สัปดาห์นี้ · แท็กที่กำลังมา · ผู้ช่วยเด่น
   ตัวเลขสัปดาห์นี้ยังไปอยู่ที่รางซ้ายและหัวฟีดด้วย — พื้นเรียบ เส้นบาง ไม่มีเงา/เบลอ/เรืองแสง
   ============================================================ */
.sx-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; padding-top: 16px; border-top: var(--hair); }
.sx-stats[hidden] { display: none; }
.sx-stats div { display: flex; flex-direction: column-reverse; gap: 4px; min-width: 0; }
.sx-stats dt { color: var(--dim); font: 400 12.5px/1.3 var(--font-body); }
.sx-stats dd { margin: 0; color: var(--ink); font: 700 24px/1.1 var(--font-display); letter-spacing: -.01em; }

.sx-tlist, .sx-hlist { margin: 0; padding: 0; list-style: none; }
.sx-tlist li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; }
.sx-tlist li + li { border-top: var(--hair); }
.sx-tlist .sx-hash { min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.sx-tlist span { flex: none; color: var(--dim); font: 400 12.5px/1.3 var(--font-body); }
.sx-hlist li + li { margin-top: 2px; }
.sx-hlist button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% + 20px);
  margin: 0 -10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background var(--dur-2);
}
.sx-hlist button:hover, .sx-hlist button:focus-visible { background: var(--surface-2); }
.sx-hlist .px-av { flex: none; width: 36px; height: 36px; font-size: 15px; }
.sx-hlist span { min-width: 0; }
.sx-hlist b { display: block; color: var(--ink); font: 600 14.5px/1.3 var(--font-display); overflow-wrap: anywhere; }
.sx-hlist em { display: block; color: var(--dim); font: 400 12.5px/1.4 var(--font-body); font-style: normal; }
.sx-box p.sx-note { color: var(--dim); font-size: 13.5px; line-height: 1.6; }

/* ตัวเลขโพสต์สัปดาห์นี้ที่รางช่องซ้ายและข้างชื่อช่องบนหัวฟีด */
.sx-rn { margin-left: auto; color: var(--dim); font: 500 12px/1 var(--font-mono); font-style: normal; }
.sx-rn b { font-weight: 500; }
.sx-ri.is-on .sx-rn { color: var(--mute); }
.sx-feed-n { color: var(--dim); font: 400 13.5px/1 var(--font-body); }
