:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --bg-elevated: #0f0f12;
  --panel: rgba(18, 18, 22, 0.92);
  --panel-2: #141418;
  --panel-solid: #121216;
  --text: #ececf1;
  --muted: #7a7d85;
  --muted-2: #555860;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --accent: #9e2a3b;
  --accent-2: #7a1f2d;
  --accent-glow: rgba(158, 42, 59, 0.30);
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, 0.10);
  --success: #27ae60;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --radius-sm: 12px;
  --transition: 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Ambient background — RED orbs */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.40;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(160, 30, 30, 0.50), transparent 70%);
  top: -6%;
  left: 50%;
  transform: translateX(-50%);
}

.orb-2 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(140, 20, 20, 0.35), transparent 70%);
  bottom: 12%;
  left: -8%;
  animation-delay: -7s;
}

.orb-3 {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(120, 25, 25, 0.25), transparent 70%);
  bottom: 22%;
  right: -4%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(10px, -14px) scale(1.03); }
  66% { transform: translate(-8px, 8px) scale(0.98); }
}

html[data-reduce-motion="true"] .orb {
  animation: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  background: none;
}

.app-shell {
  min-height: 100dvh;
  padding:
    max(22px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  position: relative;
  z-index: 1;
}

/* ========== MAIN MENU ========== */
.main-menu {
  width: min(420px, 100%);
  min-height: calc(100dvh - 44px);
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: transparent;
  border: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text .eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
}

.brand-text h1 {
  margin: 2px 0 0;
  font-size: 28px;
  letter-spacing: -0.04em;
  font-weight: 900;
  line-height: 1.1;
}

.tagline {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Menu card */
.menu-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.menu-button {
  width: 100%;
  min-height: 54px;
  padding: 0 16px 0 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  transition:
    transform var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.menu-button:active {
  transform: scale(0.98);
}

.menu-button:hover {
  background: #18181d;
  border-color: var(--border-strong);
}

.btn-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.menu-button.primary {
  background: var(--accent);
  border-color: transparent;
  color: white;
}

.menu-button.primary:hover {
  background: #b03045;
}

.menu-button.primary .btn-icon-wrap {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.menu-button.danger {
  color: var(--danger);
}

.menu-button.danger .btn-icon-wrap {
  background: var(--danger-soft);
  color: var(--danger);
}

.button-arrow {
  font-size: 17px;
  opacity: 0.35;
  font-weight: 500;
}

/* Status */
.status-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(39, 174, 96, 0.45);
  animation: blink 2.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

html[data-reduce-motion="true"] .status-dot {
  animation: none;
}

.version-badge {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ========== SCREENS ========== */
.screen {
  width: min(480px, 100%);
  min-height: calc(100dvh - 44px);
  margin: auto;
  padding-top: 4px;
  position: relative;
  animation: screenIn 0.24s var(--transition);
}

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

html[data-reduce-motion="true"] .screen {
  animation: none;
}

.hidden {
  display: none !important;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 10px 4px;
  font-weight: 700;
  font-size: 14px;
  transition: color var(--transition);
}

.back-button:hover {
  color: var(--text);
}

.back-arrow {
  font-size: 16px;
}

/* Coming soon */
.coming-soon {
  min-height: calc(100dvh - 110px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 10px;
  padding: 20px 0;
}

.coming-icon {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.coming-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.coming-soon .eyebrow {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.coming-soon h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.coming-soon p {
  margin: 0;
  color: var(--muted);
  max-width: 300px;
  line-height: 1.55;
  font-size: 14px;
}

.progress-bar {
  width: 160px;
  height: 4px;
  background: var(--panel-2);
  border-radius: 99px;
  margin-top: 18px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 38%;
  background: var(--accent);
  border-radius: 99px;
  animation: progressPulse 2.2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { width: 32%; opacity: 0.85; }
  50% { width: 48%; opacity: 1; }
}

html[data-reduce-motion="true"] .progress-fill {
  animation: none;
  width: 40%;
}

.progress-label {
  font-size: 12px !important;
  color: var(--muted-2) !important;
  margin-top: 6px !important;
}

/* ========== SETTINGS ========== */
.settings-panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.panel-header .eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.panel-header h2 {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.panel-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(158, 42, 59, 0.12);
  font-size: 18px;
  color: var(--accent);
}

/* Settings tabs */
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.tab-btn {
  min-height: 36px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.16s ease;
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

.setting-group {
  padding-top: 18px;
}

.setting-title {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 4px;
}

.setting-desc {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Segmented controls */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button {
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.16s ease;
}

.segmented button.active {
  background: var(--accent);
  color: white;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

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

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: #6b6f78;
  border-radius: 50%;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
  border-color: transparent;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
  background: white;
}

.toggle input:disabled + .toggle-track {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Danger action */
.danger-action {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(192, 57, 43, 0.15);
  transition: background 0.18s ease, transform 0.15s ease;
}

.danger-action:active {
  transform: scale(0.98);
}

.danger-action:hover {
  background: rgba(192, 57, 43, 0.16);
}

/* ========== AI TAB COMPONENTS ========== */
.select-wrap {
  margin-top: 8px;
}

.styled-select {
  width: 100%;
  height: 44px;
  padding: 0 32px 0 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237a7d85' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.styled-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  margin-top: 8px;
  outline: none;
  transition: border-color 0.2s ease;
}

.styled-input:focus {
  border-color: var(--accent);
}

.styled-input::placeholder {
  color: var(--muted-2);
}

.input-with-btn {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-with-btn .styled-input {
  flex: 1;
  margin-top: 0;
}

.scan-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.18s ease, transform 0.15s ease;
}

.scan-btn:active {
  transform: scale(0.97);
}

.scan-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Model grid with vertical scroll + right slider */
.model-search-wrap {
  margin-top: 10px;
}

.model-grid-wrap {
  margin-top: 10px;
  height: 320px;
  overflow: hidden;
  border-radius: 16px;
}

.model-scroll-container {
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--panel-2);
  padding-right: 4px;
}

.model-scroll-container::-webkit-scrollbar {
  width: 4px;
}

.model-scroll-container::-webkit-scrollbar-track {
  background: var(--panel-2);
  border-radius: 99px;
}

.model-scroll-container::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 99px;
}



/* Model card — redesigned */
.model-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease;
  flex-shrink: 0;
}

.model-card.selected {
  border-color: var(--accent);
}

.model-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.provider-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--panel-2);
}

.provider-logo img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.provider-logo .logo-fallback {
  font-size: 14px;
  font-weight: 800;
}

.model-card-header .model-name-block {
  flex: 1;
  min-width: 0;
}

.model-card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  word-break: break-word;
}

.model-card-header .model-id {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.model-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.spec-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.spec-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.model-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.model-developer {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.model-select-btn {
  min-height: 32px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.18s ease;
}

.model-select-btn.selected {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  pointer-events: none;
}

.model-select-btn:active {
  transform: scale(0.97);
}

/* Loading & error */
/* Model fallback notice */
.model-fallback-notice {
  padding: 10px 12px;
  background: rgba(158, 42, 59, 0.10);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

html[data-theme="light"] .model-fallback-notice,
@media (prefers-color-scheme: light) {
  html[data-theme="system"] .model-fallback-notice {
    background: rgba(158, 42, 59, 0.06);
  }
}

.model-grid-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  justify-content: center;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.model-error {
  padding: 16px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: var(--danger-soft);
  border-radius: 12px;
}

/* ========== ABOUT ========== */
.about-panel {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: screenIn 0.24s var(--transition);
}

.about-hero {
  text-align: center;
  padding: 24px 16px 10px;
}

.about-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 14px;
  background: transparent;
  border: none;
}

.about-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-hero h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.about-version {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.about-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
}

.about-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.about-meta {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 4px 16px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-label {
  color: var(--muted);
  font-weight: 600;
}

.meta-value {
  font-weight: 700;
}

.status-ok {
  color: var(--success);
}

.about-footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted-2);
  margin: 6px 0 0;
}



/* ========== AGE DISCLAIMER ========== */
body.modal-open {
  overflow: hidden;
}

.disclaimer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 4, 6, 0.74);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: disclaimerFadeIn 0.18s var(--transition);
}

.disclaimer-backdrop.hidden {
  display: none !important;
}

.disclaimer-modal {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  text-align: center;
  animation: disclaimerScaleIn 0.22s var(--transition);
}

.disclaimer-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(158, 42, 59, 0.14);
  border: 1px solid rgba(158, 42, 59, 0.24);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.disclaimer-modal .eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
}

.disclaimer-modal h2 {
  margin: 6px 0 10px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.disclaimer-modal p {
  margin: 0 auto;
  max-width: 330px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.age-check {
  margin: 20px 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  user-select: none;
}

.age-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.age-check-box {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  color: transparent;
  font-size: 13px;
  font-weight: 900;
  transition: all var(--transition);
}

.age-check input:checked + .age-check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 18px var(--accent-glow);
}

.age-check input:focus-visible + .age-check-box {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.disclaimer-confirm {
  margin-top: 2px;
}

.disclaimer-confirm:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
}

@keyframes disclaimerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

html[data-reduce-motion="true"] .disclaimer-backdrop,
html[data-reduce-motion="true"] .disclaimer-modal {
  animation: none;
}

/* ========== COMPACT MODE ========== */
html[data-compact="true"] .main-menu {
  gap: 16px;
}

html[data-compact="true"] .menu-button {
  min-height: 48px;
}

html[data-compact="true"] .brand-mark {
  width: 52px;
  height: 52px;
}

html[data-compact="true"] .brand-text h1 {
  font-size: 24px;
}

html[data-compact="true"] .setting-group {
  padding-top: 12px;
}

/* ========== NO ANIMATIONS ========== */
html[data-no-anim="true"] * {
  animation: none !important;
  transition-duration: 0.01ms !important;
}

/* ========== LIGHT THEME ========== */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eaecef;
  --bg-elevated: #f0f1f4;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-2: #e2e4e8;
  --panel-solid: #ffffff;
  --text: #111114;
  --muted: #5c5f66;
  --muted-2: #8a8f96;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.10);
  --shadow: 0 16px 40px rgba(20, 25, 35, 0.08);
  --accent-glow: rgba(158, 42, 59, 0.18);
}

html[data-theme="light"] .orb {
  opacity: 0.30;
}

html[data-theme="light"] .menu-button:hover {
  background: #f2f3f5;
}

html[data-theme="light"] .btn-icon-wrap {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .toggle-track::after {
  background: #8a8f96;
}

html[data-theme="light"] .toggle input:checked + .toggle-track::after {
  background: white;
}

html[data-theme="light"] .spec-item {
  background: rgba(0,0,0,0.02);
}

/* System theme → light when OS prefers light */
@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    color-scheme: light;
    --bg: #eaecef;
    --bg-elevated: #f0f1f4;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-2: #e2e4e8;
    --panel-solid: #ffffff;
    --text: #111114;
    --muted: #5c5f66;
    --muted-2: #8a8f96;
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.10);
    --shadow: 0 16px 40px rgba(20, 25, 35, 0.08);
    --accent-glow: rgba(158, 42, 59, 0.18);
  }

  html[data-theme="system"] .orb {
    opacity: 0.30;
  }

  html[data-theme="system"] .menu-button:hover {
    background: #f2f3f5;
  }

  html[data-theme="system"] .btn-icon-wrap {
    background: rgba(0, 0, 0, 0.03);
  }

  html[data-theme="system"] .spec-item {
    background: rgba(0,0,0,0.02);
  }
}
/* ========== CHARACTER CATALOG / BOTTOM NAV ========== */
.catalog-screen {
  width: min(760px, 100%);
  padding-bottom: 92px;
}

.catalog-header {
  padding: 8px 2px 18px;
  border-bottom: 1px solid var(--border);
}

.catalog-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.catalog-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.catalog-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-brand h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.catalog-content {
  padding-top: 24px;
}

.catalog-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.catalog-title-row h1 {
  margin: 5px 0 0;
  font-size: clamp(25px, 6vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 900;
}

.catalog-count {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.catalog-subtitle {
  margin: 10px 0 20px;
  max-width: 560px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.character-card {
  position: relative;
  min-height: 178px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(20,20,24,.96), rgba(12,12,15,.96));
  box-shadow: 0 14px 36px rgba(0,0,0,.25);
  transition: transform var(--transition), border-color var(--transition);
}

.character-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.character-avatar {
  height: 106px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.12) 0 17%, transparent 18%),
    radial-gradient(circle at 50% 64%, rgba(255,255,255,.08) 0 28%, transparent 29%),
    linear-gradient(145deg, rgba(158,42,59,.34), rgba(38,16,22,.7));
  border: 1px solid rgba(255,255,255,.06);
}

.character-avatar span {
  color: rgba(255,255,255,.35);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .18em;
}

.avatar-b { background: radial-gradient(circle at 45% 38%, rgba(255,255,255,.1), transparent 20%), linear-gradient(145deg, rgba(102,37,54,.42), rgba(21,15,19,.85)); }
.avatar-c { background: radial-gradient(circle at 54% 42%, rgba(255,255,255,.1), transparent 20%), linear-gradient(145deg, rgba(75,42,54,.42), rgba(16,14,18,.85)); }
.avatar-d { background: radial-gradient(circle at 48% 40%, rgba(255,255,255,.1), transparent 20%), linear-gradient(145deg, rgba(110,31,40,.4), rgba(19,13,16,.85)); }
.avatar-e { background: radial-gradient(circle at 52% 39%, rgba(255,255,255,.1), transparent 20%), linear-gradient(145deg, rgba(69,34,46,.4), rgba(16,13,17,.85)); }
.avatar-f { background: radial-gradient(circle at 49% 40%, rgba(255,255,255,.1), transparent 20%), linear-gradient(145deg, rgba(125,35,47,.36), rgba(19,13,17,.85)); }

.character-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 3px 2px;
}

.character-info strong {
  font-size: 13px;
  font-weight: 800;
}

.character-info span {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
}

.character-status {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(0,0,0,.45);
  color: rgba(255,255,255,.58);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .12em;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(520px, calc(100% - 28px));
  min-height: 68px;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr 1fr;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: rgba(15,15,18,.94);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}

.nav-button {
  min-height: 50px;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted-2);
  transition: color var(--transition), background var(--transition), transform var(--transition);
}

.nav-button:hover,
.nav-button.active {
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.nav-button:active,
.nav-create:active { transform: scale(.94); }

.nav-button svg {
  width: 20px;
  height: 20px;
}

.nav-button span:last-child {
  font-size: 9px;
  font-weight: 700;
}

.history-glyph {
  font-size: 9px;
  line-height: 20px;
  font-weight: 900;
  letter-spacing: .04em;
}

.nav-create {
  width: 58px;
  height: 58px;
  justify-self: center;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: transform var(--transition), background var(--transition);
}

.nav-create:hover { background: #b03045; }
.nav-create svg { width: 27px; height: 27px; }

.utility-screen {
  padding-bottom: 20px;
}

.utility-panel {
  min-height: calc(100dvh - 110px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

.utility-icon {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: var(--shadow);
}

.utility-panel h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -.035em;
}

.utility-panel p {
  margin: 0;
  max-width: 300px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 480px) {
  .catalog-screen { padding-bottom: 86px; }
  .character-grid { gap: 8px; }
  .character-card { min-height: 166px; padding: 8px; }
  .character-avatar { height: 94px; }
  .character-status { top: 14px; right: 14px; }
  .bottom-nav { width: calc(100% - 20px); }
}


/* v1.8.0 refinements */
[data-i18n="community"] { font-style: italic; }
.bottom-nav { grid-template-columns: 1fr 1fr 1.1fr 1fr 1fr; }
.nav-button svg { display: block; }
.profile-nav-icon { width: 20px; height: 20px; display: grid; place-items: center; }
.profile-nav-icon svg { width: 20px; height: 20px; }
.profile-nav-icon img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: block; }
.utility-icon svg { width: 34px; height: 34px; }
.profile-panel { min-height: calc(100dvh - 110px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.profile-avatar-large { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--panel); border: 1px solid var(--border-strong); color: var(--muted); box-shadow: var(--shadow); margin-bottom: 6px; }
.profile-avatar-large svg { width: 50px; height: 50px; }
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.profile-panel h2 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -.035em; }
.profile-panel p { margin: 0; max-width: 320px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.profile-action { width: min(360px, 100%); margin-top: 8px; }
.profile-upload { width: min(360px, 100%); margin-top: 8px; }
.profile-upload input { display: none; }
.profile-upload > .menu-button { display: flex; }
@media (max-width: 420px) {
  .bottom-nav { width: calc(100% - 16px); padding: 6px; gap: 2px; }
  .nav-button { min-height: 48px; border-radius: 13px; }
  .nav-button span:last-child { font-size: 8px; }
  .nav-create { width: 54px; height: 54px; }
}
