@font-face {
  font-family: "Opague";
  src: url("./fonts/Opague-Regular-Desktop.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Int'l";
  src: url("./fonts/SuisseIntl-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-top: #f7f0e6;
  --bg-bottom: #dce8f1;
  --panel: rgba(255, 252, 247, 0.86);
  --panel-strong: rgba(255, 254, 251, 0.94);
  --line: rgba(23, 41, 66, 0.12);
  --text: #19263a;
  --muted: #6c7687;
  --lime: #bfdc1a;
  --lime-deep: #9db50f;
  --blue: #214f80;
  --blue-deep: #173a5e;
  --peach: #f1c7aa;
  --green: #177a58;
  --red: #bb3d34;
  --amber: #ba7d23;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 22px 50px rgba(18, 31, 48, 0.09);
  --shadow-float: 0 26px 60px rgba(20, 39, 63, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Suisse Int'l", "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(880px 580px at 2% -8%, rgba(241, 199, 170, 0.34), transparent 60%),
    radial-gradient(820px 560px at 100% 0%, rgba(191, 220, 26, 0.22), transparent 58%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 86%);
}

.app {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 18px 72px;
  display: grid;
  gap: 20px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  padding: 24px;
  animation: rise-fade 0.55s ease both;
}

.panel::after {
  content: "";
  position: absolute;
  inset: auto -11% -34% auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(191, 220, 26, 0.12), transparent 66%);
  pointer-events: none;
}

.hero-panel {
  padding-top: 72px;
  background:
    linear-gradient(135deg, rgba(255, 251, 246, 0.96), rgba(246, 251, 255, 0.88)),
    var(--panel-strong);
  box-shadow: var(--shadow-float);
  display: grid;
  gap: 22px;
}

.hero-panel::before {
  content: "";
  position: absolute;
  top: -72px;
  right: -40px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(191, 220, 26, 0.3), transparent 64%);
  pointer-events: none;
}


.ikra-badge {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(23, 41, 66, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--blue-deep);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(20, 39, 63, 0.1);
  backdrop-filter: blur(10px);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ikra-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(20, 39, 63, 0.14);
  background: rgba(255, 255, 255, 0.94);
}

.triz-info-badge {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  position: absolute;
  top: 68px;
  right: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(23, 41, 66, 0.1);
  background: rgba(255, 255, 255, 0.72);
  color: var(--blue-deep);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(20, 39, 63, 0.08);
  backdrop-filter: blur(10px);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.triz-info-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(20, 39, 63, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 800px;
  display: grid;
  gap: 14px;
}

.eyebrow {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  display: inline-block;
  width: fit-content;
  max-width: min(100%, 680px);
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 41, 66, 0.08);
  background: linear-gradient(180deg, rgba(191, 220, 26, 0.78), rgba(227, 241, 147, 0.9));
  color: #17220f;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
  text-wrap: balance;
  box-shadow: 0 10px 24px rgba(123, 145, 13, 0.16);
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

h1,
h2 {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.35rem, 5.2vw, 4.3rem);
  line-height: 0.94;
  max-width: 920px;
}

h2 {
  font-size: clamp(1.38rem, 2.3vw, 1.8rem);
  line-height: 1.04;
}

h3 {
  font-size: 1.04rem;
}

h4 {
  font-size: 0.9rem;
}

.hero-text,
p {
  margin: 0;
  line-height: 1.56;
}

.hero-text {
  max-width: 760px;
  font-size: 1.05rem;
  color: #31435b;
}

.hero-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 5px;
  padding: 15px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 41, 66, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.metric-value {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  font-size: 1.85rem;
  font-weight: 400;
  color: #000;
}

.metric-label {
  color: #000;
  font-size: 0.92rem;
}

.section-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.step-badge {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  flex: 0 0 auto;
  min-width: 104px;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--lime), var(--lime-deep));
  color: #18250f;
  font-size: 0.95rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  box-shadow: 0 10px 22px rgba(123, 145, 13, 0.16);
}

.subtle-badge {
  background: linear-gradient(180deg, #d7e2ec, #c6d5e4);
  color: var(--blue-deep);
}

.section-note {
  margin-top: 7px;
  color: #667487;
  max-width: 780px;
}

.hidden-exemplar-block {
  display: none;
}

.step-panel,
.library-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 252, 247, 0.9)),
    var(--panel);
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(23, 41, 66, 0.12);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 0.97rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

input::placeholder,
textarea::placeholder {
  color: #8a95a5;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(191, 220, 26, 0.74);
  box-shadow: 0 0 0 4px rgba(191, 220, 26, 0.18);
}

button {
  border: 1px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 700;
  padding: 14px 18px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.primary-button,
button[type="submit"],
.success-button,
#draft-btn {
  background: linear-gradient(180deg, #bfdc1a, #99b80d);
  color: #17220f;
  box-shadow: 0 14px 28px rgba(126, 148, 18, 0.22);
}

.primary-button:hover,
button[type="submit"]:hover,
.success-button:hover,
#draft-btn:hover {
  box-shadow: 0 18px 34px rgba(126, 148, 18, 0.28);
}

.secondary-button,
#alt-draft-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 226, 0.98));
  color: #243219;
  border-color: rgba(153, 184, 13, 0.28);
  box-shadow: 0 12px 24px rgba(126, 148, 18, 0.1);
}

.secondary-button:hover,
#alt-draft-btn:hover {
  box-shadow: 0 16px 30px rgba(126, 148, 18, 0.14);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.82);
  color: #243219;
  border-color: rgba(23, 41, 66, 0.12);
  box-shadow: 0 10px 22px rgba(20, 39, 63, 0.08);
}

.ghost-button:hover {
  box-shadow: 0 14px 28px rgba(20, 39, 63, 0.12);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.action-row > button {
  flex: 1 1 280px;
}

#draft-hint {
  margin-top: 18px;
}

.stacked-form {
  display: grid;
  gap: 14px;
}

.formula-variants {
  display: grid;
  gap: 14px;
}

.formula-variant-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(191, 220, 26, 0.24);
  background: linear-gradient(180deg, rgba(249, 252, 229, 0.96), rgba(255, 255, 255, 0.96));
  box-shadow: 0 10px 22px rgba(126, 148, 18, 0.08);
}

.formula-variant-card.is-active {
  border-color: rgba(153, 184, 13, 0.5);
  box-shadow: 0 16px 32px rgba(126, 148, 18, 0.14);
  background: linear-gradient(180deg, rgba(249, 252, 229, 0.98), rgba(255, 255, 255, 0.98));
}

.formula-variant-main {
  margin: 0;
}

.formula-variant-actions {
  display: grid;
  gap: 8px;
  align-self: start;
  margin-top: 30px;
}

.formula-variant-actions > button {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: 14px;
}

.step2-toggle {
  border: 1px solid rgba(23, 41, 66, 0.1);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(249, 246, 239, 0.95));
  padding: 0;
}

.step2-toggle summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.step2-toggle summary::-webkit-details-marker {
  display: none;
}

.step2-toggle summary::before {
  content: "▸";
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

.step2-toggle[open] summary::before {
  transform: rotate(90deg);
}

.step2-toggle-content {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.group-gap {
  height: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

.formula-actions {
  display: grid;
  gap: 8px;
}


.accent-box {
  padding: 15px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(191, 220, 26, 0.12), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(191, 220, 26, 0.22);
}

.status-panel {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.76);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca6b7;
}

.status-online {
  border-color: rgba(23, 122, 88, 0.3);
  color: var(--green);
}

.status-online .status-dot {
  background: var(--green);
}

.status-offline {
  border-color: rgba(187, 61, 52, 0.28);
  color: var(--red);
}

.status-offline .status-dot {
  background: var(--red);
}

.status-checking {
  border-color: rgba(186, 125, 35, 0.28);
  color: var(--amber);
}

.status-checking .status-dot {
  background: var(--amber);
}

.cards {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid rgba(23, 41, 66, 0.1);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 245, 0.96));
  display: grid;
  gap: 10px;
  box-shadow: 0 12px 26px rgba(18, 33, 52, 0.06);
}

.card p {
  color: #223147;
}

.card-subtitle {
  margin-top: 6px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e4c38;
}

.card-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  color: #31425d;
  font-size: 0.92rem;
  line-height: 1.42;
}

.ideas-block,
.principles-block {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.ideas-title {
  font-family: "Opague", "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.05;
}

.idea-card {
  background: linear-gradient(180deg, rgba(249, 252, 229, 0.98), rgba(255, 255, 255, 0.96));
  border-color: rgba(191, 220, 26, 0.24);
}

.idea-meta {
  font-size: 0.88rem;
  color: #5a6a43;
}

.idea-archive-btn {
  margin-top: 14px;
  width: fit-content;
}

.manual-ideas-block {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.manual-ideas-actions {
  display: flex;
  justify-content: flex-start;
}

#manual-idea-input {
  min-height: 140px;
  resize: vertical;
}

#manual-idea-hint {
  margin: 0;
}

.history {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
}

.archive-item {
  list-style: none;
  margin-left: -18px;
  border: 1px solid rgba(23, 41, 66, 0.1);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.8);
}

.archive-item-content {
  display: grid;
  gap: 7px;
}

.archive-item-formula {
  display: grid;
  gap: 4px;
}

.archive-copy-btn {
  white-space: nowrap;
  align-self: center;
  color: #000;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 247, 224, 0.96));
  border: 1px solid rgba(191, 220, 26, 0.26);
}

.muted {
  color: var(--muted);
  font-size: 0.93rem;
}

.error {
  color: var(--red);
  font-size: 0.93rem;
}

.ai-loading {
  color: var(--green);
  font-size: 0.93rem;
  font-weight: 600;
  animation: soft-pulse 1.2s ease-in-out infinite;
}

@keyframes soft-pulse {
  0% { opacity: 0.45; }
  50% { opacity: 1; }
  100% { opacity: 0.45; }
}

@keyframes rise-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {

  .ikra-badge,
  .triz-info-badge {
    position: static;
    width: fit-content;
    max-width: 100%;
  }

  .hero-panel {
    padding-top: 18px;
  }

  .formula-variant-card {
    grid-template-columns: 1fr;
  }

  .app {
    padding: 16px 12px 34px;
  }

  .panel {
    padding: 16px;
    border-radius: 22px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .section-head {
    flex-direction: column;
  }

  .step-badge {
    min-width: 0;
    width: fit-content;
  }

  .action-row {
    flex-direction: column;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .archive-item {
    flex-direction: column;
    align-items: stretch;
  }

  .archive-copy-btn {
    width: 100%;
  }
}
