:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1e2230;
  --border: #2a2f3f;
  --text: #eef0f6;
  --text-dim: #a3a8b8;
  --accent: #6c5ce7;
  --accent-2: #54a0ff;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-block;
}

.site-nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  flex: none;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-dim);
}

.site-nav a:hover { color: var(--text); }

/* hero */
.hero {
  padding: 56px 24px 24px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(24px, 4vw, 36px);
  margin: 0 0 14px;
}

.hero-sub {
  color: var(--text-dim);
  max-width: 1200px;
  margin: 0 auto;
}

.hero-sub .line {
  display: block;
  font-size: clamp(13px, 1.6vw, 15px);
}

/* tool section */
.tool-section { padding: 32px 24px 56px; }

.tool-grid {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.drop-zone {
  flex: 0 0 60%;
  max-width: 60%;
  min-height: 420px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--panel-2);
}

.drop-zone-inner {
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
}

.drop-zone-inner svg { color: var(--accent-2); margin-bottom: 12px; }

.drop-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}

.drop-sub {
  font-size: 13px;
  margin: 0;
}

.drop-sub kbd {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

#previewImg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.palette-panel {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 16px;
  margin: 0;
}

.extract-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.extract-btn:hover:not(:disabled) { opacity: 0.9; }
.extract-btn:active:not(:disabled) { transform: scale(0.97); }

.extract-btn:disabled {
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: not-allowed;
}

.palette-hint {
  color: var(--text-dim);
  font-size: 13px;
}

.sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.sort-row select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.palette-item:hover { border-color: var(--border); }

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex: none;
  border: 1px solid rgba(255,255,255,0.08);
}

.palette-codes {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  min-width: 0;
}

.palette-codes .hex { font-weight: 600; }
.palette-codes .rgb { color: var(--text-dim); font-size: 12px; }

.copy-flag {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent-2);
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.palette-item.copied .copy-flag { opacity: 1; }

.palette-more {
  justify-content: center;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1px dashed var(--border);
}

.palette-more:hover { border-color: var(--accent-2); }

/* fullscreen palette modal */
.palette-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 7, 11, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.palette-modal[hidden] {
  display: none;
}

.palette-modal-inner {
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.palette-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.palette-modal-head h2 {
  font-size: 16px;
  margin: 0;
}

.palette-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.palette-modal-close:hover { color: var(--text); }

.palette-modal-grid {
  list-style: none;
  margin: 0;
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 720px) {
  .palette-modal-grid { grid-template-columns: repeat(2, 1fr); }
}

/* content sections */
.content-section {
  padding: 40px 24px;
  border-top: 1px solid var(--border);
}

.content-section h2 {
  font-size: 22px;
  margin: 0 0 16px;
}

.content-section p {
  color: var(--text-dim);
  max-width: 760px;
}

/* 소개/기능 섹션은 고정 폭 없이 창 크기에 맞춰 늘고 줄게 둠 */
#about p,
#features p {
  max-width: none;
}

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

.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.feature-card h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.feature-card p {
  font-size: 13.5px;
  margin: 0;
  color: var(--text-dim);
}

/* step list (사용 방법) */
.step-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.step-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.step-list h3 {
  font-size: 15px;
  margin: 0 0 8px;
  color: var(--text);
}

.step-list p {
  font-size: 13.5px;
  margin: 0;
}

.step-list kbd {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--text);
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.faq-list details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 14.5px;
}

.faq-list details p {
  margin: 10px 0 0;
  font-size: 13.5px;
}

/* contact */
.contact-email {
  display: inline-block;
  font-weight: 600;
  font-size: 16px;
  color: var(--accent-2);
  text-decoration: none;
}

.contact-email:hover {
  text-decoration: underline;
}

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-nav {
  display: flex;
  gap: 16px;
}

.footer-nav a { text-decoration: none; }
.footer-nav a:hover { color: var(--text); }

/* responsive */
@media (max-width: 780px) {
  .tool-grid {
    flex-direction: column;
  }
  .drop-zone {
    flex: none;
    max-width: 100%;
    min-height: 280px;
  }
  .site-nav { gap: 14px; font-size: 13px; }
  .logo { font-size: 15px; }
}
