/* Simulatore Attacchi Web — stile editoriale allineato alla home EVIL */

.sim-page {
  --sim-amber: #f59e0b;
  --sim-accent: #00ff9c;
  --sim-learn: #7dd3fc;
  --sim-serif: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  --sim-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --sim-card-bg: rgba(9, 14, 24, 0.72);
  --sim-border: rgba(255, 255, 255, 0.1);
}

.sim-page main {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2rem) clamp(3rem, 6vw, 4rem);
}

/* Sfondo morbido come home */
.sim-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.sim-backdrop-mesh {
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(ellipse 45% 40% at 15% 20%, rgba(167, 139, 250, 0.08), transparent 55%),
    radial-gradient(ellipse 40% 35% at 85% 60%, rgba(245, 158, 11, 0.07), transparent 50%),
    radial-gradient(ellipse 35% 30% at 50% 90%, rgba(0, 255, 156, 0.05), transparent 45%);
}

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

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

/* Intestazioni sezione (come home) */
.sim-section-kicker {
  margin: 0 0 0.45rem;
  font-family: var(--sim-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sim-amber);
}

.sim-section-head {
  margin-bottom: 1.25rem;
}

.sim-section-head h2 {
  margin: 0;
  font-family: var(--sim-serif);
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  font-weight: 400;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

/* Hero editorial */
.sim-hero--editorial {
  position: relative;
  padding: 0 0 clamp(2rem, 4vw, 2.75rem);
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: simFadeUp 0.65s ease-out both;
}

.sim-hero--editorial::before {
  display: none;
}

.sim-hero--editorial h1 {
  margin: 0 0 0.85rem;
  font-family: var(--sim-serif);
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  font-weight: 400;
  color: #f8fafc;
  letter-spacing: -0.02em;
  text-shadow: none;
  line-height: 1.15;
}

.sim-hero--editorial .hero-lead {
  color: #94a3b8;
  max-width: 40em;
  line-height: 1.7;
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
}

.sim-hero--editorial .hero-lead strong {
  color: #e2e8f0;
  font-weight: 600;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sim-chip {
  font-family: var(--sim-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 14, 24, 0.65);
  color: #94a3b8;
}

.sim-chip.amber {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.sim-chip.blue {
  border-color: rgba(167, 139, 250, 0.35);
  color: var(--sim-learn);
}

/* Etica — riga compatta */
.sim-ethics--compact {
  padding: 0 0 1.75rem;
  margin-bottom: 1.75rem;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  background: transparent;
  animation: simFadeUp 0.7s ease-out 0.08s both;
}

.sim-ethics--compact p {
  margin: 0;
  max-width: 42em;
  font-family: var(--sim-mono);
  font-size: 0.72rem;
  line-height: 1.65;
  letter-spacing: 0.03em;
  color: #64748b;
}

.sim-ethics--compact strong {
  color: #94a3b8;
}

.sim-ethics {
  padding: 0 0 clamp(2rem, 4vw, 2.5rem);
  margin-bottom: clamp(2rem, 4vw, 2.5rem);
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: transparent;
  animation: simFadeUp 0.7s ease-out 0.08s both;
}

.sim-ethics h2 {
  margin: 0 0 0.65rem;
  font-family: var(--sim-serif);
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  font-weight: 400;
  color: #f8fafc;
}

.sim-ethics p,
.sim-ethics li {
  color: #94a3b8;
  line-height: 1.7;
  font-size: 0.9rem;
}

.sim-ethics strong {
  color: #e2e8f0;
}

.sim-ethics ul {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
}

/* Phase rail */
.sim-phase-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
  animation: simFadeUp 0.75s ease-out 0.12s both;
}

.phase-card {
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--sim-border);
  border-left: 3px solid rgba(167, 139, 250, 0.45);
  background: var(--sim-card-bg);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.phase-card.active-phase {
  border-left-color: var(--sim-accent);
  border-color: rgba(0, 255, 156, 0.22);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.phase-card .phase-num {
  font-family: var(--sim-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sim-amber);
  margin-bottom: 0.35rem;
}

.phase-card h3 {
  margin: 0 0 0.35rem;
  font-family: var(--sim-serif);
  font-size: 0.95rem;
  font-weight: 400;
  color: #f8fafc;
}

.phase-card p {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.55;
}

/* Picker attacchi */
.sim-picker {
  margin-bottom: 1.25rem;
}

.attack-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.attack-btn {
  flex: 1 1 140px;
  min-width: 0;
  padding: 0.85rem 1rem;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--sim-border);
  border-left: 3px solid rgba(167, 139, 250, 0.35);
  background: var(--sim-card-bg);
  color: #e2e8f0;
  font-family: var(--sim-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.attack-btn .btn-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #64748b;
  text-transform: none;
}

.attack-btn:hover {
  border-color: rgba(167, 139, 250, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  color: #f8fafc;
}

.attack-btn.active {
  border-left-color: var(--sim-amber);
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
}

.attack-btn.active .btn-sub {
  color: #94a3b8;
}

/* Context */
.attack-context {
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 22, 0.55);
  animation: simFadeIn 0.35s ease-out;
}

.attack-context h2 {
  margin: 0 0 0.5rem;
  font-family: var(--sim-serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: #f8fafc;
}

.attack-context .plain-box {
  background: rgba(0, 0, 0, 0.28);
  border-left: 3px solid var(--sim-learn);
  padding: 0.75rem 0.9rem;
  border-radius: 0 8px 8px 0;
  margin: 0.75rem 0;
  color: #cbd5e1;
  line-height: 1.65;
  font-size: 0.88rem;
}

.attack-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.65rem;
}

/* Pannelli lab */
.simulator-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 0.5rem;
}

.simulation-panel,
.learn-panel {
  border-radius: 16px;
  padding: 1.35rem 1.4rem;
  min-height: 420px;
  border: 1px solid var(--sim-border);
  background: var(--sim-card-bg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.simulation-panel {
  position: relative;
  overflow: hidden;
  border-left: 3px solid rgba(0, 255, 156, 0.35);
}

.simulation-panel::after {
  content: 'Sandbox locale';
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--sim-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.45);
  font-weight: 600;
}

.learn-panel {
  border-left: 3px solid rgba(167, 139, 250, 0.4);
}

.panel-title {
  font-family: var(--sim-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sim-amber);
  margin-bottom: 1rem;
  padding-right: 6rem;
}

.panel-hint {
  font-size: 0.84rem;
  color: #64748b;
  margin: -0.5rem 0 1.1rem;
  line-height: 1.55;
}

.panel-hint code {
  font-family: var(--sim-mono);
  font-size: 0.78rem;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.input-group {
  margin-bottom: 1rem;
}

.input-label {
  display: block;
  font-family: var(--sim-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.4rem;
}

.input-field {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #e2e8f0;
  font-family: var(--sim-mono);
  font-size: 0.84rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: rgba(0, 255, 156, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 255, 156, 0.08);
}

.simulate-btn {
  width: 100%;
  padding: 0.75rem 1.25rem;
  margin-top: 0.25rem;
  border: none;
  border-radius: 999px;
  background: var(--sim-amber);
  color: #1a1208;
  font-family: var(--sim-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.simulate-btn:hover {
  background: #fbbf24;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.38);
}

.log-output {
  background: rgba(0, 0, 0, 0.38);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--sim-amber);
  border-radius: 10px;
  padding: 0.85rem;
  font-family: var(--sim-mono);
  font-size: 0.78rem;
  max-height: 320px;
  overflow-y: auto;
  color: #94a3b8;
  margin-top: 1.15rem;
}

.log-line {
  padding: 0.2rem 0;
  line-height: 1.55;
  animation: simFadeUp 0.3s ease-out forwards;
}

.log-success { color: var(--sim-accent); font-weight: 600; }
.log-error { color: #f87171; font-weight: 600; }
.log-warning { color: #fcd34d; }
.log-info { color: #7dd3fc; }

.risk-badge {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-family: var(--sim-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.risk-critical {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.risk-high {
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.learn-block {
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.learn-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.learn-block h3 {
  margin: 0 0 0.4rem;
  font-family: var(--sim-serif);
  font-size: 0.95rem;
  font-weight: 400;
  color: #f8fafc;
}

.learn-block p,
.learn-block li {
  margin: 0;
  color: #94a3b8;
  font-size: 0.86rem;
  line-height: 1.6;
}

.learn-block ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.code-snippet {
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid var(--sim-learn);
  padding: 0.65rem 0.85rem;
  border-radius: 0 8px 8px 0;
  font-family: var(--sim-mono);
  font-size: 0.78rem;
  color: #cbd5e1;
  margin: 0.65rem 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.defense-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.defense-list li {
  padding: 0.4rem 0 0.4rem 1.25rem;
  position: relative;
  color: #94a3b8;
  font-size: 0.84rem;
  line-height: 1.55;
}

.defense-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--sim-accent);
  font-weight: 600;
}

.tab-content {
  display: none;
  opacity: 0;
}

.tab-content.active {
  display: block;
  opacity: 1;
  animation: simFadeUp 0.45s ease-out forwards;
}

.sim-page .status-bar {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px dashed rgba(245, 158, 11, 0.2);
  background: rgba(8, 12, 22, 0.55);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sim-page .status-bar__inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.65rem;
  min-width: min-content;
  white-space: nowrap;
  font-family: var(--sim-mono);
  font-size: clamp(0.62rem, 1.05vw, 0.72rem);
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.sim-page .status-bar__segment strong {
  color: #e2e8f0;
  font-weight: 600;
}

.sim-page .status-bar__sep {
  color: #64748b;
  flex-shrink: 0;
  user-select: none;
}

.sim-page .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--sim-accent);
  box-shadow: 0 0 10px rgba(0, 255, 156, 0.45);
}

@media (max-width: 992px) {
  .sim-phase-rail {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .simulator-container {
    grid-template-columns: 1fr;
  }

  .sim-phase-rail {
    grid-template-columns: 1fr;
  }

  .attack-btn {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sim-hero--editorial,
  .sim-ethics,
  .sim-phase-rail,
  .tab-content.active,
  .log-line {
    animation: none;
  }

  .simulate-btn:hover,
  .attack-btn:hover,
  .phase-card.active-phase {
    transform: none;
  }
}
