:root {
  --bg: #0b1627;
  --bg-soft: #10203a;
  --surface: #172b49;
  --surface-soft: #1e3659;
  --surface-alt: #f7f9fc;
  --text: #ecf2ff;
  --text-dark: #0f172a;
  --muted: #c5d0e7;
  --line: #2e4368;
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --success: #16a34a;
  --danger: #b91c1c;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Inter", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at 12% -18%, #1d3b68 0%, var(--bg) 42%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
}

.container {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.app-strip {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
  color: #1f2937;
  border-bottom: 1px solid rgba(15, 23, 42, 0.16);
}

.app-strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
}

.app-strip-text {
  display: grid;
  gap: 2px;
}

.app-strip-text strong {
  font-size: 14px;
  font-weight: 700;
}

.app-strip-text span {
  font-size: 13px;
  color: #374151;
}

.app-strip-btn {
  text-decoration: none;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #111827;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.app-strip-btn:hover {
  background: #111827;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.2);
}

.hero {
  position: relative;
  color: #fff;
  background: linear-gradient(118deg, #0b1b31 0%, #123056 48%, #1b4b80 100%);
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 75% 18%, rgba(253, 186, 116, 0.25), transparent 40%),
    radial-gradient(circle at 35% 86%, rgba(10, 16, 28, 0.6), transparent 44%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 26px 0 40px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  opacity: 0.94;
  margin-bottom: 16px;
}

.breadcrumb a {
  color: #fde68a;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(27px, 3.2vw, 42px);
  line-height: 1.12;
}

.hero p {
  margin: 0;
  font-size: clamp(15px, 1.7vw, 18px);
  max-width: 900px;
  color: #deebff;
}

.page-content {
  padding: 28px 0 44px;
  flex: 1;
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 15px 34px rgba(4, 12, 25, 0.28);
}

.panel-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  padding: 14px 18px 10px;
}

.input-wrap {
  display: grid;
  gap: 6px;
}

.input-wrap > span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.input-wrap input,
.input-wrap textarea {
  width: 100%;
  border: 1px solid #4f6388;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: #eef2ff;
  background: #0d1e35;
}

.input-wrap input::placeholder,
.input-wrap textarea::placeholder {
  color: #a8b6d3;
}

.input-wrap input:focus,
.input-wrap textarea:focus {
  outline: 2px solid rgba(245, 158, 11, 0.3);
  border-color: var(--primary);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 12px;
}

.chip {
  border: 1px solid #64748b;
  background: #10203a;
  color: #dbe7ff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.chip[aria-pressed="true"] {
  background: var(--primary);
  color: #111827;
  border-color: var(--primary);
  font-weight: 700;
}

.template-list {
  padding: 0 18px 18px;
  max-height: 64vh;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.template-card {
  border: 1px solid #405a82;
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: 0.18s ease;
}

.template-card:hover {
  border-color: #fbbf24;
  background: #243d63;
}

.template-card.active {
  border-color: #f59e0b;
  background: #2a446d;
}

.template-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.template-icon {
  font-size: 20px;
}

.template-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.template-meta {
  color: #c5d0e7;
  font-size: 12px;
}

.template-desc {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.42;
  color: #d6e2f7;
}

.empty-state {
  padding: 16px 18px 18px;
  color: #c0cde5;
}

.hidden {
  display: none !important;
}

.editor-panel .editor-wrap {
  padding: 14px 18px 0;
}

.editor-panel textarea {
  min-height: 280px;
  resize: vertical;
}

.dynamic-fields {
  margin: 12px 18px 0;
  border: 1px dashed #5d7399;
  border-radius: 12px;
  background: rgba(6, 19, 35, 0.55);
}

.dynamic-fields-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px dashed #5d7399;
}

.dynamic-fields-head h3 {
  margin: 0;
  font-size: 14px;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px 8px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #111827;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-light {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

.btn-secondary {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.preview-wrap {
  padding: 10px 18px 18px;
}

.preview-wrap h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.preview-wrap pre {
  margin: 0;
  border: 1px solid #4c6288;
  border-radius: 10px;
  background: #0c1e35;
  color: #ebf2ff;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 140px;
  max-height: 260px;
  overflow: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
}

.seo-block {
  margin-top: 20px;
  background: var(--surface-alt);
  border: 1px solid #d7dfec;
  border-radius: 14px;
  color: var(--text-dark);
  padding: 18px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.seo-block h2 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.2;
  color: #10203a;
}

.seo-block p {
  margin: 0 0 10px;
  color: #334155;
  line-height: 1.6;
}

.footer {
  padding: 18px 0 24px;
  text-align: center;
  color: #d4dff5;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.noscript-warning {
  position: fixed;
  inset-inline: 14px;
  bottom: 14px;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  background: #fee2e2;
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
}

@media (max-width: 1080px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }

  .template-list {
    max-height: 48vh;
  }
}

@media (max-width: 680px) {
  .container {
    width: calc(100% - 20px);
  }

  .app-strip-inner {
    align-items: flex-start;
  }

  .hero-content {
    padding: 22px 0 34px;
  }

  .panel-head h2 {
    font-size: 18px;
  }

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