:root {
  /* Dark Mode (Silent Garden) */
  --bg: #0a0a0a;
  --text: #fcfcfb;
  --text-muted: #a5a19c;
  --accent: #e7d7ad; /* Champagne Gold */
  --accent-rgb: 231, 215, 173;
  --ui-bg: rgba(20, 20, 22, 0.85);
  --ui-border: rgba(255, 255, 255, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.light-mode {
  /* Light Mode (Zen Paper Garden) */
  --bg: #f5f2e8; /* Washi Paper */
  --text: #1a1a1c; /* Sumi-e Ink */
  --text-muted: #5a5a5e;
  --accent: #111111; /* Solid Ink Black */
  --accent-rgb: 17, 17, 17;
  --ui-bg: rgba(245, 242, 232, 0.9);
  --ui-border: rgba(0, 0, 0, 0.15);
  --glass-bg: rgba(0, 0, 0, 0.05);
  --line: rgba(0, 0, 0, 0.1);
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 2px 8px rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  cursor: none;
}

body {
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ─── Custom cursor ─── */

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  will-change: left, top;
  transition: width 200ms cubic-bezier(0.16, 1, 0.3, 1),
              height 200ms cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 200ms cubic-bezier(0.16, 1, 0.3, 1),
              background 200ms ease,
              opacity 200ms ease;
}

/* Hover: dot turns gold and shimmers */
.cursor-dot.is-hovering {
  width: 4px;
  height: 4px;
  background: #e7d7ad;
  box-shadow: 0 0 10px rgba(231, 215, 173, 0.6);
  opacity: 1;
  animation: gold-shimmer-dot 1s ease-in-out infinite alternate;
}

@keyframes gold-shimmer-dot {
  from { filter: brightness(1) scale(1); }
  to   { filter: brightness(1.3) scale(1.1); }
}

/* Click: dot bursts into a small splash */
.cursor-dot.is-clicking {
  animation: dot-click 320ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dot-click {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
  25%  { transform: translate(-50%, -50%) scale(3.5); opacity: 0.7; border-radius: 30%; }
  100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; border-radius: 50%; }
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--ui-border);
  background: transparent;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  will-change: left, top;
  transition: width 380ms cubic-bezier(0.16, 1, 0.3, 1),
              height 380ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 280ms ease,
              border-width 280ms ease,
              background 280ms ease;
}

/* Hover: ring swells and turns gold — Kintsugi style */
.cursor-ring.is-hovering {
  width: 52px;
  height: 52px;
  border-color: rgba(255, 209, 64, 0.5);
  border-width: 1.5px;
  background: rgba(255, 209, 64, 0.04);
  box-shadow: inset 0 0 15px rgba(255, 209, 64, 0.1);
  animation: gold-shimmer-ring 2s ease-in-out infinite alternate;
}

@keyframes gold-shimmer-ring {
  from { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  to   { opacity: 1.0; transform: translate(-50%, -50%) scale(1.05); }
}

/* Click: ring bursts outward and fades */
.cursor-ring.is-clicking {
  animation: ring-click 450ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ring-click {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
  60%  { transform: translate(-50%, -50%) scale(2.4); opacity: 0.25; }
  100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* ─── Stone hover label ─── */

.stone-label {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9996;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transform: translate(20px, -24px);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 2px;
}

.stone-label.is-visible {
  opacity: 1;
}

.stone-label.is-hint {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
}

.light-mode .stone-label.is-hint {
  color: rgba(17, 17, 17, 0.88);
  background: rgba(245, 242, 232, 0.82);
}

button {
  font-family: inherit;
  font-weight: 300;
  -webkit-tap-highlight-color: transparent;
}

button:focus,
button:focus-visible {
  outline: none;
  box-shadow: none;
}

input {
  font-family: inherit;
}

/* ─── Canvas ─── */

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─── Overlays ─── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.overlay > * {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

/* ─── Theme Toggle ─── */

.theme-toggle,
.sound-toggle {
  position: fixed;
  bottom: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  color: var(--text);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.theme-toggle {
  left: 72px; /* Next to history toggle */
}

.sound-toggle {
  left: 124px;
}

.theme-toggle:hover,
.sound-toggle:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.theme-toggle.hidden,
.sound-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.theme-toggle svg,
.sound-toggle svg {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle:active svg,
.sound-toggle:active svg {
  transform: scale(0.8) rotate(15deg);
}

/* ─── Overlays & Shared UI ─── */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
  transition: opacity 800ms ease, transform 800ms ease;
  background: radial-gradient(circle at center, transparent 0%, var(--bg) 100%);
}

/* ─── Phase 1: Landing ─── */

.brand {
  position: absolute;
  top: clamp(48px, 10vh, 80px);
  left: clamp(32px, 8vw, 80px);
}

.brand-title {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  cursor: default;
  transition: letter-spacing 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-title:hover {
  letter-spacing: 0.12em;
}

.zen-char {
  display: inline-block;
  transition: transform 300ms ease, color 300ms ease;
  will-change: transform;
}

.brand-title:hover .zen-char {
  color: var(--accent);
}

@keyframes zen-breath {
  0%   { letter-spacing: -0.01em; opacity: 0.85; filter: blur(0.5px); }
  100% { letter-spacing: 0.04em;  opacity: 1;    filter: blur(0px); }
}

.brand-tagline {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* Begin button — hidden, Three.js cube handles interaction */
.begin-btn {
  display: none !important;
}

/* (kept in DOM as accessible fallback — see main.js) */
.begin-btn-legacy {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 18px 36px;
  outline: 1px solid rgba(26, 25, 22, 0.18);
  outline-offset: 10px;
  transition: outline-color 400ms ease, color 400ms ease, opacity 400ms ease;
  animation: pulse-begin 3s ease-in-out infinite;
}

.begin-btn:hover {
  color: var(--accent);
  outline-color: rgba(255, 255, 255, 0.45);
  animation: none;
  opacity: 1;
}

@keyframes pulse-begin {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Sign up link — bottom right */
.signup-link {
  position: absolute;
  top: clamp(48px, 10vh, 100px);
  right: clamp(32px, 8vw, 100px);
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--accent);
  padding: 8px 0;
  border-radius: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  opacity: 0.5;
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), letter-spacing 600ms ease;
  box-shadow: none;
}

.signup-link:hover {
  opacity: 1;
  letter-spacing: 0.32em;
  text-decoration: underline;
  text-underline-offset: 4px;
  background: none;
  border: none;
  transform: none;
  box-shadow: none;
}

/* ─── Phase 2: Input ─── */

.input-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(580px, calc(100vw - 64px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.mash-header {
  font-family: "Outfit", sans-serif;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: 0.32em;
  text-transform: lowercase;
  color: var(--text);
  margin: 0;
  opacity: 0.3;
  transition: opacity 1.2s ease;
}

.mash-line-container {
  width: 100%;
  height: 1px;
  background: rgba(var(--accent-rgb), 0.06);
  position: relative;
  overflow: hidden;
}

.mash-surface {
  display: none;
}

.mash-surface-label {
  display: none;
}

.mash-line {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(
    90deg,
    #d4af37 0%,
    #f9e29d 50%,
    #d4af37 100%
  );
  background-size: 200% 100%;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
  transition: width 240ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: gold-shimmer 3s infinite linear;
}

@keyframes gold-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.input-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 8px;
}

.keystroke-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(var(--accent-rgb), 0.7);
  margin: 0;
}

.upload-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  transition: color 250ms ease, transform 250ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.65;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.upload-btn:hover {
  color: var(--accent);
  opacity: 1;
  transform: scale(1.1);
}

.upload-btn.has-image svg {
  opacity: 0;
}

.mash-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-palette {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 16px;
  opacity: 0.82;
}

.upload-palette-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.upload-palette-swatches {
  display: flex;
  gap: 5px;
  align-items: center;
}

.upload-palette-swatch {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.light-mode .upload-palette-swatch {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.generate-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 0;
  opacity: 0;
  visibility: hidden; /* Keeps space in layout to prevent shifting */
  pointer-events: none;
  transition: opacity 500ms ease, visibility 0s 500ms;
}

.generate-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 500ms ease, visibility 0s;
}

.keystroke-count {
  position: relative;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(var(--accent-rgb), 0.82);
  opacity: 0.92;
}

/* ─── Player bar (Horizontal) ─── */

.player-bar {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  display: flex;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 800ms ease, transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

.player-bar.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.player-wrap {
  width: min(640px, calc(100vw - 48px));
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--ui-bg);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  border: 1px solid var(--ui-border);
  border-radius: 0; /* Square edges */
  padding: 12px 24px;
  box-shadow: var(--shadow-elevated);
  pointer-events: auto;
}

.play-pause-btn {
  background: none;
  border: 1.5px solid var(--ui-border);
  border-radius: 0; /* Square button */
  color: var(--text);
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: border-color 220ms ease, background 220ms ease, transform 220ms ease;
  cursor: pointer;
}

.play-pause-btn:hover {
  border-color: var(--accent);
  background: var(--glass-bg);
  transform: scale(1.05);
}

.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 8px 0;
}

.progress-track {
  width: 100%;
  height: 2px;
  background: var(--line);
  position: relative;
  overflow: visible;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4);
  transition: width 300ms linear;
}

.playhead {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
  border: 1px solid var(--ui-border);
  opacity: 0;
  transition: left 300ms linear, opacity 300ms ease;
}

.playhead.is-active {
  opacity: 1;
}

.time-display {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  font-weight: 500;
  min-width: 40px;
  text-align: center;
  opacity: 0.6;
}

.new-btn {
  background: none;
  border: 1.5px solid var(--ui-border);
  border-radius: 2px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 10px;
  opacity: 0.9;
  transition: opacity 250ms, border-color 250ms;
}

.new-btn:hover {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: var(--shadow-elevated);
}

.playhead.is-active {
  opacity: 1;
}

/* Time in editorial serif — feels like a caption on an ink drawing */
.time-display {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.5;
}

.new-btn {
  background: none;
  border: 1.5px solid var(--ui-border);
  border-radius: 2px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  padding: 3px 10px;
  opacity: 0.9;
  transition: opacity 250ms, border-color 250ms, box-shadow 250ms;
}

.new-btn:hover {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: var(--shadow-elevated);
}

/* ─── History toggle ─── */

.history-toggle {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  opacity: 0.25;
  z-index: 20;
  padding: 12px;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: auto;
  line-height: 0;
}

.history-toggle:hover {
  opacity: 1;
  transform: scale(1.1);
  color: var(--accent);
}

/* ─── History drawer ─── */

.history-drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 360px;
  background: var(--ui-bg);
  backdrop-filter: blur(60px);
  -webkit-backdrop-filter: blur(60px);
  border-right: 1px solid var(--ui-border);
  z-index: 2000;
  padding: 64px 40px;
  transform: translateX(-100%);
  transition: transform 900ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px var(--shadow);
}

.history-drawer:not(.hidden) {
  display: flex;
}

.history-drawer.open {
  transform: translateX(0);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.8;
}

.history-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 250ms;
  padding: 8px;
  cursor: pointer;
}

.history-close:hover {
  opacity: 1;
}

.history-clear,
.history-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.52;
  transition: opacity 220ms ease, color 220ms ease;
}

.history-clear:hover,
.history-delete:hover {
  opacity: 1;
  color: var(--accent);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
  /* Hide scrollbars */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.history-list::-webkit-scrollbar {
  display: none;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  opacity: 0.45;
  transition: opacity 300ms ease, transform 300ms ease;
}

.history-row:hover {
  opacity: 1;
  transform: translateX(4px);
}

.history-swatches {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.history-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.history-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.history-timestamp {
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.history-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.4;
  padding-top: 8px;
  letter-spacing: 0.04em;
}

/* ─── Sign-up modal ─── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 2000; /* Ensure it is above the player */
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  position: relative;
  padding-top: 32px;
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 250ms;
}

.modal-close:hover {
  opacity: 1;
}

.modal-form {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.modal-email-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-weight: 300;
  font-size: 1rem;
  padding: 6px 0;
  width: 240px;
  caret-color: var(--text);
  letter-spacing: 0.02em;
}

.modal-email-input::placeholder {
  color: var(--text-muted);
  opacity: 0.4;
}

.modal-submit {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 6px 0;
  transition: color 250ms;
  white-space: nowrap;
}

.modal-submit:hover {
  color: var(--text);
}

/* ─── Fade transitions ─── */

/* Generic overlay fade — driven by .is-visible class */
#phase-landing,
#phase-input,
#player-bar,
#history-toggle {
  opacity: 0;
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

#phase-landing.is-visible,
#phase-input.is-visible,
#player-bar.is-visible,
#history-toggle.is-visible {
  opacity: 1;
}

/* Landing starts visible */
#phase-landing {
  opacity: 1;
}

.fade-out {
  animation: fade-out 600ms ease forwards;
}

@keyframes fade-out {
  to {
    opacity: 0;
    pointer-events: none;
  }
}

/* ─── Mobile adjustments ─── */

@media (max-width: 600px) {
  #phase-input.touch-mash-mode {
    touch-action: none;
  }

  .brand {
    top: 36px;
    left: 24px;
  }

  .input-wrap {
    width: min(520px, calc(100vw - 32px));
    gap: 14px;
  }

  #phase-input.touch-mash-mode .mash-surface-label {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.64rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.5);
    opacity: 0.86;
    transition: opacity 600ms ease, visibility 600ms;
    text-align: center;
    max-width: 290px;
    line-height: 1.5;
    margin: 0;
  }

  #phase-input.touch-mash-mode .mash-surface-label.fade-out,
  #phase-input.touch-mash-mode .mash-surface-label.hidden {
    opacity: 0;
    visibility: hidden;
  }

  #phase-input.touch-mash-mode .mash-surface,
  #phase-input.touch-mash-mode .mash-input {
    display: none;
  }

  .history-toggle {
    bottom: 20px;
    left: 20px;
  }

  .theme-toggle {
    bottom: 20px;
    left: 68px;
  }

  .sound-toggle {
    bottom: 20px;
    left: 116px;
  }

  .signup-link {
    top: 36px;
    right: 24px;
    bottom: auto;
  }

  .history-drawer {
    width: 260px;
  }

  .cursor-dot,
  .cursor-ring,
  .stone-label,
  .cursor-coords {
    display: none !important;
  }
}

.cursor-coords {
  position: fixed;
  bottom: 24px;
  right: 28px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  color: var(--text);
  opacity: 0.3;
  letter-spacing: 0.08em;
  pointer-events: none;
  z-index: 1000;
}

.creator-credit {
  position: fixed;
  right: 28px;
  bottom: 46px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--text);
  opacity: 0.26;
  pointer-events: none;
  z-index: 1000;
}
