/* ============================================================
   Bitcoin & Blockchain — Laboratorio STEM | Liceo Palmieri
   Stile: Dark theme con accenti Bitcoin gold/orange
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

/* ── VARIABILI ───────────────────────────────────────────── */
:root {
  --bg:         #0a0e1a;
  --surface:    #111827;
  --surface2:   #1a2235;
  --border:     rgba(255,255,255,0.08);
  --border2:    rgba(255,165,0,0.25);

  --gold:       #f7931a;
  --gold-light: #ffb347;
  --gold-dark:  #c97214;
  --cyan:       #00d2ff;
  --green:      #10b981;
  --red:        #ef4444;
  --purple:     #8b5cf6;

  --text:       #f1f5f9;
  --muted:      #94a3b8;
  --code-bg:    #0d1117;

  --radius:     14px;
  --radius-lg:  20px;
  --shadow:     0 8px 32px rgba(0,0,0,0.5);
  --glow-gold:  0 0 30px rgba(247,147,26,0.3);
  --glow-cyan:  0 0 20px rgba(0,210,255,0.25);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

/* ── NAV ─────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; width: 100%; z-index: 1000;
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex; align-items: center;
}
.nav-inner {
  max-width: 1100px; width: 100%;
  margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 1.1rem;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-decoration: none;
}
.nav-brand span.logo { font-size: 1.6rem; }
.nav-links {
  display: flex; gap: 4px;
}
.nav-links a {
  color: var(--muted); text-decoration: none;
  padding: 6px 14px; border-radius: 8px;
  font-size: 0.875rem; font-weight: 500;
  transition: all 0.25s;
}
.nav-links a:hover { background: rgba(247,147,26,0.1); color: var(--gold); }

/* ── HERO ────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(247,147,26,0.12), transparent),
    radial-gradient(ellipse 50% 40% at 10% 80%, rgba(0,210,255,0.08), transparent);
}
.hero-particles {
  position: absolute; inset: 0; pointer-events: none;
  overflow: hidden;
}
.hero-content {
  position: relative; z-index: 2;
  max-width: 760px; text-align: center; padding: 0 24px;
  animation: fadeUp 0.9s ease both;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 18px; border-radius: 99px;
  background: rgba(247,147,26,0.1);
  border: 1px solid rgba(247,147,26,0.3);
  color: var(--gold-light);
  font-size: 0.85rem; font-weight: 600; margin-bottom: 28px;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800; line-height: 1.1; margin-bottom: 22px;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--gold), var(--gold-light), #fff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-desc {
  font-size: 1.15rem; color: var(--muted); margin-bottom: 40px; max-width: 560px; margin-inline: auto;
}
.hero-btns {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; border-radius: 10px;
  font-weight: 700; font-size: 0.95rem;
  border: none; cursor: pointer; text-decoration: none;
  transition: all 0.25s;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000; box-shadow: 0 4px 18px rgba(247,147,26,0.4);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(247,147,26,0.5); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border2); color: var(--gold-light);
}
.btn-outline:hover { background: rgba(247,147,26,0.08); }

/* floating Bitcoin symbol */
.btc-float {
  position: absolute; right: 8%; top: 20%;
  font-size: 14rem; opacity: 0.04;
  animation: floatSlow 10s ease-in-out infinite;
  pointer-events: none; user-select: none;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
main {
  max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px;
}

/* ── SECTION ─────────────────────────────────────────────── */
.section {
  margin-bottom: 60px;
  animation: fadeUp 0.6s ease both;
}
.section-head {
  display: flex; align-items: center; gap: 16px; margin-bottom: 28px;
}
.section-num {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: #000;
  flex-shrink: 0; box-shadow: var(--glow-gold);
}
.section-head h2 { font-size: 1.7rem; font-weight: 800; }
.section-head p { color: var(--muted); font-size: 0.95rem; margin-top: 2px; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.concept-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative; overflow: hidden;
  transition: all 0.3s;
}
.concept-card:hover {
  border-color: var(--border2);
  box-shadow: var(--glow-gold);
}
.concept-card .icon { font-size: 2.4rem; margin-bottom: 12px; display: block; }
.concept-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.concept-card p { color: var(--muted); font-size: 0.9rem; }

/* highlight box */
.highlight-box {
  background: rgba(247,147,26,0.08);
  border: 1px solid rgba(247,147,26,0.25);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
}
.highlight-box p { color: var(--text); font-size: 0.95rem; }
.highlight-box strong { color: var(--gold-light); }

/* info-box cyan */
.info-box {
  background: rgba(0,210,255,0.06);
  border: 1px solid rgba(0,210,255,0.2);
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius);
  padding: 18px 22px; margin: 16px 0;
}
.info-box p { color: var(--text); font-size: 0.92rem; }

/* ── HASH SIMULATOR ──────────────────────────────────────── */
#hash-sim { }
.hash-io {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px;
  align-items: center; margin-top: 20px;
}
@media (max-width: 640px) { .hash-io { grid-template-columns: 1fr; } }
.hash-input-area { }
.hash-input-area label {
  display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; font-weight: 600;
}
.hash-input-area textarea {
  width: 100%; min-height: 90px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  color: var(--text); font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem; resize: vertical;
  transition: border-color 0.25s;
}
.hash-input-area textarea:focus {
  outline: none; border-color: var(--gold);
}
.hash-arrow {
  text-align: center; font-size: 2rem; color: var(--gold);
  animation: pulse 2s infinite;
}
.hash-output-area label {
  display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; font-weight: 600;
}
.hash-output {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem; color: var(--cyan);
  min-height: 90px; word-break: break-all;
  transition: all 0.4s;
  display: flex; flex-direction: column; justify-content: center;
}
.hash-output.changed {
  border-color: var(--gold); box-shadow: 0 0 16px rgba(247,147,26,0.3);
  animation: flashGold 0.5s ease;
}
.hash-properties {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px;
}
.hash-prop {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px;
  font-size: 0.82rem; color: var(--muted);
}
.hash-prop span { color: var(--gold-light); font-weight: 700; }

/* ── BLOCKCHAIN VISUALIZER ───────────────────────────────── */
.chain-container {
  overflow-x: auto; padding-bottom: 12px;
}
.chain {
  display: flex; align-items: stretch; gap: 0;
  min-width: max-content; padding: 20px 0;
}
.block {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px; width: 230px; flex-shrink: 0;
  position: relative;
  transition: all 0.4s;
}
.block.genesis { border-color: rgba(247,147,26,0.5); }
.block.valid   { border-color: rgba(16,185,129,0.5); }
.block.invalid { border-color: rgba(239,68,68,0.6); background: rgba(239,68,68,0.05); }
.block-header {
  font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.block-num {
  background: var(--gold); color: #000;
  border-radius: 6px; padding: 2px 8px; font-weight: 800; font-size: 0.8rem;
}
.block.invalid .block-num { background: var(--red); color: #fff; }
.block-field {
  margin-bottom: 8px;
}
.block-field label {
  font-size: 0.7rem; color: var(--muted); display: block; margin-bottom: 2px;
}
.block-field .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; color: var(--cyan);
  background: var(--code-bg); border-radius: 6px;
  padding: 4px 8px; word-break: break-all;
}
.block-field .val.gold { color: var(--gold); }
.block-field .val.green { color: var(--green); }
.block-field .val.red { color: var(--red); }
.chain-link {
  display: flex; align-items: center; padding: 0 6px;
  color: var(--gold); font-size: 1.5rem;
  align-self: center; flex-shrink: 0;
}
.chain-link.broken { color: var(--red); }

/* block data input */
.block-data-input {
  width: 100%; background: var(--code-bg);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem;
  margin-top: 6px;
}
.block-data-input:focus { outline: none; border-color: var(--gold); }

.chain-controls {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center;
}
.btn-sm {
  padding: 8px 18px; font-size: 0.85rem; border-radius: 8px;
  font-weight: 700; border: none; cursor: pointer; transition: all 0.25s;
}
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #0ea172; }
.btn-red   { background: var(--red);   color: #fff; }
.btn-red:hover { background: #dc2626; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 8px; padding: 8px 18px;
  font-size: 0.85rem; cursor: pointer; font-weight: 600;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.chain-status {
  flex: 1; text-align: right; font-size: 0.88rem; font-weight: 600;
}
.chain-status.ok   { color: var(--green); }
.chain-status.bad  { color: var(--red); }

/* ── MINING SIMULATOR ────────────────────────────────────── */
.mining-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-top: 20px;
}
@media (max-width: 700px) { .mining-layout { grid-template-columns: 1fr; } }
.mining-panel {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.mining-panel h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--gold-light);
}
.mine-row {
  display: flex; justify-content: space-between; margin-bottom: 10px;
  font-size: 0.88rem;
}
.mine-row .lbl { color: var(--muted); }
.mine-row .val { font-family: 'JetBrains Mono', monospace; color: var(--cyan); font-weight: 600; }
.difficulty-bar {
  display: flex; gap: 6px; margin: 14px 0;
}
.diff-dot {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: all 0.2s;
}
.diff-dot.active { background: var(--gold); border-color: var(--gold); color: #000; }
.mine-btn {
  width: 100%; padding: 12px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none; color: #000; font-weight: 800; font-size: 1rem;
  cursor: pointer; transition: all 0.25s; margin-top: 14px;
}
.mine-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--glow-gold); }
.mine-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mine-log {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  color: var(--muted); height: 180px; overflow-y: auto;
  background: var(--code-bg); border-radius: 8px; padding: 12px;
}
.mine-log .found { color: var(--green); font-weight: 700; }
.mine-log .trying { color: var(--muted); }

.nonce-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.4rem; font-weight: 800; color: var(--gold);
  text-align: center; margin: 14px 0;
  min-height: 56px;
}
.hash-target {
  text-align: center; font-size: 0.82rem; color: var(--muted);
  margin-bottom: 4px;
}
.hash-current {
  text-align: center; font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; word-break: break-all;
  color: var(--cyan); min-height: 40px;
}
.hash-current.found-hash { color: var(--green); animation: flashGreen 0.5s ease; }

/* ── QUIZ ────────────────────────────────────────────────── */
.quiz-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; margin-bottom: 16px;
}
.quiz-q { font-weight: 700; margin-bottom: 16px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 580px) { .quiz-options { grid-template-columns: 1fr; } }
.quiz-opt {
  padding: 11px 16px; border-radius: 9px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 0.9rem; text-align: left;
  transition: all 0.2s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-light); }
.quiz-opt.correct { background: rgba(16,185,129,0.15); border-color: var(--green); color: var(--green); }
.quiz-opt.wrong   { background: rgba(239,68,68,0.12); border-color: var(--red);   color: var(--red); }
.quiz-feedback { margin-top: 14px; font-size: 0.9rem; min-height: 24px; }
.quiz-feedback.ok  { color: var(--green); }
.quiz-feedback.bad { color: var(--red); }
.quiz-nav {
  display: flex; justify-content: space-between; align-items: center; margin-top: 20px;
}
.score-bar {
  display: flex; gap: 8px; margin-top: 16px;
}
.score-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  transition: all 0.3s;
}
.score-dot.ok  { background: var(--green); border-color: var(--green); }
.score-dot.bad { background: var(--red);   border-color: var(--red); }

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, var(--gold), transparent);
}
.tl-item { position: relative; margin-bottom: 32px; }
.tl-item::before {
  content: ''; position: absolute; left: -37px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px rgba(247,147,26,0.6);
}
.tl-year {
  font-size: 0.78rem; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px;
}
.tl-item h4 { font-weight: 700; margin-bottom: 4px; }
.tl-item p  { color: var(--muted); font-size: 0.9rem; }

/* ── ANALOGY ─────────────────────────────────────────────── */
.analogy-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px;
  align-items: center; margin-top: 20px;
}
@media (max-width: 640px) { .analogy-grid { grid-template-columns: 1fr; text-align: center; } }
.analogy-side {
  background: var(--surface2); border-radius: var(--radius);
  padding: 22px; text-align: center;
}
.analogy-side .big { font-size: 3rem; margin-bottom: 10px; }
.analogy-side h3  { font-weight: 700; margin-bottom: 6px; }
.analogy-side p   { font-size: 0.85rem; color: var(--muted); }
.analogy-vs {
  font-size: 1.5rem; font-weight: 800; color: var(--gold);
  text-align: center;
}

/* ── RESULT BOX ──────────────────────────────────────────── */
.result-box {
  background: var(--surface2); border-radius: var(--radius);
  padding: 30px; text-align: center; margin-top: 16px;
}
.result-box .big-score {
  font-size: 3.5rem; font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-box p { color: var(--muted); margin-top: 8px; }

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  text-align: center; padding: 40px 24px;
  color: var(--muted); font-size: 0.88rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--gold); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%       { transform: translateY(-30px) rotate(3deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes flashGold {
  0%   { box-shadow: 0 0 0 rgba(247,147,26,0); }
  50%  { box-shadow: 0 0 28px rgba(247,147,26,0.6); }
  100% { box-shadow: 0 0 0 rgba(247,147,26,0); }
}
@keyframes flashGreen {
  0%   { box-shadow: 0 0 0 rgba(16,185,129,0); }
  50%  { box-shadow: 0 0 28px rgba(16,185,129,0.5); }
  100% { box-shadow: 0 0 0 rgba(16,185,129,0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes particleFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  max-width: 600px; width: 90%;
  max-height: 85vh; overflow-y: auto;
  padding: 32px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow), var(--glow-gold);
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: none;
  color: var(--muted); font-size: 1.5rem; cursor: pointer;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--gold); }

.modal-content h2 { margin-bottom: 20px; color: var(--gold); }
.modal-content p { margin-bottom: 16px; font-size: 0.95rem; }
.modal-content ul { margin-bottom: 16px; padding-left: 20px; }
.modal-content li { margin-bottom: 8px; color: var(--muted); font-size: 0.9rem; }
