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

:root {
  --bg: #0f1117;
  --card: #1a1d27;
  --text: #e8eaf2;
  --muted: #8a90a5;
  --accent: #ff5c7a;
  --accent-dim: #b33e55;
  --ok: #4cd97b;
  --err: #ff7a5c;
  --radius: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.card, .wall { width: 100%; max-width: 480px; }
.wall { max-width: 900px; }

h1 { font-size: 1.6rem; margin-bottom: 4px; text-align: center; }
.subtitle { color: var(--muted); text-align: center; margin-bottom: 24px; }

#recorder { display: flex; flex-direction: column; align-items: center; gap: 16px; }

#meter {
  width: 100%; height: 8px; border-radius: 4px;
  background: var(--card); overflow: hidden;
}
#meter-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 80ms linear;
}

#timer { font-variant-numeric: tabular-nums; font-size: 1.4rem; color: var(--muted); }

.big-btn {
  border: none; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  font-size: 1.1rem; font-weight: 600;
  padding: 16px 32px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform 100ms ease, background 150ms ease;
}
.big-btn:active { transform: scale(0.97); }
.big-btn:disabled { background: var(--accent-dim); opacity: 0.6; cursor: default; }

#record-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; display: inline-block;
}
.recording #record-icon { border-radius: 3px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

.ghost-btn {
  border: 1px solid var(--muted); border-radius: var(--radius);
  background: none; color: var(--muted);
  font-size: 1rem; padding: 14px 24px; cursor: pointer;
}

#review { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
#review[hidden] { display: none; }
#playback { width: 100%; }

.row { display: flex; gap: 12px; justify-content: center; }
.row > * { flex: 1; }

#passcode {
  background: var(--card); border: 1px solid #2c3040;
  border-radius: var(--radius); color: var(--text);
  font-size: 1rem; padding: 14px 16px; width: 100%;
}
#passcode:focus { outline: 2px solid var(--accent); border-color: transparent; }

#status { text-align: center; margin-top: 20px; min-height: 1.4em; color: var(--muted); }
#status.ok { color: var(--ok); }
#status.err { color: var(--err); }

.wall-link {
  display: block; text-align: center; margin-top: 32px;
  color: var(--muted); text-decoration: none;
}
.wall-link:hover { color: var(--text); }

.wall-header { margin-bottom: 8px; }

.mode-switch { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.mode-switch button {
  background: var(--card); border: 1px solid #2c3040; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 0.9rem;
}
.mode-switch button.active { background: var(--accent); color: #fff; border-color: transparent; }
.style-switch { margin-top: -12px; }
.style-switch button { font-size: 0.8rem; padding: 6px 12px; }

/* Style-specific sizing so square/wide renders sit well in the layouts */
body[data-style="circle"] .plant .bloom { width: 110px; }
body[data-style="infinity"] .plant .bloom { width: 180px; }
body[data-style="circle"] .board { columns: 220px; }

#wall-area img { max-width: 100%; height: auto; display: block; }
#wall-area time { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 6px; text-align: right; }

/* --- Corkboard ------------------------------------------------------- */
.board { columns: 260px; column-gap: 18px; padding-top: 8px; }
.pin-tile {
  position: relative; display: inline-block; width: 100%;
  break-inside: avoid; margin-bottom: 18px;
  background: var(--card); border-radius: 6px;
  padding: 18px 12px 10px;
  transform: rotate(var(--rot));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}
.pin {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffdf9e, #d99a2b);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.6);
}
.pin-tile.fresh { animation: drop-in 500ms cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes drop-in {
  from { opacity: 0; transform: rotate(var(--rot)) translateY(-30px) scale(1.05); }
  to { opacity: 1; transform: rotate(var(--rot)); }
}

/* --- Sound garden ---------------------------------------------------- */
.garden {
  position: relative; height: 65vh; min-height: 420px;
  border-bottom: 2px solid #35563d; overflow: hidden;
}
.plant {
  position: absolute; bottom: 0;
  display: flex; flex-direction: column; align-items: center;
  transform-origin: bottom center;
  animation-name: sway; animation-duration: var(--sway, 4s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite; animation-direction: alternate;
}
.plant .bloom { width: 150px; }
.plant .stem { width: 2px; background: linear-gradient(#4c9159, #2b5638); }
.plant.sprouting {
  animation-name: sprout, sway;
  animation-duration: 600ms, var(--sway, 4s);
  animation-delay: 0s, 600ms;
  animation-timing-function: ease-out, ease-in-out;
  animation-iteration-count: 1, infinite;
  animation-direction: normal, alternate;
}
@keyframes sway { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
@keyframes sprout { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* --- Timeline river --------------------------------------------------- */
.river { overflow-x: auto; padding: 16px 0; }
.river-track {
  display: flex; align-items: center; gap: 28px;
  height: 360px; min-width: 100%; width: max-content; padding: 0 24px;
  background: linear-gradient(
    to bottom,
    transparent calc(50% - 1px), #2c3040 calc(50% - 1px),
    #2c3040 calc(50% + 1px), transparent calc(50% + 1px)
  );
}
.stop {
  flex: 0 0 240px; background: var(--card);
  border-radius: 12px; padding: 10px;
}
.stop:nth-child(odd) { transform: translateY(-52px); }
.stop:nth-child(even) { transform: translateY(52px); }
.stop.fresh { animation: fade-in 500ms ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
