/* MORPHEUS // M-VAVE FM-1 Authentic Web Emulator Styles */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600&family=Barlow+Semi+Condensed:wght@600;700;800&display=swap');

:root {
  --ground: #060a08;
  --ink: #e0fbe6;
  --muted: #739980;
  --rule: #182c1e;
  --accent: #00ff66;
  --accent-warm: #ffb71a;
  --accent-cyan: #00f0ff;
  --accent-glow: rgba(0, 255, 102, 0.45);
  --card: #0b140e;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--ground);
  color: var(--ink);
  margin: 0;
  padding-inline: 16px;
  padding-block: 20px 48px;
  font: 400 16px/1.55 "Barlow", "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

main {
  max-width: 1040px;
  margin: 0 auto;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1.2rem;
  margin: 0 0 1rem;
}

h1 {
  font: 800 2.2rem/1.1 "Barlow Semi Condensed", "Barlow", sans-serif;
  margin: 0;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 0 16px rgba(0, 255, 102, 0.35);
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

header nav {
  margin-left: auto;
  display: flex;
  gap: 1.2rem;
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

header nav a:hover {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 255, 102, 0.6);
}

a {
  color: var(--accent);
}

/* Device Shell and Positioning */
.devicebox {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin-bottom: 0.8rem;
}

.device {
  position: relative;
  width: 100%;
  min-width: 560px;
  aspect-ratio: 1000 / 640;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  border-radius: 4.4% / 6.9%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 255, 102, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.08);
  background: #18221c;
}

.device svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* 240x240 LCD Screen sits precisely in the center bezel */
.device canvas {
  position: absolute;
  left: 31.8%;
  top: 9.6875%;
  width: 20%;
  height: 31.25%;
  image-rendering: pixelated;
  background: #050c07;
  border-radius: 4px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.95), 0 0 16px rgba(0, 255, 102, 0.22);
  cursor: crosshair;
  z-index: 10;
}

.controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hit {
  position: absolute;
  touch-action: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 12px;
  pointer-events: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  appearance: none;
  z-index: 20;
}

.hit.knob {
  cursor: ns-resize;
  border-radius: 50%;
}

.hit:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.device:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4.4% / 6.9%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ctl {
  cursor: pointer;
}

.ctl.knob {
  cursor: ns-resize;
}

.btnface {
  transition: fill .06s, stroke .06s;
}

.lit .btnface {
  fill: var(--accent);
}

.lit text.btn {
  fill: #1b1205;
}

.held .btnface, .held .keyface {
  stroke: var(--accent);
  stroke-width: 3.5;
}

.latched .btnface {
  stroke: #6fc3ff;
  stroke-width: 3.5;
}

.keyface {
  transition: fill .06s, stroke .06s, transform .06s;
}

.lit .keyface.white {
  fill: #ffb71a;
  stroke: #ffe082;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(255, 183, 26, 0.6));
}

.lit.playhead .keyface.white {
  fill: #ffffff;
  stroke: #00ff66;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px #ffffff);
}

.lit .keyface.black {
  fill: #e0902c;
  stroke: #ffd54f;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(224, 144, 44, 0.6));
}

.held .keyface.white {
  fill: #00ff66;
  stroke: #ffffff;
  stroke-width: 3;
  filter: drop-shadow(0 0 8px #00ff66);
}

.held .keyface.black {
  fill: #00cc55;
  stroke: #ffffff;
  stroke-width: 3;
  filter: drop-shadow(0 0 8px #00ff66);
}

/* Switch On Start Screen Overlay */
.start {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 13, .55);
  backdrop-filter: blur(2px);
  border-radius: 4.4% / 6.9%;
  z-index: 50;
  transition: opacity 0.2s ease;
}

.start button {
  font: 700 1.3rem "Barlow Semi Condensed", "Barlow", sans-serif;
  letter-spacing: .04em;
  padding: .75em 1.8em;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #041407;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 255, 102, 0.45);
  transition: transform 0.1s ease, filter 0.15s ease;
}

.start button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.start[hidden] {
  display: none !important;
}

/* Live Dynamic Hint Banner */
.hint-banner {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #182029;
  border: 1px solid #2e3a48;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 11px 16px;
  margin: 0.8rem 0;
  font-size: 0.95rem;
  color: #e2e8f0;
  transition: all 0.12s ease;
}

.hint-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.hint-text {
  line-height: 1.45;
  font-weight: 500;
}

/* Bottom Control Bar */
.bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.2rem;
  align-items: center;
  margin: .8rem 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.bar button {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: .35em .85em;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bar button:hover {
  background: #252a30;
  border-color: #4a525d;
}

.bar button[aria-pressed="true"] {
  background: var(--accent);
  color: #1b1205;
  border-color: var(--accent);
  font-weight: 600;
}

.bar .cpu {
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

/* Pattern Management Toolbar */
.toolbar-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.6rem;
  align-items: center;
  margin: 0.8rem 0 0;
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 0.9rem;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-label {
  color: var(--muted);
  font-weight: 600;
  margin-right: 0.2rem;
}

.toolbar-box button {
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: #252a30;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.35em 0.8em;
  cursor: pointer;
  transition: all 0.1s ease;
}

.toolbar-box button:hover {
  background: #333a42;
  border-color: #555f6d;
  color: #fff;
}

.toolbar-box button:active {
  transform: translateY(1px);
}

.toolbar-box button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: #2b3038;
  background: #1b1e22;
  color: #667280;
  transform: none;
}

.toolbar-box button[aria-pressed="true"], .toolbar-box button.active-toggle {
  background: #00ff66;
  color: #041407;
  font-weight: 700;
  border-color: #66ff99;
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.45);
}

/* Preset Grooves Bar */
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.8rem;
  margin: 0.8rem 0 0;
  padding: 0.8rem 1rem;
  background: #0c1810;
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 0.9rem;
}

.presets-label {
  color: var(--muted);
  font-weight: 600;
  margin-right: 0.4rem;
}

.preset-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d0fcd9;
  background: #14241a;
  border: 1px solid #1e3826;
  border-radius: 6px;
  padding: 0.35em 0.85em;
  cursor: pointer;
  transition: all 0.1s ease;
}

.preset-btn:hover {
  background: #1e3826;
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.3);
}

.preset-btn.active {
  background: var(--accent);
  color: #041407;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.45);
}

/* 4-Card Quick Start Guide */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin: 1.6rem 0 0;
}

.guide-card {
  background: #171a1f;
  border: 1px solid #282d35;
  border-radius: 12px;
  padding: 16px 18px;
  transition: border-color 0.15s ease;
}

.guide-card:hover {
  border-color: #444e5c;
}

.guide-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.guide-badge {
  background: #262e38;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: "Barlow Semi Condensed", sans-serif;
  letter-spacing: 0.5px;
}

.guide-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
  font-family: "Barlow Semi Condensed", sans-serif;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Help & Instructions Section */
.help {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.5rem 2rem;
  margin: 1.8rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.help h2 {
  font: 700 1.15rem "Barlow Semi Condensed", "Barlow", sans-serif;
  margin: 0 0 .4rem;
  color: var(--ink);
}

.help p, .help ul {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
}

.help ul {
  padding-left: 1.2rem;
}

kbd {
  font: 600 .85em ui-monospace, Menlo, monospace;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .1em .35em;
  color: var(--ink);
}

/* Interactive Walkthrough HUD & Hardware Spotlights */
.walkthrough-hud {
  background: #08120b;
  border: 1px solid #16301d;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 18px 22px;
  margin: 14px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.6), 0 0 20px rgba(0, 255, 102, 0.12);
  animation: fadeIn 0.25s ease-out;
}

.walkthrough-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.walkthrough-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 255, 102, 0.12);
  color: var(--accent);
  border: 1px solid rgba(0, 255, 102, 0.35);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.2);
}

.walkthrough-progress-track {
  display: flex;
  gap: 6px;
  align-items: center;
}

.walkthrough-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #193622;
  transition: all 0.2s ease;
  cursor: pointer;
}

.walkthrough-dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transform: scale(1.25);
}

.walkthrough-dot.completed {
  background: var(--accent-warm);
}

.walkthrough-title {
  font: 700 1.25rem/1.2 "Barlow Semi Condensed", sans-serif;
  color: #fff;
  margin: 0;
  text-shadow: 0 0 10px rgba(0, 255, 102, 0.3);
}

.walkthrough-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #c7ebcf;
}

.walkthrough-sound-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #09160d;
  border-left: 3px solid #a3ff3b;
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  font-size: 0.88rem;
  color: #d6ffd0;
}

.walkthrough-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.walkthrough-nav {
  display: flex;
  gap: 8px;
}

.walkthrough-btn {
  background: #122418;
  color: #e0fbe6;
  border: 1px solid #1e3826;
  border-radius: 5px;
  padding: 7px 15px;
  font: 600 0.88rem "Barlow", sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.walkthrough-btn:hover:not(:disabled) {
  background: #1a3322;
  color: #fff;
  border-color: #2b5036;
}

.walkthrough-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.walkthrough-btn-primary {
  background: var(--accent);
  color: #041407;
  font-weight: 700;
  border-color: #66ff99;
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.45);
}

.walkthrough-btn-primary:hover:not(:disabled) {
  background: #33ff88;
  color: #000;
  box-shadow: 0 0 18px rgba(0, 255, 102, 0.7);
}

.walkthrough-btn-close {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
}

.walkthrough-btn-close:hover {
  color: #fff;
}

/* Live Hardware Spotlights on the SVG faceplate */
.device.tutorial-mode .ctl {
  opacity: 0.22;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.device.tutorial-mode .ctl.spotlight-press {
  opacity: 1 !important;
  filter: drop-shadow(0 0 14px rgba(0, 255, 102, 0.95)) !important;
  animation: spotlightPulse 1.8s infinite ease-in-out;
}

.device.tutorial-mode .ctl.spotlight-press rect,
.device.tutorial-mode .ctl.spotlight-press circle {
  stroke: #ffffff !important;
  stroke-width: 2.5px !important;
}

.device.tutorial-mode .ctl.spotlight-hold {
  opacity: 1 !important;
  filter: drop-shadow(0 0 14px rgba(163, 255, 59, 0.95)) !important;
  animation: spotlightHoldPulse 1.8s infinite ease-in-out;
}

.device.tutorial-mode .ctl.spotlight-hold rect,
.device.tutorial-mode .ctl.spotlight-hold circle {
  stroke: #a3ff3b !important;
  stroke-width: 3px !important;
}

.device.tutorial-mode .ctl.spotlight-key {
  opacity: 1 !important;
  filter: drop-shadow(0 0 12px rgba(0, 255, 102, 0.9)) !important;
}

.device.tutorial-mode .ctl.spotlight-key rect {
  fill: #00ff66 !important;
  stroke: #ffffff !important;
  stroke-width: 2px !important;
}

@keyframes spotlightPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 255, 102, 0.7)); }
  50% { filter: drop-shadow(0 0 18px rgba(0, 255, 102, 1)); }
}

@keyframes spotlightHoldPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(163, 255, 59, 0.7)); }
  50% { filter: drop-shadow(0 0 18px rgba(163, 255, 59, 1)); }
}

/* Numbered Action Pins [1], [2], [3] */
.pin-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.tutorial-pin {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #041407;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8), 0 0 10px var(--accent);
  transform: translate(-50%, -50%);
  animation: pinBounce 1.8s infinite ease-in-out;
}

.tutorial-pin.pin-hold {
  background: #a3ff3b;
  color: #041407;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8), 0 0 10px #a3ff3b;
}

@keyframes pinBounce {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -58%) scale(1.12); }
}

/* Manual Tutorial Card Styling */
.tutorial-card {
  background: #09120c;
  border: 1px solid #1a3322;
  border-radius: 10px;
  padding: 24px;
  margin: 28px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 16px rgba(0, 255, 102, 0.08);
}

.tutorial-card-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.step-num {
  font: 800 0.85rem "Barlow Semi Condensed", sans-serif;
  background: var(--accent);
  color: #041407;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: .05em;
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.4);
}

.tutorial-card h3 {
  font: 700 1.4rem "Barlow Semi Condensed", sans-serif;
  color: #fff;
  margin: 0;
  text-shadow: 0 0 10px rgba(0, 255, 102, 0.25);
}

.action-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 16px;
  font-size: 0.92rem;
}

.action-table th, .action-table td {
  border: 1px solid #1a3322;
  padding: 10px 14px;
  text-align: left;
}

.action-table th {
  background: #0c1810;
  color: #fff;
  font-weight: 600;
}

.action-table tr:nth-child(even) {
  background: #070e09;
}

.btn-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #00ff66;
  color: #041407;
  box-shadow: 0 0 6px rgba(0, 255, 102, 0.35);
}

.btn-hold {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #0d2816;
  color: #a3ff3b;
  border: 1px solid #a3ff3b;
}

.knob-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #0a2012;
  color: #00ff66;
  border: 1px solid #00ff66;
}

.key-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #e0fbe6;
  color: #041407;
}

.callout-hear {
  background: #08140c;
  border-left: 4px solid #a3ff3b;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: #d6ffd0;
  margin: 12px 0 0;
}
