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

:root {
  --bg: #0a0a14;
  --bg2: #10101f;
  --card-bg: #161628;
  --card-border: #1e1e3a;
  --text: #eaeaf5;
  --text2: #8888a8;
  --text3: #5a5a78;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --green: #22c55e;
  --radius: 14px;
  --radius-sm: 10px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* === Header === */
.header {
  padding: 16px 20px 8px;
  text-align: center;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent2), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* === Info Block === */
.info-block {
  margin: 8px 16px 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(168,85,247,0.08));
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text2);
}

.info-block p { margin-bottom: 6px; }
.info-block p:last-child { margin-bottom: 0; }
.info-block b { color: var(--text); }

/* === Sections === */
.section {
  padding: 12px 16px;
}

.section h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === Model Grid === */
.model-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.model-grid::-webkit-scrollbar { display: none; }

.model-card {
  flex: 0 0 auto;
  min-width: 80px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.model-card.active {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.12);
  box-shadow: 0 0 12px var(--accent-glow);
}

.model-card .model-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.model-card .model-cost {
  font-size: 12px;
  color: var(--accent2);
  margin-top: 2px;
}

.model-card .model-badge {
  display: inline-block;
  font-size: 9px;
  color: var(--accent2);
  background: rgba(168, 85, 247, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 3px;
  text-transform: uppercase;
}

/* === Toggle === */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
}

.toggle-row span {
  font-size: 14px;
  font-weight: 500;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--card-border);
  border-radius: 28px;
  transition: 0.3s;
}

.toggle .slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .slider {
  background: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translateX(22px);
}

/* === Mode Info === */
.mode-info {
  padding: 10px 0;
  font-size: 13px;
  color: var(--text3);
  font-style: italic;
}

/* === Style Section === */
#style-section {
  transition: opacity 0.3s;
}

#style-section.hidden {
  display: none;
}

/* === Custom Style Textarea === */
textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent);
}

textarea::placeholder {
  color: var(--text3);
}

/* === Style Actions === */
.style-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-save:active {
  background: var(--accent2);
  transform: scale(0.97);
}

.btn-clear {
  background: var(--card-bg);
  color: var(--text2);
  border: 1px solid var(--card-border);
}

.btn-clear:active {
  background: var(--bg2);
  transform: scale(0.97);
}

/* === Style Tabs === */
.style-tabs {
  display: flex;
  gap: 0;
  margin: 10px 0;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.style-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.style-tab.active {
  background: var(--accent);
  color: #fff;
}

.tab-panel.hidden {
  display: none;
}

/* === Tags === */
.tag-group {
  margin-bottom: 12px;
}

.tag-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tag-chip.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent);
  color: var(--accent2);
}

/* === Categories === */
.categories {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories::-webkit-scrollbar { display: none; }

.cat-pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* === Styles Grid === */
.styles-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.style-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.style-row:active {
  transform: scale(0.98);
}

.style-row.selected {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.1);
}

.style-artist {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 130px;
  flex-shrink: 0;
}

.style-tags {
  font-size: 12px;
  color: var(--text2);
  margin-left: auto;
  text-align: right;
}
