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

:root {
  --bg:        #F7F6F2;
  --surface:   #FFFFFF;
  --border:    #E6E5E0;
  --txt:       #111110;
  --txt2:      #6B6A66;
  --txt3:      #9B9A97;
  --acc:       #E63C00;
  --acc-h:     #C93400;
  --acc-lt:    #FFF0EB;
  --success:   #16A34A;
  --r:         12px;
  --rs:        8px;
  --sh:        0 2px 12px rgba(0,0,0,0.07);
  --shb:       0 4px 20px rgba(0,0,0,0.10);
  --ff:        'Inter', sans-serif;
  --fm:        'JetBrains Mono', monospace;
  --fd:        'Plus Jakarta Sans', sans-serif;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --bg:        #0F0F0E;
  --surface:   #1A1A18;
  --border:    #2E2E2B;
  --txt:       #F0EFE9;
  --txt2:      #9B9A97;
  --txt3:      #6B6A66;
  --acc:       #E63C00;
  --acc-h:     #FF4D10;
  --acc-lt:    #2A1200;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--txt);
  line-height: 1.6;
  min-height: 100vh;
  transition: background .2s, color .2s;
}

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--sh);
  transition: background .2s, border-color .2s;
}
.header-inner {
  max-width: 1140px; margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px;
}
.logo {
  font-family: var(--fd); font-size: 1.15rem; font-weight: 800;
  color: var(--txt); text-decoration: none; letter-spacing: -0.03em;
}
.logo span { color: var(--acc); }
nav { display: flex; align-items: center; gap: 4px; }
nav a {
  font-size: 0.875rem; font-weight: 500; color: var(--txt2);
  text-decoration: none; margin-left: 18px; transition: color .15s;
}
nav a:hover, nav a.active { color: var(--acc); }
.dark-toggle {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 100px; padding: 6px 12px; cursor: pointer;
  font-size: 0.78rem; font-weight: 600; color: var(--txt2);
  font-family: var(--ff); transition: all .15s;
  display: flex; align-items: center; gap: 5px; margin-left: 14px;
}
.dark-toggle:hover { border-color: var(--txt2); color: var(--txt); }

/* ── AD SLOT STYLES ── */
.ad-wrap {
  display: flex; justify-content: center;
  padding: 10px 24px; background: var(--bg);
}
.ad-wrap.ad-hidden, .ad-below-dl.ad-hidden { display: none !important; }
.ad-leaderboard {
  width: 100%; max-width: 728px; height: 90px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--rs);
  display: flex; align-items: center; justify-content: center;
  color: var(--txt3); font-size: 0.72rem; font-family: var(--fm);
}
.ad-rectangle {
  width: 100%; min-height: 100px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--rs);
  display: flex; align-items: center; justify-content: center;
  color: var(--txt3); font-size: 0.72rem; font-family: var(--fm);
  text-align: center; padding: 14px;
}
.ad-label {
  font-size: 0.68rem; color: var(--txt3); text-transform: uppercase;
  letter-spacing: 0.08em; text-align: center; margin-bottom: 6px;
}

/* ── HERO ── */
.hero {
  text-align: center; padding: 40px 24px 20px;
  max-width: 680px; margin: 0 auto;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--acc-lt); color: var(--acc);
  font-size: 0.72rem; font-weight: 600;
  padding: 4px 12px; border-radius: 100px; margin-bottom: 14px;
  letter-spacing: 0.05em; text-transform: uppercase;
}
h1 {
  font-family: var(--fd); font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -0.03em;
  margin-bottom: 12px;
}
h1 em { color: var(--acc); font-style: normal; }
.hero-sub {
  color: var(--txt2); font-size: 0.95rem;
  max-width: 460px; margin: 0 auto;
}

/* ── MAIN GRID ── */
.tool-grid {
  max-width: 1140px; margin: 28px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px; align-items: start;
}
@media (max-width: 860px) { .tool-grid { grid-template-columns: 1fr; } }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 26px;
  box-shadow: var(--sh);
}
.card-title {
  font-family: var(--fd); font-size: 0.95rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px; margin-bottom: 18px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acc); flex-shrink: 0; }

/* ── FORM ELEMENTS ── */
label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--txt2); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 7px;
}
.field { margin-bottom: 18px; }
textarea, select,
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"] {
  width: 100%; font-family: var(--ff); font-size: 0.9rem;
  color: var(--txt); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--rs);
  padding: 10px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
textarea { resize: vertical; min-height: 80px; }
textarea:focus, select:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="password"]:focus, input[type="number"]:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(230,60,0,0.1);
}

/* Color picker row */
.color-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--rs); padding: 8px 12px; cursor: pointer;
  transition: border-color .15s;
}
.color-row:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(230,60,0,0.1);
}
/* Coloris text input inside .color-row */
.color-row input.coloris {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--fm); font-size: 0.82rem; color: var(--txt2);
  cursor: pointer; min-width: 0;
}
/* Coloris swatch thumbnail (injected by Coloris before the input) */
.clr-field button {
  width: 26px; height: 26px; border-radius: 6px; border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.clr-field { display: flex; align-items: center; gap: 10px; width: 100%; }

/* Range */
.range-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] {
  flex: 1; -webkit-appearance: none; height: 4px;
  border-radius: 2px; background: var(--border); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--acc); cursor: pointer;
  box-shadow: 0 1px 4px rgba(230,60,0,0.3);
}
.range-label {
  font-family: var(--fm); font-size: 0.8rem;
  color: var(--txt2); min-width: 40px; text-align: right;
}

.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .g2 { grid-template-columns: 1fr; } }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .g3 { grid-template-columns: 1fr; } }

/* ── CONTENT TYPE BAR ── */
.type-bar {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.type-btn {
  padding: 5px 12px; border: 1.5px solid var(--border);
  border-radius: 100px; background: var(--bg);
  font-size: 0.75rem; font-weight: 600; color: var(--txt2);
  cursor: pointer; font-family: var(--ff); transition: all .15s;
  white-space: nowrap;
}
.type-btn:hover { border-color: var(--txt2); color: var(--txt); }
.type-btn.active { border-color: var(--acc); background: var(--acc-lt); color: var(--acc); }
/* panels start hidden via inline style="display:none" in HTML; Alpine x-show toggles them */

/* URL warning */
.url-warning {
  display: none; padding: 8px 12px; border-radius: var(--rs);
  background: #FFF7ED; border: 1px solid #FED7AA; color: #92400E;
  font-size: 0.78rem; margin-top: 6px; line-height: 1.5;
}
.url-warning.show { display: block; }
[data-theme="dark"] .url-warning { background: #1C1207; border-color: #7C4A00; color: #FCD34D; }

/* ── LOGO UPLOAD ── */
.upload-area {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%; padding: 13px 16px;
  background: var(--bg); border: 1.5px dashed var(--border);
  border-radius: var(--rs); cursor: pointer; font-size: 0.875rem;
  font-weight: 500; color: var(--txt2); transition: all .15s;
  text-align: center;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--acc); color: var(--acc); background: var(--acc-lt);
  transform: scale(1.01);
}
.upload-area.has-logo { border-color: var(--success); color: var(--success); background: #F0FFF4; border-style: solid; }
[data-theme="dark"] .upload-area.has-logo { background: #0A1F12; }
.logo-shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.logo-shape-grid .frame-btn, .frame-grid .frame-btn { min-width: 0; }
.remove-logo-btn {
  width: 100%; padding: 8px; margin-top: 8px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--rs); cursor: pointer; font-size: 0.8rem;
  color: var(--txt3); font-family: var(--ff); transition: all .15s;
}
.remove-logo-btn:hover { border-color: #dc2626; color: #dc2626; background: #FFF5F5; }

/* ── FRAME / STYLE SELECTORS ── */
.frame-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.frame-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--rs);
  cursor: pointer; font-family: var(--ff); font-size: 0.7rem;
  font-weight: 600; color: var(--txt2); transition: all .15s; line-height: 1;
}
.frame-btn:hover { border-color: var(--txt2); color: var(--txt); }
.frame-btn.active { border-color: var(--acc); background: var(--acc-lt); color: var(--acc); }
.frame-btn svg { display: block; }

.style-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.style-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--rs);
  cursor: pointer; font-family: var(--ff); font-size: 0.7rem;
  font-weight: 600; color: var(--txt2); transition: all .15s; line-height: 1;
}
.style-btn:hover { border-color: var(--txt2); color: var(--txt); }
.style-btn.active { border-color: var(--acc); background: var(--acc-lt); color: var(--acc); }
.style-btn svg { display: block; }

/* ── GRADIENT TOGGLE ── */
.gradient-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.gradient-label { font-size: 0.8rem; font-weight: 600; color: var(--txt2); }
.toggle-switch { position: relative; width: 38px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 10px;
  background: var(--border); cursor: pointer; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  left: 3px; top: 3px; background: white;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--acc); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
#gradient-color2-wrap { display: none; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 11px 20px; border-radius: var(--rs);
  font-family: var(--ff); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--acc); color: #fff; width: 100%; margin-top: 4px;
}
.btn-primary:hover {
  background: var(--acc-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(230,60,0,0.3);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg); color: var(--txt);
  border: 1.5px solid var(--border); flex: 1;
}
.btn-secondary:hover { background: var(--surface); border-color: var(--txt2); }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn-row-full { display: flex; gap: 8px; margin-top: 8px; }

/* Keyboard hint */
.kbd-hints {
  display: flex; gap: 14px; margin-top: 10px; justify-content: center;
  flex-wrap: wrap;
}
.kbd-hint { font-size: 0.7rem; color: var(--txt3); display: flex; align-items: center; gap: 3px; }
kbd {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-family: var(--fm); font-size: 0.68rem; color: var(--txt2);
  box-shadow: 0 1px 0 var(--border);
}

/* ── PREVIEW CARD ── */
.preview-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px; box-shadow: var(--sh);
  text-align: center; position: relative;
}
.qr-stage {
  background: var(--bg); border-radius: var(--rs);
  min-height: 240px; display: flex;
  align-items: center; justify-content: center;
  padding: 20px; margin-bottom: 16px; cursor: pointer;
  transition: background .15s;
}
.qr-stage:hover #qr-canvas { opacity: .9; }
.qr-placeholder { color: var(--txt3); font-size: 0.85rem; }
.qr-placeholder .ico { font-size: 2.8rem; display: block; margin-bottom: 8px; opacity: .25; }
#qr-canvas { border-radius: 4px; max-width: 100%; height: auto !important; display: none; }
.ad-below-dl { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }

/* ── HISTORY ── */
.history-section {
  max-width: 1140px; margin: 24px auto 0; padding: 0 24px;
}
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.history-title { font-family: var(--fd); font-size: 0.95rem; font-weight: 700; }
.history-clear {
  padding: 4px 12px; border: 1px solid var(--border); background: transparent;
  border-radius: 100px; font-size: 0.72rem; cursor: pointer;
  color: var(--txt3); font-family: var(--ff); transition: all .15s;
}
.history-clear:hover { border-color: #DC2626; color: #DC2626; }
.history-list {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.hist-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px; width: 108px;
  position: relative; text-align: center; transition: box-shadow .15s;
}
.hist-item:hover { box-shadow: var(--shb); }
.hist-item img {
  width: 76px; height: 76px; object-fit: contain;
  border-radius: var(--rs); display: block; margin: 0 auto 6px; cursor: pointer;
}
.hist-text {
  font-size: 0.62rem; color: var(--txt3); line-height: 1.3;
  word-break: break-all; max-height: 2.6em; overflow: hidden;
}
.hist-del {
  position: absolute; top: 5px; right: 5px;
  background: var(--border); border: none; border-radius: 50%;
  width: 18px; height: 18px; font-size: 0.6rem; cursor: pointer;
  color: var(--txt3); display: flex; align-items: center; justify-content: center;
  transition: all .15s; line-height: 1;
}
.hist-del:hover { background: #FEE2E2; color: #DC2626; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--surface); border-radius: var(--r);
  padding: 28px 24px; max-width: 280px; width: 90%; text-align: center;
  box-shadow: var(--shb); transform: scale(0.95); transition: transform .2s;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-title { font-family: var(--fd); font-weight: 700; margin-bottom: 6px; font-size: 1rem; }
.modal-sub { font-size: 0.8rem; color: var(--txt2); margin-bottom: 16px; line-height: 1.5; }
#mobile-qr-canvas { max-width: 180px; height: auto !important; display: block; margin: 0 auto 16px; border-radius: 6px; }
.modal-close {
  padding: 8px 20px; border: 1.5px solid var(--border);
  border-radius: var(--rs); cursor: pointer; font-family: var(--ff);
  font-size: 0.85rem; font-weight: 600; background: var(--bg);
  color: var(--txt2); transition: all .15s;
}
.modal-close:hover { border-color: var(--txt2); color: var(--txt); }

/* ── FEATURES ── */
.features-section {
  max-width: 1140px; margin: 32px auto 0; padding: 0 24px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.feat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px;
}
.feat-ico { font-size: 1.4rem; margin-bottom: 10px; }
.feat-title { font-family: var(--fd); font-size: 0.88rem; font-weight: 700; margin-bottom: 4px; }
.feat-desc { font-size: 0.8rem; color: var(--txt2); line-height: 1.5; }

/* ── FAQ ── */
.content-section {
  max-width: 800px; margin: 36px auto 0; padding: 0 24px;
}
.sec-title {
  font-family: var(--fd); font-size: 1.35rem; font-weight: 700;
  letter-spacing: -0.02em; margin-bottom: 20px;
}
.faq { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-q { font-weight: 600; font-size: 0.93rem; margin-bottom: 7px; }
.faq-a { font-size: 0.855rem; color: var(--txt2); line-height: 1.65; }

/* ── FOOTER ── */
footer {
  margin-top: 48px; border-top: 1px solid var(--border);
  background: var(--surface); padding: 24px;
}
.footer-inner {
  max-width: 1140px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a {
  font-size: 0.8rem; color: var(--txt3); text-decoration: none; transition: color .15s;
}
.footer-links a:hover { color: var(--txt); }
footer p { font-size: 0.8rem; color: var(--txt3); }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--txt); color: var(--bg);
  padding: 11px 20px; border-radius: 100px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shb); z-index: 999;
  transition: transform .3s cubic-bezier(0.34,1.56,0.64,1);
  white-space: nowrap; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(14px); }
  to   { opacity:1; transform:translateY(0); }
}
.card, .preview-card { animation: fadeUp .35s ease both; }
.preview-card { animation-delay: .08s; }

/* ── TABS ── */
.tab-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px;
  background: var(--bg); border-radius: var(--rs); padding: 4px;
  margin-bottom: 18px; border: 1px solid var(--border);
}
.tab-btn {
  padding: 9px 4px; border: none; background: transparent;
  border-radius: calc(var(--rs) - 3px); font-family: var(--ff);
  font-size: 0.78rem; font-weight: 600; color: var(--txt2);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tab-btn:hover { color: var(--txt); }
.tab-btn.active {
  background: var(--surface); color: var(--acc);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.tab-sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── PREVIEW STICKY ── */
.preview-col { position: sticky; top: 72px; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .hero { padding: 26px 16px 14px; }
  .tool-grid, .features-section, .content-section, .history-section { padding: 0 16px; }
  header nav { display: none; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
  .style-grid { grid-template-columns: repeat(3, 1fr); }
}
