:root {
  --ink: #0f172a; --muted: #52627a; --line: #e2e8f0; --paper: #ffffff;
  --brand: #2563eb; --brand-deep: #1e40af; --soft: #f8fafc;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--soft);
}
.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }
.top { background: linear-gradient(140deg, var(--ink), var(--brand-deep)); color: #fff; padding: 26px 0; }
.brand { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.brand span { opacity: .75; font-weight: 500; }
.tagline { opacity: .85; margin-top: 4px; font-size: 14px; }
h1 { font-size: 30px; letter-spacing: -0.5px; margin: 40px 0 6px; }
.lead { color: var(--muted); margin: 0 0 26px; line-height: 1.55; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0 30px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.tpl {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(15,23,42,.06); transition: transform .15s;
}
.tpl:hover { transform: translateY(-3px); }
.tpl .thumb { height: 170px; display: block; }
.tpl .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tpl h3 { margin: 0; font-size: 20px; }
.tpl .cat { color: var(--brand); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.tpl p { color: var(--muted); font-size: 14.5px; line-height: 1.5; margin: 0; flex: 1; }
.tpl .pages { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl .pages span { background: var(--soft); border: 1px solid var(--line); font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.tpl button { margin-top: 10px; }

.btn {
  display: inline-block; border: none; cursor: pointer; text-decoration: none; text-align: center;
  padding: 12px 22px; border-radius: 10px; font-size: 15.5px; font-weight: 600; background: var(--paper);
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }
.btn.ghost { border: 1px solid var(--line); color: var(--ink); }

.form { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.form input, .form textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.form input[type=color] { padding: 3px; height: 42px; width: 80px; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

.progress { display: flex; gap: 22px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.spinner {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#progressLog { list-style: none; margin: 0; padding: 0; font-size: 15px; line-height: 1.9; color: var(--muted); }
#progressLog li::before { content: '✓ '; color: var(--brand); font-weight: 700; }
#progressLog li:last-child { color: var(--ink); font-weight: 600; }
#progressLog li:last-child::before { content: '… '; }

.result-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: start; }
.result-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.result-card h3 { margin: 0 0 8px; font-size: 16px; }
.result-card h3 + .biglink { margin-bottom: 20px; }
.biglink a { color: var(--brand); font-size: 16px; word-break: break-all; text-decoration: none; font-weight: 600; }
.biglink a:hover { text-decoration: underline; }
.creds { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; background: var(--soft); border: 1px dashed var(--line); padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin: 6px 0 14px; align-items: center; }
.creds code { font-size: 13.5px; }
.copy { font: inherit; font-size: 12px; padding: 2px 10px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.55; }
.preview iframe { width: 100%; height: 430px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

@media (max-width: 860px) {
  .row2, .result-grid { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
}

.notice {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 14px 18px; color: var(--muted); font-size: 14.5px;
  line-height: 1.6; margin-bottom: 22px;
}
.notice code { background: var(--soft); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
