/* ============================================================
   FORMATIX CREATIONS — บัญชีผู้ใช้ · เมนู · หน้าต่าง · การตั้งค่า · ครอปรูป
   ============================================================ */

/* ---------- ปุ่มบนแถบบน ---------- */
.acct { justify-self: end; display: flex; align-items: center; gap: 6px; min-height: 42px; }
.acct-skel { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); display: none; animation: acct-pulse 1.2s ease-in-out infinite; }
.acct.is-loading .acct-skel { display: block; }
@keyframes acct-pulse { 50% { opacity: .5; } }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  color: var(--mute);
  transition: background .2s, color .2s, transform .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }

.signin-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px 0 12px; border-radius: var(--pill);
  font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
  color: var(--accent); border: 1px solid var(--line-strong); background: var(--surface);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.signin-btn:hover { background: var(--accent-soft); border-color: transparent; }

.avatar-btn { border-radius: 50%; padding: 2px; transition: box-shadow .2s, transform .15s; }
.avatar-btn:hover { box-shadow: 0 0 0 4px var(--accent-soft); }
.avatar-btn:active { transform: scale(.95); }
.avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- avatar ---------- */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); border-radius: 50%;
  display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden;
  background: var(--surface-3);
  font-family: var(--font-display); font-weight: 700; font-size: calc(var(--size) * .42); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-letter { background: linear-gradient(135deg, hsl(var(--h) 72% 58%), hsl(calc(var(--h) + 40) 70% 46%)); }
.avatar-sm { --size: 36px; }
.avatar-md { --size: 52px; }
.avatar-lg { --size: 48px; }
.avatar-xl { --size: 128px; }

/* ---------- เลเยอร์ทั่วไป ---------- */
.layer { position: fixed; inset: 0; z-index: 800; }
.layer-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .24s var(--ease); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.layer.is-open .layer-scrim { opacity: 1; }
.menu-layer .layer-scrim { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet-grip { display: none; }

/* ---------- เมนูบัญชี (จอคอม: ลอยใต้รูปโปรไฟล์) ---------- */
.acct-menu {
  position: absolute;
  top: calc(10px + var(--nav-h) + 8px + env(safe-area-inset-top));
  right: max(var(--gutter), calc((100vw - var(--shell)) / 2 + 4px));
  width: 312px; max-height: calc(100vh - 120px); overflow-y: auto;
  padding: 8px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  transform: translateY(-6px) scale(.97); opacity: 0;
  transition: transform .22s var(--ease), opacity .18s var(--ease);
}
.menu-layer.is-open .acct-menu { transform: none; opacity: 1; }

.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.menu-id { min-width: 0; display: grid; line-height: 1.35; }
.menu-id b { font-family: var(--font-display); font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-id span { font-size: 13.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-id small { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-list { display: grid; gap: 1px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 12px;
  font-size: 15px; color: var(--ink); text-align: left;
  transition: background .15s;
}
.menu-item svg { color: var(--mute); flex-shrink: 0; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.is-danger, .menu-item.is-danger svg { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

.menu-theme { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 12px; font-size: 14px; color: var(--mute); }
.mini-seg { display: flex; padding: 3px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line); }
.mini-seg button { padding: 5px 9px; border-radius: var(--pill); font-size: 13px; font-weight: 600; color: var(--mute); transition: background .2s, color .2s; }
.mini-seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- หน้าต่าง (จอคอม: กลางจอ) ---------- */
.modal-layer { display: grid; place-items: center; padding: 20px; }
.modal-card {
  position: relative; z-index: 1;
  width: min(440px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 30px 30px 26px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98); opacity: 0;
  transition: transform .3s var(--spring), opacity .2s var(--ease);
  overscroll-behavior: contain;
}
.modal-layer.is-open .modal-card { transform: none; opacity: 1; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--mute); transition: background .2s, color .2s; }
.modal-x.static { position: static; }
.modal-x:hover { background: var(--surface-2); color: var(--ink); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- เข้าสู่ระบบ ---------- */
.auth-card { text-align: center; }
.auth-mark { width: 64px; height: 64px; margin: 2px auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.auth-mark img { width: 44px; height: 44px; object-fit: contain; }
.auth-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.auth-sub { color: var(--mute); font-size: 14.5px; margin: 6px auto 20px; max-width: 34ch; }

.switcher {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; margin-bottom: 18px; border-radius: var(--pill);
  background: var(--surface-2); border: 1px solid var(--line);
}
.switcher::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: var(--pill); background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
  transition: transform .3s var(--ease);
}
.switcher.is-register::before { transform: translateX(100%); }
.switcher button { position: relative; padding: 8px 10px; font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--mute); transition: color .2s; }
.switcher button.is-on { color: var(--ink); }
.switcher button[hidden] + button, .switcher:has(button[hidden])::before { width: calc(100% - 8px); }
.switcher:has(button[hidden]) { grid-template-columns: 1fr; }

.oauth-wrap { margin-bottom: 4px; }
.oauth-list { display: grid; gap: 9px; }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 18px; border-radius: var(--pill); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: 14.5px; text-decoration: none; transition: border-color .18s, transform .18s; }
.oauth-btn:hover { border-color: var(--accent); }
.oauth-btn:active { transform: scale(.985); }
.oauth-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.link-forgot { display: block; margin: -6px 0 14px auto; padding: 2px 0; font: inherit; font-size: 13px; color: var(--accent); background: none; border: 0; cursor: pointer; }
.linked-list { display: grid; gap: 14px; }
.reauth-card { margin-bottom: 18px; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.gate-acts.left .btn svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; font-size: 12.5px; color: var(--dim); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-form { text-align: left; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .btn-block { margin-top: 6px; min-height: 50px; font-size: 15.5px; }
.fine { font-size: 12.5px; color: var(--dim); margin-top: 12px; text-align: center; }
.auth-error { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: 14px; text-align: left; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--dim); transition: color .2s, background .2s; }
.pw-eye:hover { color: var(--ink); background: var(--surface-3); }
.pw-eye.is-on { color: var(--accent); }

.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 4px; }
.pw-meter i { height: 4px; border-radius: 4px; background: var(--surface-3); transition: background .25s; }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: #e08a12; }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: #2f9e6e; }
.pw-meter[data-score="4"] i { background: var(--ok); }

/* ---------- หน้าบัญชี ---------- */
.profile-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.profile-cover {
  position: relative; aspect-ratio: 3 / 1; max-height: 300px; width: 100%;
  background: radial-gradient(70% 120% at 12% 0%, rgba(40, 215, 223, .85), transparent 60%),
              radial-gradient(60% 120% at 100% 100%, rgba(142, 69, 255, .9), transparent 60%),
              linear-gradient(135deg, #1b5fb8, #3a2a9e);
  background-size: cover; background-position: center;
}
.profile-cover[style] { background-color: var(--surface-3); }
.glass-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--pill);
  font-size: 13.5px; font-weight: 600; color: #fff;
  background: rgba(10, 13, 24, .42); border: 1px solid rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background .2s;
}
.glass-btn:hover { background: rgba(10, 13, 24, .6); }
.cover-edit { position: absolute; right: 16px; bottom: 16px; }

.profile-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: end; padding: 0 28px 24px; }
.profile-avatar { position: relative; margin-top: -58px; }
.profile-avatar .avatar { border: 5px solid var(--surface); box-shadow: var(--shadow-md); }
.avatar-edit {
  position: absolute; right: 4px; bottom: 6px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  border: 3px solid var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--spring);
}
.avatar-edit:hover { transform: scale(1.08); }
.profile-id { min-width: 0; padding-top: 14px; }
.profile-name { font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.015em; line-height: 1.2; overflow-wrap: anywhere; }
.profile-handle { color: var(--mute); font-size: 15px; margin-top: 1px; }
.profile-bio { margin-top: 10px; font-size: 15px; white-space: pre-line; max-width: 62ch; overflow-wrap: anywhere; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13.5px; color: var(--mute); }
.profile-meta > * { display: inline-flex; align-items: center; gap: 6px; }
.profile-meta svg { color: var(--dim); }
.profile-meta a { color: var(--accent); }
.profile-meta a:hover { text-decoration: underline; }
.badge-google { padding: 2px 10px 2px 6px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.badge-google svg { width: 14px; height: 14px; }
.profile-cta { display: flex; gap: 8px; }

.page-tabs-wrap { margin: 22px 0 18px; }
.page-tabs { margin: 0; }

.acct-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.acct-side { display: grid; gap: 18px; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.panel-card.is-danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.card-head { margin-bottom: 18px; }
.card-head h2 { font-family: var(--font-display); font-size: 18.5px; font-weight: 700; letter-spacing: -.005em; }
.card-head p, .card-note { color: var(--mute); font-size: 14px; margin-top: 3px; }
.count { font-style: normal; font-weight: 500; font-size: 12px; color: var(--dim); }
.affix { display: flex; align-items: stretch; }
.affix span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-right: none; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--surface-3); color: var(--mute); font-weight: 600; }
.affix input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.save-state { font-size: 13px; color: var(--dim); }

.media-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.media-row:first-of-type { border-top: none; padding-top: 0; }
.media-info { display: grid; min-width: 0; }
.media-info b { font-weight: 600; font-size: 15px; }
.media-info span { font-size: 12.5px; color: var(--dim); }
.media-acts { display: flex; gap: 4px; }
.cover-thumb { width: 78px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #1b5fb8, #3a2a9e) center/cover; box-shadow: inset 0 0 0 1px var(--line); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--mute); }
.kv dd { text-align: right; font-weight: 500; overflow-wrap: anywhere; }

.linked { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.linked-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.linked-info { display: grid; min-width: 0; }
.linked-info b { font-weight: 600; }
.linked-info span { font-size: 13px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sessions { display: grid; gap: 2px; margin-bottom: 14px; }
.session { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.session:last-child { border-bottom: none; }
.session-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--mute); }
.session-info { display: grid; min-width: 0; }
.session-info b { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.session-info span { font-size: 12.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-now { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent); }
.skel-line { height: 44px; border-radius: 12px; background: var(--surface-2); margin-bottom: 6px; animation: acct-pulse 1.2s ease-in-out infinite; }

.gate { max-width: 520px; margin: 20px auto 0; text-align: center; padding: 44px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-md); }
.gate-art { display: grid; place-items: center; margin-bottom: 18px; }
.gate h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.gate p { color: var(--mute); margin: 8px auto 22px; max-width: 40ch; }
.gate-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.gate-acts.left { justify-content: flex-start; margin-top: 12px; }

.profile-hero.is-skeleton .profile-cover { background: var(--surface-2); animation: acct-pulse 1.2s ease-in-out infinite; }
.profile-hero.is-skeleton .avatar { margin-top: -58px; border: 5px solid var(--surface); }

/* ---------- การตั้งค่า ---------- */
.page-head { margin-bottom: 24px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.card-head + .set-row { border-top: none; padding-top: 0; }
.set-row.set-tiles, .set-row.set-seg { grid-template-columns: 1fr; gap: 10px; }
.set-label { display: grid; }
.set-label b { font-weight: 600; font-size: 15px; }
.set-label span { font-size: 13px; color: var(--dim); }
.segmented.compact { margin: 0; width: 100%; }
.segmented.compact .seg { flex: 1; padding: 7px 10px; font-size: 13.5px; }
.set-logout { margin-top: 10px; }

.theme-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.theme-tile { display: grid; gap: 8px; justify-items: center; padding: 8px 8px 10px; border-radius: 16px; border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--mute); transition: border-color .2s, color .2s, background .2s; }
.theme-tile:hover { background: var(--surface-2); }
.theme-tile.is-on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.theme-prev { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: #f3f5fa; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.theme-prev i { position: absolute; border-radius: 4px; }
.theme-prev i:nth-child(1) { left: 8%; right: 8%; top: 10%; height: 14%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.theme-prev i:nth-child(2) { left: 8%; width: 52%; top: 34%; bottom: 12%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.theme-prev i:nth-child(3) { right: 8%; width: 24%; top: 34%; height: 18%; background: var(--accent); }
.theme-prev.is-dark { background: #0c0f17; }
.theme-prev.is-dark i:nth-child(1), .theme-prev.is-dark i:nth-child(2) { background: #1a202e; box-shadow: none; }
.theme-prev.is-system { background: linear-gradient(115deg, #f3f5fa 50%, #0c0f17 50%); }
.theme-prev.is-system i:nth-child(1), .theme-prev.is-system i:nth-child(2) { background: linear-gradient(115deg, #fff 50%, #1a202e 50%); }
.theme-prev.is-purple {
  background:
    radial-gradient(1px 1px at 22% 70%, #fff, transparent), radial-gradient(1px 1px at 64% 86%, #dfe8ff, transparent), radial-gradient(1px 1px at 90% 64%, #fff, transparent),
    radial-gradient(70% 45% at 30% 0%, rgba(64, 240, 196, .38), transparent 70%),
    radial-gradient(60% 60% at 95% 30%, rgba(222, 78, 190, .35), transparent 70%),
    radial-gradient(60% 60% at 70% 20%, rgba(112, 70, 236, .4), transparent 70%), #07070f;
}
.theme-prev.is-purple i:nth-child(1), .theme-prev.is-purple i:nth-child(2) { background: rgba(23, 21, 39, .86); box-shadow: inset 0 0 0 1px rgba(196, 190, 255, .1); }
.theme-prev.is-purple i:nth-child(3) { background: linear-gradient(135deg, #52f0cf, #9a63ff 60%, #ff7fc6); }
.theme-prev.is-morning {
  background:
    radial-gradient(circle at 88% 6%, #fffaf0 0 5%, rgba(255, 214, 150, .95) 11%, rgba(255, 180, 120, .45) 24%, transparent 46%),
    conic-gradient(from 196deg at 88% 6%, transparent 0deg, rgba(255, 200, 130, .45) 5deg, transparent 11deg, transparent 18deg, rgba(255, 210, 150, .4) 24deg, transparent 31deg, transparent 38deg, rgba(255, 200, 150, .35) 43deg, transparent 50deg, transparent 360deg),
    linear-gradient(to bottom, #d4e3f2 0%, #ffd9bf 34%, #fdf1e3 70%, #fdf6ec 100%);
  box-shadow: inset 0 0 0 1px rgba(110, 70, 30, .12);
}
.theme-prev.is-morning i:nth-child(1), .theme-prev.is-morning i:nth-child(2) { background: rgba(255, 252, 247, .88); box-shadow: 0 1px 2px rgba(110, 70, 30, .14); }
.theme-prev.is-morning i:nth-child(3) { background: linear-gradient(135deg, #ffb35c, #c24a26); }
.theme-tile span:last-child { text-align: center; line-height: 1.3; }

.swatches { display: flex; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; position: relative; transition: transform .2s var(--spring); }
.swatch:hover { transform: scale(1.1); }
.swatch.is-on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px currentColor; }
.swatch.is-violet { background: #6236ee; color: #6236ee; }
.swatch.is-blue { background: #1d6ee0; color: #1d6ee0; }
.swatch.is-teal { background: #0a8a80; color: #0a8a80; }
.swatch.is-rose { background: #d3336d; color: #d3336d; }
.swatch.is-amber { background: #c26400; color: #c26400; }

/* ความโปร่งใสของ Liquid Glass: ตัวอย่างสด + แถบเลื่อน (ปิด Liquid Glass แล้วแถวนี้จางและกดไม่ได้) */
.set-row.set-range { grid-template-columns: 1fr; gap: 12px; }
.set-row.is-off .glass-demo, .set-row.is-off .range-row { opacity: .4; filter: grayscale(.6); pointer-events: none; }
.glass-demo {
  position: relative; isolation: isolate; height: 136px; border-radius: 18px; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, transparent 0 13px, rgba(255, 255, 255, .22) 13px 14px),
    repeating-linear-gradient(90deg, transparent 0 13px, rgba(255, 255, 255, .22) 13px 14px),
    linear-gradient(120deg, #1b2a6b, #4b2a9a 45%, #0f5f6e);
  transition: opacity .25s, filter .25s;
}
.glass-demo i { position: absolute; border-radius: 50%; z-index: -1; animation: demo-float 9s ease-in-out infinite alternate; }
.glass-demo i:nth-child(1) { width: 92px; height: 92px; left: 8%; top: 12%; background: #22e3d2; }
.glass-demo i:nth-child(2) { width: 70px; height: 70px; left: 46%; top: 48%; background: #ff6fb5; animation-duration: 11s; animation-direction: alternate-reverse; }
.glass-demo i:nth-child(3) { width: 58px; height: 58px; right: 10%; top: 8%; background: #ffc14d; animation-duration: 7s; }
@keyframes demo-float { from { transform: translate(-14px, 6px); } to { transform: translate(26px, -8px); } }
.glass-demo-pane {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(64%, 300px); height: 64%; border-radius: 24px;
  display: grid; place-content: center; text-align: center; gap: 0; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
}
.glass-demo-pane b { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.glass-demo-pane small { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--mute); }
html.motion-off .glass-demo i, html.motion-subtle .glass-demo i { animation: none; }

.range-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); transition: opacity .25s; }
.range-row output { min-width: 42px; text-align: right; font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.range-row input[type="range"] {
  flex: 1; height: 28px; margin: 0; background: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.range-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent) 0 var(--fill, 60%), var(--surface-3) var(--fill, 60%) 100%);
}
.range-row input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
.range-row input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(0, 0, 0, .12);
  transition: transform .3s var(--spring);
}
.range-row input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .28); }
.range-row input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
.range-row input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 46px; height: 28px; border-radius: 16px; background: var(--surface-3); position: relative; transition: background .22s; box-shadow: inset 0 0 0 1px var(--line); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--spring); }
.switch input:checked + .track { background: var(--accent); box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- ครอปรูป ---------- */
.crop-card { width: min(520px, 100%); padding: 20px 22px 20px; }
.crop-card.is-cover { width: min(720px, 100%); }
.crop-stage {
  position: relative; height: min(380px, 52vh); border-radius: 18px; overflow: hidden;
  background: repeating-conic-gradient(#20263a 0% 25%, #1a1f30 0% 50%) 50% / 22px 22px;
  touch-action: none; cursor: grab; user-select: none;
}
.crop-card.is-cover .crop-stage { height: min(320px, 44vh); }
.crop-stage.is-dragging { cursor: grabbing; }
.crop-stage img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.crop-frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(8, 10, 18, .58), inset 0 0 0 2px rgba(255, 255, 255, .9);
}
.crop-card.is-cover .crop-frame { border-radius: 12px; }
.crop-frame i { position: absolute; background: rgba(255, 255, 255, .28); }
.crop-frame i:nth-child(1) { left: 33.33%; right: 33.33%; top: 0; bottom: 0; border-left: 1px solid rgba(255, 255, 255, .3); border-right: 1px solid rgba(255, 255, 255, .3); background: none; opacity: 0; transition: opacity .2s; }
.crop-frame i:nth-child(2) { top: 33.33%; bottom: 33.33%; left: 0; right: 0; border-top: 1px solid rgba(255, 255, 255, .3); border-bottom: 1px solid rgba(255, 255, 255, .3); background: none; opacity: 0; transition: opacity .2s; }
.crop-stage.is-dragging .crop-frame i { opacity: 1; }
.crop-tools { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.crop-tools input[type="range"] { flex: 1; accent-color: var(--accent); height: 28px; }
.crop-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.crop-hint { font-size: 12.5px; color: var(--dim); text-align: center; margin-top: 4px; }

/* ---------- จอกลาง ---------- */
@media (max-width: 1023px) {
  .acct-grid, .settings-grid { grid-template-columns: 1fr; }
}

/* ---------- มือถือ: เมนูและหน้าต่างกลายเป็นแผ่นเลื่อนขึ้นจากล่าง ---------- */
@media (max-width: 820px) {
  .acct { gap: 2px; }
  .signin-btn { height: 38px; padding: 0 14px 0 10px; font-size: 14px; }
  .avatar-sm { --size: 34px; }

  .menu-layer .layer-scrim { background: var(--scrim); }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--line-strong); margin: 2px auto 8px; }

  .acct-menu, .modal-card {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-height: 92vh; max-height: 92dvh;
    border-radius: 28px 28px 0 0; border-bottom: none;
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(100%); opacity: 1;
    transition: transform .34s var(--ease);
  }
  .menu-layer.is-open .acct-menu, .modal-layer.is-open .modal-card { transform: none; }
  .modal-layer { display: block; padding: 0; }
  .menu-item { padding: 13px 12px; font-size: 16px; }
  .menu-head { padding: 6px 8px 12px; }

  .modal-card { padding-left: 20px; padding-right: 20px; }
  .auth-card { padding-top: 10px; }
  .auth-card .modal-x { top: 12px; right: 12px; }
  .auth-mark { width: 54px; height: 54px; border-radius: 17px; margin-bottom: 10px; }
  .auth-mark img { width: 36px; height: 36px; }
  .auth-title { font-size: 22px; }
  .crop-card, .crop-card.is-cover { width: 100%; }
  .crop-stage { height: min(360px, 50vh); }
  .modal-foot .btn { flex: 1; }

  .profile-hero { border-radius: var(--r-lg); margin: 0 calc(-1 * var(--gutter) + 8px); }
  .profile-cover { aspect-ratio: 5 / 2; }
  .cover-edit { right: 10px; bottom: 10px; padding: 7px; }
  .cover-edit span { display: none; }
  .profile-main { grid-template-columns: 1fr; gap: 6px; padding: 0 18px 20px; align-items: start; }
  .avatar-xl { --size: 96px; }
  .profile-avatar { margin-top: -48px; width: fit-content; }
  .avatar-edit { width: 34px; height: 34px; right: 0; bottom: 2px; }
  .profile-id { padding-top: 4px; }
  .profile-cta { position: absolute; right: 16px; margin-top: 12px; }
  .profile-main { position: relative; }
  .profile-cta .btn { padding: 6px 12px; }
  .page-tabs-wrap { position: sticky; top: var(--nav-space); z-index: 20; margin: 14px calc(-1 * var(--gutter)) 12px; padding: 8px var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
  .panel-card { padding: 20px 18px; border-radius: 20px; }
  .media-row { grid-template-columns: auto minmax(0, 1fr); }
  .media-acts { grid-column: 1 / -1; justify-content: flex-end; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { text-align: left; margin-bottom: 8px; }
  .theme-tiles { gap: 8px; grid-template-columns: repeat(3, 1fr); }
  .gate { padding: 34px 20px; }
  .form-foot .btn { flex: 1; }
}
