/* "Your AI" — Settings provider/key/model UI, Upload AI strip and "Choose your AI first" card. */

/* ---------- settings: Your AI ---------- */
.ai-panel { margin-bottom: 16px; }
.ai-head { margin-bottom: 20px; }
.ai-head p { max-width: 70ch; }

.prov-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.prov-grid.has-mock { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.prov-card {
  --pc: var(--gold);
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  min-width: 0; padding: 14px 15px 13px; text-align: left; color: var(--text);
  border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface-2);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.25s, transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.prov-card:hover { border-color: color-mix(in srgb, var(--pc) 55%, var(--line-strong)); }
.prov-card:active { transform: scale(0.985); }
.prov-card.on {
  border-color: color-mix(in srgb, var(--pc) 85%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 16%, transparent), transparent 65%), var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--pc) 45%, transparent), 0 14px 34px -18px color-mix(in srgb, var(--pc) 80%, transparent);
}
.prov-top { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 8px; }
.prov-mono {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  font-family: var(--font-display); font-size: 1.3rem; line-height: 1; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--pc) 70%, #fff), var(--pc) 55%, color-mix(in srgb, var(--pc) 75%, #000));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 16px -8px var(--pc);
}
.prov-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; transition: border 0.2s; }
.prov-card.on .prov-radio { border: 5px solid var(--pc); background: #fff; }
.prov-name { font-family: var(--font-display); font-size: 1.28rem; line-height: 1.15; }
.prov-by { font-size: var(--fs-xs); color: var(--text-3); margin-top: -2px; }
.prov-pitch { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.4; margin-top: 4px; }
.prov-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.prov-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--pc) 60%, var(--text)); background: color-mix(in srgb, var(--pc) 14%, transparent);
}
.prov-tag svg { width: 12px; height: 12px; }
.prov-tag.free { color: var(--ok); background: var(--ok-soft); }
.prov-tag.ok { color: var(--ok); background: transparent; padding: 0 2px; }

.ai-empty {
  display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 14px 16px; border-radius: 14px;
  border: 1px dashed var(--line-strong); color: var(--text-2); font-size: var(--fs-sm);
}
.ai-empty svg { width: 18px; height: 18px; color: var(--gold-text); flex: none; }

.ai-config {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px;
  margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line);
}
.ai-config.no-key { grid-template-columns: minmax(0, 1fr); }
.ai-sub-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 38px; }
.ai-sub { font-family: var(--font-display); font-size: 1.3rem; }
.get-key { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.get-key svg { width: 15px; height: 15px; }
.mono-key, .am-id { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.mono-key { font-size: 0.78rem; letter-spacing: 0.01em; }
.ai-key-actions { margin-top: 14px; }
.test-result.warn { color: var(--gold-text); }
.test-result > span { min-width: 0; overflow-wrap: anywhere; }
.ai-privacy {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--steel-soft); color: var(--text); font-size: var(--fs-sm); line-height: 1.45;
}
.ai-privacy svg { width: 18px; height: 18px; color: var(--steel); flex: none; margin-top: 1px; }
.howto-foot { margin-top: 10px; }

.using-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 12px; font-size: var(--fs-sm); }
.using-line strong { font-weight: 700; }
.using-line .badge { height: auto; min-height: 24px; padding: 3px 9px; white-space: normal; }
.rec-grid { gap: 8px; }
.rec-grid .model-card { padding: 12px 14px; }
.rec-grid .mc-name { font-size: 1.15rem; font-weight: 400; }
.rec-grid .mc-cost { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.mc-pkr.free { color: var(--ok); font-weight: 800; }
.mc-per { white-space: nowrap; }
.list-status { display: flex; align-items: center; gap: 7px; margin: 10px 2px; min-height: 20px; color: var(--text-3); }
.list-status svg { width: 15px; height: 15px; flex: none; }
.list-status .spin { width: 14px; height: 14px; }
.list-status.warn { color: var(--gold-text); }

.all-models { border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.all-models > summary {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--text-2); border-radius: 16px;
}
.all-models > summary::-webkit-details-marker { display: none; }
.all-models > summary svg { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.all-models[open] > summary { color: var(--text); }
.all-models[open] > summary svg { transform: rotate(90deg); }
.all-models .count { color: var(--text-3); font-weight: 500; }
.am-tools { display: flex; align-items: center; gap: 12px; padding: 0 12px 10px; }
.am-tools .input-wrap { flex: 1; min-width: 0; }
.free-only { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.free-only input { width: 16px; height: 16px; accent-color: var(--ok); }
.am-list { max-height: 340px; overflow-y: auto; padding: 0 6px 6px; overscroll-behavior: contain; }
.am-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); text-align: left;
}
.am-row:hover { background: var(--surface-hover); }
.am-row.on { background: var(--gold-soft); }
.am-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.am-name, .am-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-name { font-weight: 600; font-size: 0.9rem; }
.am-id { font-size: 0.72rem; color: var(--text-3); }
.am-cost { font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); white-space: nowrap; }
.am-cost.free { color: var(--ok); }
.am-check { color: var(--gold-text); display: inline-flex; }
.am-check svg { width: 16px; height: 16px; }
.am-custom .am-name { color: var(--gold-text); }
.am-more { padding: 0 14px 12px; }
.am-more:empty { display: none; }

.settings-lower { margin-top: 0; }

/* ---------- upload: which AI ---------- */
.ai-strip {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px; padding: 10px 10px 10px 12px;
  border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line);
}
.ai-strip-mono, .ca-mono {
  --pc: var(--gold);
  display: grid; place-items: center; flex: none; color: #fff; font-family: var(--font-display); line-height: 1;
  background: linear-gradient(140deg, color-mix(in srgb, var(--pc) 70%, #fff), var(--pc) 55%, color-mix(in srgb, var(--pc) 75%, #000));
}
.ai-strip-mono { width: 36px; height: 36px; border-radius: 11px; font-size: 1.2rem; }
.ai-strip-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.ai-strip-main strong { font-weight: 700; overflow-wrap: anywhere; }
.read-local { display: flex; align-items: center; gap: 6px; }
.read-local svg { width: 14px; height: 14px; flex: none; }
.keep-open {
  display: inline-flex; align-items: flex-start; gap: 10px; max-width: 600px; padding: 12px 16px; border-radius: 14px;
  text-align: left; font-size: var(--fs-sm); color: var(--text); background: var(--gold-soft);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
}
.keep-open svg { width: 18px; height: 18px; color: var(--gold-text); flex: none; margin-top: 1px; }

/* ---------- upload: choose your AI first ---------- */
.choose-ai { max-width: 720px; margin: 8px auto 0; padding: clamp(28px, 5vw, 48px) clamp(18px, 4vw, 40px); text-align: center; overflow: hidden; }
.choose-ai::before {
  content: ''; position: absolute; inset: -40% -20% auto; height: 70%; pointer-events: none;
  background: radial-gradient(50% 60% at 50% 40%, var(--gold-soft), transparent 70%);
}
.ca-art { position: relative; display: grid; place-items: center; margin: 0 auto 16px; width: 76px; height: 76px; border-radius: 24px;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 45%, var(--ember) 130%); color: var(--on-gold);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 16px 40px -14px rgba(242, 160, 50, 0.85); }
.ca-art svg { width: 34px; height: 34px; }
.choose-ai h2 { position: relative; font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 10px; }
.ca-text { position: relative; max-width: 54ch; margin: 0 auto; }
.ca-tiles { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 24px; }
.ca-tile {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: var(--fs-sm);
}
.ca-mono { width: 26px; height: 26px; border-radius: 50%; font-size: 0.9rem; }
.ca-actions { position: relative; justify-content: center; }
.ca-foot { position: relative; margin-top: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .prov-grid.has-mock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1060px) {
  .ai-config { grid-template-columns: minmax(0, 1fr); gap: 26px; }
}
@media (max-width: 900px) {
  .prov-grid, .prov-grid.has-mock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .prov-grid, .prov-grid.has-mock { gap: 8px; }
  .prov-card { padding: 12px; }
  .prov-mono { width: 32px; height: 32px; font-size: 1.1rem; border-radius: 10px; }
  .prov-name { font-size: 1.12rem; }
  .prov-pitch { font-size: 0.8rem; }
  .ai-key-actions > .btn { flex: 1 1 auto; }
  .am-tools { flex-wrap: wrap; }
  .ca-actions > .btn { flex: 1 1 100%; }
  .ca-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
