:root {
  --ink: #0f1a20;
  --mist: #f1f4f6;
  --accent: #ff4d2e;
  --accent-dark: #ce3219;
  --glow: rgba(255, 77, 46, 0.3);
  --teal: #2ec4b6;
  --paper: #ffffff;
  --shadow: 0 20px 50px rgba(15, 26, 32, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Cambria", "Garamond", "Georgia", serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #fff8f4, #f8f6f0 35%, #eef3f6 65%, #e6ecef 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-orbit {
  position: fixed;
  inset: -10% -30% auto auto;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(255, 77, 46, 0.4), transparent 60%);
  filter: blur(0);
  z-index: 0;
  opacity: 0.6;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background: linear-gradient(transparent 95%, rgba(15, 26, 32, 0.06) 100%),
    linear-gradient(90deg, transparent 95%, rgba(15, 26, 32, 0.06) 100%);
  background-size: 60px 60px;
  z-index: 0;
  opacity: 0.4;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 24px 96px;
  display: grid;
  gap: 32px;
}

.hero {
  display: grid;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--paper);
  font-size: 18px;
}

.brand-name {
  font-size: 14px;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0;
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-width: 680px;
  font-size: 1.05rem;
  color: rgba(15, 26, 32, 0.7);
}

.panel {
  background: var(--paper);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-badge {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(46, 196, 182, 0.12);
  color: #1b6f66;
  font-weight: 600;
  font-size: 0.8rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

.field-wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 26, 32, 0.15);
  font-family: inherit;
  font-size: 1rem;
  background: #fdfdfd;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.outline-builder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed rgba(15, 26, 32, 0.18);
  background: #f8fafb;
}

.outline-fixed {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 26, 32, 0.06);
  font-weight: 600;
}

.outline-chapters {
  display: grid;
  gap: 12px;
}

.outline-empty {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 26, 32, 0.04);
  color: rgba(15, 26, 32, 0.6);
  font-size: 0.9rem;
}

.outline-chapter {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(15, 26, 32, 0.12);
  background: #ffffff;
}

.outline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.outline-number {
  min-width: 44px;
  font-weight: 700;
  color: rgba(15, 26, 32, 0.7);
}

.outline-input {
  flex: 1;
  min-width: 200px;
}

.outline-sections {
  display: grid;
  gap: 8px;
  padding-left: 10px;
}

.icon-btn {
  border: none;
  background: rgba(15, 26, 32, 0.08);
  color: var(--ink);
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(15, 26, 32, 0.14);
}

.icon-btn::before {
  display: block;
  font-weight: 700;
  line-height: 1;
}

.icon-btn.icon-up::before {
  content: "";
  width: 14px;
  height: 14px;
  background: no-repeat center / 14px 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%230f1a20' d='M12 7l7 7-1.4 1.4L12 9.8 6.4 15.4 5 14z'/></svg>");
}

.icon-btn.icon-down::before {
  content: "";
  width: 14px;
  height: 14px;
  background: no-repeat center / 14px 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%230f1a20' d='M12 17l-7-7 1.4-1.4L12 14.2l5.6-5.6L19 10z'/></svg>");
}

.icon-btn.icon-del::before {
  content: "";
  width: 14px;
  height: 14px;
  background: no-repeat center / 14px 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%230f1a20' d='M6.2 6.2l11.6 11.6-1.4 1.4L4.8 7.6z'/><path fill='%230f1a20' d='M17.8 6.2l1.4 1.4L7.6 19.2l-1.4-1.4z'/></svg>");
}

.btn.small {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.btn.tiny {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.outline-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hint {
  color: rgba(15, 26, 32, 0.6);
  font-size: 0.9rem;
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.cta-row .progress {
  flex: 1;
  min-width: 240px;
  flex-basis: 100%;
  align-self: center;
}

.btn {
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: var(--paper);
  box-shadow: 0 12px 24px rgba(255, 77, 46, 0.2);
}

.btn.primary:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.btn.ghost {
  background: rgba(15, 26, 32, 0.05);
  color: var(--ink);
}

.btn.ghost:hover {
  transform: translateY(-1px);
  background: rgba(15, 26, 32, 0.1);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.status {
  font-size: 0.95rem;
  color: rgba(15, 26, 32, 0.7);
}

.progress {
  display: block;
  width: 100%;
  opacity: 1;
  margin-top: 4px;
}

.progress:not(#progressBar) {
  display: none;
}

.progress-track {
  height: 10px;
  background: #e7ebee;
  border: 1px solid rgba(15, 26, 32, 0.12);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 77, 46, 0.35), var(--accent));
  transform: translateX(-140%);
  opacity: 0.45;
}

.progress.active .progress-bar {
  opacity: 1;
  animation: progress-slide 1.4s ease-in-out infinite;
}


@keyframes progress-slide {
  0% {
    transform: translateX(-140%);
  }
  50% {
    transform: translateX(60%);
  }
  100% {
    transform: translateX(180%);
  }
}

.download-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.result {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.result.active {
  opacity: 1;
}

@media (max-width: 720px) {
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
