/* Week view under 1300px: strong blur to abstract images */
@media (max-width: 1300px) {
  #calendar.is-week .fc-timegrid-col .day-image-bg img { filter: blur(8px) saturate(.9) contrast(.9); transform: scale(1.1); transform-origin: center; }
}
:root {
  --bg-1: #0f0c29;
  --bg-2: #302b63;
  --bg-3: #24243e;
  --accent: #7c5cff;
  --accent-2: #1ecbe1;
  --danger: #ff4d4f;
  --text: #e8e8f0;
  --muted: #a3a3b3;
  --card: rgba(255,255,255,0.08);
  --card-strong: rgba(255,255,255,0.12);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --font-xs: clamp(10px, 1.6vw, 12px);
  --font-sm: clamp(12px, 1.9vw, 14px);
  --font-md: clamp(13px, 2.2vw, 16px);
  --font-lg: clamp(16px, 3.2vw, 22px);
  --font-xl: clamp(18px, 4.0vw, 28px);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  overflow: hidden;
  font-size: var(--font-md);
}

/* Animated background */
.bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(-45deg, var(--bg-1), var(--bg-2), var(--bg-3), #000);
  background-size: 400% 400%;
  animation: gradientShift 18s ease infinite;
  z-index: -1;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hidden { display: none; }

/* Password overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  backdrop-filter: blur(10px) saturate(130%);
  z-index: 1000;
  pointer-events: auto;
}
.auth-overlay.hide {
  animation: fadeOut 450ms ease forwards;
}
@keyframes fadeOut {
  to { opacity: 0; visibility: hidden; }
}
.auth-card {
  width: min(520px, 94vw);
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform-origin: center;
  animation: popIn 420ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes popIn {
  0% { opacity: 0; transform: translateY(14px) scale(.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.logo-glow {
  width: 14px; height: 14px; border-radius: 999px; background: radial-gradient(circle at 30% 30%, var(--accent), transparent 60%);
  box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-2);
}
.brand { margin: 0; font-weight: 700; letter-spacing: 0.6px; }
.subtitle { margin: 2px 0 16px; color: var(--muted); }
.auth-form { display: flex; gap: 10px; }
.auth-error { color: var(--danger); min-height: 22px; margin-top: 8px; font-size: 13px; }
.hint { margin: 10px 2px 0; color: var(--muted); font-size: 12px; opacity: 0.9; }

.input {
  flex: 1;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 12px 14px;
  border-radius: 12px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, transform 150ms ease;
  font-size: var(--font-sm);
}
.input:focus { border-color: var(--accent); background: rgba(255,255,255,0.08); }

.btn {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(124,92,255,0.35);
  transition: transform 140ms ease, box-shadow 200ms ease, opacity 160ms ease;
  font-size: var(--font-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(124,92,255,0.45); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: rgba(255,255,255,0.06);
  box-shadow: none;
  border: 1px solid rgba(255,255,255,0.14);
}
.btn.primary { min-width: 112px; }
.btn.danger { background: linear-gradient(135deg, var(--danger), #ff7875); box-shadow: 0 6px 16px rgba(255,77,79,0.35); }

.icon-btn {
  appearance: none; border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.06);
  color: var(--text); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: grid; place-items: center;
  transition: transform 140ms ease, background 160ms ease;
}
.icon-btn:hover { transform: translateY(-1px); }
/* Inline SVG arrow icons */
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chev { display: inline-block; width: 10px; height: 10px; border-top: 2px solid var(--text); border-right: 2px solid var(--text); transform: rotate(45deg); }
.chev.left { transform: rotate(-135deg); }
.chev.right { transform: rotate(45deg); }

/* App layout */
.app { height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; backdrop-filter: blur(8px) saturate(120%);
}
.topbar .center { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; z-index: 2; }
.center-title { font-weight: 700; letter-spacing: .4px; opacity: .9; }
/* View-only + month view: reduce centered month title size by ~30% */
body.readonly-mode.is-month .center-title { font-size: 0.7em; line-height: 1.1; }
.topbar .left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.title { font-weight: 600; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; font-size: var(--font-lg); }
.nav { display: flex; gap: 8px; align-items: center; }
.view-switch { display: inline-flex; gap: 6px; background: rgba(255,255,255,0.06); padding: 4px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); }
.view-switch .seg { background: transparent; box-shadow: none; padding: 6px 8px; border-radius: 10px; border: none; font-size: var(--font-xs); }
.view-switch .seg.active { background: var(--card-strong); }

/* timezone chip removed */

.main { position: relative; height: calc(100vh - 64px); }
#calendar { height: 100%; margin: 0 8px 10px; padding: 6px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10); border-radius: 16px; box-shadow: var(--shadow); }
/* Toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: rgba(0,0,0,0.7); color: white; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 18px rgba(0,0,0,0.35); opacity: 0; pointer-events: none; transition: opacity 220ms ease, transform 220ms ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
/* Calendar view swap animation hook */
#calendar.calendar-anim-swap { animation: calSwap 300ms cubic-bezier(.2,.7,.2,1); }
@keyframes calSwap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Cross-view transitions */
#calendar.view-xfade-out { animation: viewOut 180ms ease both; }
#calendar.view-xfade-in { animation: viewIn 360ms cubic-bezier(.22,.61,.36,1) both; }
@keyframes viewOut { from { opacity: 1; transform: scale(1); filter: none; } to { opacity: 0; transform: scale(.98); filter: blur(.4px); } }
@keyframes viewIn { from { opacity: 0; transform: scale(1.01); filter: blur(.4px) saturate(.98); } to { opacity: 1; transform: scale(1); filter: none; } }

@media (prefers-reduced-motion: reduce) {
  #calendar.view-xfade-out, #calendar.view-xfade-in { animation: none !important; }
}

.fab {
  position: absolute; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 16px; font-size: 28px; line-height: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 28px rgba(124,92,255,0.4); border: none; color: white; cursor: pointer; transition: transform 160ms ease, box-shadow 200ms ease;
}
.fab:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 16px 34px rgba(124,92,255,0.5); }

/* FAB ripple */
.fab { overflow: hidden; }
.fab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at center, rgba(255,255,255,.35), transparent 60%); opacity: 0; transform: scale(.6); transition: transform 300ms ease, opacity 300ms ease; }
.fab:hover::after, .fab:active::after { opacity: .25; transform: scale(1); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 180ms ease; z-index: 1200; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none; transition: opacity 220ms ease, transform 220ms ease; z-index: 1300; }
.modal-card { width: min(720px, 94vw); background: var(--card); border: 1px solid rgba(255,255,255,0.14); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px; }
.modal-body { padding: 10px 8px; display: grid; gap: 10px; }
.modal-footer { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px; }
.modal.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.reservedBy-chip { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; background: rgba(255,255,255,0.12); color: var(--muted); font-size: 11px; }

/* Read-only event view styling */
.evt-view { display: grid; gap: 8px; }
.evt-view .v-title { font-weight: 700; font-size: var(--font-md); letter-spacing: .3px; }
.evt-view .v-time { color: var(--muted); font-size: var(--font-sm); }
.evt-view .v-desc { white-space: pre-wrap; line-height: 1.5; }
.evt-view .v-meta { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: var(--font-sm); }

/* Force-hide form controls in readonly mode */
body.readonly-mode #event-modal .field,
body.readonly-mode #event-modal .row,
body.readonly-mode #event-modal .checkbox,
body.readonly-mode #event-modal .modal-footer { display: none !important; }
body.readonly-mode #event-modal .evt-view { display: grid !important; }

/* FullCalendar overrides */
.fc { --fc-border-color: rgba(255,255,255,0.12); --fc-neutral-bg-color: rgba(255,255,255,0.04); --fc-page-bg-color: transparent; --fc-today-bg-color: rgba(124,92,255,0.18); --fc-now-indicator-color: var(--accent-2); }
.fc .fc-toolbar-title { font-weight: 700; letter-spacing: .3px; font-size: var(--font-lg); }
.fc .fc-button { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 6px 10px; }
.fc .fc-button:hover { background: rgba(255,255,255,0.1); }
.fc .fc-daygrid-day:hover { background: rgba(255,255,255,0.03); transition: background 120ms ease; }
.fc .fc-event { border-radius: 10px; border: none; padding: 1px 3px; transition: transform 180ms ease, box-shadow 220ms ease, filter 200ms ease; will-change: transform, box-shadow; }
.fc .fc-event:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,0.35); filter: saturate(1.05); }
.fc .fc-timegrid-slot { height: 1.6em; }
.fc .fc-timegrid-axis-cushion, .fc .fc-timegrid-slot-label-cushion { padding: 0 2px; font-size: clamp(9px, 1.3vw, 11px); }
.fc .fc-timegrid-slot { line-height: 1.25; }
.fc .fc-timegrid-event, .fc .fc-timegrid-event .fc-event-main { font-size: clamp(9px, 1.3vw, 11px); line-height: 1.15; }
.fc .fc-v-event .fc-event-time, .fc .fc-v-event .fc-event-title { font-size: clamp(9px, 1.3vw, 11px); }
.fc .fc-event .fc-event-main-frame { padding: 1px 3px; }

/* Month grid event text */
.fc .fc-daygrid-event { padding: 1px 3px; }
.fc .fc-daygrid-dot-event .fc-event-title, .fc .fc-daygrid-block-event .fc-event-title, .fc .fc-daygrid-event .fc-event-title { font-size: clamp(9px, 1.6vw, 11px); line-height: 1.15; }
.fc .fc-daygrid-event .fc-event-time { font-size: clamp(9px, 1.6vw, 11px); }
.fc .fc-daygrid-day-number { padding: 2px 3px; font-size: clamp(10px, 1.7vw, 12px); }
.fc .fc-col-header-cell-cushion { padding: 2px 4px; font-size: clamp(10px, 1.7vw, 12px); }
/* Ellipsis compaction styling */
.event-compact .fc-event-title, .event-compact .fc-event-time, .event-compact .fc-event-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-compact .fc-event-main-frame { padding-top: 0; }

/* List view items */
.fc .fc-list { font-size: var(--font-sm); }
.fc .fc-list-day { position: relative; }
/* List view hover: lower white background opacity by ~50% */
.fc .fc-list-table .fc-list-event:hover td { background: rgba(255,255,255,0.5) !important; }

/* Make current time indicator more prominent */
.fc .fc-timegrid-now-indicator-line { height: 2px; background: var(--accent-2); box-shadow: 0 0 10px rgba(30,203,225,0.9), 0 0 18px rgba(30,203,225,0.35); animation: nowPulse 2000ms ease-in-out infinite; }
.fc .fc-timegrid-now-indicator-arrow { border-color: transparent transparent var(--accent-2) transparent; filter: drop-shadow(0 0 6px rgba(30,203,225,.7)); }

/* Month view current time line (match blue indicator) */
.now-line-month {
  position: absolute; left: 2px; right: 2px; height: 2px;
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(30,203,225,0.9), 0 0 18px rgba(30,203,225,0.35);
  animation: nowPulse 2000ms ease-in-out infinite;
  border-radius: 2px; z-index: 3; pointer-events: none;
}

/* FullCalendar more-events popover: force white background */
.fc .fc-popover, .fc .fc-more-popover {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid rgba(0,0,0,0.12) !important;
  box-shadow: 0 12px 28px rgba(0,0,0,0.28) !important;
  border-radius: 12px !important;
}
.fc .fc-popover .fc-popover-header, .fc .fc-more-popover .fc-popover-header {
  background: #ffffff !important;
  color: #111111 !important;
  border-bottom: 1px solid rgba(0,0,0,0.1) !important;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.fc .fc-popover .fc-popover-body, .fc .fc-more-popover .fc-popover-body {
  background: #ffffff !important;
  color: #111111 !important;
}
.fc .fc-popover .fc-event, .fc .fc-popover .fc-event a {
  color: #111111 !important;
}

/* Day background images (30% opacity) */
.fc-daygrid-day, .fc-timegrid-col { position: relative; }
.day-image-bg {
  position: absolute;
  inset: 0;
  opacity: .3;
  pointer-events: none;
  content-visibility: auto;
  contain-intrinsic-size: 200px 200px;
}
.day-image-bg img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 420ms cubic-bezier(.2,.7,.2,1); }
.day-image-bg img[data-loaded="1"] { opacity: 1; }
.day-image-bg { will-change: opacity; }

/* Week view: under 1300px, add subtle diagonal pattern overlay to reduce clash */
#calendar.is-week .day-image-bg { opacity: .24; filter: saturate(.92) contrast(.96); }
/* removed week-view under 1300px special effects */
/* pair mode removed */

/* Event hover preview */
.evt-preview {
  position: fixed;
  z-index: 1500;
  max-width: min(360px, 88vw);
  background: #ffffff;
  color: #0f1222;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(0,0,0,0.28);
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.evt-preview.show { opacity: 1; transform: translateY(0); }
.evt-preview .p-title { font-weight: 700; margin: 0 0 4px; font-size: clamp(12px, 2.2vw, 16px); }
.evt-preview .p-time { color: #475569; font-size: clamp(11px, 2vw, 14px); margin-bottom: 6px; }
.evt-preview .p-desc { color: #111827; white-space: normal; font-size: clamp(11px, 2vw, 14px); }

/* Month cell hover logo overlay */
.day-hover-logo { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: translateY(8px) scale(.9) rotate(-1.2deg); filter: blur(2px); transition: opacity 380ms cubic-bezier(.2,.7,.2,1), transform 520ms cubic-bezier(.2,.8,.2,1), filter 420ms ease; pointer-events: none; z-index: 1; }
.day-hover-logo img { max-width: 56%; max-height: 56%; filter: drop-shadow(0 12px 28px rgba(0,0,0,.34)); opacity: .3; will-change: transform, opacity, filter; }
.fc-daygrid-day:hover .day-hover-logo { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); filter: blur(0); }
.fc-daygrid-day:hover .day-hover-logo img { animation: hoverFloat 4600ms cubic-bezier(.37,.01,.22,1) infinite alternate; }

@keyframes hoverFloat {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  50% { transform: translateY(-2px) scale(1.01) rotate(0.4deg); }
  100% { transform: translateY(-3px) scale(1.015) rotate(-0.4deg); }
}

@keyframes nowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(30,203,225,0.55), 0 0 14px rgba(30,203,225,0.2); opacity: 0.9; }
  50% { box-shadow: 0 0 18px rgba(30,203,225,1), 0 0 30px rgba(30,203,225,0.45); opacity: 1; }
}

/* Staggered view transitions */
.grid-anim .fc-daygrid-day-frame { opacity: 0; animation: cellIn 420ms cubic-bezier(.2,.7,.2,1) var(--delay, 0ms) forwards; }
.list-anim .fc-list-item { opacity: 0; animation: cellIn 360ms cubic-bezier(.2,.7,.2,1) var(--delay, 0ms) forwards; }
@keyframes cellIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Month day click zoom transition */
#calendar.zooming .fc-daygrid-day { 
  transition: transform 580ms cubic-bezier(.22,.61,.36,1), opacity 520ms ease, box-shadow 580ms ease, filter 580ms ease; 
  transform: scale(.985);
  opacity: .6;
  filter: saturate(.96) blur(.15px);
  transform-origin: center center;
}
#calendar .fc-daygrid-day.clicked-zoom {
  transform: scale(1.08) !important;
  opacity: 1 !important;
  z-index: 3;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  border-radius: 12px;
  overflow: hidden;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  #calendar.zooming .fc-daygrid-day, #calendar .fc-daygrid-day.clicked-zoom { transition: none; }
}

/* Ripple for icon and segment buttons */
.icon-btn, .view-switch .seg { position: relative; overflow: hidden; }
.icon-btn::after, .view-switch .seg::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.35), transparent 60%); opacity: 0; transform: scale(.2); transition: transform 300ms ease, opacity 300ms ease; }
.icon-btn:active::after, .view-switch .seg:active::after { opacity: .22; transform: scale(1); }

/* Add-to-calendar bell button (view-only) */
.addcal-btn { 
  appearance: none; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.08);
  color: var(--text); border-radius: 8px; font-size: 12px; line-height: 1; padding: 4px 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; opacity: .9; transition: transform 120ms ease, background 160ms ease, opacity 160ms ease;
}
.addcal-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.12); opacity: 1; }
.addcal-btn .bell { display: inline-block; }

/* Placement in grid events */
.fc .fc-event .addcal-btn { margin-left: 6px; }
/* Placement in list items: push to the right */
.fc .fc-list-item .addcal-btn { margin-left: auto; }

/* Hide add-to-calendar button on mobile for month and week in view-only */
@media (max-width: 640px) {
  body.readonly-mode #calendar.is-month .addcal-btn,
  body.readonly-mode #calendar.is-week .addcal-btn { display: none !important; }
}
/* Also hide bell in week view regardless of screen size on read-only */
body.readonly-mode #calendar.is-week .addcal-btn { display: none !important; }

/* Responsive */
@media (min-width: 840px) {
  .view-switch { display: inline-flex; }
  .title { max-width: 40vw; }
}
@media (max-width: 640px) {
  .topbar { padding: 6px 8px; gap: 6px; display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; }
  /* Ensure mobile center title is visible */
  .topbar .center { display: block; }
  .title { display: none; }
  .row { grid-template-columns: 1fr; }
  .main { height: calc(100vh - 58px); }
  #calendar { margin: 0 4px 6px; padding: 4px; border-radius: 12px; }
  .view-switch { gap: 3px; padding: 2px; flex-wrap: nowrap; width: auto; order: 0; margin-top: 0; }
  .view-switch .seg { padding: 4px 6px; font-size: var(--font-xs); }
  /* Remove internal scroll; we fit content via dynamic slot height */
  .fc .fc-scroller { overflow: hidden !important; }
  /* Use dynamic CSS var for slot height on mobile */
  .fc .fc-timegrid-slot { height: var(--slot-h, 16px); line-height: 1.1; }
  /* Month grid: keep frames tight so no vertical scroll needed */
  .fc .fc-daygrid-day-frame { padding: 1px; }
  /* Prevent horizontal scroll: force width constraints */
  html, body, .app, #calendar, .fc { max-width: 100vw; overflow-x: hidden; }
  .fc .fc-scrollgrid, .fc .fc-view-harness, .fc .fc-scroller-harness { max-width: 100%; }
  .fc .fc-scrollgrid-sync-table { width: 100% !important; table-layout: fixed; }
  .fc .fc-daygrid-body table { table-layout: fixed; }
  .fc .fc-col-header-cell-cushion { padding: 2px 4px; white-space: nowrap; }
  .fc .fc-daygrid-day-top { padding: 0 2px; }
  .fc .fc-timegrid-axis { width: clamp(28px, 8vw, 40px); }
  .fc .fc-event { max-width: 100%; }
  /* Single-line compact topbar */
  .topbar .left, .topbar .right { width: auto; display: flex; align-items: center; gap: 6px; }
  .icon-btn { width: 26px; height: 26px; }
  .btn { font-size: var(--font-xs); padding: 5px 6px; }
  #shareBtn { white-space: nowrap; }

  /* Mobile: show indicators instead of text in month view */
  #calendar.is-month .fc .fc-daygrid-event { display: none !important; }

  /* Mobile: show event text in week/day views */
  .fc .fc-timegrid .fc-v-event .fc-event-main { display: block; }
}

/* Day/column badges to indicate event counts on mobile */
.day-badge, .col-badge {
  position: absolute; top: 4px; right: 6px; z-index: 2;
  min-width: 16px; height: 16px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.22);
  color: var(--text); font-size: 11px; line-height: 1;
}

/* Mobile + month view (view-only): center a single badge and hide other content */
@media (max-width: 640px) {
  /* Hide event rows but keep the day number visible */
  #calendar.is-month .fc-daygrid-day-events { display: none !important; }
  #calendar.is-month .fc-daygrid-day-frame {
    position: relative; display: block; padding: 0 !important;
  }
  #calendar.is-month .day-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    min-width: 24px; height: 24px; padding: 0 8px; font-size: 13px;
    background: var(--accent-2); color: #00161a; border: none; box-shadow: 0 6px 16px rgba(30,203,225,0.35);
    font-weight: 700;
  }
  /* Ensure the day number remains visible (top-left) alongside centered badge */
  #calendar.is-month .fc-daygrid-day-top { display: flex !important; }
}
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Defensive: ensure no default selection popover bubble is shown */
.fc .fc-highlight { background: rgba(124,92,255,0.15); }
.fc .fc-timegrid-selection { background: transparent; }

/* Disable hover animation on all-day line (week/day views) */
.fc .fc-timegrid-allday .fc-event,
.fc .fc-timegrid-allday .fc-h-event,
.fc .fc-timegrid-allday .fc-daygrid-event,
.fc .fc-timegrid-allday .fc-daygrid-block-event { transition: none !important; }
.fc .fc-timegrid-allday .fc-event:hover,
.fc .fc-timegrid-allday .fc-h-event:hover,
.fc .fc-timegrid-allday .fc-daygrid-event:hover,
.fc .fc-timegrid-allday .fc-daygrid-block-event:hover { transform: none !important; box-shadow: none !important; filter: none !important; }

/* Extra defensive neutralization for all-day hover */
.fc .fc-timegrid-allday .fc-event a:hover { filter: none !important; }
.fc .fc-timegrid-allday:hover .fc-event { transform: none !important; box-shadow: none !important; }
/* Ensure any logo hover overlay is never shown in all-day row */
.fc .fc-timegrid-allday .day-hover-logo { display: none !important; }


