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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fafafa;
  color: #111;
  min-height: 100vh;
}

/* ========== Navigation ========== */
#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #111;
  border-bottom: 1px solid #222;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  gap: 4px;
}

.nav-logo {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.5px;
  margin-right: 20px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: opacity 0.15s;
}

.nav-logo:hover {
  opacity: 0.8;
}

.nav-logo.active {
  border-bottom-color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #888;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: #ddd;
  background: rgba(255,255,255,0.08);
}

.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

/* ========== Layout ========== */
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px;
  transition: max-width 0.2s;
}

#app:has(.thumb-layout) {
  max-width: 1100px;
}

.hidden {
  display: none !important;
}

/* SEO 정적 콘텐츠 (JS 로드 전에만 표시) */
.seo-content {
  padding: 20px 0;
  line-height: 1.7;
}

.seo-content h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.seo-content h2 {
  font-size: 17px;
  margin-top: 20px;
  margin-bottom: 4px;
}

.seo-content p {
  font-size: 14px;
  color: #555;
}

/* ========== Tool Grid (Home) ========== */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 28px 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  background: #fff;
}

.tool-card:hover {
  border-color: #999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}

.tool-card .icon {
  font-size: 28px;
  margin-bottom: 14px;
  filter: grayscale(1);
}

.tool-card .name {
  font-size: 15px;
  font-weight: 700;
}

.tool-card .desc {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  line-height: 1.4;
}

/* ========== Common Tool UI ========== */
.tool-view {
  animation: fadeIn 0.2s ease;
}

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

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
  color: #111;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: #888;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: #111;
  color: #fff;
}

.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  background: #eee;
  color: #333;
}

.btn-secondary:hover {
  background: #ddd;
}

.form-group {
  margin-bottom: 16px;
}

.result-box {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  word-break: break-all;
}

.result-box.empty {
  color: #aaa;
  text-align: center;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ========== Address Tool ========== */
.addr-status {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #666;
  background: #f5f5f5;
  border-radius: 8px;
}

/* ========== Thumbnail Tool ========== */
.thumb-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.thumb-preview {
  position: sticky;
  top: 72px;
}

.thumb-panel {
  min-width: 0;
}

.canvas-wrapper {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  justify-content: center;
}

.canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.color-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}

.color-swatch.active {
  border-color: #111;
}

.size-row {
  display: flex;
  gap: 6px;
}

.size-btn {
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: #333;
}

.size-btn:hover {
  border-color: #999;
}

.size-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.img-upload-name {
  font-size: 12px;
  color: #999;
}

/* ── 텍스트 블록 (입력 + 인라인 스타일) ── */
.text-block {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.text-block:last-child {
  border-bottom: none;
}

.style-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.style-font {
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  color: #333;
  outline: none;
  cursor: pointer;
  min-width: 80px;
}

.style-font:focus {
  border-color: #888;
}

.style-color {
  width: 28px;
  height: 28px;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 1px;
  cursor: pointer;
  background: #fff;
}

.style-color.disabled {
  opacity: 0.25;
  pointer-events: none;
}

.style-size {
  width: 52px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
  outline: none;
  background: #fff;
  color: #333;
}

.style-size:focus {
  border-color: #888;
}

.style-outline-label {
  display: inline-flex !important;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #666;
  cursor: pointer;
  margin-bottom: 0;
  white-space: nowrap;
  user-select: none;
}

.style-outline-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.style-outline-label span {
  font-weight: 500;
}

.style-label-sm {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}

.btn-sm {
  padding: 4px 10px !important;
  font-size: 12px !important;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .thumb-layout {
    grid-template-columns: 1fr;
  }

  .thumb-preview {
    position: static;
  }

  #app:has(.thumb-layout) {
    max-width: 720px;
  }
}

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

  .nav-inner {
    padding: 0 12px;
  }

  .nav-link {
    font-size: 12px;
    padding: 5px 8px;
  }

  .size-row {
    flex-wrap: wrap;
  }
}
