@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Hedvig+Letters+Serif&display=swap');

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

:root {
  --bg: #fafafa;
  --text: rgba(0,0,0,0.75);
  --muted: rgba(0,0,0,0.35);
  --border: rgba(0,0,0,0.06);
  --input-bg: #f5f5f5;
  --accent: rgba(0,0,0,0.5);
}

body.dark {
  --bg: #1B1B1B;
  --text: rgba(255,255,255,0.75);
  --muted: rgba(255,255,255,0.3);
  --border: rgba(255,255,255,0.06);
  --input-bg: #202020;
  --accent: rgba(255,255,255,0.5);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  letter-spacing: -0.03em;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ── Layout ── */
.page { max-width: 720px; margin: 0 auto; padding: 24px 32px 180px; }

/* ── Nav ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  background: var(--bg);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.nav-links a { 
  text-decoration: none; 
  transition: color 0.2s;
  font-weight: 600;
}
.nav-links a.active {
  color: #303030;
}
.nav-links a.inactive { 
  color: #999;
}
.nav-links .pipe {
  color: #999;
  user-select: none;
  font-weight: 400;
}
body.dark .nav-links a.active {
  color: #e0e0e0;
}
.nav-right { display: flex; align-items: center; gap: 24px; }

/* ── Theme toggle ── */
.toggle {
  width: 38px; height: 20px; border-radius: 10px;
  background: rgba(0,0,0,0.04); border: none;
  cursor: pointer; position: relative; transition: background 0.3s;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,0.3); transition: transform 0.3s, background 0.3s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
body.dark .toggle { background: rgba(255,255,255,0.08); }
body.dark .toggle::after { 
  transform: translateX(18px); 
  background: rgba(255,255,255,0.6);
}

/* ── Orb ── */
.orb-wrap { 
  display: flex; 
  justify-content: center; 
  align-items: center;
  min-height: 50vh;
  margin: 0 0 60px;
}

#orb { 
  width: 400px;
  height: 400px;
}

/* ── Thought input ── */
.thought-box {
  background: var(--input-bg);
  border: none;
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}
textarea {
  flex: 1;
  background: transparent; 
  border: none; 
  outline: none;
  color: var(--text); 
  font-size: 14px; 
  line-height: 1.6;
  resize: none; 
  font-family: 'Hedvig Letters Serif', serif;
  min-height: 24px;
  letter-spacing: 0;
}
textarea::placeholder { color: var(--muted); }
button.send-btn {
  background: rgba(0,0,0,0.05);
  border: none;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
button.send-btn:hover { background: rgba(0,0,0,0.08); }
button.send-btn img { width: 22px; height: 22px; }
body.dark button.send-btn { background: rgba(255,255,255,0.06); }
body.dark button.send-btn:hover { background: rgba(255,255,255,0.1); }

/* ── Music bar ── */
.music-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 24px 32px 32px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.visualizer-wrap {
  width: 100%;
  max-width: 200px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.visualizer-bar {
  width: 2px;
  background: rgba(0,0,0,0.6);
  border-radius: 1px;
  transition: height 0.15s ease-out;
}
body.dark .visualizer-bar {
  background: rgba(255,255,255,0.6);
}

.music-controls {
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 0;
}
.music-controls:hover input[type=range] {
  height: 4px;
  background: linear-gradient(to right, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.15) 0%);
}
body.dark .music-controls:hover input[type=range] {
  background: linear-gradient(to right, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.15) 0%);
}

.play-pause-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s;
}
.play-pause-btn:hover { color: var(--text); }

input[type=range] {
  flex: 1; 
  -webkit-appearance: none; 
  appearance: none;
  height: 2px; 
  border-radius: 1px;
  background: linear-gradient(to right, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.08) 0%);
  outline: none; 
  cursor: pointer;
  transition: height 0.2s ease, background 0.2s ease;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; 
  width: 0;
  height: 0;
  cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 0;
  height: 0;
  cursor: pointer;
  border: none;
}
input[type=range]::-moz-range-progress {
  background: rgba(0,0,0,0.2);
  height: 2px;
  border-radius: 1px;
  transition: height 0.2s ease, background 0.2s ease;
}
body.dark input[type=range] {
  background: linear-gradient(to right, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.08) 0%);
}
body.dark input[type=range]::-moz-range-progress {
  background: rgba(255,255,255,0.2);
}

/* ── Thoughts list ── */
.thought-item {
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.thought-item:last-child { border-bottom: none; }
.thought-content { flex: 1; min-width: 0; }
.thought-meta { 
  font-size: 11px; 
  color: var(--muted); 
  margin-bottom: 10px;
}
.thought-text { 
  line-height: 1.6; 
  white-space: pre-wrap;
  color: var(--text);
  font-family: 'Hedvig Letters Serif', serif;
  font-size: 15px;
  letter-spacing: 0;
}
.delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  opacity: 0.4;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.delete-btn:hover { opacity: 1; }
.empty { 
  color: var(--muted); 
  font-size: 14px; 
  text-align: center; 
  padding: 80px 0;
  font-family: 'Hedvig Letters Serif', serif;
}

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

  nav { padding: 16px 20px; }

  #orb {
    width: min(85vw, 320px);
    height: min(85vw, 320px);
  }

  .orb-wrap {
    min-height: 40vh;
    margin: 0 0 60px;
  }

  .thought-box {
    padding: 16px 18px;
    border-radius: 14px;
  }

  textarea { font-size: 15px; }

  .music-bar {
    padding: 16px 20px 24px;
    gap: 10px;
  }

  .visualizer-wrap {
    max-width: 160px;
    height: 40px;
  }

  .music-controls {
    max-width: 220px;
    padding: 8px 0;
  }

  input[type=range] { 
    height: 3px;
    width: 160px;
    flex: none;
  }

  .thought-text { font-size: 14px; }

  .thought-item { padding: 18px 0; }
}
