/* Great Tints — feelings-wheel UI. Builds on the great-apps framework.css. */

/* Multicolour "Tints" wordmark — a nod to the color-wheel theme. */
.header-accent {
  background: linear-gradient(90deg,
    hsl(48 80% 62%), hsl(2 80% 64%), hsl(335 75% 66%),
    hsl(265 70% 70%), hsl(215 75% 64%), hsl(135 60% 55%));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 700;
}

/* ── Wheel stage ───────────────────────── */
.wheel-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(1200px 900px at 50% 42%, #16161f 0%, var(--bg) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

svg#wheel {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

#scene.animated {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.seg {
  stroke: rgba(12, 12, 18, 0.34);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: filter 0.12s;
}
.seg:hover { filter: brightness(1.07); }
.seg.sel {
  stroke: #ffffff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  filter: brightness(1.1) saturate(1.05);
}

.seg-label {
  pointer-events: none;
  user-select: none;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 600;
}
.seg-label.lvl-0 { font-weight: 800; letter-spacing: 0.02em; }
.seg-label.lvl-2 { font-weight: 500; }

/* Centre hub */
.hub-bg {
  fill: #13131b;
  stroke: var(--border);
  stroke-width: 1.5;
}
.hub-prompt { fill: var(--text-muted); font-weight: 600; }
.hub-name { fill: var(--text); font-weight: 800; }
.hub-sub { fill: var(--text-muted); font-weight: 700; letter-spacing: 0.1em; }

/* Zoom controls (mirrors great-trains map-controls) */
.wheel-controls {
  position: absolute;
  right: 12px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}
.wheel-controls button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(26, 26, 36, 0.9);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}
.wheel-controls button:active { background: var(--bg-active); }
.wheel-controls .locate svg { width: 20px; height: 20px; }

.wheel-hint { font-size: 0.75rem; color: var(--text-muted); }

/* ── Search dropdown ───────────────────── */
.search-wrap { position: relative; margin-top: 10px; }
.search-wrap[hidden] { display: none; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 52vh;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.search-results:empty { display: none; }

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.result-row:last-child { border-bottom: none; }
.result-row:hover, .result-row:focus { background: var(--bg-hover); outline: none; }

.result-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.result-name { font-size: 0.94rem; font-weight: 600; flex-shrink: 0; }
.result-crumb {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
}

/* ── Bottom sheet ──────────────────────── */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
#sheet {
  box-shadow: none;
  pointer-events: none;
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.28s;
}
#sheet.open {
  transform: translateY(0);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  visibility: visible;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: -6px auto 12px;
}
.sheet-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.sheet-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.crumb-core { font-weight: 700; }
.crumb-sep { opacity: 0.5; }

.sheet-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}
.sheet-prompt {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  opacity: 0.9;
  margin-bottom: 18px;
}

.visit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: opacity 0.15s;
}
.visit-btn.logged {
  opacity: 0.8;
  background: var(--bg-active) !important;
  color: var(--text);
  text-shadow: none;
}

/* ── History overlay ───────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.overlay[hidden] { display: none; }

.sheet.stats-sheet {
  position: relative;
  max-width: 520px;
  width: 100%;
  transform: none;
  max-height: 84vh;
  overflow-y: auto;
}

.history-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.history-summary b { color: var(--text); }
.history-summary .empty { font-size: 0.9rem; line-height: 1.6; }
.history-summary .empty b { color: var(--text); }

.stat-group { margin-bottom: 18px; }
.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.stat-name { width: 92px; font-size: 0.86rem; flex-shrink: 0; }
.stat-bar {
  flex: 1;
  height: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.stat-bar > i {
  display: block;
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
}
.stat-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  width: 28px;
  text-align: right;
}

.history-recent { margin-bottom: 16px; }
.recent-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.recent-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.recent-row:last-child { border-bottom: none; }
.recent-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.recent-name { font-size: 0.9rem; font-weight: 600; flex-shrink: 0; }
.recent-crumb {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-time {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.danger-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #55344a;
  background: transparent;
  color: #ff7a9c;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.danger-btn:active { background: rgba(255, 122, 156, 0.08); }

/* ── Desktop niceties ──────────────────── */
@media (min-width: 769px) {
  .wheel-hint { font-size: 0.8rem; }
}
