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

/* ── Design tokens (kju.app palette) ── */
:root {
  --bg:        #ffffff;
  --bg-2:      #f5f5f3;
  --bg-3:      #eeeeec;
  --text:      #111111;
  --text-2:    #555555;
  --text-3:    #888888;
  --lime:      #c8ff5e;
  --lime-dark: #a8e03a;
  --border:    #e8e8e8;
  --success:   #22c55e;
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --font:      'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:      ui-monospace, 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08), 0 8px 32px rgba(0,0,0,.10);
  --tr:        .15s ease;
}

[data-theme="dark"] {
  --bg:     #0f0f0f;
  --bg-2:   #1a1a1a;
  --bg-3:   #222222;
  --text:   #f0f0f0;
  --text-2: #999999;
  --text-3: #666666;
  --border: #252525;
  --shadow:    0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 24px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:     #0f0f0f;
    --bg-2:   #1a1a1a;
    --bg-3:   #222222;
    --text:   #f0f0f0;
    --text-2: #999999;
    --text-3: #666666;
    --border: #252525;
    --shadow:    0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 24px rgba(0,0,0,.5);
  }
}

html { font-family: var(--font); font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.65;
  transition: background var(--tr), color var(--tr);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Site header ── */
.site-header {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

[data-theme="dark"] .site-header,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header {
    background: rgba(15,15,15,.92);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header { background: rgba(15,15,15,.92); }
}
[data-theme="dark"] .site-header { background: rgba(15,15,15,.92); }

.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-logo .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--lime);
  border-radius: 50%;
  margin: 0 1px;
}

.back-link {
  font-size: .875rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--tr);
}
.back-link:hover { color: var(--text); text-decoration: none; }
.header-sep { color: var(--border); font-size: .9rem; }
.header-spacer { flex: 1; }

.theme-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: background var(--tr), color var(--tr);
  flex-shrink: 0;
}
.theme-btn:hover { background: var(--bg-3); color: var(--text); }
.theme-btn svg { width: 17px; height: 17px; fill: currentColor; }

/* ── Main ── */
main {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 52px 24px;
  width: 100%;
}

/* ── Index hero ── */
.hero {
  text-align: center;
  margin-bottom: 52px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--lime);
  color: #111;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.12;
  margin-bottom: 14px;
}
.hero p {
  color: var(--text-2);
  font-size: 1rem;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Tool grid (index) ── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.tool-card-link {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: border-color var(--tr), box-shadow var(--tr), transform var(--tr);
  color: inherit;
}
.tool-card-link:hover {
  border-color: var(--lime);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-icon {
  width: 40px;
  height: 40px;
  background: var(--lime);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  flex-shrink: 0;
}
.tool-icon svg { width: 20px; height: 20px; }
.tool-card-link h2 {
  font-size: .975rem;
  font-weight: 600;
  letter-spacing: -.015em;
}
.tool-card-link p {
  font-size: .845rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* ── Tool page header ── */
.tool-page-header { margin-bottom: 28px; }
.tool-page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 5px;
}
.tool-page-header p { color: var(--text-2); font-size: .93rem; }

/* ── Tool section card ── */
.tool-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 8px;
}

/* ── Form controls ── */
textarea, select, input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: .855rem;
  padding: 11px 13px;
  resize: vertical;
  transition: border-color var(--tr), box-shadow var(--tr);
  outline: none;
  line-height: 1.55;
}
textarea:focus, select:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(200,255,94,.18);
}
textarea { min-height: 130px; }
select {
  font-family: var(--font);
  cursor: pointer;
  height: 40px;
  resize: none;
  min-height: unset;
}
input[type="file"] {
  font-size: .875rem;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  font-family: var(--font);
}

/* ── Option group (pill radios) ── */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.opt-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color var(--tr), background var(--tr), color var(--tr);
  user-select: none;
  font-weight: 500;
}
.opt-label:has(input:checked) {
  border-color: var(--lime);
  background: var(--lime);
  color: #111;
}
.opt-label input[type="radio"] { display: none; }

/* ── Output area ── */
.output-wrap { position: relative; }
.output-wrap textarea { padding-right: 72px; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  font-size: .775rem;
  font-family: var(--font);
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--tr);
  white-space: nowrap;
}
.copy-btn:hover { background: var(--bg-3); color: var(--text); }
.copy-btn.ok { color: var(--success); border-color: var(--success); }

/* ── Monospace display ── */
.mono-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-family: var(--mono);
  font-size: .855rem;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 46px;
  color: var(--text);
  line-height: 1.7;
}

/* ── Actions ── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.btn {
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--tr), transform var(--tr);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -.01em;
}
.btn:active { transform: scale(.98); }

/* lime = primary CTA */
.btn-primary {
  background: var(--lime);
  color: #111;
  border-color: var(--lime);
}
.btn-primary:hover { background: var(--lime-dark); border-color: var(--lime-dark); }

/* dark = secondary CTA */
.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }

/* ── Info box ── */
.info-box {
  background: rgba(200,255,94,.08);
  border: 1px solid rgba(200,255,94,.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .845rem;
  color: var(--text-2);
  margin-top: 14px;
  line-height: 1.6;
}
.info-box code {
  font-family: var(--mono);
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .82rem;
  color: var(--text);
}

/* ── Count selector ── */
.count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: .88rem;
  color: var(--text-2);
}
.count-row input[type="number"] {
  width: 64px;
  min-height: unset;
  height: 36px;
  padding: 0 8px;
  text-align: center;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 24px;
  text-align: center;
  font-size: .8rem;
  color: var(--text-3);
  line-height: 1.9;
}
.site-footer a { color: var(--text-3); }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer .lime-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--lime);
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 6px;
}

/* ── No-cookie section (index) ── */
.no-cookie-section {
  margin-top: 40px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  box-shadow: var(--shadow);
}
.no-cookie-icon {
  width: 44px;
  height: 44px;
  background: var(--lime);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.no-cookie-icon svg { width: 24px; height: 24px; }
.no-cookie-section h3 {
  font-size: .975rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 4px;
}
.no-cookie-section p {
  font-size: .855rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 620px;
}

/* ── No-cookie badge (footer) ── */
.no-cookie-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-3);
}
.no-cookie-badge svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  main { padding: 28px 16px; }
  .tool-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .option-group { flex-direction: column; }
}
