/* ==================== ZONA DE REPASO (study-tools.js) ==================== */
.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.study-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary-soft), var(--success-soft));
}

.st-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.st-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
.st-tab {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
}
.st-tab:hover { background: var(--bg-hover); }
.st-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.st-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.8rem;
}
.st-grow { flex: 1 1 180px; }
.st-check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; cursor: pointer; }
.st-center { text-align: center; }
.st-list { margin: 0.6rem 0 0.8rem 1.2rem; text-align: left; }
.st-list li { margin: 0.2rem 0; }

/* ---------- Flashcards ---------- */
.st-flash {
  perspective: 1200px;
  height: 260px;
  max-width: 680px;
  margin: 0 auto 1rem;
  cursor: pointer;
  outline: none;
}
.st-flash-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}
.st-flash.flipped .st-flash-inner { transform: rotateY(180deg); }
.st-flash:focus-visible .st-flash-inner { box-shadow: 0 0 0 3px var(--primary-soft); border-radius: 16px; }
.st-flash-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
}
.st-flash-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--bg-card), var(--primary-soft));
}
.st-flash-text { font-size: 1.15rem; line-height: 1.5; }
.st-flash-hint { font-size: 0.78rem; }
.st-flash-nav { display: flex; justify-content: center; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }

/* ---------- Glosario ---------- */
.st-gloss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.7rem; }
.st-gloss-item {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.st-gloss-def { color: var(--text-muted); font-size: 0.9rem; }
.st-gloss-item.concealed { cursor: pointer; }
.st-gloss-item.concealed .st-gloss-def { filter: blur(6px); user-select: none; transition: filter 0.2s; }
.st-gloss-item.concealed.revealed .st-gloss-def { filter: none; }
.st-gloss-item mark { background: var(--warning-soft); color: inherit; border-radius: 3px; }

/* ---------- Emparejar ---------- */
.st-match { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 0.8rem; }
.st-match-col { display: flex; flex-direction: column; gap: 0.5rem; }
.st-match-item {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, transform 0.15s, opacity 0.3s;
}
.st-match-def { font-weight: 400; }
.st-match-item:hover { background: var(--bg-hover); }
.st-match-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.st-match-item.done { border-color: var(--success); background: var(--success-soft); opacity: 0.55; cursor: default; }
.st-match-item.wrong { border-color: var(--danger); background: var(--danger-soft); animation: st-shake 0.35s; }
@keyframes st-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Clasificar / opciones ---------- */
.st-sort-item h3 { margin-top: 0.5rem; font-size: 1.2rem; }
.st-sort-buckets { display: grid; gap: 0.6rem; margin: 0.8rem 0; }
.st-bucket { min-height: 3.2rem; white-space: normal; }
.st-ok { border-color: var(--success) !important; background: var(--success-soft) !important; color: var(--success) !important; }
.st-bad { border-color: var(--danger) !important; background: var(--danger-soft) !important; color: var(--danger) !important; }
.st-options { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.6rem 0; }
.st-option {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.st-option:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--primary); }
.st-option:disabled { cursor: default; }

/* ---------- Casos ---------- */
.st-case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.8rem; }
.st-case-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 14px;
  padding: 1rem;
  cursor: pointer;
  font-size: 0.88rem;
  transition: transform 0.15s, border-color 0.15s;
}
.st-case-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.st-case-icon { font-size: 1.8rem; }
.st-case-play { margin-top: 0.8rem; }
.st-scenario { background: var(--bg); border-left: 3px solid var(--primary); padding: 0.7rem 0.9rem; border-radius: 8px; margin: 0.6rem 0 1rem; }
.st-case-log { padding: 0.55rem 0.8rem; border-radius: 8px; margin-bottom: 0.5rem; font-size: 0.88rem; }
.st-case-log.ok { background: var(--success-soft); }
.st-case-log.bad { background: var(--danger-soft); }
.st-case-step { margin-top: 0.8rem; }

/* ---------- Simulador SG/ACL ---------- */
.st-packet-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.6rem; }
.st-node { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.3rem 0.55rem; font-size: 0.82rem; }
.st-arrow { color: var(--text-muted); }
.st-rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.8rem; margin: 0.9rem 0; }
.st-rule-box { border: 1px solid var(--border); background: var(--bg-card); border-radius: 12px; padding: 0.8rem; min-width: 0; }
.st-rule-box h4 { margin-bottom: 0.5rem; }
.st-rules { width: 100%; font-size: 0.82rem; }
.st-allow { color: var(--success); font-weight: 700; }
.st-deny { color: var(--danger); font-weight: 700; }
.st-add-rule { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.st-add-rule input, .st-add-rule select { font-size: 0.8rem; padding: 0.3rem 0.4rem; }
.st-guess-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.45rem 0; }
.st-guess-row span { min-width: 250px; }
.st-trace { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.45rem; }
.st-trace-step {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.88rem;
  opacity: 0;
  animation: st-fade 0.35s forwards;
}
.st-trace-step.ok { background: var(--success-soft); }
.st-trace-step.bad { background: var(--danger-soft); }
@keyframes st-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- CIDR ---------- */
.st-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0.9rem; }
.st-cidr-q { font-size: 1.05rem; margin-top: 0.4rem; }
.st-cidr-facts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }

/* ---------- Consola AWS CLI ---------- */
.st-cli-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0.9rem; }
.st-cli-left { display: flex; flex-direction: column; min-width: 0; }
.st-goals { list-style: none; margin: 0 0 0.7rem; font-size: 0.88rem; }
.st-goals li { padding: 0.15rem 0; }
.st-goals li.ok { color: var(--success); }
.st-term {
  background: #0a0f1a;
  color: #d1fae5;
  border-radius: 10px;
  padding: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  height: 420px;
  overflow-y: auto;
  cursor: text;
}
.st-term pre { white-space: pre-wrap; word-break: break-word; margin: 0; font-family: inherit; }
.st-term-cmd { color: #93c5fd; }
.st-term-err { color: #fca5a5; }
.st-term-help { color: #fde68a; }
.st-term-ok { color: #6ee7b7; font-weight: 700; }
.st-term-line { display: flex; gap: 0.45rem; align-items: center; }
.st-term-line span { color: #6ee7b7; }
.st-term-line input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: inherit;
  padding: 0.2rem 0;
}
.st-diagram-empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; border: 2px dashed var(--border); border-radius: 12px; }
.st-vpc { border: 2px solid var(--primary); border-radius: 14px; padding: 0.7rem; margin-bottom: 0.8rem; background: var(--primary-soft); font-size: 0.82rem; }
.st-vpc-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-weight: 700; margin-bottom: 0.6rem; }
.st-igw { background: var(--bg-card); border: 1px solid var(--warning); border-radius: 8px; padding: 0.1rem 0.4rem; font-weight: 600; }
.st-subnets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.5rem; }
.st-subnet { border-radius: 10px; padding: 0.5rem; background: var(--bg-card); border: 2px solid var(--border); display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.st-subnet.pub { border-color: var(--success); }
.st-subnet.priv { border-color: var(--text-muted); border-style: dashed; }
.st-subnet code { font-size: 0.72rem; word-break: break-all; }
.st-nat { background: var(--warning-soft); border-radius: 6px; padding: 0.15rem 0.35rem; }
.st-rt { font-size: 0.75rem; color: var(--text-muted); }
.st-vpc-foot { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.st-id {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--primary);
  border-radius: 6px;
  padding: 0 0.3rem;
  cursor: copy;
}
.st-id:hover { border-color: var(--primary); }

@media (max-width: 860px) {
  .st-cli-grid, .st-match { grid-template-columns: 1fr; }
  .st-term { height: 320px; }
  .st-flash { height: 300px; }
  .st-guess-row span { min-width: 0; width: 100%; }
  .st-sort-buckets { grid-template-columns: 1fr 1fr !important; }
}

/* ---- Examen escrito y Escribe el comando (ASO) ---- */
.st-chips-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.st-chip-btn { border: 1px solid var(--border); background: var(--bg-card); color: var(--text); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.82rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; }
.st-chip-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.st-written-area { width: 100%; min-height: 220px; margin-top: 0.8rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88rem; line-height: 1.45; padding: 0.7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; box-sizing: border-box; }
.st-written-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.st-written-result { margin-top: 0.8rem; border-radius: 10px; padding: 0.7rem 0.9rem; border: 1px solid var(--border); }
.st-written-result.ok { border-color: var(--success); background: var(--success-soft, rgba(34, 197, 94, 0.1)); }
.st-written-result.bad { border-color: var(--warning); background: var(--warning-soft, rgba(234, 179, 8, 0.1)); }
.st-keypoints { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.25rem; }
.st-keypoints li.ok { color: var(--success); }
.st-keypoints li.bad { color: var(--danger, #ef4444); }
.st-written-model { margin-top: 0.8rem; border-left: 4px solid var(--primary); padding: 0.5rem 0.8rem; background: var(--primary-soft); border-radius: 0 10px 10px 0; }
.st-written-model pre { white-space: pre-wrap; word-break: break-word; font-size: 0.85rem; margin: 0.4rem 0 0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.st-cmd-task { font-size: 1.02rem; margin: 0.8rem 0; }
.st-cmd-form { display: flex; align-items: center; gap: 0.5rem; background: #0f172a; border-radius: 10px; padding: 0.55rem 0.7rem; }
.st-cmd-prompt { color: #22c55e; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.st-cmd-input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: #f8fafc; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.95rem; }

/* ---------- Rellenar huecos (cloze) ---------- */
.st-cloze-text { line-height: 2.25; font-size: 1rem; margin: 0.6rem 0 0.9rem; }
.st-cloze-wrap { display: inline-flex; flex-direction: column; vertical-align: baseline; margin: 0 0.15rem; max-width: 100%; }
.st-cloze-input {
  font: inherit;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  min-width: 5ch;
  max-width: 100%;
  border: none;
  border-bottom: 2px solid var(--primary);
  border-radius: 6px 6px 0 0;
  background: var(--bg-hover, rgba(99, 102, 241, 0.08));
  color: var(--text);
  text-align: center;
}
.st-cloze-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.st-cloze-input.ok { border-bottom-color: var(--success, #10b981); background: color-mix(in srgb, var(--success, #10b981) 16%, transparent); }
.st-cloze-input.bad { border-bottom-color: var(--danger, #ef4444); background: color-mix(in srgb, var(--danger, #ef4444) 14%, transparent); }
.st-cloze-sol { font-size: 0.75rem; line-height: 1.2; color: var(--success, #10b981); font-weight: 700; text-align: center; }
@media (max-width: 640px) {
  .st-cloze-text { font-size: 0.95rem; line-height: 2.4; }
}

/* ---------- Herramientas DNS (dns-tools.js) ---------- */
.dns-plan { display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.4rem 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.dns-plan.ok span { color: var(--success); text-decoration: line-through; }
.dns-plan input { margin-top: 0.3rem; flex: none; width: auto; }
.dns-ready { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0 0.4rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.dns-ready .muted { grid-column: 2; font-size: 0.8rem; }
.dns-big { font-size: 1.25rem; min-height: 5.2rem; display: flex; align-items: center; justify-content: center; }
.dns-vf { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; max-width: 520px; margin: 0.6rem auto; }
.dns-vf .btn { min-height: 3.2rem; justify-content: center; }
.dns-route { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.6rem 0; }
.dns-hop { padding: 0.5rem 0.75rem; border-radius: 8px; border-left: 4px solid var(--border); background: var(--bg); font-size: 0.9rem; }
.dns-hop.rec { border-left-color: var(--primary); }
.dns-hop.ite { border-left-color: var(--warning); }
.dns-code { display: flex; flex-direction: column; background: #0a0f1a; border-radius: 10px; padding: 0.5rem; overflow-x: auto; }
.dns-code button { text-align: left; white-space: pre; background: transparent; color: #e2e8f0; border: 1px solid transparent; border-radius: 6px; padding: 0.28rem 0.5rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.84rem; cursor: pointer; }
.dns-code button:hover:not(:disabled) { background: #1e293b; }
.dns-done { color: var(--success); }
