:root {
  --bg: #fdeef4;
  --card: #ffffff;
  --ink: #3b1626;
  --ink-2: #6e4558;
  --muted: #9a7183;
  --line: #f4d6e2;
  --line-2: #ecc2d3;
  --primary: #d6336c;
  --primary-hover: #b8285a;
  --primary-soft: #fde3ed;
  --primary-softer: #fff3f7;
  --free: #17784a;
  --free-bg: #def5e8;
  --busy: #b42a2a;
  --busy-bg: #fde3e3;
  --none: #76636c;
  --none-bg: #f1ebee;
  /* ท้องฟ้ากลางคืน */
  --night-1: #12061f;
  --night-2: #2a0c3d;
  --night-3: #5a1650;
  --night-4: #8e2a6b;
  --glow: #ffb3d4;
  --shadow: 0 1px 2px rgba(120, 20, 60, .06), 0 8px 28px rgba(180, 40, 90, .08);
  --shadow-lg: 0 2px 6px rgba(120, 20, 60, .08), 0 18px 50px rgba(180, 40, 90, .16);
  --radius: 22px;
  --dock-h: 120px;
  --font: 'Anuphan', 'Noto Sans Thai', 'Leelawadee UI', system-ui, sans-serif;
  --serif: 'Trirong', 'Noto Serif Thai', Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  padding-bottom: 40px;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ================= ส่วนหัว: ท้องฟ้ากลางคืน ================= */
.hero { position: relative; color: #fff; padding-bottom: 150px; } /* ไม่ตั้ง z-index เพื่อให้ช่องแชตลอยเหนือปฏิทินได้ */
.scene {
  position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 520px at 50% 100%, rgba(255, 105, 180, .55), transparent 70%),
    radial-gradient(700px 380px at 12% 18%, rgba(140, 60, 200, .35), transparent 70%),
    radial-gradient(700px 380px at 90% 30%, rgba(214, 51, 108, .28), transparent 70%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 38%, var(--night-3) 72%, var(--night-4) 100%);
}
.stars { position: absolute; inset: 0; }
.star {
  position: absolute; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px rgba(255, 220, 240, .9);
  animation: twinkle var(--d, 4s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes twinkle { 0%, 100% { opacity: var(--o, .8); transform: scale(1); } 50% { opacity: .15; transform: scale(.7); } }
.nebula {
  position: absolute; left: 50%; top: 34%; width: 820px; height: 420px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 140, 200, .28), transparent);
  filter: blur(20px);
}
/* ขอบดาวเคราะห์โค้งเรืองแสง */
.planet {
  position: absolute; left: 50%; top: calc(100% - 118px); transform: translateX(-50%);
  width: max(260%, 2600px); height: 2200px; border-radius: 50%;
  background: var(--bg);
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, .95),
    0 -4px 18px 2px rgba(255, 255, 255, .85),
    0 -14px 50px 10px rgba(255, 179, 212, .9),
    0 -40px 140px 50px rgba(240, 90, 160, .55);
}

/* แถบเมนูแคปซูล */
.topbar {
  position: relative; z-index: 4;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  max-width: 1240px; margin: 0 auto; padding: 18px 24px;
}
.topbar-side.right { display: flex; justify-content: flex-end; }
.capsule {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 10px 30px -12px rgba(0, 0, 0, .5);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: #fff; text-decoration: none; padding: 2px 8px 2px 2px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); position: relative; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .18), 0 0 14px rgba(255, 120, 180, .7); }
.brand-mark::after { content: ''; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #fff; left: 8.5px; top: 10px; }
.capsule-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .2); margin: 0 4px; }
.nav-link { border: 0; background: transparent; color: rgba(255, 255, 255, .82); font-weight: 500; font-size: 15px; padding: 6px 14px; border-radius: 999px; }
.nav-link:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.hero-inner { position: relative; max-width: 1240px; margin: 0 auto; padding: 22px 24px 0; text-align: center; }
.group-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: #ffe3f0;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 200, 225, .28);
}
.hero h1 { margin: 14px 0 0; font-size: clamp(34px, 5.4vw, 62px); line-height: 1.45; letter-spacing: -.005em; }
.hero h1 span { display: block; }
.hero h1 .l1 { font-weight: 700; color: #fff; text-shadow: 0 2px 30px rgba(255, 120, 190, .35); }
.hero h1 .l2 {
  font-family: var(--serif); font-style: italic; font-weight: 600; line-height: 1.5;
  padding: 0 .2em .08em; margin-top: -.05em;
  background: linear-gradient(95deg, #ffd6e8 0%, #ffb0d2 45%, #ff8cc0 70%, #ffe1ee 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* เวทีกลางส่วนหัว: การ์ดลอย | ช่องแชต | การ์ดลอย */
.hero-stage {
  margin: 30px auto 0; display: grid; align-items: center; gap: 28px;
  grid-template-columns: minmax(200px, 250px) minmax(0, 640px) minmax(200px, 250px); justify-content: center;
}

/* ================= ช่องแชต ================= */
.dock { position: relative; z-index: 5; text-align: left; }
.dock::after { /* วงแสงเรืองรอบช่องพิมพ์ */
  content: ''; position: absolute; inset: -46px -60px; z-index: -1; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 120, 190, .55), rgba(255, 120, 190, .18) 55%, transparent 75%);
  filter: blur(8px);
}
.composer {
  position: relative; background: #fff; color: var(--ink); border-radius: 26px; padding: 12px 12px 10px 16px;
  display: flex; flex-direction: column; gap: 6px; border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 170, 210, .5), 0 20px 60px -10px rgba(255, 80, 160, .55);
}
.composer:focus-within { box-shadow: 0 0 0 6px rgba(255, 200, 225, .22), 0 0 0 1px #f39ac0, 0 20px 60px -10px rgba(255, 80, 160, .7); }
.composer textarea {
  width: 100%; border: 0; outline: none; resize: none; padding: 6px 2px 4px; font-size: 17px; line-height: 1.55;
  max-height: 140px; background: transparent; min-height: 48px;
}
.composer textarea::placeholder { color: #b9939f; }
.composer-bottom { display: flex; align-items: center; gap: 6px; }

.who { position: relative; flex: none; }
.who-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; padding: 3px 10px 3px 3px;
  border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.who-btn:hover, .who-btn[aria-expanded="true"] { background: var(--primary-soft); border-color: transparent; color: var(--primary-hover); }
.who-btn.attention { animation: nudge .5s 2; background: #ffe2b3; border-color: #e08a00; color: #8a4b00; }
@keyframes nudge { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.who-avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary-hover); font-size: 12px; font-weight: 700;
}
.who-btn.set .who-avatar { background: var(--primary); color: #fff; }
.who-menu {
  position: absolute; left: 0; bottom: calc(100% + 10px); width: 250px; max-height: min(60dvh, 430px); overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
}
.who-menu .menu-head { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.who-opt { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 12px; font-size: 15px; color: var(--ink); }
.who-opt:hover, .who-opt:focus-visible { background: var(--primary-softer); outline: none; }
.who-opt .who-avatar { width: 28px; height: 28px; }
.who-opt .check { margin-left: auto; color: var(--primary); visibility: hidden; }
.who-opt[aria-selected="true"] { background: var(--primary-soft); font-weight: 600; }
.who-opt[aria-selected="true"] .check { visibility: visible; }
.year-chip {
  flex: none; font-size: 13px; font-weight: 600; color: var(--primary-hover); background: var(--primary-softer);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 2px 0;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--primary); color: var(--primary-hover); background: var(--primary-softer); }
.chip-accent { background: var(--primary-soft); border-color: transparent; color: var(--primary-hover); font-weight: 600; }
.thread-toggle { flex: none; border: 0; background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; font-size: 13px; border-radius: 999px; padding: 4px 12px; }
.send {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 18px -4px rgba(214, 51, 108, .75); transition: background .15s, transform .1s;
}
.send:hover { background: var(--primary-hover); }
.send:active { transform: scale(.95); }
.send:disabled { background: #eab3c7; box-shadow: none; }

/* หน้าต่างแชต: จอคอมเปิดลงใต้ช่องพิมพ์ */
.thread-wrap {
  position: absolute; left: 0; right: 0; top: calc(100% + 12px); z-index: 30;
  background: rgba(255, 255, 255, .98); color: var(--ink); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: min(56dvh, 540px);
}
.thread-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.thread-head small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.thread { overflow-y: auto; padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: #f9eef3; border-bottom-left-radius: 6px; }
.msg.bot .hint { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.msg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); opacity: .4; animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 50% { opacity: 1; transform: translateY(-2px); } }

/* การ์ดยืนยันก่อนบันทึก */
.confirm { align-self: stretch; border: 1px solid var(--line-2); border-radius: 18px; padding: 12px; background: #fff; box-shadow: 0 4px 16px -8px rgba(214, 51, 108, .3); }
.confirm-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink-2); }
.warn { background: #fff4e5; color: #8a4b00; border-radius: 12px; padding: 8px 10px; font-size: 14px; margin-bottom: 8px; }
.note { color: var(--ink-2); font-size: 13px; margin: 6px 0 2px; }
.note b { color: var(--primary-hover); }
.c-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 14px; }
.c-row { border-top: 1px dashed var(--line); padding: 8px 0; }
.c-row:first-of-type { border-top: 0; }
.c-sum { font-weight: 600; font-size: 15px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.c-sum .dot-sep { color: var(--muted); }
.c-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.c-edit select, .c-edit input, .c-name select { border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 8px; background: #fff; min-height: 36px; font-size: 14px; }
.c-name select.need { border-color: #e08a00; box-shadow: 0 0 0 3px #ffe2b3; }
.c-edit input.year { width: 78px; }
.c-edit .seg { grid-template-columns: repeat(3, auto); }
.c-edit .seg button { min-height: 34px; padding: 2px 10px; font-size: 13px; }
.c-del { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.confirm.done { opacity: .75; }
.confirm.done .c-edit, .confirm.done .confirm-actions, .confirm.done .c-name, .confirm.done .warn { display: none; }

/* ================= การ์ดลอยโปร่งแสง ================= */
.float-card {
  text-align: left; border-radius: 20px; padding: 16px 16px 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 24px 50px -20px rgba(10, 0, 20, .6);
}
.fc-today { transform: rotate(-2.5deg) translateY(10px); animation: floaty 7s ease-in-out infinite; }
.fc-month { transform: rotate(2.5deg) translateY(-6px); animation: floaty 8s ease-in-out -2s infinite; }
@keyframes floaty { 50% { translate: 0 -8px; } }
.fc-kicker { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: #ffd0e4; }
.fc-title { font-size: 16px; font-weight: 700; color: #fff; margin: 2px 0 10px; line-height: 1.4; }
.fc-rows { display: flex; flex-direction: column; gap: 6px; }
.fc-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.fc-row b { color: #fff; font-size: 15px; }
.float-card .pill { font-size: 12px; padding: 2px 9px; }
.progress { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .15); margin-top: 12px; }
.progress span { display: block; height: 100%; }
.progress .p-free { background: #4ade80; }
.progress .p-busy { background: #fb7185; }
.fc-foot { font-size: 12px; color: #ffd6e8; margin-top: 6px; }
.fc-big { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 2px; }
.fc-big b { font-size: 44px; line-height: 1.1; font-weight: 700; color: #fff; }
.fc-big span { font-size: 16px; color: #ffe3f0; font-weight: 600; }
.spark { display: block; width: 100%; height: 48px; margin-top: 8px; overflow: visible; }

/* ================= เนื้อหา (พื้นชมพูอ่อน) ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; white-space: nowrap; transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px -6px rgba(214, 51, 108, .6); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #e8a9c0; box-shadow: none; cursor: not-allowed; }
.btn-soft { background: var(--primary-soft); color: var(--primary-hover); }
.btn-soft:hover { background: #fbd3e2; }
.btn-white { background: #fff; color: var(--night-2); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .45); }
.btn-white:hover { background: #ffe9f2; color: var(--primary-hover); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn.sm { width: 32px; height: 32px; }

.layout {
  position: relative; z-index: 4;
  max-width: 1240px; margin: -96px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start;
}
.card { background: var(--card); border-radius: var(--radius); border: 1px solid rgba(244, 214, 226, .7); }
.calendar-card, .day-card { box-shadow: 0 -10px 40px -10px rgba(255, 150, 200, .55), var(--shadow-lg); }

.calendar-card { padding: 20px; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-nav h2 { margin: 0; font-size: 24px; font-weight: 700; min-width: 190px; text-align: center; line-height: 1.5; }
.cal-actions { display: flex; gap: 8px; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays span { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.weekdays span:first-child, .weekdays span:last-child { color: var(--primary); }

.day {
  position: relative; min-height: 92px; padding: 8px 8px 7px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.day:hover { border-color: var(--line-2); box-shadow: 0 4px 14px -6px rgba(214, 51, 108, .35); }
.day.out { background: transparent; border-style: dashed; border-color: #f4dde6; }
.day.out .num { color: #cfb1bf; }
.day.out .counts { opacity: .45; }
.day .num { font-weight: 700; font-size: 16px; line-height: 1.2; display: flex; align-items: center; gap: 6px; }
.day.today .num span:first-child { background: var(--primary); color: #fff; border-radius: 999px; min-width: 26px; height: 26px; display: inline-grid; place-items: center; padding: 0 6px; }
.day.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; background: var(--primary-softer); }
.day.all-free { background: linear-gradient(180deg, #e9f9f0, #fff); border-color: #9fd9b8; }
.day.all-free.selected { box-shadow: 0 0 0 2px var(--free) inset; }
.counts { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.cnt { font-size: 12px; font-weight: 600; line-height: 1.35; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnt.free { color: var(--free); background: var(--free-bg); }
.cnt.busy { color: var(--busy); background: var(--busy-bg); }
.badge-allfree, .mini-allfree { font-size: 11px; font-weight: 700; color: #fff; background: var(--free); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.day .me-mark { position: absolute; right: 7px; top: 7px; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 999px; line-height: 18px; }
.day .me-mark.free { background: var(--free-bg); color: var(--free); }
.day .me-mark.busy { background: var(--busy-bg); color: var(--busy); }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.legend-note { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }

/* ป้ายสถานะ: สี + ข้อความทุกครั้ง */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.s-free { color: var(--free); background: var(--free-bg); }
.s-busy { color: var(--busy); background: var(--busy-bg); }
.s-none { color: var(--none); background: var(--none-bg); }

.find-result { margin-top: 16px; border-radius: 16px; background: var(--primary-softer); border: 1px solid var(--line); padding: 14px 16px; }
.find-result h3 { margin: 0 0 8px; font-size: 16px; }
.find-result p { margin: 0; color: var(--ink-2); }
.date-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.date-chip { border: 1px solid #9fd9b8; background: #fff; color: var(--free); font-weight: 600; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.date-chip:hover { background: var(--free-bg); }
.near { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.near ul { margin: 6px 0 0; padding-left: 18px; }
.near button { border: 0; background: none; padding: 0; color: var(--primary-hover); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.day-card { padding: 20px; position: sticky; top: 16px; }
.day-card h3 { margin: 0; font-size: 19px; line-height: 1.45; }
.day-card .day-sub { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.allfree-banner { background: var(--free-bg); color: var(--free); font-weight: 600; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; }
.me-editor { border: 1px solid var(--line); background: var(--primary-softer); border-radius: 16px; padding: 12px; margin-bottom: 14px; }
.me-editor .label { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me-editor select { border: 1px solid var(--line-2); border-radius: 10px; padding: 4px 8px; background: #fff; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { min-height: 40px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fff; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 6px; }
.seg button i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.seg button[data-s="free"] { color: var(--free); }
.seg button[data-s="busy"] { color: var(--busy); }
.seg button[data-s="none"] { color: var(--none); }
.seg button[aria-pressed="true"][data-s="free"] { background: var(--free-bg); border-color: var(--free); }
.seg button[aria-pressed="true"][data-s="busy"] { background: var(--busy-bg); border-color: var(--busy); }
.seg button[aria-pressed="true"][data-s="none"] { background: var(--none-bg); border-color: var(--none); }
.seg button:disabled { opacity: .6; cursor: progress; }
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.roster li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #f8e7ee; }
.roster li:last-child { border-bottom: 0; }
.roster .n { width: 22px; color: var(--muted); font-size: 13px; text-align: right; flex: none; }
.roster .nm { flex: 1; font-weight: 500; min-width: 0; }
.roster .you { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.roster li.is-me { background: var(--primary-softer); border-radius: 10px; }

.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); text-align: center; }
.error-card { padding: 28px; text-align: center; grid-column: 1 / -1; }

/* ================= ขนาดจอ ================= */
/* จอคอมเล็ก: การ์ดลอยย้ายไปใต้ช่องพิมพ์ */
@media (max-width: 1180px) and (min-width: 981px) {
  .hero-stage { grid-template-columns: repeat(2, minmax(0, 300px)); grid-template-areas: "dock dock" "a b"; }
  .dock { grid-area: dock; width: min(640px, 100%); margin: 0 auto; }
  .fc-today { grid-area: a; justify-self: end; width: 100%; }
  .fc-month { grid-area: b; width: 100%; }
}

/* แท็บเล็ต + มือถือ: ช่องพิมพ์ติดด้านล่างจอ ซ่อนการ์ดลอย */
@media (max-width: 980px) {
  body { padding-bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom)); }
  .hero { padding-bottom: 110px; }
  .hero-stage { display: block; margin-top: 0; }
  .float-card { display: none; }
  .dock {
    position: fixed; z-index: 50; left: 50%; bottom: 0; transform: translateX(-50%);
    width: min(780px, 100%); padding: 0 10px calc(10px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 8px;
  }
  .dock::after { display: none; }
  .dock::before { /* ไล่สีจาง ๆ หลังช่องพิมพ์ ให้อ่านง่ายเมื่อเลื่อนผ่านเนื้อหา */
    content: ''; position: absolute; left: -100vw; right: -100vw; bottom: 0; height: calc(var(--dock-h) + 44px); z-index: -1; pointer-events: none;
    background: linear-gradient(180deg, rgba(253, 238, 244, 0), rgba(253, 238, 244, .94) 45%);
  }
  .composer { box-shadow: 0 0 0 1px var(--line-2), 0 14px 40px -10px rgba(180, 40, 90, .35); }
  .thread-wrap { position: static; max-height: min(52dvh, 520px); }
  .layout { grid-template-columns: 1fr; margin-top: -70px; }
  .day-card { position: static; }
  .planet { top: calc(100% - 92px); }
}

@media (max-width: 640px) {
  :root { --radius: 18px; }
  .topbar { grid-template-columns: auto 1fr; padding: 12px 14px; }
  .topbar-side:first-child { display: none; }
  .nav-link, .capsule-sep { display: none; }
  .capsule { padding: 5px 12px 5px 6px; }
  .btn-white { min-height: 38px; padding: 6px 12px; font-size: 14px; }
  .hero-inner { padding: 10px 16px 0; }
  .group-pill { font-size: 13px; }
  .hero h1 { font-size: clamp(30px, 8.6vw, 40px); margin-top: 10px; }
  .hero { padding-bottom: 90px; }
  .planet { top: calc(100% - 70px); width: 1500px; height: 1300px; }
  .layout { padding: 0 10px; gap: 12px; margin-top: -50px; }
  .calendar-card { padding: 14px 10px; }
  .day-card { padding: 16px; }
  .cal-toolbar { gap: 10px; }
  .cal-nav { width: 100%; justify-content: space-between; }
  .cal-nav h2 { font-size: 20px; min-width: 0; }
  .cal-actions { width: 100%; }
  .cal-actions .btn { flex: 1; }
  .weekdays, .grid { gap: 3px; }
  .day { min-height: 66px; padding: 4px 3px; border-radius: 10px; gap: 2px; }
  .day .num { font-size: 13px; }
  .day.today .num span:first-child { min-width: 22px; height: 22px; }
  .cnt { font-size: 9.5px; padding: 0 3px; border-radius: 4px; letter-spacing: -.02em; }
  .badge-allfree { font-size: 9px; padding: 0 4px; }
  .day .me-mark { display: none; }
  .legend-note { margin-left: 0; }
  .composer { border-radius: 22px; padding: 8px 8px 8px 12px; }
  .composer textarea { font-size: 16px; min-height: 40px; }
  .who-btn #whoLabel { max-width: 82px; overflow: hidden; text-overflow: ellipsis; }
  .msg { font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
