/* ===== Abas: Integrações, Mods, Lag e Ranking (prefixos in-, md-, lg-, rk-) ===== */
#tab-integracoes, #tab-mods, #tab-lag, #tab-ranking { --in-green: #3ddc84; --in-yellow: #ffc857; }

/* campos de formulário comuns dessas abas */
:is(#tab-integracoes, #tab-mods, #tab-lag, #tab-ranking) :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
  width: 100%; min-width: 0; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font: inherit;
}
:is(#tab-integracoes, #tab-mods, #tab-lag, #tab-ranking) :is(input, select, textarea):focus { outline: none; border-color: var(--accent); }
#tab-integracoes textarea { resize: vertical; line-height: 1.4; }
.in-mono { font-family: var(--mono) !important; font-size: .82rem !important; }

.in-stack { display: flex; flex-direction: column; gap: 18px; }
.in-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; align-items: start; }
.in-grid > .card, .in-stack > .card { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.in-grid > .card .card-title, .in-stack > .card .card-title { margin-bottom: 0; flex-wrap: wrap; }
.in-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.in-row > .in-grow { flex: 1 1 180px; min-width: 0; }
.in-field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.in-field > span b { color: var(--text); font-weight: 600; }
.in-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.in-check { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: .9rem; padding: 3px 0; }
.in-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.in-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 2px 12px; }
.in-sub { margin-bottom: 18px; }
.in-sub button { min-width: 120px; }
.in-desc { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.in-status { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 2px 10px; border-radius: 99px; background: var(--gauge-track); color: var(--muted); white-space: nowrap; }
.in-status.on { color: var(--in-green); background: color-mix(in srgb, var(--in-green) 15%, transparent); }
.in-err { border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); color: #ffd3d8; padding: 8px 12px; border-radius: 10px; font-size: .88rem; overflow-wrap: anywhere; }
.in-note { border: 1px solid color-mix(in srgb, var(--accent-2) 50%, var(--border)); background: color-mix(in srgb, var(--accent-2) 10%, transparent); padding: 10px 14px; border-radius: 10px; font-size: .9rem; line-height: 1.45; }
.in-note.warn { border-color: color-mix(in srgb, var(--in-yellow) 60%, var(--border)); background: color-mix(in srgb, var(--in-yellow) 10%, transparent); }
.in-save { position: sticky; bottom: 10px; z-index: 2; display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.in-save .btn { box-shadow: 0 6px 20px #000a; }

details.in-help { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
details.in-help summary { cursor: pointer; color: var(--accent-soft); font-size: .88rem; font-weight: 600; }
details.in-help ol { margin: 8px 0 4px; padding-left: 20px; font-size: .86rem; line-height: 1.55; }
details.in-help li + li { margin-top: 2px; }
details.in-help a { color: var(--accent-2); }
details.in-help code, .in-desc code { font-family: var(--mono); font-size: .8rem; background: var(--bg-2); padding: 1px 5px; border-radius: 5px; }

/* provedores da IA */
.in-prov { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 10px; }
.in-prov button { text-align: left; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; transition: .15s; }
.in-prov button:hover { border-color: var(--accent); }
.in-prov button.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-2)); }
.in-prov b { font-size: 1rem; }
.in-prov small { color: var(--muted); font-size: .8rem; }
.in-prov .tag { align-self: flex-start; }
.in-answer { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; min-height: 44px; }
.in-answer b { color: #e78bff; }

/* página pública e vaquinha */
.in-link { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.in-link code { flex: 1 1 200px; min-width: 0; font: .85rem var(--mono); color: var(--accent-soft); overflow-wrap: anywhere; }
.in-bar { height: 16px; border-radius: 99px; background: var(--gauge-track); overflow: hidden; }
.in-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; transition: width .4s; }
.in-money { font-size: 1.4rem; font-weight: 700; color: var(--accent-soft); }
.in-dons { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.in-don { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); }
.in-don .in-grow { flex: 1; min-width: 0; }
.in-don .in-grow > * { display: block; overflow-wrap: anywhere; }
.in-don .in-val { font-weight: 700; color: var(--in-green); white-space: nowrap; }

/* resumo do dia */
.in-resumo { background: var(--bg-2); border-left: 4px solid var(--accent-2); border-radius: 10px; padding: 12px 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.in-resumo b { color: var(--accent-soft); }

/* ===== Mods ===== */
.md-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.md-num { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.md-num b { display: block; font-size: 1.7rem; line-height: 1.1; }
.md-num span { color: var(--muted); font-size: .82rem; }
.md-num.hl b { color: var(--in-green); }
.md-safe { border: 1px solid color-mix(in srgb, var(--in-yellow) 60%, var(--border)); background: color-mix(in srgb, var(--in-yellow) 10%, var(--card)); border-radius: var(--radius); padding: 12px 16px; line-height: 1.5; font-size: .92rem; }
.md-safe b { color: var(--in-yellow); }
.md-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.md-filters .chip { padding: 6px 12px; font-size: .85rem; }
.md-filters .search { flex: 1 1 200px; max-width: 320px; margin: 0; }
.md-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 10px; }
.md-item { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
.md-item.up { border-color: color-mix(in srgb, var(--in-green) 55%, var(--border)); }
.md-item.ign { opacity: .7; }
.md-icon { width: 44px; height: 44px; border-radius: 10px; flex: none; background: var(--bg-2); display: grid; place-items: center; font-size: 1.4rem; overflow: hidden; }
.md-icon img { width: 100%; height: 100%; object-fit: cover; }
.md-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.md-name { font-weight: 600; overflow-wrap: anywhere; }
.md-file { color: var(--muted); font: .74rem var(--mono); overflow-wrap: anywhere; }
.md-ver { font: .82rem var(--mono); overflow-wrap: anywhere; }
.md-ver .new { color: var(--in-green); font-weight: 700; }
.md-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.md-st { font-size: .72rem; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--gauge-track); color: var(--muted); }
.md-st.atualizar { background: color-mix(in srgb, var(--in-green) 18%, transparent); color: var(--in-green); }
.md-st.em_dia { background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: var(--accent-2); }
.md-st.sem_versao { background: color-mix(in srgb, var(--in-yellow) 16%, transparent); color: var(--in-yellow); }
.md-st.ign { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.md-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.md-acts a.btn { font-size: .8rem; padding: 4px 10px; }
.md-log { background: #0a0612; border: 1px solid var(--border); border-radius: 10px; padding: 12px; max-height: 60vh; overflow: auto; font: .82rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.md-busy { display: inline-flex; gap: 8px; align-items: center; }
.md-spin, .lg-spin { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: in-spin .8s linear infinite; display: inline-block; }
@keyframes in-spin { to { transform: rotate(360deg); } }

/* ===== Lag ===== */
.lg-top { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .lg-top { grid-template-columns: 1fr; } }
.lg-tps { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.lg-tps .lg-big { font: 700 4.2rem/1 var(--mono); }
.lg-tps .lg-big.good { color: var(--in-green); }
.lg-tps .lg-big.mid { color: var(--in-yellow); }
.lg-tps .lg-big.bad { color: var(--danger); }
.lg-tps .lg-word { font-weight: 600; }
.lg-chart { width: 100%; height: 190px; display: block; }
.lg-worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.lg-world { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.lg-world h4 { margin: 0 0 8px; font-size: 1rem; overflow-wrap: anywhere; }
.lg-world dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; font-size: .88rem; }
.lg-world dt { color: var(--muted); } .lg-world dd { margin: 0; font-weight: 600; text-align: right; }
.lg-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lg-table td.num, .lg-table th.num { text-align: right; white-space: nowrap; }
.lg-table td { padding: 8px 6px; }
.lg-table .lg-heavy { color: var(--warn); font-weight: 700; }
.lg-coord { font: .82rem var(--mono); white-space: nowrap; }
.lg-what { font-size: .82rem; }
.lg-what span { display: block; }
@media (max-width: 700px) {
  .lg-table thead { display: none; }
  .lg-table, .lg-table tbody, .lg-table tr, .lg-table td { display: block; width: 100%; }
  .lg-table tr { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
  .lg-table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  .lg-table td.num { text-align: right; }
  .lg-table td::before { content: attr(data-l); color: var(--muted); text-align: left; font-size: .8rem; }
  .lg-table td:last-child::before { content: none; }
  .lg-table td:last-child { justify-content: flex-end; }
}

/* ===== Ranking ===== */
.rk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.rk-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rk-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.rk-list li:nth-child(-n+3) { background: color-mix(in srgb, var(--accent) 10%, var(--bg-2)); }
.rk-pos { width: 28px; text-align: center; flex: none; font-weight: 700; color: var(--muted); }
.rk-pos.medal { font-size: 1.3rem; }
.rk-face { width: 28px; height: 28px; border-radius: 6px; image-rendering: pixelated; flex: none; background: var(--bg-2); }
.rk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-val { font-weight: 700; color: var(--accent-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rk-val small { color: var(--muted); font-weight: 400; }
