*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg-card: #161616;
  --bg-card-hover: #1e1e1e;
  --bg-selected: #1a1a2e;
  --text: #f0f0f0;
  --text-dim: #888;
  --text-dimmer: #555;
  --accent: #ff6b35;
  --accent-glow: rgba(255, 107, 53, 0.15);
  --accent2: #e040fb;
  --accent3: #00e5ff;
  --border: #252525;
  --radius: 12px;
  --radius-sm: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 110px;
  --viewbar-h: 86px;
}

html, body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen { display: none; height: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* Login */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 40px;
}
.login-logo { text-align: center; }
.logo-text {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-sub { font-size: 14px; color: var(--text-dim); letter-spacing: 4px; margin-top: 8px; }

.login-form { display: flex; gap: 10px; width: 100%; max-width: 360px; }
.login-form input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.login-form input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary:active { opacity: 0.8; }

.existing-users { text-align: center; width: 100%; max-width: 360px; }
.existing-label { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.user-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.user-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.user-chip:active { background: var(--accent); border-color: var(--accent); }

/* Header */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--border);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}
.header-title { font-size: 18px; font-weight: 700; letter-spacing: 3px; }
.header-year { color: var(--accent); }
.header-user { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); }
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
}

.day-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px 0;
}
.day-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 0 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.day-tab .day-date { font-size: 10px; font-weight: 400; }
.day-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* View bar */
.view-bar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--bg);
  padding-top: var(--safe-top);
}
.view-tabs {
  display: flex;
  gap: 0;
  padding: 8px 16px 0;
}
.view-tab {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 8px 0;
  cursor: pointer;
  text-align: center;
}
.view-tab:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.view-tab:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.view-tab:not(:last-child) { border-right: none; }
.view-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.filter-row {
  display: flex;
  gap: 6px;
  padding: 10px 16px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.stage-pill {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.stage-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Content */
#content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--header-h) + var(--viewbar-h) + 8px) 12px calc(80px + var(--safe-bottom)) 12px;
}

/* Set Cards */
.stage-section { margin-bottom: 20px; }
.stage-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 8px 4px 6px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.set-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.set-card:active { background: var(--bg-card-hover); }
.set-card.selected {
  background: var(--bg-selected);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.set-card.playing {
  border-color: var(--accent3);
  box-shadow: inset 3px 0 0 var(--accent3);
}
.set-card.playing::after {
  content: "LIVE";
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent3);
  letter-spacing: 1px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.set-time {
  min-width: 52px;
  text-align: center;
}
.set-time-start {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.set-time-end {
  font-size: 11px;
  color: var(--text-dimmer);
}

.set-info { flex: 1; min-width: 0; }
.set-artist {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.set-artist.headliner {
  font-size: 17px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.set-stage-label {
  font-size: 11px;
  color: var(--text-dimmer);
  margin-top: 2px;
}

.set-friends {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  max-width: 100px;
}
.friend-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.set-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  transition: all 0.15s;
}
.set-card.selected .set-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* My Sets view */
.my-sets-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}
.my-sets-empty .emoji { font-size: 48px; margin-bottom: 16px; }
.my-sets-empty p { font-size: 15px; line-height: 1.6; }

/* Friends view */
.friend-section { margin-bottom: 24px; }
.friend-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 8px;
}
.friend-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.friend-name { font-size: 16px; font-weight: 600; }
.friend-count { font-size: 12px; color: var(--text-dim); }

.conflict-badge {
  background: #ff1744;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Now button */
.now-btn {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  right: 16px;
  background: var(--accent3);
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  z-index: 101;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.3);
}
.now-btn.hidden { display: none; }

/* Sync indicator */
.sync-indicator {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-dim);
  z-index: 101;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sync-indicator.hidden { display: none; }
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent3);
  animation: pulse 1s infinite;
}
.sync-indicator.offline .sync-dot { background: #ff9800; }
.sync-indicator.offline::after { content: "Offline"; }

/* Up Next card */
.up-next {
  background: linear-gradient(135deg, rgba(255,107,53,0.1), rgba(224,64,251,0.1));
  border: 1px solid rgba(255,107,53,0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.up-next-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 8px;
}
.up-next-artist { font-size: 18px; font-weight: 700; }
.up-next-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Claude modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.claude-section { display: flex; flex-direction: column; gap: 10px; }
.claude-section.hidden { display: none; }
.claude-section input, .claude-section textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.claude-section input:focus, .claude-section textarea:focus { border-color: var(--accent); }
.error-text { color: #ff4444; font-size: 13px; }
.error-text.hidden { display: none; }
.claude-status {
  font-size: 13px;
  color: var(--accent3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.claude-status.hidden { display: none; }
.claude-status.error { color: #ff4444; }
.claude-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}
.claude-output.hidden { display: none; }

/* Install banner */
.install-banner {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 12px;
  right: 12px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.2);
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.install-banner.hidden { display: none; }
.install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.install-text strong { font-size: 14px; color: var(--text); }
.install-text span { font-size: 12px; color: var(--text-dim); }
.btn-install {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn-install:active { opacity: 0.8; }
.btn-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* Map view */
.map-container {
  width: 100%;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x pan-y;
}
.map-container svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
}
.map-stage-marker {
  cursor: pointer;
  transition: transform 0.15s;
}
.map-stage-marker:hover rect,
.map-stage-marker:hover ellipse {
  filter: brightness(1.3);
}
.map-stage-label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  fill: #fff;
  text-anchor: middle;
  pointer-events: none;
}
.map-sublabel {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 400;
  fill: rgba(255,255,255,0.6);
  text-anchor: middle;
  font-size: 7px;
  pointer-events: none;
}
.map-landmark-label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 500;
  fill: rgba(255,255,255,0.45);
  text-anchor: middle;
  font-size: 7px;
  pointer-events: none;
  letter-spacing: 1px;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 4px;
  justify-content: center;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.map-tooltip {
  position: fixed;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  max-width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.map-tooltip-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.map-tooltip-set {
  font-size: 12px;
  color: var(--text);
  padding: 2px 0;
  line-height: 1.4;
}
.map-tooltip-set .time {
  color: var(--text-dim);
  margin-right: 4px;
}
.map-tooltip-set.now {
  color: var(--accent3);
  font-weight: 600;
}
.map-tooltip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.map-you-are-here {
  font-size: 9px;
  font-weight: 700;
  fill: var(--accent3);
  text-anchor: middle;
}

/* Responsive */
@media (min-width: 600px) {
  #content { padding-left: 24px; padding-right: 24px; max-width: 640px; margin: 0 auto; }
}
