:root {
  --bg: #0b0b0d;
  --surface: #151518;
  --surface-2: #1d1d22;
  --line: rgb(255 255 255 / .09);
  --text: #f2f1ec;
  --muted: #a3a29c;
  --accent: #d7ff3d;
  --accent-ink: #12140a;
  --radius: 14px;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --body: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--body);
  overflow-x: clip;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }

/* Floating artwork of picked events, behind everything. */
.drift { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.drift-tile {
  position: absolute;
  width: var(--w);
  aspect-ratio: 1200 / 630;
  left: var(--x);
  top: var(--y);
  border-radius: var(--radius);
  background: var(--img) center / cover, var(--surface-2);
  opacity: 0;
  filter: saturate(.9) brightness(.55);
  animation: drift var(--dur) ease-in-out var(--delay) infinite alternate, fade-in 1.6s var(--ease) var(--delay) forwards;
}
.drift-tile.word {
  background: none;
  aspect-ratio: auto;
  width: auto;
  font: 900 clamp(64px, 14vw, 200px)/1 var(--display);
  color: transparent;
  -webkit-text-stroke: 1px rgb(255 255 255 / .12);
  filter: none;
  white-space: nowrap;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(var(--r0)); }
  to { transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--r1)); }
}
@keyframes fade-in { to { opacity: var(--o, .5); } }

.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain {
  25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); }
}

.hero, .add, .marquee, .friends, .day-tabs, .calendar, .foot { position: relative; z-index: 2; }

/* Hero */
.hero { padding: clamp(28px, 6vw, 72px) clamp(16px, 4vw, 48px) 8px; max-width: 1400px; margin: 0 auto; }
.kinetic {
  margin: 0;
  font: 900 clamp(52px, 13vw, 168px)/.92 var(--display);
  letter-spacing: -.04em;
  text-transform: uppercase;
  display: flex; flex-wrap: wrap; gap: 0 .22em;
}
.kinetic .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(40%) skewY(6deg);
  animation: word-in .9s var(--ease) calc(var(--i) * 110ms + 100ms) forwards, word-wobble 6s ease-in-out calc(var(--i) * 700ms + 1.2s) infinite;
}
.kinetic .accent { color: var(--accent); }
@keyframes word-in { to { opacity: 1; transform: none; } }
@keyframes word-wobble {
  0%, 100% { transform: none; }
  50% { transform: translateY(-.04em) skewX(-6deg); }
}
.hero-sub { margin: 18px 0 0; max-width: 46ch; color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); }

/* Add form */
.add { z-index: 12; max-width: 1400px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 8px; }
.add-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 2.4fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: rgb(21 21 24 / .72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #807f79; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(215 255 61 / .18); }

.btn {
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 15px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .25s var(--spring), filter .2s;
}
.btn:hover { transform: translateY(-2px) rotate(-1.5deg); }
.btn:active { transform: scale(.96); }
.btn:disabled { filter: grayscale(1) brightness(.7); cursor: progress; }
.form-msg { grid-column: 1 / -1; margin: 0; min-height: 0; font-size: 14px; color: var(--accent); }
.form-msg:empty { display: none; }
.form-msg.error { color: #ff8a7a; }

/* Combobox */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  max-height: min(52dvh, 420px); overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 60px rgb(0 0 0 / .55);
  animation: pop .22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.combo-list li {
  display: grid; grid-template-columns: 74px 1fr; gap: 2px 12px;
  padding: 10px; border-radius: 10px; cursor: pointer;
}
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--surface-2); }
.combo-list .c-when { grid-row: span 2; font: 500 12px/1.35 var(--mono); color: var(--accent); padding-top: 2px; }
.combo-list .c-title { font-weight: 600; line-height: 1.3; }
.combo-list .c-venue { font-size: 13px; color: var(--muted); }
.combo-list .c-empty { display: block; color: var(--muted); cursor: default; }

/* Marquee of what the crew is doing */
.marquee {
  margin: 28px 0 0;
  border-block: 1px solid var(--line);
  background: var(--accent);
  color: var(--accent-ink);
  overflow: hidden;
  transform: rotate(-1.2deg) scale(1.02);
}
.marquee-track {
  display: flex; width: max-content;
  font: 700 clamp(14px, 1.6vw, 18px)/1 var(--display);
  text-transform: uppercase;
  padding: 12px 0;
  animation: marquee var(--marquee-dur, 40s) linear infinite;
}
.marquee-track span { padding: 0 22px; white-space: nowrap; }
.marquee-track span::after { content: '✺'; margin-left: 44px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Friends filter */
.friends {
  max-width: 1400px; margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.friends:empty { display: none; }
.friend-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: transform .25s var(--spring), background .2s, border-color .2s, opacity .2s;
}
.friend-chip:hover { transform: translateY(-2px); }
.friend-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-2); }
.friends.filtering .friend-chip[aria-pressed="false"] { opacity: .45; }
.friend-chip .count { font: 500 12px var(--mono); color: var(--muted); }

.avatar {
  --h: 0;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 50%;
  background: hsl(var(--h) 72% 62%);
  color: #101010;
  font: 700 12px/1 var(--display);
}

/* Day tabs (mobile only) */
.day-tabs { display: none; }

/* Calendar */
.calendar {
  max-width: 1400px; margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 40px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.day { min-width: 0; }
.day-head {
  position: sticky; top: 0; z-index: 3;
  padding: 12px 2px 12px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.day-name { font: 900 clamp(16px, 1.45vw, 26px)/1 var(--display); text-transform: uppercase; letter-spacing: -.02em; }
.day-date { font: 500 12px/1 var(--mono); color: var(--muted); margin-top: 6px; }
.day-list { display: grid; gap: 10px; }
.day-empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 18px 14px; color: #8b8a84; font-size: 14px;
}

.party {
  position: relative;
  display: grid;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: party-in .6s var(--spring) both;
  animation-delay: calc(var(--n, 0) * 50ms);
  transition: transform .3s var(--spring), border-color .2s, opacity .3s;
}
.party:hover { transform: translateY(-3px) rotate(-.4deg); border-color: rgb(215 255 61 / .5); }
.party.dim { opacity: .28; }
.party.fresh { animation: party-pop .8s var(--spring) both; }
@keyframes party-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes party-pop {
  0% { opacity: 0; transform: scale(.6) rotate(-4deg); }
  60% { opacity: 1; }
  100% { transform: none; }
}
.party-img {
  aspect-ratio: 1200 / 630;
  background: var(--img) center / cover, linear-gradient(135deg, var(--surface-2), #26261d);
  transition: transform .8s var(--ease);
}
.party:hover .party-img { transform: scale(1.06); }
.party-body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.party-time { font: 500 12px/1 var(--mono); color: var(--accent); }
.party-title {
  font-weight: 600; line-height: 1.25; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.party-title::after { content: ''; position: absolute; inset: 0; }
.party-venue { font-size: 13px; color: var(--muted); }
.party-crew { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.crew {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px 0 2px;
  border-radius: 999px; background: var(--surface-2);
  font-size: 13px; font-weight: 500;
  animation: party-in .4s var(--spring) both;
}
.crew .avatar { width: 26px; height: 26px; font-size: 11px; }
.crew.me { box-shadow: inset 0 0 0 1px var(--accent); }
.crew button {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; margin-right: -4px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.crew button:hover { color: var(--text); background: rgb(255 255 255 / .08); }

.skeleton-col {
  height: 340px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }

.foot {
  max-width: 1400px; margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) calc(32px + env(safe-area-inset-bottom));
  color: #8b8a84; font-size: 13px;
}

/* Tablet: 6 columns get too narrow, scroll sideways instead. */
@media (max-width: 1100px) {
  .calendar {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 42vw);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: clamp(16px, 4vw, 48px);
    scrollbar-width: none;
  }
  .calendar::-webkit-scrollbar { display: none; }
  .day { scroll-snap-align: start; }
}

/* Phone */
@media (max-width: 720px) {
  .add-form { grid-template-columns: 1fr; padding: 12px; }
  .btn { width: 100%; }
  .day-tabs {
    display: flex; gap: 4px;
    position: sticky; top: 0; z-index: 10;
    padding: 10px 16px;
    margin-top: 16px;
    background: rgb(11 11 13 / .85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
  }
  .day-tabs button {
    flex: 1 0 auto;
    height: 40px; padding: 0 8px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
    font: 700 12px/1 var(--display); text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, color .2s;
  }
  .day-tabs button[aria-current="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .day-tabs button .n { font: 500 11px var(--mono); opacity: .7; margin-left: 3px; }
  .calendar { grid-auto-columns: calc(100vw - 32px); gap: 16px; padding-top: 8px; }
  .day-head { display: none; }
  .drift-tile { filter: saturate(.9) brightness(.4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .kinetic .word { opacity: 1; transform: none; }
  .drift-tile { opacity: var(--o, .5); }
  .grain { animation: none; }
}

/* Views: "/" is the start page, "/<group>" the calendar. */
.view-home .only-group, .view-group .only-home { display: none !important; }

.group-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.group-code {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--accent); color: var(--accent);
  font: 500 15px/1 var(--mono);
}
.btn-ghost {
  height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: transform .25s var(--spring), border-color .2s;
}
.btn-ghost:hover { transform: translateY(-2px); border-color: rgb(255 255 255 / .3); }
.btn-ghost:active { transform: scale(.96); }

.start { position: relative; z-index: 2; max-width: 1400px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 8px; }
.start-form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: end;
  max-width: 860px; padding: 14px;
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
  background: rgb(21 21 24 / .72);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.start-form .btn-ghost { height: 52px; }
.code-input {
  display: flex; align-items: center; height: 52px; padding-left: 16px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.code-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(215 255 61 / .18); }
.code-input span { font: 500 15px/1 var(--mono); color: #8b8a84; white-space: nowrap; }
.field .code-input input { height: 50px; border: 0; padding: 0 16px 0 2px; box-shadow: none; background: transparent; font: 500 15px/1 var(--mono); }

.party-share {
  position: absolute; z-index: 2; top: 10px; right: 10px;
  height: 32px; padding: 0 14px;
  border: 1px solid rgb(255 255 255 / .18); border-radius: 999px;
  background: rgb(11 11 13 / .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .25s var(--spring), background .2s, color .2s;
}
.party-share:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.party.focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(215 255 61 / .25); }

.toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  padding: 12px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px;
  transform: translate(-50%, 140%); opacity: 0;
  transition: transform .45s var(--spring), opacity .2s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 720px) {
  .start-form { grid-template-columns: 1fr; padding: 12px; }
  .start-form .btn, .start-form .btn-ghost { width: 100%; }
  .code-input span { font-size: 13px; }
}
