:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---- top bar ---- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 60px; flex-shrink: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
}
.bar-title { font-size: 24px; font-weight: 700; letter-spacing: 0.3px; }
.bar-sub {
  font-size: 18px; font-weight: 600; color: var(--accent);
  background: var(--bg-tertiary); padding: 4px 12px; border-radius: 999px;
  min-width: 48px; text-align: center;
}

/* ---- gradient preview ---- */
.preview {
  flex: 1; min-height: 0; margin: 14px;
  border-radius: var(--radius-md);
  background: #1C1E21;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* ---- hex readout row ---- */
.hexrow {
  display: flex; gap: 12px; padding: 0 14px; flex-shrink: 0;
}
.hexchip {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 10px 14px; height: 52px;
}
.hexdot {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.hexval {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 20px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-primary);
}

/* ---- controls grid ---- */
.controls {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; padding: 14px; flex-shrink: 0;
}
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 64px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 19px; font-weight: 600; text-align: center;
  padding: 8px 10px;
}
.btn:focus { background: #262640; }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-secondary));
  color: #04121a; font-weight: 800; min-height: 72px; font-size: 21px;
}
.btn-primary:focus { filter: brightness(1.08); }
.span2 { grid-column: 1 / -1; }

/* ---- saved list ---- */
.list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.saved-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 12px 14px; min-height: 72px;
}
.saved-item:focus { background: #20203a; }
.saved-swatch {
  width: 84px; height: 48px; border-radius: 8px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.saved-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.saved-hex {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 18px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.saved-angle { font-size: 14px; color: var(--text-secondary); }
.empty {
  margin: auto; text-align: center; color: var(--text-muted);
  font-size: 19px; line-height: 1.5; padding: 30px;
}

/* ---- about ---- */
.about-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px;
  color: var(--text-secondary); font-size: 18px; line-height: 1.55;
}
.about-body p { margin-bottom: 14px; }
.about-body ul { margin: 0 0 14px 20px; }
.about-body li { margin-bottom: 8px; }
.about-body b { color: var(--text-primary); }
.about-body code {
  font-family: ui-monospace, Menlo, monospace; font-size: 16px;
  background: var(--bg-tertiary); padding: 2px 6px; border-radius: 6px; color: var(--accent);
}
.about-body .hint { color: var(--text-muted); font-size: 16px; margin-top: 6px; }

/* ---- toast ---- */
.toast {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 12px 24px; font-size: 18px; font-weight: 600;
  box-shadow: 0 0 24px rgba(0,212,255,0.35);
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }
