/* NoPrompt.Tools — based on the Boostupp preview design */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #F58227;
  --brand-dark: #D96E18;
  --brand-light: #FEF3E7;
  --brand-muted: #FAD7B4;
  --surface: #ffffff;
  --surface-2: #F8F8F6;
  --surface-3: #F1F0ED;
  --ink: #1A1A1A;
  --ink-muted: #5C5C5C;
  --ink-faint: #8E8E8E;
  --border: #E8E7E3;
  --danger: #C2410C;
  --add-bg: #DCFCE7; --add-ink: #166534;
  --del-bg: #FEE2E2; --del-ink: #991B1B;
  --radius-card: 20px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--ink);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #D5D3CE; border-radius: 4px; }

/* ---------- NAV ---------- */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px; background: var(--brand); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px;
}
.logo-text { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 20px; color: var(--ink); }
.logo-dot { color: var(--brand); }
.nav-badges { display: flex; gap: 8px; }
.badge {
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--brand-light); padding: 6px 12px; border-radius: 100px;
}

/* ---------- MAIN ---------- */
main { max-width: 1200px; width: 100%; margin: 0 auto; padding: 40px 24px 56px; flex: 1; }

.hero { text-align: center; padding: 24px 0 40px; }
.hero-left { text-align: left; padding-top: 0; }
.hero-title {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: clamp(30px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.02em;
}
.hero-title small { font-size: 0.45em; color: var(--ink-faint); font-weight: 600; }
.hl { color: var(--brand); }
.hero-sub { margin-top: 16px; font-size: 17px; color: var(--ink-muted); }
.trust {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 20px; margin-top: 22px; font-size: 14px; font-weight: 500; color: var(--ink-muted);
}
.trust span { color: var(--brand); font-weight: 700; margin-right: 4px; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; }

/* ---------- TOOL CARDS ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .tools-grid { grid-template-columns: 1fr; } }

.tool-card {
  background: var(--surface); border-radius: var(--radius-card); padding: 24px;
  box-shadow: var(--shadow-card); text-decoration: none; display: block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}
.tool-card:hover, .tool-card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-hover); outline: none; }
.tool-card:hover .card-arrow, .tool-card:focus-visible .card-arrow { opacity: 1; }
.tool-card:hover .card-title { color: var(--brand); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.card-arrow {
  width: 28px; height: 28px; background: var(--brand); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.card-title {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px;
  margin-bottom: 6px; transition: color 0.15s;
}
.card-desc { font-size: 13px; color: var(--ink-muted); line-height: 1.6; }

/* ---------- TOOL PAGE ---------- */
.back-link {
  display: inline-block; font-size: 13px; font-weight: 500; color: var(--ink-muted);
  text-decoration: none; margin-bottom: 20px;
}
.back-link:hover { color: var(--brand); }
.tool-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.tool-head-icon {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.tool-title { font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(24px, 3.5vw, 32px); }
.tool-tagline { color: var(--ink-muted); font-size: 15px; margin-top: 2px; }

.workspace {
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-card);
  display: grid; grid-template-columns: 400px 1fr; min-height: 560px; overflow: hidden;
}
@media (max-width: 860px) { .workspace { grid-template-columns: 1fr; } }

.ws-input { padding: 24px; border-right: 1px solid var(--border); }
@media (max-width: 860px) { .ws-input { border-right: none; border-bottom: 1px solid var(--border); } }

.form-group { margin-bottom: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 400px) { .row2 { grid-template-columns: 1fr; } }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; }
.req { color: var(--brand); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 14px; color: var(--ink); font-family: inherit; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
.form-textarea { resize: vertical; line-height: 1.55; min-height: 110px; }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(245,130,39,0.15);
}
.form-input.invalid, .form-textarea.invalid { border-color: var(--danger); }
.counter { text-align: right; font-size: 11px; color: var(--ink-faint); margin-top: 4px; min-height: 14px; }
.counter.over { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 7px 14px; border-radius: 100px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--ink-muted);
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.chip span:hover { border-color: var(--brand-muted); color: var(--brand); }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(245,130,39,0.3); }

.pdf-drop {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 8px;
  border: 1.5px dashed var(--border); border-radius: 12px; background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.pdf-drop.drag { border-color: var(--brand); background: var(--brand-light); }
.pdf-btn {
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px;
  background: var(--surface); border: 1.5px solid var(--border); cursor: pointer;
}
.pdf-btn:hover { border-color: var(--brand); color: var(--brand); }
.pdf-status { font-size: 12px; color: var(--ink-faint); }
.pdf-status.ok { color: var(--add-ink); }
.pdf-status.err { color: var(--danger); }

.btn-generate {
  width: 100%; padding: 14px; background: var(--brand); color: #fff;
  border: none; border-radius: 12px; font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.btn-generate:hover { background: var(--brand-dark); }
.btn-generate:active { transform: scale(0.99); }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; }
.hint { text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 8px; }

/* ---------- OUTPUT ---------- */
.ws-output { display: flex; flex-direction: column; min-width: 0; }
.output-toolbar {
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px;
}
.output-label { font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.output-actions { display: flex; gap: 8px; }
.output-actions[hidden] { display: none; }
.output-btn {
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 12px; font-weight: 600; font-family: inherit;
  color: var(--ink-muted); cursor: pointer; transition: all 0.15s;
}
.output-btn:hover { background: var(--surface-2); color: var(--ink); }
.output-btn[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.output-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.output-btn.primary:hover { background: var(--brand-dark); }

.output-content { flex: 1; overflow-y: auto; padding: 24px; max-height: 75vh; }
@media (max-width: 860px) { .output-content { max-height: none; } }
.output-placeholder {
  height: 100%; min-height: 280px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 40px;
}
.output-placeholder[hidden] { display: none; }
.output-placeholder-icon { font-size: 40px; margin-bottom: 12px; }
.output-placeholder p { font-size: 14px; color: var(--ink-muted); font-weight: 500; }
.output-placeholder small { font-size: 12px; color: var(--ink-faint); margin-top: 4px; display: block; }

.output-text { font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-wrap: break-word; }
.output-text.md { white-space: normal; }
.output-notes { margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--border); }
.output-error {
  padding: 14px 16px; border-radius: 12px; background: #FFF4ED; color: var(--danger);
  font-size: 14px; font-weight: 500;
}
.output-foot { padding: 10px 24px; border-top: 1px solid var(--border); font-size: 12px; color: var(--ink-faint); }

ins.d-add { background: var(--add-bg); color: var(--add-ink); text-decoration: none; border-radius: 3px; padding: 0 1px; }
del.d-del { background: var(--del-bg); color: var(--del-ink); border-radius: 3px; padding: 0 1px; }

/* Markdown output */
.md h2 { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.md h3 { font-size: 14px; font-weight: 700; margin: 16px 0 6px; }
.md h2:first-child, .md h3:first-child { margin-top: 0; }
.md p { margin: 6px 0; line-height: 1.7; font-size: 14px; }
.md ul, .md ol { margin: 6px 0 6px 20px; font-size: 14px; line-height: 1.7; }
.md li { margin: 2px 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md .tbl { overflow-x: auto; margin: 8px 0; }
.md table, table.stats { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td, .stats th, .stats td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.md th, .stats th { background: var(--surface-2); font-weight: 600; }

.shimmer-lines[hidden] { display: none; }
.shimmer-line {
  height: 14px; border-radius: 6px; margin-bottom: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 50%, #f0f0f0 75%);
  background-size: 800px 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: -400px 0 } 100% { background-position: 400px 0 } }

.stats-wrap { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-card); padding: 24px; }
.stats-wrap .card-title { margin: 8px 0 12px; }
.stats-wrap table + .card-title { margin-top: 28px; }

/* ---------- FOOTER / TOAST ---------- */
footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 24px; font-size: 13px; color: var(--ink-muted); text-align: center; }
.footer-faint { color: var(--ink-faint); font-size: 12px; margin-top: 6px; }

#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  padding: 12px 20px; background: #1A1A1A; color: #fff; border-radius: 12px;
  font-size: 13px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateY(80px); opacity: 0; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 580px) {
  main { padding: 24px 16px 40px; }
  .nav-inner { padding: 0 16px; }
  .hide-sm { display: none; }
  .ws-input, .output-content { padding: 18px 16px; }
  .output-toolbar { padding: 12px 16px; }
}
