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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(96, 120, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(95, 125, 255, 0.08), transparent 28%),
    #080a13;
  color: #e0e0e0;
  display: flex;
  align-items: stretch;
}

/* ---- Layout ---- */
.container {
  display: grid;
  grid-template-columns: 300px 1fr;
  width: 100%;
  height: 100vh;
}

/* ---- Sidebar ---- */
.panel {
  background: rgba(12, 16, 34, 0.98);
  border-right: 1px solid rgba(70, 80, 150, 0.18);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(71, 88, 197, 0.2);
  background: linear-gradient(180deg, rgba(30, 37, 74, 0.98), rgba(11, 14, 30, 0.98));
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 96px;
  height: auto;
  min-width: 96px;
  border-radius: 18px;
  padding: 8px;
  filter: drop-shadow(0 0 18px rgba(95, 125, 255, 0.35));
}

.brand-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8ea0ff;
  margin-bottom: 4px;
}

.panel-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin: 0;
}

.tool-tagline {
  margin: 6px 0 0;
  font-size: 12px;
  color: #b5bfff;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }

/* ---- Section title ---- */
.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #444;
  margin-bottom: 8px;
}

/* ---- Color picker row ---- */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type=color] {
  width: 44px;
  height: 36px;
  border: 1px solid #1e2340;
  border-radius: 8px;
  cursor: pointer;
  background: none;
  padding: 2px;
  flex-shrink: 0;
}

.hex-input {
  flex: 1;
  max-width: 120px;
  background: #111420;
  border: 1px solid #1e2340;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 13px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
}
.hex-input:focus { border-color: #3a4070; }

.random-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(95,125,255,0.1);
  border: 1px solid rgba(95,125,255,0.2);
  border-radius: 8px;
  color: #8ea0ff;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.random-btn:hover { background: rgba(95,125,255,0.2); color: #fff; }

/* ---- Harmony grid ---- */
.harmony-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.harmony-btn {
  background: #0e1020;
  border: 1px solid #1e2340;
  border-radius: 7px;
  color: #555;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 6px;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.harmony-btn:hover { border-color: #3a4070; color: #8ea0ff; }
.harmony-btn.active {
  background: rgba(95,125,255,0.15);
  border-color: #5f7dff;
  color: #8ea0ff;
}

/* ---- Range ---- */
.row { display: flex; align-items: center; gap: 10px; }
input[type=range] {
  flex: 1;
  accent-color: #5f7dff;
  cursor: pointer;
  height: 2px;
}
.range-val {
  font-size: 12px;
  color: #555;
  width: 18px;
  text-align: right;
  font-family: monospace;
}

/* ---- Export ---- */
.export-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.export-btn {
  background: rgba(95,125,255,0.1);
  border: 1px solid rgba(95,125,255,0.2);
  border-radius: 7px;
  color: #8ea0ff;
  font-size: 11px;
  font-weight: 600;
  padding: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.export-btn:hover { background: rgba(95,125,255,0.2); color: #fff; }

.export-area {
  width: 100%;
  background: #0a0d1a;
  border: 1px solid #1e2340;
  border-radius: 8px;
  color: #7a8ab0;
  font-size: 11px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  padding: 10px;
  resize: none;
  height: 110px;
  outline: none;
  line-height: 1.6;
}

/* ---- Divider ---- */
hr { border: none; border-top: 1px solid #1c1c1c; }

/* ---- Output side ---- */
.output-side {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.output-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(70, 80, 150, 0.18);
  background: rgba(10, 13, 28, 0.8);
  flex-shrink: 0;
  gap: 10px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #8ea0ff;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5f7dff;
  display: inline-block;
  transition: background .3s;
}

.topbar-hint {
  font-size: 11px;
  color: #333;
}

/* ---- Palette area ---- */
.palette-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: #1e1e1e transparent;
}
.palette-area::-webkit-scrollbar { width: 6px; }
.palette-area::-webkit-scrollbar-track { background: transparent; }
.palette-area::-webkit-scrollbar-thumb { background: #1e1e1e; border-radius: 4px; }

/* ---- Palette group ---- */
.palette-group {}

.palette-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #333;
  margin-bottom: 10px;
}

.swatch-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---- Swatch ---- */
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 60px;
  max-width: 100px;
  position: relative;
}

.swatch-color {
  width: 100%;
  aspect-ratio: 1 / 1.2;
  border-radius: 10px;
  transition: transform .15s, box-shadow .15s;
  border: 1px solid rgba(255,255,255,0.06);
}

.swatch:hover .swatch-color {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.swatch-hex {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 10px;
  color: #555;
  transition: color .15s;
  text-align: center;
}
.swatch:hover .swatch-hex { color: #aaa; }

.swatch-toast {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,200,120,0.15);
  border: 1px solid rgba(0,200,120,0.3);
  color: #00c878;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.swatch.copied .swatch-toast { opacity: 1; }

/* ---- Mobile ---- */
@media (max-width: 700px) {
  html, body { overflow: auto; height: auto; }

  .container {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .panel { height: auto; overflow: visible; border-right: none; border-bottom: 1px solid rgba(70,80,150,0.18); }
  .panel-body { overflow: visible; }
  .output-side { height: auto; min-height: 400px; }
}
