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

:root {
  --green: #10b981;
  --green-dark: #059669;
  --green-light: #d1fae5;
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #f0f4f8;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

/* ===========================
   HEADER
   =========================== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.header-nav {
  display: flex;
  gap: 28px;
}

.header-nav a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.2s;
}

.header-nav a:hover { color: var(--green); }

/* ===========================
   MAIN & HERO
   =========================== */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.hero h1 .accent { color: var(--green); }

.hero-sub {
  margin-top: 14px;
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ===========================
   PANELS LAYOUT
   =========================== */
.panels {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .panels { grid-template-columns: 1fr; }
  .right-panel { order: -1; }
}

/* ===========================
   CARD
   =========================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  margin-bottom: 20px;
}

.card:last-child { margin-bottom: 0; }

/* ===========================
   TYPE TABS
   =========================== */
.type-card { padding: 16px 20px; }

.type-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.type-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.type-tab:hover { border-color: var(--green); color: var(--green); }
.type-tab.active {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}

/* ===========================
   STEP HEADER
   =========================== */
.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

/* ===========================
   FORM FIELDS
   =========================== */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.field-input,
textarea.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  line-height: 1.5;
}

.field-input:focus,
textarea.field-input:focus {
  border-color: var(--green);
  background: #fff;
}

.field-input::placeholder,
textarea.field-input::placeholder { color: var(--muted); }

textarea.field-input { resize: vertical; min-height: 100px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-group { margin-bottom: 14px; }
.field-group:last-child { margin-bottom: 0; }

/* ===========================
   DESIGN TABS
   =========================== */
.design-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.design-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.18s;
  font-family: inherit;
}

.design-tab:hover:not(.active) { color: var(--ink-soft); }
.design-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

/* ===========================
   FRAME GRID
   =========================== */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.frame-item {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
  background: #fafafa;
}

.frame-item:hover { border-color: var(--green); background: #f0fdf9; }
.frame-item.active { border-color: var(--green); background: var(--green-light); }

.frame-item span {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.frame-item.active span { color: var(--green); }

/* ===========================
   SHAPE GRID
   =========================== */
.tab-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.shape-item {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px 7px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
  background: #fafafa;
}

.shape-item:hover { border-color: var(--green); }
.shape-item.active { border-color: var(--green); background: var(--green-light); }

.shape-item span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
.shape-item.active span { color: var(--green); }

/* ===========================
   COLOR SECTION
   =========================== */
.color-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.color-field {}

.color-swatch-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.2s;
}

.color-swatch-wrap:focus-within { border-color: var(--green); }

.color-swatch-wrap input[type=color] {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: none;
}

.color-swatch-wrap span {
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: var(--ink-soft);
}

/* ===========================
   SIZE OPTIONS
   =========================== */
.size-section {}

.size-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.size-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
  background: #fafafa;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.size-opt input[type=radio] { display: none; }

.size-opt:hover { border-color: var(--green); }

.size-opt:has(input:checked) {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.size-opt small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}

/* ===========================
   LOGO TAB
   =========================== */
.tab-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  line-height: 1.6;
}

.upload-btn {
  width: 100%;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.upload-btn:hover { border-color: var(--green); color: var(--green); background: #f0fdf9; }

.logo-preview {
  margin-top: 14px;
  text-align: center;
}

.logo-preview img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
}

.remove-logo {
  display: block;
  margin: 8px auto 0;
  font-size: 12px;
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* ===========================
   QR PREVIEW BOX
   =========================== */
.preview-card { position: sticky; top: 80px; }

.qr-preview-box {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: visible;
}

.qr-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-inner canvas,
.qr-inner img { display: block; border-radius: 4px; }

.placeholder-svg { opacity: 0.4; }

.preview-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ===========================
   DOWNLOAD BUTTON
   =========================== */
.dl-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
  margin-bottom: 10px;
}

.dl-btn:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
.dl-btn:active:not(:disabled) { transform: translateY(0); }
.dl-btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }

.copy-btn {
  width: 100%;
  padding: 11px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s;
  font-family: inherit;
}

.copy-btn:hover { border-color: var(--green); color: var(--green); }

/* ===========================
   TIPS CARD
   =========================== */
.tips-card { background: var(--green-light); border: 1px solid #a7f3d0; }

.tips-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 10px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tips-list li {
  font-size: 13px;
  color: #065f46;
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}

.tips-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 20px 24px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

/* ===========================
   TOAST
   =========================== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================
   FRAME OVERLAYS (applied by JS)
   =========================== */
.frame-border-div {
  position: absolute;
  inset: -6px;
  pointer-events: none;
  border-radius: 4px;
}

.frame-label-div {
  position: absolute;
  bottom: -6px;
  left: -6px;
  right: -6px;
  text-align: center;
  padding: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: white;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.frame-label-top {
  bottom: auto;
  top: -6px;
  border-radius: 4px 4px 0 0;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 600px) {
  .main { padding: 24px 16px 48px; }
  .hero h1 { font-size: 28px; }
  .hero-sub { font-size: 15px; }
  .header-nav { display: none; }
  .shape-grid { grid-template-columns: repeat(3, 1fr); }
  .size-options { grid-template-columns: repeat(2, 1fr); }
  .color-section { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 4px; text-align: center; }
}

/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.site-header {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #eee;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  max-width: 1200px;
  margin: auto;
}

/* LOGO SECTION */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

#qrcode {
  width: 80px;
  height: 80px;
}

#qr-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* NAVIGATION */
.header-nav {
  display: flex;
  gap: 20px;
}

.header-nav a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: 0.3s;
}

.header-nav a:hover {
  color: #007bff;
}

/* =========================
   RESPONSIVE DESIGN
========================= */

/* Tablet */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 10px;
  }

  .header-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    text-align: center;
  }

  .logo {
    justify-content: center;
  }

  #qrcode,
  #qr-logo {
    width: 32px;
    height: 32px;
  }

  .header-nav {
    flex-direction: column;
    gap: 8px;
  }
}