:root {
  --bg: linear-gradient(135deg, #0f172a, #0b1022 35%, #131c3a 70%, #0f1115);
  --surface: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #60a5fa;
  --accent: #34d399;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 18px 18px 60px;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  color: var(--muted);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 16px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card, .panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card-head, .preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
}

.pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.pill-soft {
  background: #eef2ff;
  border-color: #e0e7ff;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.field span {
  font-weight: 600;
  color: var(--text);
}

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: #cbd5ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.range {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  flex: 1;
}

.range span {
  min-width: 60px;
  text-align: right;
  color: var(--muted);
}

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

.grid-tight {
  gap: 8px;
}

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

.primary,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  color: var(--text);
}

.primary {
  background: linear-gradient(120deg, var(--primary), #7dd3fc);
  color: #0b1220;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.3);
  border: none;
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost {
  background: var(--surface);
}

.ghost-cta {
  border-color: #d1d5db;
}

.ghost-cta.sm {
  padding: 8px 10px;
}

.primary:hover:not(:disabled),
.ghost:hover {
  transform: translateY(-1px);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

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

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

.color-picker input[type="color"] {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.selector p {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.chips.selectable {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  transition: border 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.chip-option.active {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.chip-preview {
  width: 28px;
  height: 12px;
  border-radius: 20px;
  display: inline-block;
  border: 1px solid var(--border);
}

.chip-preview.analogous {
  background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
}
.chip-preview.complementary {
  background: linear-gradient(90deg, #2563eb, #2563eb 50%, #f59e0b);
}
.chip-preview.triad {
  background: linear-gradient(90deg, #2563eb, #10b981, #f97316);
}
.chip-preview.mono {
  background: linear-gradient(90deg, #0f172a, #3b4a63, #94a3b8);
}
.chip-preview.split {
  background: linear-gradient(90deg, #2563eb, #22c55e, #f59e0b);
}
.chip-preview.tetradic {
  background: linear-gradient(90deg, #2563eb, #22c55e, #f97316, #8b5cf6);
}

.tone-bar {
  width: 28px;
  height: 12px;
  border-radius: 20px;
  display: inline-block;
  border: 1px solid var(--border);
}
.tone-bar.balanced { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.tone-bar.vivid { background: linear-gradient(90deg, #1d4ed8, #ef4444); }
.tone-bar.soft { background: linear-gradient(90deg, #a5b4fc, #c7d2fe); }
.tone-bar.muted { background: linear-gradient(90deg, #6b7280, #9ca3af); }
.tone-bar.warm { background: linear-gradient(90deg, #f97316, #fbbf24); }
.tone-bar.cool { background: linear-gradient(90deg, #22c55e, #06b6d4); }

.preview {
  display: grid;
  gap: 12px;
}

.mini-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

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

.swatch {
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.swatch:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.swatch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.role {
  font-weight: 700;
}

.hex {
  font-family: "Space Grotesk", monospace;
  color: var(--muted);
}

.accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  margin-top: 6px;
}

.accent::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

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

.ratio {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.ratio span {
  display: block;
  height: 100%;
}

.full-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.6s ease;
}

.full-left, .full-right {
  animation: float 14s ease-in-out infinite alternate;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.full-left h3 {
  margin: 4px 0 6px;
}

.muted {
  color: var(--muted);
}

.chip-row, .badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.type-preview {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.type-preview h3,
.type-preview h4,
.type-preview h5,
.type-preview h6 {
  margin: 6px 0 4px;
}

.list-block {
  margin: 10px 0;
}

.list-block ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.table-block {
  margin-top: 10px;
}

.table-block table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-block th,
.table-block td {
  padding: 6px 8px;
  border: 1px solid var(--border);
}

.table-block .th-contrast,
.table-block .td-contrast {
  background: #111827;
  color: #ffffff;
}

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

.gallery-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow);
}

.gallery-card .stat {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.gallery-card.alert {
  background: linear-gradient(120deg, rgba(255, 148, 66, 0.12), rgba(255, 67, 67, 0.08));
}

.gallery-card.form input {
  background: rgba(255, 255, 255, 0.06);
}

.chip, .badge {
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}

.cta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.cta {
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  color: #0b1220;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  transition: transform 0.14s ease, box-shadow 0.2s ease;
}

.cta-invert {
  background: #0b1220;
  color: #ffffff;
}

.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.hero-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(16, 185, 129, 0.05));
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 12px;
}

.card-lite {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.8);
}
.nav-logo {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nav-links {
  display: flex;
  gap: 10px;
  font-size: 13px;
}
.nav-link {
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface);
}

.hero-copy h1 {
  margin-top: 4px;
}

.hero-copy h2 {
  margin-top: 6px;
  color: var(--muted);
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.spec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}

.text-config textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-size: 14px;
}

.footer {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

body.apply-preview {
  background: var(--surface);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    padding: 14px 12px 50px;
  }
}
