:root {
  --bg: #1c1c1e;
  --card: #2c2c2e;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --accent: #34c759;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header { padding: 12px 12px 0; }
.tabs { display: flex; gap: 6px; background: var(--card); border-radius: 12px; padding: 4px; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 10px; border-radius: 10px; font-weight: 600;
}
.tab.active { background: #3a3a3c; color: var(--text); }
main { flex: 1; padding: 16px; }
.panel { display: none; }
.panel.active { display: block; }
h1 { font-size: 1.25rem; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.sv {
  position: relative; width: 100%; aspect-ratio: 1.4;
  border-radius: 12px; background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, hsl(210, 100%, 50%));
  touch-action: none;
}
.sv-cursor {
  position: absolute; width: 18px; height: 18px; border: 2px solid #fff;
  border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4);
}
#hue { width: 100%; margin: 14px 0; accent-color: var(--accent); }
.preview-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #555; }
#hex {
  flex: 1; background: var(--card); border: 0; color: var(--text);
  padding: 12px; border-radius: 10px; font-size: 1rem; letter-spacing: 0.04em;
}
/* Extra bottom space so HTML «Готово» stays above Telegram MainButton */
footer {
  padding: 12px 16px calc(88px + env(safe-area-inset-bottom, 0px));
}
.primary {
  width: 100%; border: 0; background: var(--accent); color: #041;
  font-weight: 700; padding: 14px; border-radius: 12px; font-size: 1rem;
  cursor: pointer; position: relative; z-index: 5;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.primary:disabled { opacity: 0.6; }
.status {
  text-align: center; color: var(--muted); margin-top: 8px; font-size: 0.85rem; min-height: 1.2em;
}
.brand { text-align: center; color: var(--muted); margin-top: 10px; font-size: 0.8rem; }
canvas { width: 100%; max-width: 280px; display: block; margin: 0 auto; border-radius: 12px; background: #111; }
