/* ==========================================================================
   TARO // SESSION_30 — stylesheet
   Personalizza i colori qui sotto in :root se vuoi cambiare la palette.
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-panel: #121212;
  --bg-panel-2: #181818;
  --green: #00ff41;
  --green-dim: #0a5c1c;
  --orange: #ff6600;
  --cyan: #00e5ff;
  --yellow: #ffcc00;
  --red: #ff2b2b;
  --text-dim: #6b7d6f;
  --border: #1f2a20;
  --font: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--green);
  font-family: var(--font);
  overflow-x: hidden;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--green); color: #000; }

/* Scrollbar, stile mixer */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--green-dim); border: 2px solid var(--bg); }

/* ---------- Oscilloscopio di sfondo ---------- */
#scope-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.25;
  pointer-events: none;
}

/* ---------- Torii easter egg ---------- */
.torii {
  position: fixed;
  bottom: 14px;
  left: 10px;
  width: 42px;
  height: 34px;
  color: var(--green-dim);
  opacity: 0.55;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Layout principale ---------- */
#app {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,18,18,0.9), rgba(10,10,10,0.5));
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  font-size: 1.15rem;
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--green);
}
.logo .slash { color: var(--orange); }

.rec-indicator {
  font-size: 0.85rem;
  color: var(--orange);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rec-indicator .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: blink-rec 1.2s infinite;
}
@keyframes blink-rec {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

/* ---------- Righello temporale ---------- */
.timeline {
  position: relative;
  height: 34px;
  margin: 0 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.timeline-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  transition: width 0.6s ease;
  box-shadow: 0 0 12px var(--green);
}
.timeline-ticks {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  height: 100%;
  align-items: center;
  padding: 0 10px;
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.timeline-ticks span.active { color: #000; font-weight: bold; }
.timeline-ticks span {
  padding: 2px 4px;
}

/* ---------- Contenitore schermate ---------- */
#screen-root {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 18px;
}

.screen {
  width: 100%;
  max-width: 720px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 32px 28px;
  box-shadow: 0 0 40px rgba(0,255,65,0.05), inset 0 0 60px rgba(0,0,0,0.4);
  position: relative;
}

.screen.glitching {
  animation: glitch-fx 0.4s steps(2, end) 2;
}
@keyframes glitch-fx {
  0%   { transform: translate(0,0); filter: hue-rotate(0deg) contrast(1); }
  20%  { transform: translate(-3px, 2px); filter: hue-rotate(40deg) contrast(2); }
  40%  { transform: translate(3px, -1px); filter: hue-rotate(-30deg) contrast(1.5); }
  60%  { transform: translate(-2px, -2px); filter: hue-rotate(20deg) contrast(2); }
  80%  { transform: translate(2px, 1px); filter: hue-rotate(-10deg) contrast(1.2); }
  100% { transform: translate(0,0); filter: hue-rotate(0deg) contrast(1); }
}

.track-label {
  color: var(--orange);
  font-size: 0.8rem;
  letter-spacing: 2px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}

.terminal-text {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.98rem;
  min-height: 3em;
  cursor: default;
}
.terminal-text.typing::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  background: var(--green);
  vertical-align: text-bottom;
  animation: cursor-blink 0.8s steps(1) infinite;
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* ---------- Bottoni stile mixer ---------- */
.btn {
  font-family: var(--font);
  background: var(--bg-panel-2);
  color: var(--green);
  border: 1px solid var(--green-dim);
  padding: 12px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 1px;
  border-radius: 3px;
  position: relative;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: none;
  transition: all 0.15s ease;
}
.btn:hover {
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(0,255,65,0.35);
  transform: translateY(-1px);
}
.btn:hover::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.btn:active { transform: translateY(0); }
.btn.primary {
  border-color: var(--orange);
  color: var(--orange);
}
.btn.primary::before { background: var(--red); }
.btn.primary:hover {
  box-shadow: 0 0 14px rgba(255,102,0,0.45);
}
.btn.primary:hover::before { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-row {
  margin-top: 22px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Scelta multipla ---------- */
.options {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-btn {
  font-family: var(--font);
  text-align: left;
  background: var(--bg-panel-2);
  color: var(--green);
  border: 1px solid var(--border);
  padding: 13px 16px;
  font-size: 0.92rem;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}
.option-btn .opt-letter { color: var(--orange); margin-right: 8px; }
.option-btn:hover:not(:disabled) {
  border-color: var(--green);
  background: #1c221c;
  padding-left: 20px;
}
.option-btn:disabled { cursor: not-allowed; }
.option-btn.correct {
  border-color: var(--green);
  background: rgba(0,255,65,0.12);
  box-shadow: 0 0 14px rgba(0,255,65,0.3);
}
.option-btn.wrong {
  border-color: var(--red);
  background: rgba(255,43,43,0.12);
  box-shadow: 0 0 14px rgba(255,43,43,0.25);
}

.easter-tiny {
  color: #1a1a1a;
  font-size: 0.55rem;
  margin-top: 18px;
  user-select: none;
  letter-spacing: 0.5px;
}

.feedback {
  margin-top: 16px;
  font-size: 0.9rem;
  min-height: 1.4em;
  letter-spacing: 0.5px;
}
.feedback.ok { color: var(--green); text-shadow: 0 0 6px var(--green); }
.feedback.bad { color: var(--red); text-shadow: 0 0 6px var(--red); }

/* ---------- Livello 3: riassemblaggio frammenti audio ---------- */
.assembly-wrap {
  margin-top: 20px;
}
.assembled-track {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.assembled-track.shake {
  animation: shake-fx 0.4s ease;
}
@keyframes shake-fx {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.assembled-slot {
  width: 38px;
  height: 44px;
  border: 1px dashed var(--green-dim);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-dim);
  background: var(--bg-panel-2);
}
.assembled-slot.filled {
  border-style: solid;
  border-color: var(--orange);
  color: var(--orange);
  text-shadow: 0 0 8px rgba(255,102,0,0.5);
  background: #1c130a;
}
.fragment-pool {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.fragment-tile {
  font-family: var(--font);
  width: 42px;
  height: 42px;
  border: 1px solid var(--green-dim);
  background: var(--bg-panel-2);
  color: var(--green);
  font-size: 1.05rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.fragment-tile:hover:not(:disabled) {
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(0,255,65,0.3);
  transform: translateY(-2px);
}
.fragment-tile.used,
.fragment-tile:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.coord-note {
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ---------- Livello 4: Simon Says EQ ---------- */
.eq-simon-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (min-width: 480px) {
  .eq-simon-grid { grid-template-columns: repeat(4, 1fr); }
}
.eq-pad {
  font-family: var(--font);
  border: 2px solid var(--border);
  background: var(--bg-panel-2);
  padding: 22px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #dcdcdc;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-align: center;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.eq-pad:disabled { cursor: not-allowed; }
.eq-pad[data-band="bass"]     { border-color: #7a3b00; }
.eq-pad[data-band="midlow"]   { border-color: #7a6a00; }
.eq-pad[data-band="midhigh"]  { border-color: #0a5c1c; }
.eq-pad[data-band="treble"]   { border-color: #006670; }

.eq-pad.lit[data-band="bass"]     { background: var(--orange); color: #1a0a00; box-shadow: 0 0 24px var(--orange); }
.eq-pad.lit[data-band="midlow"]   { background: var(--yellow); color: #1a1500; box-shadow: 0 0 24px var(--yellow); }
.eq-pad.lit[data-band="midhigh"]  { background: var(--green); color: #001a05; box-shadow: 0 0 24px var(--green); }
.eq-pad.lit[data-band="treble"]   { background: var(--cyan); color: #001a1c; box-shadow: 0 0 24px var(--cyan); }

.eq-pad:active:not(:disabled) { transform: scale(0.94); }

.simon-status {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ---------- Barre EQ decorative (persistenti in basso) ---------- */
.eq-bar-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 16px 10px;
}
.eq-bar {
  width: 8px;
  height: 10px;
  background: linear-gradient(180deg, var(--green), var(--green-dim));
  border-radius: 2px 2px 0 0;
  animation: eq-bounce 1.1s ease-in-out infinite;
}
.eq-bar:nth-child(1) { animation-duration: 0.9s;  animation-delay: -0.1s; }
.eq-bar:nth-child(2) { animation-duration: 1.3s;  animation-delay: -0.4s; }
.eq-bar:nth-child(3) { animation-duration: 0.75s; animation-delay: -0.2s; }
.eq-bar:nth-child(4) { animation-duration: 1.1s;  animation-delay: -0.6s; }
.eq-bar:nth-child(5) { animation-duration: 0.95s; animation-delay: -0.3s; }
.eq-bar:nth-child(6) { animation-duration: 1.25s; animation-delay: -0.15s; }
.eq-bar:nth-child(7) { animation-duration: 0.85s; animation-delay: -0.5s; }
.eq-bar:nth-child(8) { animation-duration: 1.05s; animation-delay: -0.25s; }

@keyframes eq-bounce {
  0%, 100% { height: 6px; }
  25% { height: 34px; }
  50% { height: 14px; }
  75% { height: 42px; }
}

.eq-bar-container.exploding .eq-bar {
  animation: eq-explode 0.25s ease-in-out infinite;
  background: linear-gradient(180deg, var(--orange), var(--red));
}
@keyframes eq-explode {
  0%, 100% { height: 40px; }
  50% { height: 46px; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 12px 24px 18px;
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 6px;
}
.footer-jp {
  color: var(--green-dim);
  letter-spacing: 2px;
}

/* ---------- Schermata finale ---------- */
.final-hidden {
  color: #1a1a1a;
  font-size: 0.6rem;
  margin-top: 20px;
  user-select: none;
}

/* ---------- Intro loader ---------- */
.loader-lines {
  font-size: 0.9rem;
  line-height: 1.8;
  min-height: 6em;
}
.loader-lines .done { color: var(--text-dim); }
.loader-lines .done::before { content: '✓ '; color: var(--green); }

/* ---------- Onda sinusoidale SVG decorativa ---------- */
.sine-deco {
  width: 100%;
  height: 30px;
  margin: 14px 0;
  opacity: 0.5;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .topbar { padding: 14px 16px; }
  .timeline { margin: 0 16px; }
  .screen { padding: 24px 18px; }
  .logo { font-size: 0.95rem; }
  .timeline-ticks { font-size: 0.5rem; }
}
