:root {
    --bg: #020617;
    --card: #020617;
    --card-elevated: #020617;
    --border: #1e293b;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.2);
    --text: #e5e7eb;
    --muted: #9ca3af;
    --danger: #f97373;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
  }
  
  /* Reset */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  
  html,
  body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family:
      system-ui,
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #0f172a 0, #020617 50%, #000 100%);
    overflow-x: hidden;
  }
  
  body {
    display: flex;
    align-items: stretch;
    justify-content: center;
  }
  
  /* App shell */
  .app {
    width: 100%;
    max-width: 1200px;
    margin: 32px auto;
    padding: 20px 24px 24px;
    background:
      linear-gradient(135deg, rgba(56, 189, 248, 0.09), transparent 40%),
      radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.12), #020617);
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  
  /* Header */
  .app-header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
  }
  
  .logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
  }
  
  .logo .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #e0f2fe, #38bdf8);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  }
  
  .logo-text {
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
  }
  
  .app-title {
    flex: 1;
    margin-left: 16px;
  }
  
  .app-title h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.03em;
  }
  
  .app-title p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
  }
  
  .badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border: 1px solid rgba(56, 189, 248, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--accent);
  }
  
  /* Main layout */
  .app-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  
  .controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  
  .buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  
  /* Buttons */
  .btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition:
      transform 0.12s ease,
      box-shadow 0.12s ease,
      background 0.12s ease,
      border-color 0.12s ease;
  }
  
  .btn.primary {
    background: radial-gradient(circle at 20% 0, #e0f2fe, #38bdf8);
    color: #0b1120;
    box-shadow: 0 14px 35px rgba(56, 189, 248, 0.45);
  }
  
  .btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 45px rgba(56, 189, 248, 0.6);
  }
  
  .btn.ghost {
    background: rgba(15, 23, 42, 0.9);
    color: var(--muted);
    border: 1px solid rgba(148, 163, 184, 0.5);
  }
  
  .btn.ghost:hover {
    border-color: rgba(248, 250, 252, 0.8);
    color: #e5e7eb;
  }
  
  .btn-small {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  /* Status */
  .status {
    min-width: 180px;
    font-size: 12px;
    color: var(--muted);
  }
  
  .status.ok,
  .status.success {
    color: #4ade80;
  }
  
  .status.error {
    color: var(--danger);
  }
  
  /* Grid */
  .editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  /* Panels */
  .panel {
    background: rgba(15, 23, 42, 0.92);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(30, 64, 175, 0.75);
    box-shadow: 0 14px 45px rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .panel-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(30, 64, 175, 0.6);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  
  .panel-header span {
    font-size: 13px;
    font-weight: 500;
  }
  
  .panel-header small {
    font-size: 11px;
    color: var(--muted);
  }
  
  .panel-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  /* Upload */
  .upload-zone {
    border-radius: var(--radius-md);
    border: 1px dashed rgba(148, 163, 184, 0.5);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(15, 23, 42, 0.8);
  }
  
  .upload-zone input[type="file"] {
    display: none;
  }
  
  .upload-hint {
    font-size: 11px;
    color: var(--muted);
  }
  
  .file-info {
    font-size: 12px;
    color: var(--muted);
  }
  
  /* Sizes */
  .section-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 500;
    color: #e5e7eb;
  }
  
  .size-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .size-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .size-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    font-size: 12px;
    color: var(--muted);
    background: rgba(15, 23, 42, 0.9);
  }
  
  .size-tag input {
    accent-color: var(--accent);
  }
  
  /* Advanced / locked features */
  .advanced {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .feature {
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(148, 163, 184, 0.5);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .feature-main {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .lock-icon {
    font-size: 13px;
  }
  
  .feature-label {
    font-size: 12px;
  }
  
  .feature-tag {
    font-size: 11px;
    color: var(--muted);
  }
  
  .feature--locked {
    opacity: 0.65;
    cursor: not-allowed;
  }
  
  .feature-inline {
    margin-top: 8px;
  }
  
  .preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
  }
  
  .preview-item {
    text-align: center;
  }
  
  .preview-box {
    width: 96px;
    height: 96px;
    margin: 0 auto 6px;
    border-radius: 24px;
    background: radial-gradient(circle at top left, #020617, #020617 40%, #020617 100%);
    border: 1px solid rgba(148, 163, 184, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  
  .preview-image {
    display: block;
    max-width: 72px;
    max-height: 72px;
    border-radius: 20px;
  }
  
  .preview-label {
    font-size: 12px;
    color: var(--muted);
  }
  
 

  
  /* Code block */
  .code-block {
    margin-top: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(30, 64, 175, 0.75);
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
  }
  
  textarea#codeOutput {
    width: 100%;
    min-height: 120px;
    max-height: 220px;
    resize: vertical;
    border: none;
    outline: none;
    border-radius: 10px;
    padding: 8px 10px;
    background: #020617;
    color: var(--text);
    font-family:
      ui-monospace,
      SFMono-Regular,
      Menlo,
      Monaco,
      Consolas,
      "Liberation Mono",
      "Courier New",
      monospace;
    font-size: 12px;
    line-height: 1.5;
  }
  

  .actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
  }
  
  .btn.secondary {
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition:
      transform 0.12s ease,
      box-shadow 0.12s ease,
      background 0.12s ease,
      border-color 0.12s ease,
      color 0.12s ease;
  }
  
  /* Заблокированные Pro */
  .pro-locked {
    opacity: 0.6;
    cursor: not-allowed;
  }
  
  .lock-icon {
    font-size: 13px;
    opacity: 0.9;
  }
  
  
  /* Footer */
  .app-footer {
    margin-top: 20px;
    font-size: 11px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
  }
  
  /* Social links */
  .social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 0;
  }
  
  .social-link {
    color: var(--accent);
    opacity: 0.75;
    transition:
      opacity 0.2s ease,
      transform 0.2s ease,
      filter 0.2s ease;
  }
  
  .social-link:hover {
    opacity: 1;
    transform: translateY(-2px);
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7));
  }
  
  .icon {
    width: 22px;
    height: 22px;
    display: block;
  }
  
  /* Light theme (на будущее, совместимо с HTML/CSS tool) */
  body.theme-light {
    background: radial-gradient(circle at top left, #e5f2ff 0, #f8fafc 50%, #e5e7eb 100%);
    color: #0f172a;
  }
  
  body.theme-light .app {
    background:
      linear-gradient(135deg, rgba(56, 189, 248, 0.06), rgba(248, 250, 252, 0.9)),
      radial-gradient(circle at bottom right, rgba(191, 219, 254, 0.4), #f8fafc);
    border-color: rgba(148, 163, 184, 0.4);
  }
  
  body.theme-light .panel {
    background: #f9fafb;
    border-color: rgba(148, 163, 184, 0.7);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
  }
  
  body.theme-light textarea#codeOutput {
    background: #f9fafb;
    color: #0f172a;
  }
  
  /* Mobile */
  @media (max-width: 750px) {
    .app {
      margin: 12px;
      padding: 16px;
    }
  
    .app-header {
      flex-direction: column;
      align-items: flex-start;
    }
  
    .app-title {
      margin-left: 0;
    }
  
    .editor-grid {
      grid-template-columns: 1fr;
      gap: 10px;
    }
  
    .panel {
      border-radius: 18px;
      margin: 0;
      overflow: hidden;
    }
  
    .preview-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }