.synesthesia-painter {
  --sp-bg: #fff;
  --sp-bg-muted: #f8fafc;
  --sp-text: #0f172a;
  --sp-text-muted: #475569;
  --sp-text-dim: #64748b;
  --sp-border: #e2e8f0;
  --sp-shadow: rgba(0, 0, 0, 0.08);
  --sp-primary: #6366f1;
  --sp-primary-on: #fff;
  --sp-header-bg: rgba(255, 255, 255, 0.92);
}

.theme-dark .synesthesia-painter {
  --sp-bg: #0f172a;
  --sp-bg-muted: #1e293b;
  --sp-text: #f8fafc;
  --sp-text-muted: #94a3b8;
  --sp-text-dim: #64748b;
  --sp-border: #334155;
  --sp-shadow: rgba(0, 0, 0, 0.35);
  --sp-primary: #818cf8;
  --sp-header-bg: rgba(30, 41, 59, 0.92);
}

.synesthesia-painter-card {
  position: relative;
  min-height: 420px;
  background-color: var(--sp-bg);
  border-radius: 2rem;
  border: 1px solid var(--sp-border);
  box-shadow: 0 20px 40px -8px var(--sp-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.synesthesia-painter-header {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  background-color: var(--sp-header-bg);
  backdrop-filter: blur(8px);
  padding: 0.3rem;
  border-radius: 9999px;
  border: 1px solid var(--sp-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 0.2rem;
}

.synesthesia-painter-mode-btn {
  padding: 0.4rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background 0.2s, color 0.2s;
  color: var(--sp-text-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.synesthesia-painter-mode-btn:hover {
  background-color: var(--sp-bg-muted);
  color: var(--sp-text);
}

.synesthesia-painter-mode-btn.active {
  background-color: var(--sp-primary);
  color: var(--sp-primary-on);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.synesthesia-painter-canvas-wrapper {
  position: relative;
  flex-grow: 1;
  padding: 2rem;
  padding-top: 5rem;
  cursor: text;
}

@media (min-width: 768px) {
  .synesthesia-painter-canvas-wrapper {
    padding: 3rem;
    padding-top: 5rem;
  }
}

.synesthesia-painter-viz-layer {
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.625;
  outline: none;
  font-size: 2.5rem;
  min-height: 100%;
}

.synesthesia-painter-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: text;
  z-index: -10;
  width: 100%;
  height: 100%;
  resize: none;
  border: none;
  background: transparent;
}

.synesthesia-painter-placeholder {
  position: absolute;
  top: 5rem;
  left: 2rem;
  pointer-events: none;
  opacity: 0.35;
  user-select: none;
}

@media (min-width: 768px) {
  .synesthesia-painter-placeholder {
    left: 3rem;
  }
}

.synesthesia-painter-placeholder-text {
  color: var(--sp-text-dim);
  font-size: 2.25rem;
  font-weight: 300;
  font-style: italic;
}

.synesthesia-painter-footer {
  background-color: var(--sp-bg-muted);
  border-top: 1px solid var(--sp-border);
  padding: 0.875rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.synesthesia-painter-tooltip {
  font-size: 0.75rem;
  color: var(--sp-text-muted);
  font-weight: 500;
  margin: 0;
}

.synesthesia-painter-clear-btn {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sp-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
  white-space: nowrap;
}

.synesthesia-painter-clear-btn:hover {
  color: #ef4444;
}

.synesthesia-painter-char {
  display: inline-block;
  color: var(--char-color);
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: sp-fade-in 0.2s ease-out forwards;
}

@keyframes sp-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.synesthesia-painter-viz-layer.dots .synesthesia-painter-char {
  color: transparent;
  font-size: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--char-color);
  margin: 0.25rem;
  box-shadow: 0 0 8px var(--char-color);
}

.synesthesia-painter-viz-layer.aura .synesthesia-painter-char {
  color: rgba(255, 255, 255, 0.15);
  text-shadow: 0 0 18px var(--char-color), 0 0 36px var(--char-color);
}

.theme-dark .synesthesia-painter-viz-layer.aura .synesthesia-painter-char {
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 14px var(--char-color), 0 0 28px var(--char-color), 0 0 56px var(--char-color);
}

.synesthesia-painter-cursor {
  display: inline-block;
  width: 2px;
  height: 2.5rem;
  background-color: var(--sp-primary);
  animation: sp-blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes sp-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}