/*!
 * Shape Playground - Styles
 * Modern dark UI, mobile-first, responsive
 * ---------------------------------------- */

:root {
  --bg: #0e0e14;
  --surface: #1a1a24;
  --surface-2: #22222e;
  --border: #2c2c3a;
  --text: #eaeaf2;
  --text-muted: #9a9aac;
  --accent: #6c8cff;
  --track: #33333f;
  --thumb: #ffffff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; /* never allow horizontal scrolling */
}

/* App shell: single centered column, works on phone and desktop */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height (mobile browser chrome aware) */
}

/* --- Header --- */
#header { text-align: center; padding: 4px 0 2px; }
#header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
#tagline { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-muted); }

/* --- Stage (shape preview) --- */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 8px 0;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 45%, #1e1e2c 0%, #14141c 70%);
  border: 1px solid var(--border);
}

/* The shape itself */
#shape {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  border-radius: 24px;
  background: hsl(210, 75%, 55%);
  transform: translate(-50%, -50%);
  transform-origin: center;
  will-change: transform, width, height, border-radius, background;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* --- Controls --- */
#controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-row {
  display: grid;
  grid-template-columns: 96px 1fr 64px;
  align-items: center;
  gap: 10px;
}

.slider-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.slider-row .value {
  font-size: 0.85rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px 6px;
  min-width: 64px;
}

/* --- Range inputs (touch friendly) --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px; /* large touch target */
  background: transparent;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--track);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px; /* (24 - 6) / 2, centers thumb on track */
  border-radius: 50%;
  background: var(--thumb);
  border: 2px solid var(--accent);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--track);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--thumb);
  border: 2px solid var(--accent);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

/* --- Presets --- */
#presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
#presets button {
  padding: 11px 8px;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
#presets button:active { background: var(--surface-2); border-color: var(--accent); }

/* --- Actions --- */
#actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
#actions button {
  padding: 13px 10px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
#actions button:active { transform: scale(0.97); }
#reset { background: var(--surface-2); color: var(--text); }
#randomize { background: var(--accent); color: #0b0b12; }

/* --- Desktop: widen a touch and give more breathing room --- */
@media (min-width: 600px) {
  #app { padding: 28px; }
  #stage { min-height: 380px; }
  .slider-row { grid-template-columns: 110px 1fr 72px; }
}

/* --- Reduced motion: keep layout, no animation (handled in JS) --- */
@media (prefers-reduced-motion: reduce) {
  input[type="range"]::-webkit-slider-thumb { transition: none; }
}
