/* ─── Tutorial Modal ───────────────────────────────────────────────────────── */
#tutorial-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: 440px;
  max-width: 95vw;
  z-index: 99999;
  background: rgba(4,4,2,.96);
  border-left: 1px solid #1a3a1a;
  box-shadow: -4px 0 30px rgba(0,0,0,.7), 0 0 60px rgba(0,255,0,.03);
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  overflow-y: auto;
  animation: tutSlideIn .3s ease;
}
#tutorial-overlay.active { display: flex; }

@keyframes tutSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes tutSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes tutGlitch {
  0%, 100% { text-shadow: none; }
  20% { text-shadow: -2px 0 #f00, 2px 0 #0ff; }
  40% { text-shadow: 2px 0 #f00, -2px 0 #0ff; }
  60% { text-shadow: -1px 1px #f00, 1px -1px #0ff; }
}
@keyframes tutScanline {
  0% { background-position: 0 0; }
  100% { background-position: 0 100%; }
}
@keyframes tutBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}
@keyframes tutTypewriter {
  from { width: 0; }
  to   { width: 100%; }
}

#tutorial-modal {
  position: relative;
  width: 100%;
  max-height: none;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  animation: tutSlideUp .4s ease;
}

/* Scanline effect over the panel */
#tutorial-modal::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 95vw;
  pointer-events: none;
  z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,255,0,.012) 2px,
    rgba(0,255,0,.012) 4px
  );
  animation: tutScanline 8s linear infinite;
}

/* Portrait area */
.tut-portrait-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 0 18px;
}

.tut-portrait {
  width: 70px;
  height: 70px;
  border: 1px solid #1a3a1a;
  background: #050505;
  flex-shrink: 0;
  image-rendering: pixelated;
  position: relative;
  overflow: hidden;
}
.tut-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder portrait when no image loaded */
.tut-portrait-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #1a5a1a;
  background: linear-gradient(135deg, #080808, #0a0f0a);
  font-family: monospace;
}

.tut-speaker {
  flex: 1;
  min-width: 0;
}

.tut-speaker-name {
  font-family: monospace;
  font-size: 16px;
  letter-spacing: .18em;
  color: #2a6a2a;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.tut-speaker-title {
  font-family: monospace;
  font-size: 13px;
  letter-spacing: .12em;
  color: #1a3a1a;
  text-transform: uppercase;
}

/* Content area */
.tut-body {
  padding: 14px 18px 10px 18px;
  position: relative;
  z-index: 1;
}

.tut-heading {
  font-size: 20px;
  font-family: monospace;
  letter-spacing: .14em;
  color: #3a8a3a;
  text-transform: uppercase;
  margin: 0 0 10px 0;
  animation: tutGlitch 4s infinite;
}

.tut-text {
  font-family: monospace;
  font-size: 15px;
  line-height: 1.7;
  color: #8a8a7a;
  margin: 0;
  min-height: 70px;
}

.tut-text em {
  color: #4eaa4e;
  font-style: normal;
}

.tut-text strong {
  color: #cc8833;
  font-weight: normal;
}

.tut-text .warn {
  color: #aa3333;
}

/* Step indicator */
.tut-steps {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 20px 6px 20px;
  justify-content: center;
}

.tut-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a2a1a;
  transition: background .2s, box-shadow .2s;
}
.tut-dot.active {
  background: #3a8a3a;
  box-shadow: 0 0 6px rgba(0,255,0,.3);
}
.tut-dot.seen {
  background: #2a4a2a;
}

/* Controls */
.tut-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px 16px 18px;
}

.tut-btn {
  font-family: monospace;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 8px 18px;
  border: 1px solid #1a3a1a;
  background: transparent;
  color: #4a8a4a;
  cursor: pointer;
  transition: all .15s;
}
.tut-btn:hover {
  background: #1a3a1a;
  color: #aaffaa;
  border-color: #3a6a3a;
}
.tut-btn.primary {
  border-color: #2a6a2a;
  background: #0a1a0a;
}
.tut-btn.primary:hover {
  background: #1a4a1a;
  border-color: #4a8a4a;
}

.tut-skip {
  font-family: monospace;
  font-size: 13px;
  letter-spacing: .1em;
  color: #3a3a3a;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  transition: color .15s;
}
.tut-skip:hover {
  color: #6a3a3a;
}

/* Terminal cursor blink in text */
.tut-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: #3a8a3a;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: tutBlink 1s infinite;
}

/* Highlight callouts */
.tut-callout {
  margin-top: 8px;
  padding: 6px 10px;
  border-left: 2px solid #2a5a2a;
  background: rgba(0,255,0,.02);
  font-family: monospace;
  font-size: 14px;
  color: #5a8a5a;
  letter-spacing: .06em;
}

/* Responsive */
@media (max-width: 500px) {
  #tutorial-overlay { width: 100vw; }
  .tut-portrait { width: 56px; height: 56px; }
  .tut-text { font-size: 14px; }
  .tut-heading { font-size: 17px; }
}
