/* ============================================================
   グラデーション・シャドウCSSジェネレーター — style.css
   Mobile-first, AdSense-ready
   ============================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1e293b;
  background: #f1f5f9;
  min-height: 100vh;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.back-link {
  display: inline-block;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  min-height: 44px;
  line-height: 44px;
  padding: 0 0.25rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: #e2e8f0;
}

.site-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  color: #f8fafc;
}

.subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* ============================================================
   Main Layout
   ============================================================ */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem;
}

/* ============================================================
   Ad Units
   ============================================================ */

.ad-unit {
  margin: 1.25rem 0;
}

/* ============================================================
   Tool Section
   ============================================================ */

.tool-section {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ============================================================
   Preset Bar
   ============================================================ */

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.preset-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.preset-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
  white-space: nowrap;
}

.preset-btn:hover,
.preset-btn.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

/* ============================================================
   Editor Layout (controls + preview)
   ============================================================ */

.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================================
   Controls Panel
   ============================================================ */

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
}

.control-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.875rem;
}

.control-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.control-row select,
.control-row input[type="range"] {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #1e293b;
  appearance: auto;
}

.control-row select:focus,
.control-row input[type="range"]:focus {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

input[type="range"] {
  padding: 0;
  height: 44px;
  cursor: pointer;
  accent-color: #6366f1;
}

/* ============================================================
   Color Stops
   ============================================================ */

.color-stops-header,
.shadow-layers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.color-stops-header label,
.shadow-layers-header label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.btn-small {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #6366f1;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}

.btn-small:hover {
  background: #4f46e5;
}

.color-stops-list,
.shadow-layers-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Single color stop row */
.stop-row {
  display: grid;
  grid-template-columns: 44px 1fr 60px 44px; /* カラーピッカー・スライダー・%表示・削除ボタン */
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
}

.stop-row input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
}

.stop-row input[type="range"] {
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 0;
}

.stop-row .stop-pct {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  font-weight: 600;
  min-width: 40px;
}

.stop-row .remove-btn {
  width: 44px;
  height: 44px;
  border: 1.5px solid #fca5a5;
  background: #fff1f2;
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  min-height: 44px;
}

.stop-row .remove-btn:hover {
  background: #fee2e2;
}

/* ============================================================
   Shadow Layers
   ============================================================ */

.shadow-layer-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
}

.shadow-layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.shadow-layer-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
}

.shadow-layer-header .remove-btn {
  width: 44px;
  height: 44px;
  border: 1.5px solid #fca5a5;
  background: #fff1f2;
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  min-height: 44px;
}

.shadow-layer-header .remove-btn:hover {
  background: #fee2e2;
}

.shadow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
}

.shadow-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.shadow-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.shadow-field input[type="number"] {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  min-height: 44px;
  color: #1e293b;
}

.shadow-field input[type="number"]:focus {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

.shadow-field input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 3px 4px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
}

.shadow-field select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  min-height: 44px;
  color: #1e293b;
  background: #fff;
}

.shadow-field select:focus {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

/* ============================================================
   Preview Background Color
   ============================================================ */

.bg-color-row {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bg-color-row input[type="color"] {
  width: 48px;
  height: 48px;
  padding: 3px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  flex-shrink: 0;
}

.bg-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bg-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  min-height: 44px;
}

.bg-swatch:hover,
.bg-swatch.active {
  border-color: #6366f1;
  transform: scale(1.15);
}

/* ============================================================
   Preview + Output Panel
   ============================================================ */

.preview-output-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-wrapper {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.preview-bg {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #1a1a2e;
  transition: background 0.2s;
}

.preview-card {
  width: 180px;
  height: 120px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, box-shadow 0.1s;
}

.preview-card-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   Code Output
   ============================================================ */

.output-block {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f1f5f9;
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid #e2e8f0;
}

.output-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.03em;
}

.copy-btn {
  padding: 0.3rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: #6366f1;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: #4f46e5;
}

.copy-btn.copied {
  background: #10b981;
}

.code-output {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.875rem;
  font-size: 0.82rem;
  font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 180px;
  overflow-y: auto;
  min-height: 80px;
}

/* ============================================================
   How-To Section
   ============================================================ */

.howto-section {
  margin-top: 1.5rem;
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.howto-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.howto-section h2:first-child {
  margin-top: 0;
}

.howto-section ol {
  padding-left: 1.25rem;
  color: #475569;
  font-size: 0.9rem;
}

.howto-section li {
  margin-bottom: 0.6rem;
  line-height: 1.65;
}

.howto-section p {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.75;
}

.howto-section code {
  background: #f1f5f9;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
  color: #6366f1;
  font-family: Consolas, monospace;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 2rem;
}

.site-footer a {
  color: #64748b;
  text-decoration: none;
}

.site-footer a:hover {
  color: #334155;
  text-decoration: underline;
}

.site-footer p + p {
  margin-top: 0.4rem;
}

/* ============================================================
   Responsive — tablet+
   ============================================================ */

@media (min-width: 640px) {
  .site-header {
    padding: 1rem 1.5rem;
  }

  .site-header h1 {
    font-size: 1.3rem;
  }

  main {
    padding: 1.5rem 2rem;
  }

  .preview-bg {
    min-height: 240px;
  }

  .preview-card {
    width: 240px;
    height: 160px;
  }

  .shadow-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .editor-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }

  .controls-panel {
    flex: 0 0 340px;
    max-width: 340px;
  }

  .preview-output-panel {
    flex: 1;
    min-width: 0;
  }

  .site-header h1 {
    font-size: 1.45rem;
  }
}

/* ============================================================
   Animations
   ============================================================ */

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

.stop-row,
.shadow-layer-card {
  animation: fadeIn 0.2s ease;
}
