:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #253347;
  --border: rgba(59, 130, 246, 0.15);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-dim: #60a5fa;
  --danger: #ef4444;
  --radius: 12px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #0f1218;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  padding: 1.75rem 0 1rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ad-slot {
  min-height: 90px;
  margin: 1rem auto;
  border-radius: var(--radius);
  overflow: hidden;
}

.ad-slot .adsbygoogle {
  display: block;
  min-height: 90px;
}

.layout {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem 0 3rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .picker-panel {
    grid-row: span 2;
  }

  .palette-panel {
    grid-column: 1 / -1;
  }

  .history-panel {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(300px, 340px) 1fr 1fr;
  }

  .picker-panel {
    grid-row: 1 / span 2;
  }

  .palette-panel,
  .history-panel {
    grid-column: auto;
  }

  .palette-panel {
    grid-column: 2 / -1;
  }

  .history-panel {
    grid-column: 2 / -1;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 280px);
  margin: 0 auto 1rem;
  aspect-ratio: 1;
}

#colorWheel {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.wheel-cursor {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.v-field {
  display: block;
  margin-bottom: 1rem;
}

.v-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.swatch-large {
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.value-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.copy-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.copy-btn:hover {
  border-color: var(--accent-dim);
  background: #232a38;
}

.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-btn .k {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.copy-btn code {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  word-break: break-all;
}

.inputs-grid {
  display: grid;
  grid-template-columns: 1fr repeat(3, 1fr);
  gap: 0.5rem;
}

@media (max-width: 480px) {
  .inputs-grid {
    grid-template-columns: 1fr 1fr;
  }

  .inputs-grid .field:first-child {
    grid-column: 1 / -1;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input[type="text"],
.field input[type="number"] {
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.field input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
}

.contrast-demo {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
}

.contrast-fg {
  font-weight: 600;
  font-size: 1.05rem;
}

.contrast-ratio {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.contrast-ratio strong {
  font-family: var(--mono);
  color: var(--accent);
}

.contrast-pass {
  color: var(--accent);
}

.contrast-fail {
  color: var(--danger);
}

.palette-row,
.history-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.palette-chip,
.history-chip {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s, border-color 0.12s;
}

.palette-chip:hover,
.history-chip:hover {
  transform: scale(1.06);
  border-color: var(--accent);
}

.palette-chip:focus-visible,
.history-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-ghost {
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-ghost:hover {
  color: var(--text);
}

.site-footer {
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.65rem 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

.toast[hidden] {
  display: none;
}
