/* Minimal dark UI inspired by provided screenshots (Mini App look) */
:root {
  --bg: #0b0b0f;
  --panel: #13131a;
  --panel-2: #171723;
  --text: #e9e9f2;
  --muted: #a4a4b6;
  --border: rgba(255, 255, 255, 0.08);
  --blue: #2f80ff;
  --blue-2: #3a64ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 20% -10%, rgba(47, 128, 255, 0.20), transparent 60%),
    radial-gradient(900px 600px at 90% 20%, rgba(138, 43, 226, 0.18), transparent 60%),
    var(--bg);
  color: var(--text);
}

.app {
  width: min(100%, 1400px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px 14px 32px;
}

.topbar { display: flex; flex-direction: column; gap: 12px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(19, 19, 26, 0.65);
  backdrop-filter: blur(10px);
}
.logo { font-weight: 800; letter-spacing: 0.4px; }
.balance { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }

.hero {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 16px;
  padding: 14px 14px;
  background: linear-gradient(90deg, rgba(47,128,255,0.90), rgba(138,43,226,0.85));
  border: 1px solid rgba(255,255,255,0.14);
}
.hero-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}
.hero-link:hover { filter: brightness(1.03); }
.hero-link:active { transform: translateY(1px); }
.hero-title { font-weight: 800; font-size: 15px; }
.hero-subtitle { font-size: 12px; opacity: 0.9; max-width: 540px; margin-top: 4px; }
.hero-emoji {
  font-size: 34px;
  opacity: 0.98;
  line-height: 1;
  padding: 6px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.main { margin-top: 14px; }
.section { border: 1px solid var(--border); border-radius: 16px; background: rgba(19, 19, 26, 0.55); }
.section-title {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 0;
  font-weight: 700;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,0.07); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; }
.btn-primary {
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
  border-color: rgba(255,255,255,0.12);
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}
@media (max-width: 680px) {
  .cards { grid-template-columns: 1fr; }
}

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  overflow: hidden;
  cursor: pointer;
  min-height: 162px;
}

/* Model icon overlay (replaces AI gradient) */
.card-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.30;
  filter: saturate(1.25) contrast(1.05);
  pointer-events: none;
  z-index: 0;
}
.card-top,
.card-title,
.card-desc {
  position: relative;
  z-index: 1;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 220px at 20% 20%, rgba(47,128,255,0.25), transparent 60%);
  pointer-events: none;
}
.card:hover { border-color: rgba(255,255,255,0.14); }
.card-top { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 11px;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 4px 8px;
  border-radius: 999px;
}
.card-emoji { font-size: 20px; }
.card-title { font-weight: 800; margin-top: 10px; font-size: 16px; }
.card-desc { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.35; }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  background: rgba(0,0,0,0.55);
  padding: 12px;
  z-index: 50;
}
.hidden { display: none !important; }

.modal-sheet {
  width: min(920px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(19,19,26,0.98), rgba(15,15,20,0.98));
  box-shadow: var(--shadow);
}

/* Pleasant transitions */
@keyframes sheetIn {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal:not(.hidden) { animation: backdropIn 180ms ease-out; }
.modal:not(.hidden) .modal-sheet { animation: sheetIn 220ms ease-out; }

.modal-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(19,19,26,0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.card.selected {
  outline: 2px solid rgba(47,128,255,0.85);
  box-shadow: 0 0 0 4px rgba(47,128,255,0.14);
}

.modal-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: rgba(19,19,26,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 2;
}
.modal-title { font-weight: 900; }

.search { padding: 12px 14px 0; }
.input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}
.input:focus { border-color: rgba(47,128,255,0.35); box-shadow: 0 0 0 3px rgba(47,128,255,0.12); }

.tabs { display: flex; gap: 8px; padding: 12px 14px 0; flex-wrap: wrap; }
.tab {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.tab.active { background: rgba(47,128,255,0.18); border-color: rgba(47,128,255,0.30); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}
@media (max-width: 680px) {
  .grid { grid-template-columns: 1fr; }
}

.model-hero {
  margin: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(47,128,255,0.55), rgba(138,43,226,0.45));
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.model-hero-name { font-weight: 900; font-size: 16px; }
.model-hero-desc { margin-top: 6px; font-size: 12px; color: rgba(255,255,255,0.86); line-height: 1.35; }
.model-hero-badge {
  margin-left: auto;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 12px;
}

.panel {
  margin: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.panel-title { font-weight: 900; margin-bottom: 10px; }

.controls { display: flex; flex-direction: column; gap: 14px; }
.control {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px;
  background: rgba(255,255,255,0.02);
}
.control-title { font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.control-sub { color: var(--muted); font-size: 12px; margin-top: -6px; margin-bottom: 8px; }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented button {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}
.segmented button.active { background: rgba(47,128,255,0.18); border-color: rgba(47,128,255,0.30); }

.range {
  width: 100%;
}
.range-row { display: flex; align-items: center; gap: 10px; }
.range-value { min-width: 56px; text-align: right; color: var(--muted); font-weight: 800; }

.textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  padding: 12px;
  outline: none;
}
.textarea:focus { border-color: rgba(47,128,255,0.35); box-shadow: 0 0 0 3px rgba(47,128,255,0.12); }

.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.row-text { color: var(--muted); font-size: 12px; }
.hint { margin-top: 10px; color: var(--muted); font-size: 12px; }

.switch { position: relative; width: 42px; height: 24px; display: inline-flex; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.10);
  transition: all 160ms ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  transition: all 160ms ease;
}
.switch input:checked + .switch-track {
  background: rgba(47,128,255,0.55);
  border-color: rgba(47,128,255,0.35);
}
.switch input:checked + .switch-track::after {
  left: 21px;
  background: white;
}

