/* CSS 그라데이션 생성기 도구 전용 스타일
   테마: 선명한 마젠타/핑크 계열 — "컬러·디자인" 도구라는 느낌을 살리면서
   다른 도구들(블루/오렌지/보라/청록/인디고)과 확실히 다른 톤으로 구분합니다. */

:root {
  --grad-primary: #db2777;
  --grad-primary-dark: #be185d;
  --grad-bg: #f7f7f7;
  --grad-card-bg: #ffffff;
  --grad-border: #e2e8f0;
  --grad-text: #212529;
  --grad-text-muted: #53575e;
  --grad-radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--grad-bg);
  color: var(--grad-text);
  line-height: 1.6;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  background: var(--grad-bg);
}

/* PC처럼 넓은 화면에서는 스크롤을 올렸을 때 상단바 전체가 화면을 가리지 않도록,
   막대(.top-bar) 자체를 폭 전체가 아니라 버튼 크기만큼만 남기고 배경도 지웁니다.
   .back-link 자체가 이미 불투명한 배경(pill 버튼)을 갖고 있어서 겹침 문제 없이
   버튼만 떠 있는 것처럼 보입니다. */
@media (min-width: 768px) {
  .top-bar {
    width: fit-content;
    height: auto;
    padding: 12px 16px 0;
    background: transparent;
  }
}

.back-link {
  display: inline-block;
  padding: 6px 14px;
  background: var(--grad-card-bg);
  border: 1px solid var(--grad-border);
  border-radius: 999px;
  color: var(--grad-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.back-link:hover {
  color: var(--grad-primary);
}

.page-header {
  text-align: center;
  padding: 10px 16px 16px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-family: "Encode Sans Expanded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: -0.01em;
  color: var(--grad-primary-dark);
}

.subtitle {
  margin: 0;
  color: var(--grad-text-muted);
  font-size: 1.1rem;
}

.tagline-extra {
  margin: 6px 0 0;
  color: var(--grad-text-muted);
  font-size: 0.9rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.grad-preview-section {
  margin-top: 24px;
}

.grad-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--grad-radius);
  border: 1px solid var(--grad-border);
}

.grad-controls-section {
  margin-top: 20px;
  background: var(--grad-card-bg);
  border: 1px solid var(--grad-border);
  border-radius: var(--grad-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.grad-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--grad-text-muted);
  margin-bottom: 8px;
}

.grad-field input[type="range"] {
  width: 100%;
  accent-color: var(--grad-primary);
}

.grad-type-tabs {
  display: flex;
  gap: 6px;
}

.grad-type-tab {
  flex: 1;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--grad-border);
  border-radius: 999px;
  background: var(--grad-card-bg);
  color: var(--grad-text-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.grad-type-tab:hover {
  border-color: var(--grad-primary);
  color: var(--grad-primary-dark);
}

.grad-type-tab.is-active {
  background: var(--grad-primary);
  border-color: var(--grad-primary);
  color: #fff;
}

.grad-stops-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--grad-text-muted);
  margin-bottom: 10px;
}

.grad-stops-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grad-stop-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grad-stop-row input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 0;
  border: 1px solid #d1d5db;
  cursor: pointer;
  background: none;
  border-radius: 6px;
}

.grad-stop-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.grad-stop-row input[type="color"]::-webkit-color-swatch {
  border: none;
}

.grad-stop-position {
  width: 64px;
  padding: 8px 10px;
  font-size: 0.9rem;
  border: 1px solid var(--grad-border);
  border-radius: 8px;
  color: var(--grad-text);
}

.grad-stop-suffix {
  font-size: 0.85rem;
  color: var(--grad-text-muted);
  margin-left: -4px;
}

.grad-stop-remove {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--grad-border);
  border-radius: 999px;
  background: none;
  color: var(--grad-text-muted);
  cursor: pointer;
}

.grad-stop-remove:hover:not(:disabled) {
  border-color: #dc2626;
  color: #dc2626;
}

.grad-stop-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.grad-add-stop-btn {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px dashed var(--grad-primary);
  border-radius: 999px;
  background: none;
  color: var(--grad-primary-dark);
  cursor: pointer;
}

.grad-add-stop-btn:hover {
  background: #fdf2f8;
}

.grad-error {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.8rem;
}

.grad-code-section {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e1e2e;
  border-radius: var(--grad-radius);
  padding: 16px 18px;
}

.grad-code {
  flex: 1;
  min-width: 0;
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 0.85rem;
  color: #f4f4f5;
  word-break: break-all;
  white-space: pre-wrap;
}

.grad-copy-btn {
  flex: 0 0 auto;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.12s ease;
}

.grad-copy-btn:hover {
  background: var(--grad-primary-dark);
}

.ads-container {
  margin: 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-card-bg);
  border: 1px solid var(--grad-border);
  border-radius: var(--grad-radius);
  color: var(--grad-text-muted);
  font-size: 0.85rem;
}

.ads-rail {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  margin: 0;
  display: none;
  z-index: 5;
}

.ads-rail-left {
  left: 16px;
}

.ads-rail-right {
  right: 16px;
}

@media (min-width: 972px) {
  .ads-rail {
    display: flex;
  }
}

.info-section {
  margin-top: 24px;
}

.info-section h2 {
  color: var(--grad-primary-dark);
  font-size: 1.35rem;
  margin-top: 32px;
}

.faq-list .faq-item {
  margin-bottom: 16px;
}

.faq-list dt {
  font-weight: 600;
  color: var(--grad-text);
  margin-bottom: 4px;
}

.faq-list dd {
  margin: 0;
  color: var(--grad-text-muted);
}

.footer-links {
  margin: 8px 0 0;
}

.footer-links a {
  color: var(--grad-text-muted);
  text-decoration: underline;
}

.footer-links a:hover {
  color: var(--grad-primary);
}

.page-footer {
  text-align: center;
  padding: 24px 16px 40px;
  color: var(--grad-text-muted);
  font-size: 0.85rem;
}

.scroll-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--grad-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(219, 39, 119, 0.3);
  transition: background 0.12s ease, transform 0.12s ease;
}

.scroll-top-btn:hover {
  background: var(--grad-primary-dark);
  transform: translateY(-2px);
}

.scroll-top-btn[hidden] {
  display: none;
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 1.7rem;
  }

  .grad-code-section {
    flex-direction: column;
    align-items: stretch;
  }
}
