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

/* Prevent double-tap zoom on interactive elements */
button, a, [role="button"] {
  touch-action: manipulation;
}

/* Prevent iOS auto-zoom on input focus (triggered when font-size < 16px) */
input, textarea, select {
  font-size: 16px !important;
}

:root {
  --bg: #07070f;
  --surface: #10101e;
  --surface2: #181828;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f0f0f8;
  --text-dim: #6868a0;
  --text-mid: #a0a0c8;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(to bottom, var(--bg) 55%, transparent);
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

/* ── Index: Wheel Page ── */
.wheel-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 80px;
  gap: 36px;
}

.mission {
  text-align: center;
  max-width: 520px;
}

.mission-title {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 12px;
  color: var(--text);
}

.mission-sub {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-mid);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.prompt {
  text-align: center;
}

.prompt-title {
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.2px;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.prompt-sub {
  font-size: 13px;
  color: var(--text-dim);
  opacity: 0.6;
}

.wheel-wrapper {
  position: relative;
  width: min(420px, 88vw);
  height: min(420px, 88vw);
  transition: filter 0.4s ease;
  overflow: visible;
}

/* ── Floating emotion tooltip (follows cursor around wheel) ── */
.wheel-tooltip {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.wheel-tooltip.visible {
  opacity: 1;
}

/* Floating callout above finger during touch on wheel */
.wheel-touch-callout {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px 6px 8px;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 56px));
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 9999;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.wheel-touch-callout.visible {
  opacity: 1;
}
.touch-callout-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}
.touch-callout-label {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

/* Screen reader only — visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#wheelCanvas {
  display: block;
  cursor: crosshair;
  width: 100%;
  height: 100%;
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 162px;
  height: 162px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  pointer-events: none;
}

.center-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  transition: background 0.1s, box-shadow 0.25s;
}

.center-emotion {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.1s;
  color: var(--text);
}

.center-sub {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 110px;
}

/* Post panel */
.post-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.post-panel.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.post-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
}

.post-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-info strong {
  font-size: 13px;
  font-weight: 600;
}

.post-info span {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.08em;
}

.post-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  letter-spacing: 0.02em;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-btn:hover {
  opacity: 0.88;
  transform: translateX(2px);
}

.post-btn .arrow {
  transition: transform 0.2s;
}

.post-btn:hover .arrow {
  transform: translateX(3px);
}

.post-location-line {
  font-size: 10px;
  color: var(--text-dim);
  display: none;
  letter-spacing: 0.02em;
}

/* ── Post panel inline states ── */
.post-confirm {
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.post-confirm-city {
  flex: 1;
  font-size: 13px;
  color: var(--text-mid);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-confirm-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.post-btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.post-btn-ghost:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
}

.post-loc-input {
  flex: 1;
  gap: 8px;
  align-items: center;
}

/* ── Location confirm bar ── */
.location-confirm-bar {
  max-width: 460px;
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 16px 20px;
  animation: fadeUp 0.25s ease;
}

.lcb-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
}

.lcb-text {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.5;
}

.lcb-actions {
  display: flex;
  gap: 8px;
}

.lcb-yes {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 100px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 20px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.lcb-yes:hover { opacity: 0.88; }

.lcb-change {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.lcb-change:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
}

/* ── Quick location input ── */
.location-quick {
  display: flex;
  gap: 8px;
  max-width: 360px;
  width: 100%;
  animation: fadeUp 0.2s ease;
}

.quick-city-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 18px;
  outline: none;
  transition: border-color 0.2s;
}

.quick-city-input:focus {
  border-color: rgba(255,255,255,0.25);
}

.quick-city-input::placeholder { color: var(--text-dim); }

.quick-save-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 100px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.quick-save-btn:hover { opacity: 0.88; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Feed Page ── */
.page-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Feed card styles are scoped to feed.html */

/* ── Map Page ── */
.map-main {
  padding: 100px 24px 80px;
  max-width: 900px;
  margin: 0 auto;
}

.map-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.map-placeholder {
  width: 100%;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-dim);
  font-size: 14px;
}

.map-dots {
  display: grid;
  grid-template-columns: repeat(40, 1fr);
  gap: 3px;
  padding: 24px;
  width: 100%;
}

.map-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.7;
}

.map-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-mid);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Profile Page ── */
.profile-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.profile-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.profile-handle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.profile-stats {
  display: flex;
  gap: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.color-history {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.history-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  position: relative;
}

.history-swatch:hover {
  transform: scale(1.15);
  z-index: 1;
}

.history-swatch[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid var(--border);
}

/* ── Floating post button (non-index pages) ── */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 300;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s, opacity 0.2s;
  z-index: 50;
}

.fab:hover {
  transform: scale(1.08);
  opacity: 0.9;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .header {
    padding: 16px 20px;
  }

  .nav {
    gap: 20px;
  }

  .wheel-main {
    padding: 72px 16px 48px;
    gap: 20px;
  }

  .mission-title {
    font-size: 26px;
    letter-spacing: -0.5px;
  }

  .mission-sub {
    font-size: 14px;
  }

  .prompt-title {
    font-size: 16px;
  }

  .prompt-sub {
    font-size: 12px;
  }

  .wheel-center {
    width: 130px;
    height: 130px;
  }

  .post-panel {
    flex-direction: column;
    border-radius: var(--radius);
    text-align: center;
    gap: 10px;
    padding: 14px 16px;
  }

  .post-confirm {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .post-confirm-city {
    text-align: center;
  }

  .post-loc-input {
    flex-direction: column;
  }

  .post-loc-input .quick-city-input,
  .post-loc-input .post-btn {
    width: 100%;
    text-align: center;
  }

  .profile-hero {
    flex-direction: column;
    text-align: center;
  }

  .profile-stats {
    justify-content: center;
  }
}
