* {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    :root {
      --bg: #0f172a;
      --panel: rgba(15, 23, 42, 0.8);
      --card: rgba(30, 41, 59, 0.8);
      --accent: #8b5cf6;
      --accent2: #06b6d4;
      --text: #f8fafc;
      --muted: #cbd5e1;
      --border: rgba(255,255,255,0.08);
      --shadow: 0 20px 45px rgba(0,0,0,0.35);
    }

    body {
      font-family: 'Inter', sans-serif;
      background:
        radial-gradient(circle at top left, rgba(139,92,246,0.25), transparent 35%),
        radial-gradient(circle at bottom right, rgba(6,182,212,0.2), transparent 35%),
        linear-gradient(135deg, #020617, #0f172a);
      color: var(--text);
      min-height: 100vh;
      overflow-x: hidden;
    }

    .app {
      display: grid;
      grid-template-columns: 360px 1fr 420px;
      min-height: 100vh;
      gap: 20px;
      padding: 20px;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 28px;
      backdrop-filter: blur(20px);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .controls-panel {
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 20px;
      max-height: calc(100vh - 40px);
    }

    .controls-header {
      padding: 24px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(6,182,212,0.15));
    }

    a.back {
      float:right;
      margin-bottom: 10px;
      color: #ffffff;
      -webkit-text-decoration: none;
      -moz-text-decoration: none;
      text-decoration: none;
    }

    .controls-header h1 {
      font-size: 1.8rem;
      font-weight: 800;
      margin-bottom: 8px;
    }

    .controls-header p {
      color: var(--muted);
      line-height: 1.5;
    }

    .nav-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding: 16px;
      border-bottom: 1px solid var(--border);
      background: rgba(255,255,255,0.02);
    }

    .nav-tabs button {
      border: none;
      padding: 10px 14px;
      border-radius: 12px;
      background: rgba(255,255,255,0.05);
      color: var(--muted);
      cursor: pointer;
      font-weight: 600;
      transition: 0.3s;
    }

    .nav-tabs button.active,
    .nav-tabs button:hover {
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      color: white;
      transform: translateY(-2px);
    }

    .controls-content {
      overflow-y: auto;
      padding: 20px;
    }

    .control-section {
      display: none;
      animation: fade 0.3s ease;
    }

    .control-section.active {
      display: block;
    }

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

    .group {
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.05);
      border-radius: 18px;
      padding: 18px;
      margin-bottom: 18px;
    }

    .group h3 {
      margin-bottom: 14px;
      font-size: 1rem;
      color: #fff;
    }

    .field {
      margin-bottom: 14px;
    }

    .field label {
      display: block;
      margin-bottom: 8px;
      font-size: 0.9rem;
      color: var(--muted);
      font-weight: 600;
    }

    input,
    select,
    textarea {
      width: 100%;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.06);
      color: white;
      border-radius: 12px;
      padding: 12px;
      outline: none;
      transition: 0.25s;
    }

    input:focus,
    select:focus,
    textarea:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(139,92,246,0.2);
    }

    input[type="color"] {
      height: 52px;
      padding: 4px;
      cursor: pointer;
    }

    input[type="range"] {
      padding: 0;
    }

    .inline-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    .inline-grid-3 {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
    }

    .preview-panel,
    .code-panel {
      padding: 24px;
      overflow: hidden;
    }

    .preview-panel h2,
    .code-panel h2 {
      margin-bottom: 18px;
      font-size: 1.5rem;
    }

    .preview-wrapper {
      background: rgba(255,255,255,0.03);
      border-radius: 24px;
      border: 1px solid rgba(255,255,255,0.06);
      overflow: hidden;
      min-height: 700px;
      position: relative;
    }

    .preview-area {
      padding: 30px;
      min-height: 700px;
      background:
        linear-gradient(135deg, rgba(15,23,42,0.9), rgba(30,41,59,0.8)),
        url('https://images.unsplash.com/photo-1498050108023-c5249f4df085?q=80&w=1600&auto=format&fit=crop');
      background-size: cover;
      background-position: center;
    }

    .generated-header {
      position: relative;
      overflow: hidden;
      border-radius: 22px;
      transition: 0.3s;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .header-overlay {
      position: absolute;
      inset: 0;
      z-index: 1;
    }

    .header-content {
      position: relative;
      z-index: 2;
      width: 100%;
      padding: 40px;
    }

    .cta-button {
      cursor: pointer;
      transition: 0.3s ease;
    }

    .cta-button:hover {
      transform: translateY(-4px) scale(1.02);
    }

    .preset-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    .preset-card {
      border-radius: 16px;
      padding: 16px;
      min-height: 120px;
      cursor: pointer;
      border: 1px solid rgba(255,255,255,0.06);
      transition: 0.3s;
      display: flex;
      align-items: flex-end;
      font-weight: 700;
    }

    .preset-card:hover {
      transform: translateY(-5px) scale(1.02);
      box-shadow: 0 18px 30px rgba(0,0,0,0.35);
    }

    .code-box {
      background: #020617;
      border-radius: 22px;
      border: 1px solid rgba(255,255,255,0.08);
      overflow: hidden;
      height: calc(100vh - 180px);
      display: flex;
      flex-direction: column;
    }

    .code-actions {
      display: flex;
      gap: 10px;
      padding: 16px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .code-actions button {
      flex: 1;
      border: none;
      border-radius: 12px;
      padding: 12px;
      font-weight: 700;
      cursor: pointer;
      color: white;
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      transition: 0.3s;
    }

    .code-actions button:hover {
      transform: translateY(-3px);
    }

    pre {
      flex: 1;
      overflow: auto;
      padding: 20px;
      color: #e2e8f0;
      font-size: 0.85rem;
      line-height: 1.6;
    }

    code {
      white-space: pre-wrap;
      word-break: break-word;
    }

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

      .controls-panel {
        position: relative;
        max-height: unset;
      }

      .code-box {
        height: 600px;
      }
    }
}