:root {
  color-scheme: light;
  --ink: #20231f;
  --muted: #898b82;
  --line: #ecebe5;
  --paper: #fffefa;
  --accent: #e56445;
  --green: #517d62;
  --display: "Space Grotesk", "Arial", sans-serif;
  --body: "DM Sans", "Arial", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f7f6f2;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  min-width: 0;
  height: 72px;
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid #eeede7;
  z-index: 3;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 20px var(--display); letter-spacing: -1.1px; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: white; font: 700 22px var(--display); letter-spacing: -2px; padding: 0 3px 4px 0; transform: rotate(-5deg); }
.brand-mark span { color: #ffd879; }
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.name-field { display: flex; align-items: center; gap: 8px; height: 38px; width: 154px; padding: 0 11px; border: 1px solid #eeede7; border-radius: 9px; background: #fff; }
.name-field:focus-within { border-color: #d7a393; box-shadow: 0 0 0 3px #e5644514; }
.name-icon { color: var(--accent); font-size: 15px; }
.name-field input { border: 0; outline: 0; width: 100%; color: var(--ink); font-size: 12px; background: transparent; }
.name-field input::placeholder { color: #a4a49d; }
.name-field input:disabled { cursor: not-allowed; }
.auth-button { min-width: 76px; height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--ink); color: white; font-size: 11px; font-weight: 600; cursor: pointer; }
.auth-button:hover:not(:disabled) { background: #3c4038; }
.auth-button:disabled { cursor: not-allowed; opacity: .55; }

.backend-notice { display: flex; align-items: center; min-height: 34px; padding: 7px 34px; border-bottom: 1px solid #eeede7; color: #687365; background: #f0f4ee; font-size: 10px; }
.backend-notice::before { width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: #6b996e; content: ""; flex: none; }
.backend-notice.is-setup, .backend-notice.is-error { color: #8a5d40; background: #fbf1e8; }
.backend-notice.is-setup::before, .backend-notice.is-error::before { background: #d5844e; }
.backend-notice.is-connecting { color: #727367; background: #f5f3ed; }
.backend-notice.is-connecting::before { background: #b7a46a; }

.workspace { flex: 1; height: calc(100vh - 106px); min-height: 650px; display: grid; grid-template-columns: 390px minmax(0, 1fr); }
.discover-panel { display: flex; flex-direction: column; padding: 33px 25px 18px 34px; background: #fffefa; border-right: 1px solid #eeede7; min-height: 0; z-index: 1; }
.intro { margin-bottom: 23px; }
.eyebrow { color: #9c9b91; font: 700 9px var(--body); letter-spacing: 1.15px; }
.intro .eyebrow { display: flex; align-items: center; gap: 7px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #74a576; box-shadow: 0 0 0 3px #74a5761b; }
h1 { margin: 15px 0 7px; font: 600 41px/1.05 var(--display); letter-spacing: -2.35px; }
h1 span { color: var(--accent); }
.intro p { margin: 0; color: #85867e; font-size: 12px; letter-spacing: .04px; }

.search-box { display: flex; gap: 9px; align-items: center; height: 42px; padding: 0 11px; border-radius: 9px; border: 1px solid #ecebe6; background: #fbfaf6; }
.search-box svg { width: 16px; height: 16px; fill: none; stroke: #96978e; stroke-width: 1.7; flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.search-box input::placeholder { color: #a3a39c; }
.search-box kbd { color: #aaa99f; font: 10px var(--body); white-space: nowrap; }
.filters { display: flex; gap: 6px; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin: 13px 0 27px; padding-bottom: 1px; }
.filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: none; display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid #efeee8; border-radius: 16px; background: #fff; color: #77786f; font-size: 10px; cursor: pointer; transition: .15s ease; }
.filter-chip:hover { border-color: #d6d3c8; }
.filter-chip.is-active { color: #fff; border-color: var(--ink); background: var(--ink); }
.filter-chip span { font-size: 12px; }
#all-count { font-size: 9px; opacity: .7; }

.events-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.events-heading h2 { margin: 5px 0 0; font: 600 18px var(--display); letter-spacing: -.5px; }
.heading-date { color: #a3a298; font: 400 12px var(--body); letter-spacing: 0; }
.sort-button { display: flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; color: #77786f; background: none; font-size: 10px; cursor: pointer; }
.sort-button:first-letter { font-size: 14px; }
.event-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; padding: 1px 3px 8px 0; scrollbar-color: #e1dfd5 transparent; scrollbar-width: thin; }
.event-card { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; min-height: 105px; padding: 11px; border: 1px solid #eeede7; border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s; cursor: pointer; }
.event-card:hover, .event-card.is-selected { border-color: #d8c8bc; box-shadow: 0 4px 16px #3630200b; }
.event-card:hover { transform: translateY(-1px); }
.event-visual { position: relative; width: 58px; height: 80px; border-radius: 7px; display: grid; place-items: center; overflow: hidden; color: #fff; }
.event-visual::before, .event-visual::after { position: absolute; content: ""; border: 1px solid #ffffff3b; border-radius: 50%; }
.event-visual::before { width: 57px; height: 57px; top: -23px; right: -17px; }
.event-visual::after { width: 49px; height: 49px; bottom: -25px; left: -12px; }
.visual-icon { z-index: 1; font-size: 23px; }
.visual-market { background: linear-gradient(145deg, #dd8a58, #c55d45); }
.visual-run { background: linear-gradient(145deg, #83a779, #557c62); }
.visual-jazz { background: linear-gradient(145deg, #63708e, #3f4b65); }
.visual-coffee { background: linear-gradient(145deg, #c69b69, #936e4e); }
.visual-art { background: linear-gradient(145deg, #bc7581, #8e526b); }
.visual-picnic { background: linear-gradient(145deg, #c3a34f, #8f984d); }
.event-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.event-meta { display: flex; align-items: center; gap: 6px; margin: 1px 0 4px; color: #a09f95; font-size: 9px; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: #c1c0b7; }
.event-category { color: #77786f; font-weight: 600; }
.event-info h3 { margin: 0; max-width: 100%; overflow: hidden; color: #2a2b26; text-overflow: ellipsis; white-space: nowrap; font: 600 13px var(--display); letter-spacing: -.25px; }
.event-place { margin-top: 3px; color: #8d8d85; font-size: 10px; }
.event-bottom { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; margin-top: auto; padding-top: 6px; }
.attendee-summary { display: flex; align-items: center; gap: 4px; color: #87887f; font-size: 9px; min-width: 0; }
.attendee-faces { display: flex; padding-left: 3px; }
.attendee-face { display: grid; place-items: center; width: 17px; height: 17px; margin-left: -4px; border: 1.5px solid white; border-radius: 50%; background: #e7e5d9; color: #6f6b5b; font-size: 7px; font-weight: 700; }
.attendee-face:nth-child(2) { background: #e7d4ca; color: #8d6054; }
.attendee-face:nth-child(3) { background: #dbe6d8; color: #547356; }
.attendee-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.going-button { flex: none; padding: 5px 9px; border: 1px solid #ecebe6; border-radius: 6px; background: white; color: #575951; font-size: 9px; font-weight: 600; cursor: pointer; transition: .15s; }
.going-button:hover { border-color: var(--accent); color: var(--accent); }
.going-button.is-going { border-color: #dce8dd; background: #f0f6f0; color: #557b5a; }
.going-button:disabled { cursor: default; opacity: .65; }
.list-footer { display: flex; align-items: center; gap: 7px; margin: auto 0 0; padding-top: 14px; color: #aaa99f; font-size: 10px; }
.list-footer span { color: #d18c56; }
.empty-state { padding: 24px 12px; border: 1px dashed #e6e4da; border-radius: 10px; color: #88887f; text-align: center; font-size: 12px; line-height: 1.6; }

.map-area { min-width: 0; padding: 13px 13px 13px 12px; }
.map-canvas { position: relative; height: 100%; min-height: 570px; overflow: hidden; border: 1px solid #e6e4db; border-radius: 12px; background: #f1efe8; isolation: isolate; }
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.water { fill: #dce9e7; }
.park { fill: #d8e4d1; }
.park-detail { fill: none; stroke: #c6d8bd; stroke-width: 4; stroke-linecap: round; }
.road-major { fill: none; stroke: #fffdf7; stroke-width: 19; stroke-linecap: round; }
.road { fill: none; stroke: #fffdf8; stroke-width: 8; stroke-linecap: round; opacity: .85; }
.map-labels text { fill: #a3a59b; font: 600 12px var(--body); letter-spacing: 1.8px; }
.map-labels .water-label { fill: #91aaa7; font-size: 11px; letter-spacing: 2px; }
.map-labels .street-label { fill: #bbb9ae; font-size: 9px; font-weight: 500; letter-spacing: 1.2px; }
.map-grain { position: absolute; inset: 0; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); opacity: .12; mix-blend-mode: multiply; }
.map-top-controls { position: absolute; top: 18px; right: 18px; left: 18px; display: flex; justify-content: space-between; align-items: flex-start; }
.map-location { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid #e7e5dc; border-radius: 8px; background: #fffefaed; box-shadow: 0 2px 6px #3630200a; color: #55574f; font-size: 11px; font-weight: 600; }
.pin-icon { color: var(--accent); font-size: 16px; }
.location-caret { color: #9e9d94; padding-left: 5px; }
.map-zoom { display: flex; flex-direction: column; width: 32px; border: 1px solid #e7e5dc; border-radius: 8px; background: #fffefaed; box-shadow: 0 2px 6px #3630200a; overflow: hidden; }
.map-zoom button { height: 31px; border: 0; background: transparent; color: #6b6d64; font-size: 18px; line-height: 1; cursor: pointer; }
.map-zoom button:hover { color: var(--accent); background: #f6f4ec; }
.map-zoom span { height: 1px; background: #eceae1; }
.map-legend { position: absolute; top: 19px; left: 50%; display: flex; align-items: center; gap: 7px; transform: translateX(-50%); padding: 9px 13px; border: 1px solid #e8e6de; border-radius: 20px; background: #fffefaed; box-shadow: 0 2px 6px #3630200a; color: #77786f; font-size: 10px; white-space: nowrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #e5644522; }
.map-markers { position: absolute; inset: 0; }
.map-marker { position: absolute; display: flex; align-items: center; justify-content: center; width: 37px; height: 37px; border: 2px solid #fffefa; border-radius: 50% 50% 50% 7px; background: var(--marker-color, #e56445); box-shadow: 0 3px 8px #2c302133; color: white; font-size: 16px; cursor: pointer; transform: translate(-50%, -50%) rotate(-45deg); transition: transform .18s, box-shadow .18s; }
.map-marker span { transform: rotate(45deg); }
.map-marker:hover, .map-marker.is-selected { z-index: 1; transform: translate(-50%, -58%) rotate(-45deg) scale(1.14); box-shadow: 0 5px 12px #2c302144; }
.map-marker.is-selected { outline: 4px solid #e5644530; }
.map-card { position: absolute; left: 50%; bottom: 56px; width: min(320px, calc(100% - 34px)); min-height: 0; padding: 0; border: 0; border-radius: 11px; background: #fffefa; box-shadow: 0 8px 26px #35332221; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: .2s ease; }
.map-card.is-visible { padding: 14px 15px; opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.map-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.map-card .event-meta { margin: 0 0 5px; }
.map-card h3 { margin: 0; font: 600 15px var(--display); letter-spacing: -.35px; }
.map-card .event-place { margin-top: 4px; font-size: 10px; }
.map-card-attendees { margin-top: 11px; }
.map-card-attendees span { color: #a09f95; font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.map-card-attendees p { margin: 4px 0 0; color: #676960; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.card-close { flex: none; width: 23px; height: 23px; border: 0; border-radius: 50%; background: #f4f2eb; color: #77786f; cursor: pointer; }
.map-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; padding-top: 10px; border-top: 1px solid #efeee8; }
.map-card-bottom .attendee-summary { font-size: 10px; }
.map-card-bottom .going-button { padding: 7px 12px; font-size: 10px; }
.map-credit { position: absolute; bottom: 15px; left: 18px; color: #a8a79c; font-size: 8px; font-weight: 600; letter-spacing: 1.1px; }
.toast { position: fixed; z-index: 5; right: 22px; bottom: 22px; padding: 11px 15px; border: 1px solid #e5e3d8; border-radius: 9px; background: #fffefa; box-shadow: 0 5px 20px #35332218; color: #4e6751; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.auth-dialog { width: min(420px, calc(100% - 32px)); padding: 29px; border: 1px solid #e8e5dc; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px #25231e2b; }
.auth-dialog::backdrop { background: #20231f66; backdrop-filter: blur(3px); }
.auth-dialog form { display: flex; flex-direction: column; align-items: stretch; }
.dialog-close { align-self: flex-end; width: 27px; height: 27px; margin: -12px -12px 12px 0; border: 0; border-radius: 50%; background: #f2f0e9; color: #77786f; font-size: 19px; cursor: pointer; }
.auth-dialog h2 { margin: 8px 0; font: 600 25px var(--display); letter-spacing: -1px; }
.auth-dialog form > p:not(.auth-message) { margin: 0 0 20px; color: #77786f; font-size: 12px; line-height: 1.6; }
.auth-email-label { margin-bottom: 6px; color: #686a62; font-size: 10px; font-weight: 600; }
.auth-dialog input { height: 42px; padding: 0 12px; border: 1px solid #e8e6de; border-radius: 8px; background: white; color: var(--ink); font-size: 12px; outline: 0; }
.auth-dialog input:focus { border-color: #d7a393; box-shadow: 0 0 0 3px #e5644514; }
.send-link-button { height: 40px; margin-top: 10px; border: 0; border-radius: 8px; background: var(--accent); color: white; font-size: 11px; font-weight: 700; cursor: pointer; }
.send-link-button:disabled { cursor: wait; opacity: .65; }
.auth-message { min-height: 16px; margin: 10px 0 0; color: #61745f; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }

@media (min-width: 1440px) {
  .workspace { grid-template-columns: 420px minmax(0, 1fr); }
  .discover-panel { padding-right: 29px; padding-left: 38px; }
  .event-list { gap: 10px; }
  .event-card { min-height: 111px; grid-template-columns: 62px minmax(0, 1fr); }
  .event-visual { width: 62px; height: 85px; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 350px minmax(0, 1fr); }
  .discover-panel { padding-right: 18px; padding-left: 22px; }
  .map-legend { top: 68px; left: 18px; transform: none; }
}

@media (max-width: 700px) {
  .topbar { height: 60px; padding: 0 17px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 29px; height: 29px; }
  .name-field { width: 125px; height: 34px; }
  .auth-button { min-width: 67px; height: 34px; padding: 0 9px; font-size: 10px; }
  .backend-notice { padding-right: 17px; padding-left: 17px; line-height: 1.4; }
  .workspace { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .map-area { order: 0; height: 49vh; min-height: 340px; padding: 10px 10px 0; }
  .map-canvas { min-height: 0; border-radius: 10px; }
  .discover-panel { order: 1; min-height: 0; padding: 25px 18px 16px; border: 0; }
  .intro { margin-bottom: 17px; }
  h1 { margin-top: 11px; font-size: 34px; }
  .filters { margin-bottom: 22px; }
  .events-heading { margin-bottom: 10px; }
  .event-list { overflow: visible; }
  .list-footer { padding-top: 18px; }
  .map-top-controls { top: 12px; right: 12px; left: 12px; }
  .map-location { height: 34px; font-size: 10px; }
  .map-zoom { width: 29px; }
  .map-zoom button { height: 27px; }
  .map-legend { top: auto; bottom: 13px; left: 12px; padding: 7px 10px; font-size: 9px; }
  .map-credit { display: none; }
  .map-card { bottom: 13px; left: auto; right: 12px; width: min(270px, calc(100% - 112px)); transform: translateY(8px); }
  .map-card.is-visible { transform: translateY(0); }
  .toast { right: 12px; bottom: 12px; left: 12px; text-align: center; }
}

@media (max-width: 390px) {
  .map-card { width: calc(100% - 24px); bottom: 56px; right: 12px; }
  .map-legend { bottom: 13px; }
  .name-field { width: 112px; }
  .discover-panel { padding-right: 14px; padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
