/* ============================================================
   KashAi — Design tokens & base styles
   ============================================================ */

:root {
  /* Palette */
  --bg-0: #0a0a0c;
  --bg-1: #111114;
  --bg-2: #16161a;
  --bg-3: #1c1c22;
  --bg-4: #24242c;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.10);
  --line-3: rgba(255, 255, 255, 0.16);

  --fg: #f4f4f5;
  --fg-dim: #a1a1aa;
  --fg-muted: #71717a;
  --fg-faint: #52525b;

  --accent-blue: #2b6cf6;
  --accent-blue-hover: #4581ff;
  --accent-blue-soft: rgba(43, 108, 246, 0.12);
  --accent-blue-ring: rgba(43, 108, 246, 0.45);

  --accent-amber: #e8a857;
  --accent-amber-soft: rgba(232, 168, 87, 0.14);

  --accent-pink: #ff4d8f;
  --accent-pink-soft: rgba(255, 77, 143, 0.14);

  --success: #3ecf8e;
  --warning: #ffb84d;
  --danger: #ff5d5d;

  /* Type */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;

  /* Shadows */
  --shadow-blue: 0 6px 16px rgba(43, 108, 246, 0.45);
  --shadow-blue-lg: 0 10px 40px rgba(43, 108, 246, 0.55);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.4);
  --shadow-elev: 0 24px 60px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(43,108,246,0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 5%, rgba(232,168,87,0.05), transparent 55%),
    var(--bg-0);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Utility ============================================== */
.font-display { font-family: var(--font-display); letter-spacing: -0.02em; }
.font-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; }
.tight { letter-spacing: -0.04em; }
.tighter { letter-spacing: -0.06em; }
.dim { color: var(--fg-dim); }
.muted { color: var(--fg-muted); }

/* Buttons ============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .25s ease;
}
.btn:hover { background: var(--bg-4); border-color: var(--line-3); transform: translateY(-1px); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-dim); }
.btn-ghost:hover { color: var(--fg); background: var(--bg-2); }

.btn-primary {
  background: var(--accent-blue);
  border-color: rgba(255,255,255,0.10);
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
  background: var(--accent-blue-hover);
  box-shadow: var(--shadow-blue-lg);
  transform: translateY(-1px);
}

.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 12px; }

/* Chip ============================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--fg-dim);
  font-family: var(--font-mono);
}
.chip.blue { background: var(--accent-blue-soft); color: #9ec0ff; border-color: rgba(43,108,246,0.35); }
.chip.amber { background: var(--accent-amber-soft); color: #f3c98a; border-color: rgba(232,168,87,0.30); }
.chip.pink { background: var(--accent-pink-soft); color: #ff8fb6; border-color: rgba(255,77,143,0.28); }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* Cards ============================================== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* Animations ============================================== */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(43,108,246,0.55), 0 6px 16px rgba(43,108,246,0.45); }
  50% { box-shadow: 0 0 0 12px rgba(43,108,246,0.0), 0 6px 22px rgba(43,108,246,0.6); }
}
@keyframes scan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift {
  0% { transform: translate3d(0,0,0) rotate(0); }
  50% { transform: translate3d(8px,-10px,0) rotate(2deg); }
  100% { transform: translate3d(0,0,0) rotate(0); }
}

.rise { animation: rise .8s cubic-bezier(.2,.8,.2,1) both; }
.rise-1 { animation-delay: .05s; }
.rise-2 { animation-delay: .15s; }
.rise-3 { animation-delay: .25s; }
.rise-4 { animation-delay: .35s; }
.rise-5 { animation-delay: .45s; }
.rise-6 { animation-delay: .55s; }
.rise-7 { animation-delay: .65s; }

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }
::-webkit-scrollbar-track { background: transparent; }

/* Selection */
::selection { background: var(--accent-blue); color: white; }

/* ============================================================
   App layout
   ============================================================ */

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Top bar ============================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 18px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-blue), #1a4ec0 60%, #122e6e);
  box-shadow: var(--shadow-blue);
  color: white;
  font-weight: 800;
  font-size: 14px;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  flex: 1;
  overflow: visible;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-item {
  position: relative;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-dim);
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s, background .18s, transform .18s;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-item:hover {
  color: var(--fg);
  background: var(--bg-2);
  transform: translateY(-1px);
}
.nav-item.active {
  color: white;
  background: var(--accent-blue);
  box-shadow: var(--shadow-blue);
}
.nav-item .new-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 5px;
  background: var(--accent-amber);
  color: #1a1208;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Lang switcher */
.lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: border-color .2s, color .2s;
}
.lang:hover { color: var(--fg); border-color: var(--line-3); }
.lang-flag {
  width: 18px; height: 18px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 11px;
  background: var(--bg-4);
}
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-elev);
  display: none;
  z-index: 60;
}
.lang.open .lang-menu { display: block; animation: rise .25s both; }
.lang-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg);
  font-family: var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  cursor: pointer;
}
.lang-opt:hover { background: var(--bg-3); }
.lang-opt.active { color: #9ec0ff; }
.lang-opt .check { margin-left: auto; opacity: 0; }
.lang-opt.active .check { opacity: 1; }

/* Hero (Kling-style featured) ============================ */
.hero-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  margin-top: 28px;
}
@media (max-width: 980px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-feature {
  position: relative;
  border-radius: var(--r-2xl);
  overflow: hidden;
  min-height: 480px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(120% 80% at 80% 20%, rgba(43,108,246,0.45), transparent 60%),
    radial-gradient(80% 60% at 10% 100%, rgba(232,168,87,0.18), transparent 60%),
    linear-gradient(180deg, #11142a 0%, #0a0c1a 100%);
  isolation: isolate;
}
.hero-feature::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 50%, black 30%, transparent 75%);
  pointer-events: none;
}
.hero-feature::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(700px 200px at 30% 100%, rgba(43,108,246,0.5), transparent 60%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100%;
  min-height: 480px;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent-amber);
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
}
.hero-eyebrow::before {
  content: ""; width: 24px; height: 1px; background: currentColor;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(48px, 6vw, 84px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  margin: 0;
}
.hero-title .accent { color: var(--accent-blue); }
.hero-sub {
  max-width: 480px;
  color: var(--fg-dim);
  font-size: 15px;
  line-height: 1.55;
}
.hero-meta {
  display: flex;
  gap: 28px;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px dashed var(--line-2);
}
.hero-meta .item { display: flex; flex-direction: column; gap: 4px; }
.hero-meta .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--fg-muted); text-transform: uppercase; }
.hero-meta .val { font-family: var(--font-display); font-size: 18px; font-weight: 600; }

.hero-cta-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Floating preview tiles in hero */
.hero-tiles {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
  display: grid;
  grid-template-columns: repeat(2, 180px);
  gap: 14px;
  z-index: 1;
  filter: drop-shadow(0 30px 50px rgba(0,0,0,0.6));
}
.hero-tile {
  width: 180px; height: 240px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  overflow: hidden;
  position: relative;
  background: var(--bg-3);
  animation: drift 8s ease-in-out infinite;
}
.hero-tile:nth-child(2) { animation-delay: -2s; transform: translateY(28px); }
.hero-tile:nth-child(3) { animation-delay: -4s; transform: translateY(-16px); }
.hero-tile:nth-child(4) { animation-delay: -6s; }
.hero-tile-label {
  position: absolute; left: 10px; bottom: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
}
@media (max-width: 1180px) { .hero-tiles { display: none; } }

/* Side hero card (Nano Banana Pro widget) */
.side-feature {
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-2);
  background:
    radial-gradient(80% 60% at 0% 0%, rgba(232,168,87,0.20), transparent 60%),
    var(--bg-1);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 480px;
  position: relative;
  overflow: hidden;
}
.side-feature h3 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.03em;
  margin: 8px 0 0;
  text-transform: uppercase;
  font-weight: 700;
}
.side-feature .desc { color: var(--fg-dim); font-size: 13.5px; line-height: 1.5; }

.mini-prompt {
  margin-top: auto;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mini-prompt textarea {
  width: 100%;
  background: transparent;
  border: 0;
  resize: none;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  min-height: 48px;
}
.mini-prompt-bottom {
  display: flex; gap: 8px; justify-content: space-between; align-items: center;
}

/* Tabs (Image / Video) ============================ */
.workspace { margin-top: 36px; }
.tabs {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  padding: 4px;
  border-radius: 12px;
  gap: 2px;
}
.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-dim);
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color .2s, background .2s, box-shadow .2s;
}
.tab:hover { color: var(--fg); }
.tab.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: var(--shadow-blue);
}

.workspace-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.workspace-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}

.tab-panel { display: none; animation: fadeIn .35s ease both; }
.tab-panel.active { display: block; }

/* Workspace grid */
.work-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) { .work-grid { grid-template-columns: 1fr; } }

/* Prompt area */
.prompt-card {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  position: relative;
}
.prompt-textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  background: transparent;
  border: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  outline: none;
}
.prompt-textarea::placeholder { color: var(--fg-muted); }

.prompt-tools {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.tool-btn:hover { color: var(--fg); border-color: var(--line-3); transform: translateY(-1px); }

/* Drop zone */
.dropzone {
  border: 1.5px dashed var(--line-3);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 130px;
  text-align: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,0.018) 14px 28px),
    var(--bg-1);
  transition: border-color .2s, background .2s, transform .2s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent-blue);
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(43,108,246,0.06) 14px 28px),
    var(--bg-1);
}
.dropzone .dz-title { font-weight: 600; font-size: 14px; }
.dropzone .dz-sub { color: var(--fg-muted); font-size: 12px; font-family: var(--font-mono); letter-spacing: 0.06em; }

/* Generate row */
.generate-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.cost {
  display: inline-flex; gap: 8px; align-items: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--fg-dim);
}
.cost .credits { color: var(--accent-amber); font-weight: 700; }

.btn-generate {
  position: relative;
  padding: 14px 24px;
  border-radius: 12px;
  background: var(--accent-blue);
  color: white;
  border: 1px solid rgba(255,255,255,0.10);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow-blue);
  transition: transform .2s, box-shadow .2s;
  display: inline-flex; align-items: center; gap: 10px;
  overflow: hidden;
}
.btn-generate:hover { transform: translateY(-1px); box-shadow: var(--shadow-blue-lg); }
.btn-generate.loading { animation: pulseGlow 1.6s ease-in-out infinite; }
.btn-generate.loading .gen-label { opacity: 0; }
.btn-generate .spinner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  opacity: 0;
  animation: spin .8s linear infinite;
}
.btn-generate.loading .spinner { opacity: 1; }

/* Models panel ====================================== */
.models-panel {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0;
  display: flex; align-items: center; justify-content: space-between;
}

.model-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
  transition: all .2s;
}
.model-card:hover {
  border-color: var(--line-3);
  transform: translateY(-1px);
  background: var(--bg-3);
}
.model-card.selected {
  border-color: var(--accent-blue);
  background: linear-gradient(180deg, rgba(43,108,246,0.10), transparent), var(--bg-2);
  box-shadow: 0 0 0 1px var(--accent-blue) inset, 0 6px 16px rgba(43,108,246,0.20);
}
.model-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--bg-4);
  display: grid; place-items: center;
  font-size: 22px;
  border: 1px solid var(--line-2);
}
.model-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.model-tag {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  background: var(--accent-blue-soft); color: #9ec0ff;
  padding: 2px 5px; border-radius: 4px;
  text-transform: uppercase;
}
.model-desc { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }
.model-price {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  text-align: right;
}
.model-price strong { color: var(--accent-amber); font-weight: 700; }

/* Param groups */
.param-group { display: flex; flex-direction: column; gap: 8px; }
.param-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.04em;
}
.pill:hover { color: var(--fg); border-color: var(--line-3); transform: translateY(-1px); }
.pill.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-blue);
}

/* Aspect tiles */
.aspect-row { display: flex; gap: 8px; flex-wrap: wrap; }
.aspect {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  min-width: 56px;
}
.aspect:hover { border-color: var(--line-3); transform: translateY(-1px); }
.aspect.active { border-color: var(--accent-blue); background: linear-gradient(180deg, rgba(43,108,246,0.12), transparent); box-shadow: 0 0 0 1px var(--accent-blue) inset; }
.aspect-shape {
  background: var(--fg-faint);
  border-radius: 3px;
}
.aspect.active .aspect-shape { background: var(--accent-blue); }
.aspect-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--fg-dim); }
.aspect.active .aspect-label { color: var(--fg); }

/* ==== Loading skeleton on result ==== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.skel {
  position: relative;
  border-radius: 10px;
  height: 140px;
  background:
    linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.6s linear infinite;
  border: 1px solid var(--line);
  overflow: hidden;
}
.skel::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(43,108,246,0.18), transparent 60%);
  animation: scan 1.4s linear infinite;
}

/* Result gallery ================================== */
.gallery {
  margin-top: 56px;
}
.gallery-head {
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.03em;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
}
.masonry {
  columns: 4 240px;
  column-gap: 14px;
}
.tile {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
  transition: transform .25s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile-image {
  width: 100%;
  display: block;
  aspect-ratio: var(--ar, 3/4);
}
.tile-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.85));
  opacity: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14px;
  gap: 10px;
  transition: opacity .25s;
}
.tile:hover .tile-overlay { opacity: 1; }
.tile-prompt {
  font-size: 12px;
  color: white;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.18); transform: scale(1.06); }
.tile-meta {
  position: absolute; top: 10px; left: 10px;
  display: flex; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  padding: 4px 8px; border-radius: 999px;
  letter-spacing: 0.08em;
}

/* ==== Footer ==== */
.footer {
  margin-top: 80px;
  padding: 48px 24px 36px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 32px;
}
@media (max-width: 980px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.foot-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 14px;
  font-weight: 600;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.foot-col a { font-size: 13px; color: var(--fg-dim); transition: color .2s; }
.foot-col a:hover { color: var(--fg); }
.foot-headline {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1;
  margin: 0 0 16px;
  max-width: 360px;
}
.foot-bottom {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); letter-spacing: 0.08em;
}

/* ==== Modal ==== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn .25s both;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(440px, 92vw);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-2xl);
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-elev);
  animation: rise .35s both;
  overflow: hidden;
}
.modal::before {
  content: "";
  position: absolute; inset: -1px;
  background: radial-gradient(800px 200px at 50% -20%, rgba(43,108,246,0.35), transparent 70%);
  pointer-events: none;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  color: var(--fg-dim); cursor: pointer;
  display: grid; place-items: center;
  transition: all .2s;
}
.modal-close:hover { color: var(--fg); background: var(--bg-3); }
.modal h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 8px 0;
  text-transform: uppercase;
  position: relative;
}
.modal p { color: var(--fg-dim); font-size: 14px; margin: 0 0 24px; line-height: 1.5; position: relative; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; position: relative; }
.auth-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.auth-btn:hover { background: var(--bg-3); border-color: var(--line-3); transform: translateY(-1px); }
.auth-btn .auth-icon { width: 22px; height: 22px; display: grid; place-items: center; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--fg-muted); font-size: 11px; font-family: var(--font-mono);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin: 12px 0;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* Generic SVG placeholder */
.placeholder-img {
  display: block;
  background: var(--bg-3);
  position: relative;
}
.placeholder-img > .ph-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.6));
}
/* ============================================================
   MOBILE RESPONSIVE (Медиа-запросы для телефонов)
   ============================================================ */

/* ============================================================
   MEGA MENU
   ============================================================ */
.nav-item.has-mega {
  position: relative;
  cursor: pointer;
  z-index: 50;
}

.mega-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 45;
  opacity: 0;
  pointer-events: none;
}
.mega-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 48;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px var(--line) inset;
  width: 340px;
  padding-top: 6px;
  display: none;
  cursor: default;
}
.mega-menu.open {
  display: block;
}

/* Invisible bridge so mouse doesn't lose hover in the gap */
.mega-menu::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 12px;
}

.mega-inner {
  padding: 0;
}

.mega-col {
  padding: 12px;
  border-right: none;
}
.mega-col:last-child {
  border-right: none;
}

.mega-col-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 8px;
  padding: 0 8px;
  font-weight: 600;
}

.mega-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.mega-list::-webkit-scrollbar { width: 5px; }
.mega-list::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 4px; }

.mega-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.mega-item:hover {
  background: var(--bg-3);
  transform: translateX(2px);
}

.mega-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

.mega-item-info {
  flex: 1;
  min-width: 0;
}
.mega-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mega-item-desc {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mega-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.mega-badge.NEW {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  border: 1px solid rgba(232,168,87,0.3);
}
.mega-badge.TOP {
  background: var(--accent-pink-soft);
  color: var(--accent-pink);
  border: 1px solid rgba(255,77,143,0.3);
}
.mega-badge.HERO {
  background: var(--accent-blue-soft);
  color: #9ec0ff;
  border: 1px solid rgba(43,108,246,0.35);
}
.mega-badge.FAST {
  background: rgba(62,207,142,0.12);
  color: var(--success);
  border: 1px solid rgba(62,207,142,0.3);
}
.mega-badge.ANIM {
  background: rgba(178,132,255,0.12);
  color: #b284ff;
  border: 1px solid rgba(178,132,255,0.3);
}

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  z-index: 55;
  transition: border-color .2s;
}
.hamburger:hover { border-color: var(--line-3); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--fg-dim);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   MOBILE DRAWER
   ============================================================ */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 85vw);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-1);
  border-left: 1px solid var(--line-2);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--fg-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .2s;
}
.drawer-close:hover { color: var(--fg); background: var(--bg-3); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-dim);
  cursor: pointer;
  transition: color .2s, background .2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}
.drawer-nav-item:hover { color: var(--fg); background: var(--bg-2); }
.drawer-nav-item.active { color: var(--accent-blue); }
.drawer-nav-item .new-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 5px;
  background: var(--accent-amber);
  color: #1a1208;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-left: 8px;
}
.drawer-nav-arrow {
  transition: transform .3s;
  color: var(--fg-muted);
}
.drawer-nav-item.expanded .drawer-nav-arrow {
  transform: rotate(180deg);
}

.drawer-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(.4,0,.2,1);
  background: var(--bg-0);
}
.drawer-submenu.open {
  max-height: 2000px;
}

.drawer-sub-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 14px 24px 6px;
  font-weight: 600;
}

.drawer-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  cursor: pointer;
  transition: background .18s;
}
.drawer-sub-item:hover { background: var(--bg-2); }
.drawer-sub-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}
.drawer-sub-info { min-width: 0; }
.drawer-sub-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 6px;
}
.drawer-sub-desc {
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
}
.drawer-footer .btn {
  flex: 1;
  justify-content: center;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet landscape & small desktop */
@media (max-width: 1280px) {
}

/* Tablet portrait */
@media (max-width: 1024px) {
  .app { padding: 0 20px 60px; }
  .hero-grid { grid-template-columns: 1fr; margin-top: 20px; }
  .hero-tiles { display: none; }
  .work-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .foot-headline { grid-column: span 3; }
  .masonry { columns: 3 200px; }
}

/* Mobile large / tablet small */
@media (max-width: 850px) {
  .app { padding: 0 16px 60px; }
  .topbar { padding: 12px 16px; gap: 10px; }

  /* Hide desktop nav, show hamburger */
  .nav { display: none; }
  .hamburger { display: flex; }

  /* Hide mega menu on mobile (use drawer instead) */
  .mega-menu, .mega-overlay { display: none !important; }

  .topbar-right { gap: 6px; }
  .topbar-right .btn-ghost:first-of-type { display: none; } /* hide pricing button */

  /* Hero */
  .hero-grid { grid-template-columns: 1fr; margin-top: 16px; }
  .hero-title { font-size: clamp(36px, 10vw, 48px); }
  .hero-content { padding: 24px; min-height: auto; gap: 16px; }
  .hero-meta { flex-direction: column; gap: 16px; border-top: none; padding-top: 0; }
  .hero-cta-row { flex-direction: column; width: 100%; }
  .hero-cta-row .btn { width: 100%; }

  .side-feature { min-height: auto; padding: 20px; }
  .work-grid { grid-template-columns: 1fr; }
  .models-panel { padding: 16px; }
  .prompt-card { padding: 16px; }

  .masonry { columns: 2 150px; column-gap: 10px; }
  .tile { margin-bottom: 10px; }
  .gallery-head { flex-direction: column; align-items: flex-start; }

  .footer { padding: 32px 20px 24px; margin-top: 48px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .foot-headline { font-size: 24px; grid-column: span 2; }
}

/* Mobile medium */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar-right #open-login { display: none; }
  .topbar-right #open-signup { font-size: 12px; padding: 8px 14px; }

  .hero-content { padding: 20px; }
  .hero-title { font-size: clamp(30px, 9vw, 42px); }
  .hero-sub { font-size: 13.5px; }
  .hero-meta .val { font-size: 15px; }

  .side-feature h3 { font-size: 22px; }
  .workspace-title { font-size: 20px; }
  .gallery-title { font-size: 24px; }

  .model-card { grid-template-columns: 36px 1fr auto; gap: 10px; padding: 10px; }
  .model-icon { width: 36px; height: 36px; font-size: 18px; }
  .model-name { font-size: 13px; }
  .model-desc { font-size: 11px; }

  .prompt-textarea { font-size: 14px; min-height: 90px; }
  .prompt-tools { gap: 6px; }
  .tool-btn { padding: 6px 10px; font-size: 11px; }
}

/* Mobile small */
@media (max-width: 480px) {
  .masonry { columns: 1 100%; }
  .footer-grid { grid-template-columns: 1fr; }
  .foot-headline { grid-column: span 1; }
  .foot-bottom { flex-direction: column; gap: 8px; align-items: flex-start; }

  .hero-content { padding: 16px; }
  .hero-title { font-size: clamp(26px, 8vw, 36px); }
  .hero-cta-row .btn { font-size: 14px; padding: 12px 18px; }

  .btn-generate { padding: 12px 18px; font-size: 14px; }
  .generate-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .cost { justify-content: center; }

  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }

  .workspace-head { flex-direction: column; align-items: flex-start; gap: 12px; }

  .dropzone { padding: 18px; min-height: 100px; }

  .aspect-row { gap: 6px; }
  .aspect { min-width: 48px; padding: 6px 8px; }

  .mini-prompt-bottom { flex-direction: column; align-items: stretch; gap: 8px; }
  .mini-prompt-bottom > div { justify-content: center; }

  .modal { padding: 24px 20px; }
  .modal h2 { font-size: 22px; }
}

/* Very small devices */
@media (max-width: 360px) {
  .app { padding: 0 10px 40px; }
  .topbar { padding: 8px 10px; }
  .brand span { font-size: 15px; }
  .hero-content { padding: 14px; }
  .hero-title { font-size: 24px; }
  .side-feature { padding: 16px; }
  .side-feature h3 { font-size: 18px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-feature { min-height: 320px; }
  .hero-content { min-height: 320px; padding: 20px 28px; }
  .hero-title { font-size: clamp(28px, 5vw, 40px); }
  .side-feature { min-height: auto; }
}

/* iPad Pro / large tablets */
@media (min-width: 1025px) and (max-width: 1366px) {
  .hero-grid { grid-template-columns: 1.3fr 1fr; }
}

/* Print */
@media print {
  .topbar, .hamburger, .mobile-drawer, .drawer-overlay, .mega-menu, .mega-overlay { display: none !important; }
  body { background: white; color: black; }
  .app { max-width: 100%; padding: 0; }
}