/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f0f13;
  --surface:    #1a1a24;
  --surface2:   #242434;
  --border:     #333350;
  --text:       #e8e8f0;
  --text-muted: #888;
  --accent:     #7c6dff;
  --accent2:    #ff6db0;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 4px 20px rgba(0,0,0,.45);
  --transition: 0.2s ease;
}

body.light {
  --bg:         #f0f0f8;
  --surface:    #ffffff;
  --surface2:   #e8e8f0;
  --border:     #ccccdd;
  --text:       #111122;
  --text-muted: #666;
  --shadow:     0 4px 20px rgba(0,0,0,.12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Noto Sans JP', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-inner { display: flex; align-items: baseline; gap: 10px; }

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline { font-size: 0.8rem; color: var(--text-muted); }

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

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 6px 12px;
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--border); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--surface2);
}

.upload-icon  { font-size: 2.5rem; }
.upload-label { font-size: 1rem; }
.upload-hint  { font-size: 0.8rem; color: var(--text-muted); }

/* ── Controls ────────────────────────────────────────────────────────────── */
.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 180px;
}

.control-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.control-label strong { color: var(--text); }
.hint { font-size: 0.75rem; color: var(--text-muted); }

/* Mode buttons */
.mode-btns { display: flex; gap: 6px; }

.mode-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 14px;
  transition: all var(--transition);
}
.mode-btn:hover  { border-color: var(--accent); color: var(--text); }
.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Range sliders */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0,0,0,.3);
}

/* ── Status ──────────────────────────────────────────────────────────────── */
.status-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 8px;
}

/* ── Preview ─────────────────────────────────────────────────────────────── */
.preview-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .preview-section { grid-template-columns: 1fr; }
}

.canvas-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canvas-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.canvas-scroll {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 480px;
}

canvas {
  display: block;
  max-width: 100%;
}

/* ── Action buttons ──────────────────────────────────────────────────────── */
.action-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 10px 20px;
  transition: all var(--transition);
}
.action-btn:hover  { border-color: var(--accent); }
.action-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.action-btn.primary:hover { filter: brightness(1.1); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
