/* ═══════════════════════════════════════════
   Char Carpet Animator — Stylesheet
   ═══════════════════════════════════════════ */

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Open Sans', sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
}

.hidden {
  display: none !important;
}

body {
  display: flex;
}

/* ─── Sidebar ─── */
#sidebar {
  width: 270px;
  min-width: 270px;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  background: linear-gradient(180deg, #111 0%, #0d0d0d 100%);
  border-right: 1px solid #222;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

/* Title */
.sidebar-title h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: #fff;
}

.title-rule {
  margin-top: 12px;
  height: 2px;
  background: #fff;
  width: 100%;
}

/* Control groups */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.readout {
  font-weight: 400;
  font-size: 10px;
  color: #666;
  font-variant-numeric: tabular-nums;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #fff;
  color: #111;
}

.btn-primary:hover {
  background: #ddd;
}

.btn-accent {
  background: #7c1910;
  color: #fff;
}

.btn-accent:hover {
  background: #a02218;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Ratio toggle buttons */
.btn-ratio {
  background: transparent;
  color: #888;
  border: 1px solid #444;
  font-size: 10px;
  padding: 6px 0;
}

.btn-ratio:hover {
  border-color: #888;
  color: #ccc;
}

.btn-ratio.active {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.export-status {
  font-size: 10px;
  color: #f0a040;
  min-height: 14px;
  text-align: center;
}

/* 2D Pad */
.pad-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1.7 / 1;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  cursor: crosshair;
  overflow: hidden;
}

.pad-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #fff 0%, #999 100%);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: left 0.05s, top 0.05s;
}

/* Text input */
input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: #666;
}

/* Dropdown */
.dropdown {
  width: 100%;
  padding: 8px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}

.dropdown:focus {
  border-color: #666;
}

/* Emoji Grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.emoji-btn {
  aspect-ratio: 1;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.emoji-btn:hover {
  background: #333;
  border-color: #555;
  transform: scale(1.1);
}

.emoji-btn:active {
  transform: scale(0.9);
}

/* Color pickers — circles */
.color-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 4px 0;
}

.color-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.color-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  border: 2px solid #444;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="color"]:hover {
  border-color: #888;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Range sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  outline: none;
  border: 1px solid #333;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Canvas container */
#canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#canvas-container canvas {
  display: block;
}