:root {
  --bg: #0d0f16;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #e8ecff;
  --muted: #9aa3c4;
  --accent: #7cf6f0;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, #182235, #0d0f16 40%), radial-gradient(circle at 80% 10%, #1c1232, transparent 40%), radial-gradient(circle at 50% 80%, #113034, transparent 45%), #0d0f16;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  text-align: right;
}

.shell {
  width: min(1100px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  padding: 28px;
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  margin-top: 4px;
  font-size: 15px;
}

.advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.tab-bar {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  border-color: rgba(124, 246, 240, 0.6);
  background: rgba(124, 246, 240, 0.12);
  color: var(--accent);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-panel.active {
  display: flex;
}

.advanced-off .advanced-only {
  display: none;
}

.kit {
  display: grid;
  gap: 16px;
}

.kit-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.kit-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 10px;
}

.kit-heading {
  font-size: 28px;
  font-weight: 700;
}

.kit-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.kit-btn {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.kit-btn:hover {
  transform: translateY(-1px);
}

.kit-btn:active {
  transform: translateY(0);
}

.kit-btn.primary {
  background: var(--kit-primary, #7cf6f0);
  color: #0a111a;
  border-color: transparent;
}

.kit-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--kit-secondary, var(--panel-border));
}

.kit-btn.ghost {
  background: transparent;
  color: var(--kit-accent, var(--accent));
  border-color: var(--panel-border);
}

.kit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.kit-input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  font-size: 14px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch-mini {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.base-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.remove-btn {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.remove-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

select {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
  min-width: 150px;
}

label {
  color: var(--muted);
  font-size: 14px;
}

.text-input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  font-size: 14px;
  min-width: 220px;
  direction: ltr;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

#baseColors {
  flex-direction: column;
  align-items: flex-start;
}

#baseColors label {
  margin-bottom: 4px;
}

input[type="color"] {
  appearance: none;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

input[type="number"] {
  width: 70px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  font-size: 14px;
}

button {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  color: #081019;
  background: linear-gradient(135deg, #7cf6f0, #64c6ff);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 14px 35px rgba(100, 198, 255, 0.3);
  min-width: 120px;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 10px 25px rgba(100, 198, 255, 0.2);
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
  min-width: unset;
  padding: 10px 12px;
}

.palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.palette.small {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.color-wheel-wrap {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.color-wheel {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}

.wheel-note {
  color: var(--muted);
  font-size: 12px;
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.preset-chip button {
  padding: 6px 8px;
  min-width: unset;
}

.base-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.base-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  color: var(--text);
}

.base-chip .dot {
  width: 16px;
  height: 16px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.swatch {
  position: relative;
  min-height: 180px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: #1a1d2c;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.swatch.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: 0 18px 40px rgba(124, 246, 240, 0.18);
}

.swatch.primary {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: 0 18px 40px rgba(124, 246, 240, 0.18);
}

.swatch.secondary {
  outline: 2px dashed rgba(124, 246, 240, 0.5);
  outline-offset: -2px;
}

.swatch-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  border: 1px solid var(--panel-border);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.lock-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: unset;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  border: 1px solid var(--panel-border);
  box-shadow: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  z-index: 2;
}

.lock-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-1px);
}

.swatch.locked {
  outline: 2px dashed rgba(124, 246, 240, 0.9);
  outline-offset: -2px;
}

.swatch.locked .lock-btn {
  background: rgba(124, 246, 240, 0.18);
  border-color: rgba(124, 246, 240, 0.7);
  color: #0a111a;
}

.swatch.locked .lock-btn:hover {
  background: rgba(124, 246, 240, 0.28);
}

.combo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.combo-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 8px;
}

.combo-label {
  font-weight: 700;
  font-size: 14px;
}

.combo-contrast {
  font-size: 12px;
  color: var(--muted);
}

.gradients {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.gradient-card {
  height: 120px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  overflow: hidden;
}

.cb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.cb-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 8px;
}

.cb-swatch {
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.swatch:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.35);
}

.swatch-info {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #f4f7ff;
  font-weight: 600;
  font-size: 14px;
}

.swatch span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.analysis {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.section-title {
  font-weight: 600;
  font-size: 18px;
  margin: 6px 0;
}

.paragraph {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.tips {
  margin-top: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  padding: 18px;
  display: grid;
  gap: 10px;
}

.tip-title {
  font-weight: 700;
  font-size: 16px;
}

.tip-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.analysis-card {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analysis-title {
  font-weight: 600;
  font-size: 18px;
}

.analysis-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  font-weight: 600;
  color: var(--text);
  margin: 4px 4px 0 0;
  font-size: 13px;
}

.analysis-text {
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.mini-swatch {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.copied {
  position: absolute;
  top: 12px;
  right: 52px;
  background: rgba(0, 0, 0, 0.55);
  color: #d8ffe8;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid rgba(216, 255, 232, 0.35);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.copied.visible {
  opacity: 1;
  transform: translateY(0);
}

.adjust-panel {
  margin-top: 24px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  display: none;
  gap: 14px;
  flex-direction: column;
}

.adjust-panel.open {
  display: flex;
}

.adjust-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.adjust-title {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 4px;
}

.adjust-hex {
  color: var(--muted);
  font-size: 14px;
}

.adjust-preview {
  width: 100%;
  height: 80px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #1c1f2f;
}

.adjust-input-row {
  display: grid;
  grid-template-columns: 70px 1fr 90px;
  gap: 10px;
  align-items: center;
}

.adjust-input-row input[type="text"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  font-size: 14px;
  direction: ltr;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-btn {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.slider-row {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  gap: 12px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.value {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.adjust-note {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  header {
    gap: 10px;
  }
  .title {
    font-size: 26px;
  }
  .controls {
    width: 100%;
    justify-content: flex-start;
  }
  button {
    width: 100%;
  }

  .slider-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .value {
    text-align: left;
  }

  .adjust-input-row {
    grid-template-columns: 1fr 1fr;
  }
  .adjust-input-row label {
    grid-column: 1 / -1;
  }
}
