/* ───────── tokens ───────── */
:root {
  --bg: #080b0f;
  --bg-2: #0d1218;
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .085);
  --stroke: rgba(255, 255, 255, .10);
  --stroke-2: rgba(255, 255, 255, .18);
  --text: #eef2f6;
  --muted: #8d98a6;
  --accent: #52e6a8;
  --accent-ink: #052018;
  --accent-soft: rgba(82, 230, 168, .14);
  --hot: #ffb057;
  --hot-soft: rgba(255, 176, 87, .14);
  --danger: #ff7a7a;
  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 18px 40px -22px rgba(0,0,0,.9);
  --lift: 0 1px 0 rgba(255,255,255,.10) inset, 0 26px 50px -20px rgba(0,0,0,.95);
  --float: rgba(11, 16, 22, .88);   /* พื้นผิวลอยเหนือเนื้อหา ต้องทึบพอให้อ่านได้จริง */
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"] {
  --bg: #eef1f5;
  --bg-2: #e4e9f0;
  --glass: rgba(255, 255, 255, .70);
  --glass-2: rgba(255, 255, 255, .90);
  --stroke: rgba(12, 20, 30, .09);
  --stroke-2: rgba(12, 20, 30, .16);
  --text: #101720;
  --muted: #5f6b7a;
  --accent: #0c9a6c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(12, 154, 108, .12);
  --hot: #b3651b;
  --hot-soft: rgba(179, 101, 27, .12);
  --danger: #c33;
  --float: rgba(252, 253, 255, .92);
  --shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 12px 28px -18px rgba(20,30,45,.55);
  --lift: 0 1px 0 rgba(255,255,255,.9) inset, 0 20px 36px -16px rgba(20,30,45,.6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* ───────── ฉากหลัง ───────── */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.aurora .blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5;
  will-change: transform;
}
.aurora .b1 { width: 62vmax; height: 62vmax; left: -22vmax; top: -24vmax; background: #0f6b52; animation: drift1 28s ease-in-out infinite; }
.aurora .b2 { width: 52vmax; height: 52vmax; right: -20vmax; top: 18vh; background: #14456e; animation: drift2 34s ease-in-out infinite; }
.aurora .b3 { width: 46vmax; height: 46vmax; left: 12vw; bottom: -22vmax; background: #4a2a5e; opacity: .38; animation: drift3 40s ease-in-out infinite; }
.aurora .grain {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, transparent 35%, rgba(0,0,0,.55) 100%);
}
:root[data-theme="light"] .aurora .b1 { background: #7fe3c1; opacity: .55; }
:root[data-theme="light"] .aurora .b2 { background: #9cc6f0; opacity: .5; }
:root[data-theme="light"] .aurora .b3 { background: #c9b6e8; opacity: .45; }
:root[data-theme="light"] .aurora .grain { background: radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(255,255,255,.65) 100%); }

@keyframes drift1 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(8vw,6vh,0) scale(1.12); } }
@keyframes drift2 { 0%,100% { transform: translate3d(0,0,0) scale(1.05); } 50% { transform: translate3d(-7vw,-5vh,0) scale(.92); } }
@keyframes drift3 { 0%,100% { transform: translate3d(0,0,0) scale(.95); } 50% { transform: translate3d(5vw,-7vh,0) scale(1.1); } }

/* ───────── โครงหน้าจอ ───────── */
.screen { position: relative; z-index: 1; height: 100dvh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ───────── หน้าเข้าสู่ระบบ ───────── */
.auth {
  align-items: center; justify-content: center; text-align: center;
  padding: 24px 22px calc(28px + var(--safe-b));
}
.stage { perspective: 760px; width: 200px; height: 200px; position: relative; }
/* glow เป็นชั้นของตัวเอง — box-shadow บนชิ้นที่ clip-path จะเรืองเป็นสี่เหลี่ยม */
.glow {
  position: absolute; left: 50%; top: 40%; width: 230px; height: 230px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(82,230,168,.30) 0%, rgba(82,230,168,.10) 38%, transparent 68%);
  pointer-events: none;
}
:root[data-theme="light"] .glow { background: radial-gradient(circle, rgba(12,154,108,.20) 0%, transparent 65%); }
.shuttle {
  position: absolute; left: 50%; top: 108px; width: 0; height: 0;
  transform-style: preserve-3d;
  animation: spin 16s linear infinite, bob 5.5s ease-in-out infinite;
}
.skirt { position: absolute; left: 0; bottom: 0; transform-style: preserve-3d; }
.skirt i {
  position: absolute; left: -9px; bottom: 0; width: 18px; height: 96px;
  transform-origin: 50% 100%;
  transform: rotateY(calc(var(--i) * 45deg)) rotateX(-15deg);
  background: linear-gradient(to top, rgba(255,255,255,.14), rgba(255,255,255,.62));
  clip-path: polygon(50% 100%, 100% 26%, 84% 0, 16% 0, 0 26%);
  border-radius: 3px;
}
.cork {
  position: absolute; left: -17px; bottom: -30px; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffffff, var(--accent) 62%, #0a6a4c 100%);
}
.shadow {
  position: absolute; left: 50%; bottom: 8px; width: 96px; height: 14px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0,0,0,.55), transparent 70%);
  filter: blur(4px);
  animation: shadowPulse 5.5s ease-in-out infinite;
}
:root[data-theme="light"] .skirt i { background: linear-gradient(to top, rgba(20,40,60,.20), rgba(255,255,255,.95)); }
@keyframes spin { to { transform: rotateY(360deg); } }
@keyframes bob { 0%,100% { translate: 0 0; } 50% { translate: 0 -14px; } }
@keyframes shadowPulse { 0%,100% { opacity: .5; width: 96px; } 50% { opacity: .28; width: 72px; } }

.brand { font-size: 1.9rem; font-weight: 700; margin: 18px 0 0; letter-spacing: -.02em; }
.tagline { color: var(--muted); margin: 8px 0 30px; font-size: .92rem; line-height: 1.7; }
.auth-actions { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.auth-note { color: var(--muted); font-size: .8rem; margin: 2px 0 0; min-height: 1em; }
.linky {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .84rem;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px;
}

/* ───────── ปุ่ม ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 600; letter-spacing: .01em;
  border: 1px solid var(--stroke); background: var(--glass); color: var(--text);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transition: transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .16s, background .16s;
}
.btn:active { transform: translateY(1px) scale(.985); box-shadow: var(--shadow); }
.btn.primary, .btn.accent { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.google { background: #fff; color: #1f2328; border-color: transparent; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { color: var(--danger); }
.btn.big { padding: 15px 22px; font-size: 1.02rem; flex: 1; }
.btn.small { padding: 9px 14px; font-size: .86rem; border-radius: 11px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.icon-btn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 13px; cursor: pointer;
  border: 1px solid var(--stroke); background: var(--glass); color: var(--text);
  font-size: 1.35rem; font-weight: 400; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.icon-btn:active { transform: scale(.94); }

/* ───────── แถบบน ───────── */
.topbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
}
.group-chip {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--stroke); background: var(--glass); color: var(--text);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font: inherit; font-weight: 600;
}
.group-chip .gname { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-chip:active { transform: scale(.985); }
.dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ready { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot.syncing { background: var(--hot); animation: pulse 1.1s ease-in-out infinite; }
.dot.error { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.avatar {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; overflow: hidden;
  border: 1px solid var(--stroke-2); background: var(--glass); color: var(--text);
  display: grid; place-items: center; font-weight: 700; font-size: .95rem; padding: 0;
}
.avatar #avatarInner { display: grid; place-items: center; width: 100%; height: 100%; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar:active { transform: scale(.94); }

/* ───────── พื้นที่เลื่อน ───────── */
.scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(104px + var(--safe-b));
  scroll-behavior: smooth;
}
.panel { display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin: 0 auto; }

/* ───────── การ์ด ───────── */
.card {
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.card > h2 { font-size: .95rem; font-weight: 700; margin: 0 0 12px; }
.card > h2 .hint { font-weight: 500; color: var(--muted); font-size: .8rem; margin-left: 6px; }
.note { color: var(--muted); font-size: .82rem; margin: 10px 0 0; line-height: 1.6; }
.note code { background: var(--glass-2); padding: 1px 5px; border-radius: 5px; font-size: .95em; }
.note.preview { color: var(--text); font-weight: 500; }
.error { background: var(--hot-soft); color: var(--hot); padding: 10px 12px; border-radius: var(--r-sm); font-size: .84rem; font-weight: 600; margin: 10px 0 0; }

/* ───────── ฟอร์ม ───────── */
input, select, textarea, button { font: inherit; font-family: inherit; color: var(--text); }
input[type="text"], input[type="time"], input[type="number"], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke); background: var(--glass-2); color: var(--text);
  appearance: none; -webkit-appearance: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
textarea { min-height: 96px; resize: vertical; font-size: .88rem; line-height: 1.6; }
select { background-image: none; padding-right: 10px; }

.add-row { display: flex; gap: 8px; }
.add-row input[type="text"] { flex: 1; min-width: 0; }
.add-row select { flex: 0 0 96px; }

.picker { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); }
.picker button {
  padding: 12px 6px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--stroke); background: var(--glass-2); color: var(--text);
  font: inherit; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: background .15s, color .15s, transform .15s, border-color .15s;
}
.picker button small { display: block; font-size: .66rem; font-weight: 600; opacity: .62; margin-top: 2px; }
.picker button[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.picker button[aria-pressed="true"] small { opacity: .75; }
.picker button.more { color: var(--muted); font-size: 1.15rem; }
.picker.wide { grid-template-columns: repeat(3, 1fr); }
.badge.single { background: rgba(120, 170, 255, .16); color: #7fb0ff; border-color: transparent; }
:root[data-theme="light"] .badge.single { background: rgba(28, 90, 190, .12); color: #1c5abe; }
.court .label .badge { margin-left: 6px; vertical-align: 1px; }
.picker button:active { transform: scale(.95); }

.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.fields.tight { margin-top: 12px; }
.fields label { display: flex; flex-direction: column; gap: 5px; }
.fields label span { font-size: .74rem; color: var(--muted); font-weight: 600; }

.slider-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .86rem; margin-bottom: 8px; }
.slider-head b { color: var(--accent); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 30px; background: transparent; accent-color: var(--accent); }

.fold { margin-top: 14px; border-top: 1px solid var(--stroke); padding-top: 12px; }
.fold summary { cursor: pointer; color: var(--muted); font-size: .84rem; font-weight: 600; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: '＋ '; }
.fold[open] summary::before { content: '－ '; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cta { display: flex; gap: 10px; margin-top: 4px; }

/* ───────── รายชื่อผู้เล่น ───────── */
.players { list-style: none; margin: 12px 0 0; padding: 0; }
.players li {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-top: 1px solid var(--stroke);
}
.players li.out { opacity: .38; }
.players li .tick {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 9px; cursor: pointer; padding: 0;
  border: 1.5px solid var(--stroke-2); background: transparent; color: var(--accent-ink);
  display: grid; place-items: center; font-size: .8rem;
}
.players li:not(.out) .tick { background: var(--accent); border-color: transparent; }
.players li .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.players li select { width: auto; flex: 0 0 auto; padding: 6px 9px; font-size: .82rem; border-radius: 9px; }
.players li .rm { flex: 0 0 auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; font-size: 1.05rem; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; color: var(--muted);
  background: var(--glass-2); border: 1px solid var(--stroke);
}
.badge.lv { background: var(--accent-soft); color: var(--accent); }
.badge.hot { background: var(--hot-soft); color: var(--hot); }

/* ───────── สรุป ───────── */
.summary { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(94px, 1fr)); }
.summary > div { background: var(--glass-2); border-radius: var(--r-sm); padding: 10px 12px; }
.summary .k { font-size: .7rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.summary .v {
  font-size: clamp(.95rem, 3.6vw, 1.2rem); font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.25;
}

/* ───────── รอบ ───────── */
.round {
  border: 1px solid var(--stroke); border-radius: var(--r); overflow: hidden;
  background: var(--glass); box-shadow: var(--shadow); margin-bottom: 10px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .2s;
}
.round.now { border-color: var(--accent); box-shadow: var(--lift), 0 0 0 1px var(--accent-soft); transform: translateY(-2px); }
.round.past { opacity: .42; }
.round > header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 14px; background: var(--glass-2); border-bottom: 1px solid var(--stroke);
}
.round.grouped > header { background: var(--hot-soft); }
.round > header .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.round > header .no { color: var(--muted); font-size: .82rem; margin-right: auto; }

.court { padding: 12px 14px; border-top: 1px solid var(--stroke); }
.court:first-of-type { border-top: 0; }
.court .label { font-size: .68rem; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 7px; }
.match { display: flex; align-items: center; gap: 10px; }
.team { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.team.right { text-align: right; align-items: flex-end; }
.team span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.team small { color: var(--muted); font-size: .68rem; font-weight: 600; }
.vs { flex: 0 0 auto; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.resting { padding: 9px 14px; border-top: 1px solid var(--stroke); font-size: .8rem; color: var(--muted); }
.resting b { color: var(--text); font-weight: 600; }

/* ───────── ปรับตารางกลางวง ───────── */
.live { border-color: var(--stroke-2); }
.stepper { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stepper .lab { flex: 1; font-size: .86rem; color: var(--muted); font-weight: 600; }
.stepper .val { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.6em; text-align: center; }
.stepper button {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer; flex: 0 0 auto;
  border: 1px solid var(--stroke); background: var(--glass-2); color: var(--text);
  font-size: 1.2rem; line-height: 1; display: grid; place-items: center;
}
.stepper button:active { transform: scale(.92); }
.stepper button:disabled { opacity: .3; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--stroke); background: var(--glass-2); color: var(--text);
  font: inherit; font-size: .84rem; font-weight: 600;
}
.chip .lv { color: var(--muted); font-weight: 500; font-size: .92em; }
.chip.off { opacity: .34; text-decoration: line-through; }
.chip.fresh { border-color: var(--accent); color: var(--accent); }
.chip:active { transform: scale(.94); }

.diff { font-size: .82rem; margin: 12px 0 0; line-height: 1.7; }
.diff .out { color: var(--danger); font-weight: 600; }
.diff .in { color: var(--accent); font-weight: 600; }
.diff .same { color: var(--muted); }

.round.locked { opacity: .5; }
.round.locked > header { background: var(--glass); }
.round.locked.now { opacity: .85; }

.pp {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
  border-radius: 8px; padding: 1px 6px; margin: 0 -6px;
  cursor: pointer; transition: background .14s, color .14s;
}
.pp.sel { background: var(--accent); color: var(--accent-ink); }
.resting .pp {
  display: inline-block; vertical-align: baseline;
  font-weight: 600; color: var(--text); margin: 0; padding: 2px 5px;
}
.resting .sep { color: var(--muted); margin: 0 1px 0 -3px; }
.swap-hint {
  padding: 9px 14px; border-top: 1px solid var(--stroke);
  font-size: .78rem; color: var(--accent); font-weight: 600;
}
.swap-hint .linky { font-size: .78rem; padding: 0 4px; color: var(--muted); }
.round.edited > header { background: var(--hot-soft); }
.card.prompt { border-color: var(--hot); }
.card.prompt > h2 { color: var(--hot); }

/* ───────── สถิติ ───────── */
table.stats { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.stats th, table.stats td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--stroke); }
table.stats th { color: var(--muted); font-size: .72rem; font-weight: 600; }
table.stats td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), rgba(82,230,168,.35)); display: block; }
.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 4px; }
table.matrix { border-collapse: collapse; font-size: .7rem; }
table.matrix th, table.matrix td { border: 1px solid var(--stroke); padding: 4px 6px; text-align: center; min-width: 28px; }
table.matrix th.side { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--bg-2); }
table.matrix td.c0 { color: var(--muted); opacity: .35; }
table.matrix td.c1 { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
table.matrix td.c2 { background: var(--hot-soft); color: var(--hot); font-weight: 700; }
table.matrix td.self { background: var(--glass-2); }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }

/* ───────── แท็บล่าง ───────── */
.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  z-index: 5; display: flex; gap: 2px; padding: 5px;
  width: min(420px, calc(100vw - 32px));
  border-radius: 20px; border: 1px solid var(--stroke-2);
  background: var(--float); box-shadow: var(--lift);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
}
.tabbar button {
  flex: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 9px 4px 7px; border-radius: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 600;
  transition: background .18s, color .18s, transform .18s;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tabbar button:active { transform: scale(.95); }

/* ───────── bottom sheet ───────── */
.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-height: 86dvh; overflow-y: auto;
  padding: 10px 18px calc(24px + var(--safe-b));
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--stroke-2);
  background: var(--bg-2); color: var(--text);
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,.9);
  animation: rise .26s cubic-bezier(.2,.9,.3,1);
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet .grip { width: 38px; height: 4px; border-radius: 2px; background: var(--stroke-2); margin: 2px auto 14px; }
.sheet h3 { font-size: 1rem; margin: 0 0 12px; }
.sheet > .note:last-child { margin-bottom: 0; }
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: 480px; border-radius: 24px; bottom: 24px; }
  @keyframes rise { from { transform: translate(-50%, 110%); } to { transform: translate(-50%, 0); } }
}

.group-list { list-style: none; margin: 0; padding: 0; }
.group-list li {
  display: flex; align-items: center; gap: 10px; padding: 12px 0;
  border-top: 1px solid var(--stroke);
}
.group-list li:first-child { border-top: 0; }
.group-list .pick { flex: 1; min-width: 0; background: none; border: 0; cursor: pointer; text-align: left; padding: 0; }
.group-list .pick b { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-list .pick small { color: var(--muted); font-size: .76rem; }
.group-list li.on .pick b { color: var(--accent); }
.group-list .mini { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 7px; font-size: .95rem; }

.account-head { display: flex; align-items: center; gap: 12px; padding: 2px 0 14px; }
.account-head .pic { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--glass-2); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.account-head .pic img { width: 100%; height: 100%; object-fit: cover; }
.account-head .who { min-width: 0; }
.account-head .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head .who small { color: var(--muted); font-size: .78rem; }

.menu { list-style: none; margin: 0; padding: 0; }
.menu li { border-top: 1px solid var(--stroke); }
.menu button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 14px 2px; font: inherit; font-weight: 500; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.menu button small { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 400; }
.menu button.danger { color: var(--danger); }

/* ───────── toast ───────── */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  z-index: 20; padding: 11px 18px; border-radius: 999px;
  background: var(--float); border: 1px solid var(--stroke-2); color: var(--text);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--lift); font-size: .85rem; font-weight: 600;
  max-width: calc(100vw - 40px); text-align: center;
  pointer-events: none;   /* ไม่บังปุ่มที่อยู่ใต้มัน */
  animation: toastIn .22s cubic-bezier(.2,.9,.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .shuttle { transform: rotateY(-22deg); }
}

@media print {
  .aurora, .topbar, .tabbar, .cta, .sheet, .scrim, .toast { display: none !important; }
  body, .screen, .scroll { height: auto; overflow: visible; background: #fff; color: #000; }
  .round, .card { break-inside: avoid; background: #fff; border-color: #ccc; box-shadow: none; }
}
