/*
 * Alee Share Links — Frontend v1.9.2
 *
 *  ┌──────────────────────────────────────────────────────────────────┐
 *  │  Modes:                                                          │
 *  │    .asl-mode-fab   → single FAB + bottom sheet (default)         │
 *  │    .asl-mode-bar   → sticky bar (mobile) + sidebar (PC)          │
 *  │                                                                  │
 *  │  Positions (FAB only):                                           │
 *  │    .asl-fab-right / .asl-fab-left                                │
 *  │                                                                  │
 *  │  Sizes (v1.5 — wired to CSS vars so every size scales together): │
 *  │    .asl-size-sm / .asl-size-md / .asl-size-lg                    │
 *  │                                                                  │
 *  │  Mobile breakpoints:                                             │
 *  │    ≤420px  → FAB goes icon-only (label hidden)                   │
 *  │    ≤360px  → extra compact (auto tier-down one size)             │
 *  └──────────────────────────────────────────────────────────────────┘
 */

.asl-root {
  /* Core palette */
  --asl-primary:     #2563eb;
  --asl-primary-ink: #1d4ed8;
  --asl-text:        #0f172a;
  --asl-text-muted:  #64748b;
  --asl-surface:     #ffffff;
  --asl-surface-alt: #f1f5f9;
  --asl-border:      rgba(15, 23, 42, 0.08);
  --asl-radius:      10px;
  --asl-radius-lg:   16px;
  --asl-shadow-fab:  0 6px 16px rgba(37, 99, 235, 0.32), 0 2px 6px rgba(37, 99, 235, 0.2);
  --asl-shadow-sheet:0 -16px 40px rgba(15, 23, 42, 0.15), 0 -2px 8px rgba(15, 23, 42, 0.06);
  --asl-safe-offset: 0px;

  /* ---- Size tokens (overridden by .asl-size-* modifier) ---- */
  /* Defaults here are 'md'; see .asl-size-sm / .asl-size-lg below */
  --asl-fab-h:        48px;   /* FAB height + bar-button height */
  --asl-fab-px-r:     18px;   /* right padding when label is shown */
  --asl-fab-px-l:     14px;   /* left padding (icon side) */
  --asl-fab-fs:       13.5px; /* FAB label font-size */
  --asl-fab-gap:       7px;   /* space between FAB icon and label */
  --asl-fab-icon:     20px;   /* FAB SVG size */
  --asl-fab-compact:  48px;   /* square size when icon-only on tiny screens */

  --asl-bar-minh:     52px;   /* legacy bar row height */
  --asl-bar-icon-box: 32px;   /* icon pill inside legacy bar button */
  --asl-bar-icon-svg: 17px;   /* SVG inside bar icon pill */
  --asl-bar-fs:       10.5px; /* bar label font-size */

  --asl-side-icon-box: 36px;  /* desktop sidebar icon circle */
  --asl-side-icon-svg: 18px;
  --asl-side-fs:       12.5px;

  --asl-sheet-icon-box: 42px; /* bottom-sheet row icon box */
  --asl-sheet-icon-svg: 20px;
  --asl-sheet-row-pad: 11px;
  --asl-sheet-lbl-fs:  14.5px;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "IBM Plex Sans Thai", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.asl-root * { box-sizing: border-box; }

/* Size SMALL — for sites where the default still feels too big */
.asl-root.asl-size-sm {
  --asl-fab-h:        42px;
  --asl-fab-px-r:     16px;
  --asl-fab-px-l:     12px;
  --asl-fab-fs:       12.5px;
  --asl-fab-gap:       6px;
  --asl-fab-icon:     18px;
  --asl-fab-compact:  42px;

  --asl-bar-minh:     48px;
  --asl-bar-icon-box: 28px;
  --asl-bar-icon-svg: 15px;
  --asl-bar-fs:       10px;

  --asl-side-icon-box: 32px;
  --asl-side-icon-svg: 16px;
  --asl-side-fs:       12px;

  --asl-sheet-icon-box: 38px;
  --asl-sheet-icon-svg: 18px;
  --asl-sheet-row-pad: 10px;
  --asl-sheet-lbl-fs:  14px;
}

/* Size LARGE — matches the pre-1.5 feel; use if 'md' feels too small */
.asl-root.asl-size-lg {
  --asl-fab-h:        56px;
  --asl-fab-px-r:     20px;
  --asl-fab-px-l:     16px;
  --asl-fab-fs:       14px;
  --asl-fab-gap:       8px;
  --asl-fab-icon:     22px;
  --asl-fab-compact:  56px;

  --asl-bar-minh:     58px;
  --asl-bar-icon-box: 34px;
  --asl-bar-icon-svg: 18px;
  --asl-bar-fs:       10.5px;

  --asl-side-icon-box: 40px;
  --asl-side-icon-svg: 20px;
  --asl-side-fs:       12.5px;

  --asl-sheet-icon-box: 44px;
  --asl-sheet-icon-svg: 22px;
  --asl-sheet-row-pad: 12px;
  --asl-sheet-lbl-fs:  15px;
}

/* Mono accent */
.asl-root.asl-accent-mono .asl-btn-icon,
.asl-root.asl-accent-mono .asl-sheet-item-icon { --asl-brand: #475569 !important; }

/* ============================================================
 *  FAB (Floating Action Button) — v1.1 default
 * ============================================================ */
.asl-fab {
  position: fixed;
  z-index: 997;
  display: none;
  align-items: center;
  gap: var(--asl-fab-gap);
  padding: 0 var(--asl-fab-px-r) 0 var(--asl-fab-px-l);
  height: var(--asl-fab-h);
  border: none;
  border-radius: 999px;
  background: var(--asl-primary);
  color: #fff;
  font-family: inherit;
  font-size: var(--asl-fab-fs);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--asl-shadow-fab);
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s cubic-bezier(.4, 0, .2, 1),
              box-shadow .2s ease,
              opacity .2s ease;
  /* iOS safe area */
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--asl-safe-offset));
}
.asl-root.asl-fab-right .asl-fab { right: 20px; }
.asl-root.asl-fab-left  .asl-fab { left:  20px; }

.asl-fab:hover  { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(37, 99, 235, 0.38), 0 3px 8px rgba(37, 99, 235, 0.25); }
.asl-fab:active { transform: translateY(0) scale(0.96); }
.asl-fab:focus-visible { outline: 3px solid #bfdbfe; outline-offset: 3px; }

.asl-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.asl-fab-icon svg { width: var(--asl-fab-icon); height: var(--asl-fab-icon); }
.asl-fab-label { letter-spacing: .01em; }

/* Visibility */
.asl-root.asl-mode-fab.asl-on-mobile .asl-fab  { display: inline-flex; }
@media (min-width: 900px) {
  .asl-root.asl-mode-fab.asl-on-desktop .asl-fab { display: inline-flex; }
  .asl-root.asl-mode-fab.asl-off-desktop .asl-fab { display: none; }
}
@media (max-width: 899px) {
  .asl-root.asl-mode-fab.asl-off-mobile .asl-fab { display: none; }
}

/* Auto-hide behavior */
.asl-root.asl-hidden .asl-fab {
  opacity: 0;
  transform: translateY(8px) scale(0.94);
  pointer-events: none;
}
.asl-root.asl-sheet-open .asl-fab {
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
}

/* Compact (icon only) on small screens — label disappears, FAB becomes round */
@media (max-width: 420px) {
  .asl-fab {
    width: var(--asl-fab-compact);
    height: var(--asl-fab-compact);
    padding: 0;
    justify-content: center;
  }
  .asl-fab-label { display: none; }
  .asl-root.asl-fab-right .asl-fab { right: 16px; }
  .asl-root.asl-fab-left  .asl-fab { left:  16px; }
}

/* Extra-narrow phones (<360px) — one tier smaller still.
   Keeps the FAB from dominating the viewport on devices like the SE 1st gen
   or older Androids, without forcing users to pick 'sm' explicitly. */
@media (max-width: 360px) {
  .asl-root.asl-size-lg { --asl-fab-compact: 48px; --asl-fab-icon: 20px; }
  .asl-root.asl-size-md { --asl-fab-compact: 44px; --asl-fab-icon: 19px; }
  .asl-root.asl-size-sm { --asl-fab-compact: 40px; --asl-fab-icon: 17px; }
}

/* ============================================================
 *  Bottom Sheet
 * ============================================================ */
.asl-sheet-root {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}
.asl-sheet-root[data-visible="1"] { pointer-events: auto; }

.asl-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity .25s ease;
}
.asl-sheet-root[data-visible="1"] .asl-sheet-backdrop { opacity: 1; }

.asl-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: var(--asl-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--asl-shadow-sheet);
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom) + var(--asl-safe-offset));
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.asl-sheet-root[data-visible="1"] .asl-sheet {
  transform: translateX(-50%) translateY(0);
}

/* Desktop: centered modal instead of bottom sheet (looks better on wide viewports) */
@media (min-width: 900px) {
  .asl-sheet {
    top: 50%;
    bottom: auto;
    left: 50%;
    transform: translate(-50%, -48%) scale(0.96);
    opacity: 0;
    width: calc(100% - 40px);
    max-width: 420px;
    border-radius: 20px;
    padding-top: 14px;
    padding-bottom: 14px;
    max-height: 75vh;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.1);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1),
                opacity .22s ease;
  }
  .asl-sheet-root[data-visible="1"] .asl-sheet {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  /* Drag handle not useful on desktop — hide */
  .asl-sheet-handle { display: none; }

  /* Honor show_labels_desktop on the desktop sheet —
     when off, hide labels and tighten rows so the modal is compact */
  .asl-root.asl-nolbl-d .asl-sheet-item-label   { display: none; }
  .asl-root.asl-nolbl-d .asl-sheet-item-chevron { display: none; }
  .asl-root.asl-nolbl-d .asl-sheet-item         { gap: 0; justify-content: center; }
}

.asl-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--asl-surface-alt);
  border-radius: 999px;
  margin: 4px auto 10px;
  flex: none;
}

.asl-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--asl-border);
  flex: none;
}
.asl-sheet-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--asl-text);
  line-height: 1.2;
}
.asl-sheet-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: var(--asl-surface-alt);
  border-radius: 50%;
  color: var(--asl-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.asl-sheet-close:hover { background: #e2e8f0; color: var(--asl-text); }
.asl-sheet-close:focus-visible { outline: 2px solid var(--asl-primary); outline-offset: 2px; }

.asl-sheet-body {
  padding: 6px 10px;
  overflow-y: auto;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

.asl-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: var(--asl-sheet-row-pad) 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--asl-text);
  transition: background .15s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.asl-sheet-item:hover { background: var(--asl-surface-alt); }
.asl-sheet-item:active { transform: scale(0.98); }
.asl-sheet-item:focus-visible { background: var(--asl-surface-alt); box-shadow: inset 0 0 0 2px var(--asl-primary); }

.asl-sheet-item-icon {
  width: var(--asl-sheet-icon-box);
  height: var(--asl-sheet-icon-box);
  border-radius: 12px;
  background: var(--asl-brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: transform .15s ease;
}
.asl-sheet-item-icon svg { width: var(--asl-sheet-icon-svg); height: var(--asl-sheet-icon-svg); }
.asl-sheet-item:active .asl-sheet-item-icon { transform: scale(0.94); }

.asl-sheet-item-label {
  flex: 1;
  font-size: var(--asl-sheet-lbl-fs);
  font-weight: 600;
  color: var(--asl-text);
}

.asl-sheet-item-chevron {
  color: #cbd5e1;
  display: inline-flex;
  transition: transform .15s ease, color .15s ease;
}
.asl-sheet-item:hover .asl-sheet-item-chevron { color: var(--asl-text-muted); transform: translateX(2px); }

/* ============================================================
 *  FAB sheet — mobile grid + desktop adaptive layout (v1.5.1)
 *
 *  MOBILE (≤899px):
 *    Always renders as a grid — icons on top, labels below when the
 *    "show labels" toggle is ON (matching the wording "ใต้ไอคอน"),
 *    or icons only when OFF. The list-row layout that v1.5.0 used on
 *    mobile contradicted the toggle's own wording, so it's gone.
 *
 *  DESKTOP (≥900px):
 *    Toggle ON  → list rows with label to the right of icon (the
 *                 traditional centered modal — fits "ข้างไอคอน").
 *    Toggle OFF → grid of icon-only cards.
 *
 *  The chevron decoration is a list-only affordance and gets hidden
 *  whenever we switch to grid mode (mobile always, desktop OFF).
 *
 *  :has() lets us auto-adjust column count when sites enable extra
 *  platforms (rare, but the LINE@ aux entry isn't here so the realistic
 *  ceiling is still 4 share targets — the rules are defensive).
 * ============================================================ */
@media (max-width: 899px) {
  /* Mobile is always grid — toggle controls whether labels are visible */
  .asl-root.asl-mode-fab .asl-sheet-body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 14px 16px 18px;
  }
  .asl-root.asl-mode-fab .asl-sheet-item {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 14px 6px;
    border-radius: 14px;
    background: var(--asl-surface-alt);
    text-align: center;
    min-height: 84px;
  }
  .asl-root.asl-mode-fab .asl-sheet-item:hover { background: #e2e8f0; }
  .asl-root.asl-mode-fab .asl-sheet-item-chevron { display: none; }

  /* Toggle ON → label sits under the icon (matches "ใต้ไอคอน" wording) */
  .asl-root.asl-mode-fab.asl-lbl-m .asl-sheet-item-label {
    flex: none;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--asl-text);
    /* Long platform names ("คัดลอกลิงก์") get clipped politely instead of
       breaking the grid cell width */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Toggle OFF → icon-only, tighter cell */
  .asl-root.asl-mode-fab.asl-nolbl-m .asl-sheet-item {
    gap: 0;
    min-height: 72px;
  }
  .asl-root.asl-mode-fab.asl-nolbl-m .asl-sheet-item-label { display: none; }

  /* 5+ enabled platforms — keep cells touch-friendly */
  .asl-root.asl-mode-fab .asl-sheet-body:has(> :nth-child(5)) {
    grid-template-columns: repeat(5, 1fr);
  }
  .asl-root.asl-mode-fab .asl-sheet-body:has(> :nth-child(7)) {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 900px) {
  /* Desktop with labels OFF → switch the centered modal to icon grid too */
  .asl-root.asl-mode-fab.asl-nolbl-d .asl-sheet-body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 14px 16px 18px;
  }
  .asl-root.asl-mode-fab.asl-nolbl-d .asl-sheet-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 16px 6px;
    border-radius: 14px;
    background: var(--asl-surface-alt);
    text-align: center;
    min-height: 76px;
  }
  .asl-root.asl-mode-fab.asl-nolbl-d .asl-sheet-item:hover { background: #e2e8f0; }
  .asl-root.asl-mode-fab.asl-nolbl-d .asl-sheet-item-label,
  .asl-root.asl-mode-fab.asl-nolbl-d .asl-sheet-item-chevron { display: none; }

  .asl-root.asl-mode-fab.asl-nolbl-d .asl-sheet-body:has(> :nth-child(5)) {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================================
 *  Sheet — MOBILE grid layout (v1.5)
 *
 *  Up to 899px wide, the bottom sheet renders platform options as a
 *  grid of icon-cards: icon on top, label below — matching the
 *  settings page description "แสดงชื่อแพลตฟอร์มใต้ไอคอน".
 *  This is the standard Android-style action sheet pattern and feels
 *  right at the bottom of the screen, where horizontal rows look bulky.
 *
 *  Desktop (≥900px) keeps the row layout (icon | label | chevron) —
 *  matches "ข้างไอคอน" and works better in a centered modal.
 *
 *  When show_labels_mobile is OFF (.asl-nolbl-m), labels are hidden
 *  so the sheet collapses into a compact icon-only grid.
 * ============================================================ */
@media (max-width: 899px) {
  .asl-sheet-body {
    display: grid;
    /* 4 columns is the sweet spot — fits messenger/line/x/copy on one row;
       if user adds a 5th platform it wraps cleanly to a second row */
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px 4px;
  }
  .asl-sheet-item {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 12px 4px 14px;
    text-align: center;
    min-width: 0;  /* let it shrink in narrow grids */
  }
  /* Chevron is a row-layout decoration — irrelevant in a grid cell */
  .asl-sheet-item-chevron { display: none; }

  .asl-sheet-item-label {
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--asl-text-muted);
    /* Labels can be long ("คัดลอกลิงก์", "LINE Official Account") —
       allow up to 2 lines, then ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    /* Keep the cell's vertical rhythm consistent regardless of 1- vs 2-line */
    min-height: calc(11.5px * 1.25 * 2);
  }

  /* Labels OFF on mobile — collapse to compact icon-only grid */
  .asl-root.asl-nolbl-m .asl-sheet-item-label { display: none; }
  .asl-root.asl-nolbl-m .asl-sheet-item       { padding: 14px 4px; gap: 0; }
  .asl-root.asl-nolbl-m .asl-sheet-body       { padding: 10px 10px 6px; }
}

/* ============================================================
 *  LEGACY MODE (v1.0 look) — .asl-mode-bar
 *  Preserves old bar on mobile + sidebar on desktop
 * ============================================================ */

/* Sticky bar (mobile) */
.asl-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 998;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--asl-border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  display: none;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--asl-safe-offset));
}
.asl-root.asl-mode-bar.asl-on-mobile .asl-bar  { display: block; }
.asl-root.asl-mode-bar.asl-off-mobile .asl-bar { display: none !important; }
.asl-root.asl-mode-bar.asl-hidden .asl-bar     { transform: translateY(110%); }

.asl-bar-inner {
  display: flex;
  align-items: stretch;
  max-width: 640px;
  margin: 0 auto;
}

/* Floating sidebar (desktop) */
.asl-sidebar {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 998;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--asl-border);
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.asl-sidebar.asl-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%);
}
.asl-sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--asl-text-muted);
  padding: 2px 8px;
}
.asl-sidebar-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }

.asl-root.asl-mode-bar.asl-on-desktop  .asl-sidebar { display: flex; }
.asl-root.asl-mode-bar.asl-off-desktop .asl-sidebar { display: none !important; }
@media (max-width: 899px) {
  .asl-root.asl-mode-bar .asl-sidebar { display: none !important; }
}
@media (min-width: 900px) {
  .asl-root.asl-mode-bar .asl-bar { display: none !important; }
}

/* Legacy buttons */
.asl-btn {
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  color: var(--asl-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  line-height: 1.2;
  transition: transform .15s ease;
}
.asl-btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  color: #fff;
  background: var(--asl-brand);
  width: var(--asl-bar-icon-box); height: var(--asl-bar-icon-box);
  border-radius: 10px;
  transition: transform .15s ease, filter .15s ease;
}
.asl-btn-icon svg { width: var(--asl-bar-icon-svg); height: var(--asl-bar-icon-svg); }
.asl-btn:hover  .asl-btn-icon { filter: brightness(0.95); }
.asl-btn:active .asl-btn-icon { transform: scale(0.92); }
.asl-btn-label { font-size: 13px; font-weight: 600; color: var(--asl-text); }

.asl-btn-bar {
  flex: 1 1 0;
  flex-direction: column;
  gap: 3px;
  padding: 7px 4px 9px;
  min-height: var(--asl-bar-minh);
}
.asl-root.asl-nolbl-m .asl-btn-bar .asl-btn-label { display: none; }
.asl-root.asl-lbl-m  .asl-btn-bar .asl-btn-label { font-size: var(--asl-bar-fs); color: var(--asl-text-muted); }

.asl-btn-sidebar {
  flex: none;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0);
  width: 100%;
}
.asl-btn-sidebar:hover { background: rgba(15, 23, 42, 0.04); }
.asl-btn-sidebar .asl-btn-icon {
  width: var(--asl-side-icon-box);
  height: var(--asl-side-icon-box);
  border-radius: 50%;
}
.asl-btn-sidebar .asl-btn-icon svg { width: var(--asl-side-icon-svg); height: var(--asl-side-icon-svg); }
.asl-root.asl-nolbl-d .asl-btn-sidebar { padding: 6px; }
.asl-root.asl-nolbl-d .asl-btn-sidebar .asl-btn-label { display: none; }
.asl-root.asl-lbl-d  .asl-btn-sidebar .asl-btn-label { font-size: var(--asl-side-fs); }

/* Pulse for feedback */
@keyframes aslPulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.asl-btn.asl-pulse .asl-btn-icon,
.asl-sheet-item.asl-pulse .asl-sheet-item-icon,
.asl-fab.asl-pulse,
.asl-lineat-fab.asl-pulse { animation: aslPulse .35s ease; }

/* ============================================================
 *  Toast (copy feedback)
 * ============================================================ */
.asl-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom) + var(--asl-safe-offset));
  transform: translateX(-50%) translateY(8px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}
.asl-toast[data-visible="1"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Lift the toast above the FAB in fab mode */
.asl-root.asl-mode-fab .asl-toast {
  bottom: calc(92px + env(safe-area-inset-bottom) + var(--asl-safe-offset));
}
.asl-root.asl-mode-bar .asl-toast {
  bottom: calc(80px + env(safe-area-inset-bottom) + var(--asl-safe-offset));
}
@media (min-width: 900px) {
  .asl-root.asl-mode-bar .asl-toast { bottom: 24px; }
}
.asl-toast-icon { display: inline-flex; color: #86efac; }
.asl-toast-icon svg { width: 16px; height: 16px; }

/* ============================================================
 *  v1.5 — LINE@ "Add Friend" CTA (separate from share UI)
 *
 *  Two render modes:
 *    .asl-lineat-root         — floating FAB (wp_footer)
 *    .asl-lineat-inline       — inline block (the_content filter)
 *
 *  Reuses the --asl-size-* tokens so it scales with the global button-size
 *  setting, but the LINE@ FAB is always pill-shaped (icon + label) on
 *  desktop/tablet because "add friend" is unfamiliar icon-only on most sites.
 * ============================================================ */

.asl-lineat-root {
  /* Size token defaults (md) — cloned from .asl-root scope so this stays
     self-contained when rendered without a sibling .asl-root */
  --asl-fab-h:        48px;
  --asl-fab-px-r:     18px;
  --asl-fab-px-l:     14px;
  --asl-fab-fs:       13.5px;
  --asl-fab-gap:       7px;
  --asl-fab-icon:     20px;
  --asl-fab-compact:  48px;
  --asl-safe-offset:  0px;
  --asl-lineat-max:  400px;

  position: fixed;
  z-index: 996;  /* just below share FAB (997) so they never fight */
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--asl-safe-offset));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "IBM Plex Sans Thai", Roboto, sans-serif;
}
.asl-lineat-root.asl-size-sm {
  --asl-fab-h: 42px; --asl-fab-px-r: 16px; --asl-fab-px-l: 12px;
  --asl-fab-fs: 12.5px; --asl-fab-gap: 6px; --asl-fab-icon: 18px; --asl-fab-compact: 42px;
}
.asl-lineat-root.asl-size-lg {
  --asl-fab-h: 56px; --asl-fab-px-r: 20px; --asl-fab-px-l: 16px;
  --asl-fab-fs: 14px; --asl-fab-gap: 8px; --asl-fab-icon: 22px; --asl-fab-compact: 56px;
}

.asl-lineat-root.asl-lineat-right { right: 20px; }
.asl-lineat-root.asl-lineat-left  { left:  20px; }

/* Stacked above the share FAB when both are on the same edge.
   20px gap from bottom + FAB height (md) + 14px breathing room ≈ 82px */
.asl-lineat-root.asl-lineat-stacked {
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--asl-safe-offset) + var(--asl-fab-h) + 14px);
}

.asl-lineat-fab {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  min-height: var(--asl-fab-h);
  border-radius: 18px;
  background: var(--asl-brand);
  color: #fff;
  font-size: var(--asl-fab-fs);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(6, 199, 85, 0.30), 0 2px 6px rgba(6, 199, 85, 0.18);
  transition: transform .2s cubic-bezier(.4, 0, .2, 1), box-shadow .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
  width: auto !important;
  max-width: min(var(--asl-lineat-max, 400px), calc(100vw - 40px)) !important;
  min-width: 174px;
  box-sizing: border-box;
  overflow: hidden;
}
.asl-lineat-fab:hover  { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(6, 199, 85, 0.38), 0 3px 8px rgba(6, 199, 85, 0.24); color: #fff; }
.asl-lineat-fab:active { transform: translateY(0) scale(0.97); }
.asl-lineat-fab:focus-visible { outline: 3px solid #86efac; outline-offset: 3px; }

.asl-lineat-fab-label {
  display: block;
  flex: 1 1 auto;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  text-align: left;
}
.asl-lineat-fab-mark {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 46px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  line-height: 1;
}
.asl-lineat-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.asl-lineat-fab-icon svg { width: var(--asl-fab-icon); height: var(--asl-fab-icon); display:block; }
.asl-lineat-fab-brand {
  display: block;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
}

/* LINE@ floating display modes from Settings. */
.asl-lineat-root.asl-lineat-display-icon_only .asl-lineat-fab {
  width: var(--asl-fab-compact) !important;
  min-width: var(--asl-fab-compact);
  height: var(--asl-fab-compact);
  min-height: var(--asl-fab-compact);
  padding: 0;
  justify-content: center;
  border-radius: 999px;
}
.asl-lineat-root.asl-lineat-display-icon_only .asl-lineat-fab-mark {
  min-width: 0;
  padding-left: 0;
  border-left: 0;
  gap: 0;
}
.asl-lineat-root.asl-lineat-display-icon_only .asl-lineat-fab-brand { display: none; }
.asl-lineat-root.asl-lineat-display-text_only .asl-lineat-fab {
  min-width: 132px;
  padding: 0 18px;
  height: var(--asl-fab-h);
  min-height: var(--asl-fab-h);
  border-radius: 999px;
  justify-content: center;
}
.asl-lineat-root.asl-lineat-display-text_only .asl-lineat-fab-label { text-align: center; }
.asl-lineat-root.asl-lineat-display-text_icon .asl-lineat-fab-label { padding-right: 2px; }

@media (max-width: 899px) {
  .asl-lineat-root.asl-lineat-right { right: 16px; }
  .asl-lineat-root.asl-lineat-left  { left:  16px; }
  .asl-lineat-root.asl-lineat-display-text_icon .asl-lineat-fab {
    min-width: 168px;
    max-width: min(var(--asl-lineat-max, 400px), calc(100vw - 32px)) !important;
  }
}
@media (max-width: 360px) {
  .asl-lineat-root.asl-size-lg { --asl-fab-compact: 48px; --asl-fab-icon: 20px; }
  .asl-lineat-root.asl-size-md { --asl-fab-compact: 44px; --asl-fab-icon: 19px; }
  .asl-lineat-root.asl-size-sm { --asl-fab-compact: 40px; --asl-fab-icon: 17px; }
  .asl-lineat-root.asl-lineat-display-text_icon .asl-lineat-fab { min-width: 156px; padding-left: 14px; gap: 9px; }
  .asl-lineat-fab-mark { min-width: 40px; padding-left: 9px; }
  .asl-lineat-fab-brand { font-size: 9px; }
}

/* --- Inline block (inside the_content) --- */
.asl-lineat-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  width: 100%;
  max-width: min(var(--asl-lineat-max, 400px), 100%);
  margin: 24px auto;
  box-sizing: border-box;
  background: #f0fdf4;                   /* very light green surface */
  border: 1px solid rgba(6, 199, 85, 0.18);
  border-radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "IBM Plex Sans Thai", Roboto, sans-serif;
  line-height: 1.35;
  color: #0f172a;
}
.asl-lineat-inline-icon {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.asl-lineat-inline-icon svg { width: 24px; height: 24px; }

.asl-lineat-inline-body { flex: 1 1 auto; min-width: 0; }
.asl-lineat-inline-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}
.asl-lineat-inline-desc {
  font-size: 13px;
  color: #334155;
}

.asl-lineat-inline-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--asl-brand, #06C755);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(6, 199, 85, 0.25);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  width: fit-content !important;
  max-width: min(320px, 100%) !important;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asl-lineat-inline-cta:hover  { transform: translateY(-1px); filter: brightness(1.03); color: #fff; box-shadow: 0 4px 10px rgba(6, 199, 85, 0.32); }
.asl-lineat-inline-cta:active { transform: translateY(0); }

/* Size variants for inline */
.asl-lineat-inline.asl-size-sm { padding: 12px 14px; gap: 12px; }
.asl-lineat-inline.asl-size-sm .asl-lineat-inline-icon { width: 38px; height: 38px; }
.asl-lineat-inline.asl-size-sm .asl-lineat-inline-icon svg { width: 20px; height: 20px; }
.asl-lineat-inline.asl-size-sm .asl-lineat-inline-title { font-size: 14px; }
.asl-lineat-inline.asl-size-sm .asl-lineat-inline-desc  { font-size: 12.5px; }
.asl-lineat-inline.asl-size-sm .asl-lineat-inline-cta   { padding: 8px 14px; font-size: 13px; }

.asl-lineat-inline.asl-size-lg { padding: 18px 20px; gap: 16px; }
.asl-lineat-inline.asl-size-lg .asl-lineat-inline-icon { width: 52px; height: 52px; }
.asl-lineat-inline.asl-size-lg .asl-lineat-inline-icon svg { width: 28px; height: 28px; }
.asl-lineat-inline.asl-size-lg .asl-lineat-inline-title { font-size: 16px; }
.asl-lineat-inline.asl-size-lg .asl-lineat-inline-desc  { font-size: 13.5px; }
.asl-lineat-inline.asl-size-lg .asl-lineat-inline-cta   { padding: 10px 18px; font-size: 14px; }

/* Stack vertically on narrow phones so the CTA doesn't get squeezed */
@media (max-width: 500px) {
  .asl-lineat-inline {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
  .asl-lineat-inline-body { flex: 1 1 160px; }
  .asl-lineat-inline-cta  {
    flex: 0 1 320px;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
  }
}

/* ============================================================
 *  Reduced motion
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .asl-fab, .asl-bar, .asl-sidebar, .asl-toast,
  .asl-btn-icon, .asl-sheet, .asl-sheet-backdrop,
  .asl-sheet-item, .asl-sheet-item-icon, .asl-sheet-item-chevron,
  .asl-lineat-fab, .asl-lineat-inline-cta {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
 *  Prefers dark (neutral tweaks so FAB/sheet don't look jarring)
 * ============================================================ */
@media (prefers-color-scheme: dark) {
  .asl-root {
    --asl-surface:     #1e293b;
    --asl-surface-alt: #334155;
    --asl-text:        #e2e8f0;
    --asl-text-muted:  #94a3b8;
    --asl-border:      rgba(255, 255, 255, 0.08);
  }
  .asl-bar     { background: rgba(15, 23, 42, 0.88); }
  .asl-sidebar { background: rgba(15, 23, 42, 0.85); }
  .asl-sheet-close { background: #334155; }
  .asl-sheet-close:hover { background: #475569; }

  .asl-lineat-inline {
    background: rgba(6, 199, 85, 0.08);
    border-color: rgba(6, 199, 85, 0.3);
    color: #e2e8f0;
  }
  .asl-lineat-inline-title { color: #f1f5f9; }
  .asl-lineat-inline-desc  { color: #cbd5e1; }
}

/* Body scroll lock helper (applied by JS) */
html.asl-no-scroll, body.asl-no-scroll {
  overflow: hidden !important;
  touch-action: none;
}

/* v1.7.3 — Production LINE@ width guard: cap the floating pill and inline card, even when a theme forces links/buttons to 100% width. */
.asl-lineat-root .asl-lineat-fab {
  width: auto !important;
  max-width: min(var(--asl-lineat-max, 400px), calc(100vw - 40px)) !important;
  box-sizing: border-box;
}
.asl-lineat-inline {
  width: 100% !important;
  max-width: min(var(--asl-lineat-max, 400px), 100%) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
}
.asl-lineat-inline .asl-lineat-inline-cta {
  width: fit-content !important;
  max-width: min(320px, 100%) !important;
  box-sizing: border-box;
}
@media (max-width: 500px) {
  .asl-lineat-inline .asl-lineat-inline-cta {
    width: 100% !important;
    max-width: 320px !important;
  }
}
