
/* ======================================================
   ALAP BEÁLLÍTÁSOK
   ====================================================== */
body {
  background: rgb(0, 0, 0);
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

:root {
  --accent: #f7ffdb;
  --accent-glow: rgba(247, 255, 219, 0.5);
  --panel-bg: rgba(12, 14, 24, 0.72);
  --panel-border: rgba(247, 255, 219, 0.22);
  --panel-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  --kbd-bg: rgba(247, 255, 219, 0.10);
  --kbd-border: rgba(247, 255, 219, 0.35);
}

/* ======================================================
   SZEKVENCER PANEL (jobb alsó sarok, kompakt)
   ====================================================== */
#ui-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  left: auto;
  transform: none;

  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  z-index: 10;

  background: var(--panel-bg);
  padding: 14px 16px 16px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
  transition: opacity 0.25s ease;
}

.sequencer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(247, 255, 219, 0.18);
  padding-bottom: 10px;
}

.sequencer-title {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sequencer-close {
  background: rgba(247, 255, 219, 0.08);
  color: var(--accent);
  border: 1px solid rgba(247, 255, 219, 0.25);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sequencer-close:hover {
  background: rgba(247, 255, 219, 0.18);
}

#ui-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
}

#bpm-control {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

#bpm-input {
  background: rgba(247, 255, 219, 0.08);
  border: 1px solid var(--kbd-border);
  color: var(--accent);
  width: 56px;
  border-radius: 6px;
  margin-left: 8px;
  padding: 4px 6px;
  font-weight: 600;
  text-align: center;
  font-family: inherit;
}

#ui-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

#play-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  letter-spacing: 0.3px;
  align-self: flex-start;
}

#play-btn:hover {
  box-shadow: 0 0 14px var(--accent-glow);
}

#play-btn:active {
  transform: scale(0.96);
}

#sequencer {
  display: grid;
  grid-template-columns: 36px repeat(16, 20px);
  gap: 3px;
  align-items: center;
}

.track-label {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  padding-right: 6px;
  opacity: 0.75;
  font-family: 'Consolas', monospace;
  letter-spacing: 0.5px;
}

.cell {
  width: 20px;
  height: 20px;
  background: rgba(247, 255, 219, 0.07);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
}

.cell.beat-marker {
  background: rgba(247, 255, 219, 0.13);
}

.cell:hover {
  background: rgba(247, 255, 219, 0.28);
}

.cell.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.cell.playing {
  outline: 2px solid #fff;
  outline-offset: 1px;
  transform: scale(1.18);
  z-index: 2;
}

#sequencer-launcher {
  position: absolute;
  bottom: 20px;
  right: 20px;
  left: auto;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  color: var(--accent);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: background 0.15s ease, transform 0.1s ease;
}

#sequencer-launcher:hover {
  background: rgba(20, 24, 40, 0.85);
  transform: translateY(-1px);
}

#sequencer-launcher span {
  font-size: 16px;
  color: var(--accent);
}

#sequencer-launcher kbd {
  background: rgba(247, 255, 219, 0.12);
  border: 1px solid var(--kbd-border);
  border-radius: 4px;
  padding: 0 6px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: var(--accent);
}

/* ======================================================
   SÚGÓ OVERLAY (vezérlés leírás + élő állapot)
   ====================================================== */
#help-overlay {
  display: none;
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 18px 16px 18px;
  color: var(--accent);
  font-size: 12.5px;
  line-height: 1.5;
  width: 280px;
  box-shadow: var(--panel-shadow);
  transition: opacity 0.25s ease;
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(247, 255, 219, 0.25);
}

#help-overlay h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.help-close {
  background: rgba(247, 255, 219, 0.08);
  color: var(--accent);
  border: 1px solid rgba(247, 255, 219, 0.25);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.help-close:hover {
  background: rgba(247, 255, 219, 0.18);
}

#help-overlay h3 {
  margin: 12px 0 5px 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.6;
  letter-spacing: 1.2px;
}

#help-overlay .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

#help-overlay .row > span:first-child {
  white-space: nowrap;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
}

#help-overlay .row > span:last-child {
  text-align: right;
  opacity: 0.85;
  font-size: 11.5px;
}

#help-overlay .help-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(247, 255, 219, 0.15);
  opacity: 0.85;
}

#help-overlay kbd {
  display: inline-block;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  border-radius: 4px;
  padding: 1px 6px;
  margin: 0;
  font-family: 'Consolas', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  min-width: 12px;
  text-align: center;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

#help-overlay kbd.active {
  background: var(--accent);
  color: #0a0a14;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: translateY(-1px);
}

.state-badge {
  display: inline-block;
  background: rgba(247, 255, 219, 0.10);
  border: 1px solid rgba(247, 255, 219, 0.25);
  border-radius: 4px;
  padding: 0 6px;
  margin-left: 6px;
  font-family: 'Consolas', monospace;
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.state-badge.active {
  background: #ff3333;
  border-color: #ff5555;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 51, 51, 0.6);
}

#help-toggle-hint {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 999;
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#help-toggle-hint:hover {
  background: rgba(20, 24, 40, 0.85);
  transform: translateY(-1px);
}

#help-toggle-hint kbd {
  display: inline-block;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  border-radius: 4px;
  padding: 0 6px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: var(--accent);
}

#prism-halo {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 1.0) 0%,
    rgba(255, 255, 240, 0.85) 18%,
    rgba(255, 250, 200, 0.45) 42%,
    rgba(247, 255, 219, 0.12) 70%,
    rgba(247, 255, 219, 0) 100%
  );
  filter: blur(5px);
  mix-blend-mode: screen;
  transition: opacity 0.12s ease;
}

/* ======================================================
   JS BŐL KISZERVEZETT ÚJ ELEMEK (Gombok, Szinti, Szekvenszer)
   ====================================================== */

#ui-container, #sequencer { 
  display: none !important; 
}

#seq-panel { 
  position: absolute; 
  bottom: 20px; 
  left: 20px; 
  background: rgba(10, 10, 15, 0.85); 
  border-radius: 12px; 
  padding: 20px; 
  display: none; 
  flex-direction: column; 
  gap: 15px; 
  backdrop-filter: blur(8px); 
  border: 1px solid rgba(255,255,255,0.15); 
  font-family: sans-serif; 
  color: white; 
  z-index: 9999; 
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

.seq-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  border-bottom: 1px solid #444; 
  padding-bottom: 10px; 
}

.seq-header h3 { 
  margin: 0; 
  font-size: 16px; 
  font-weight: normal; 
  color: #ddd; 
}

.seq-controls { 
  display: flex; 
  gap: 10px; 
  align-items: center; 
}

.seq-btn { 
  background: #333; 
  border: 1px solid #555; 
  color: white; 
  padding: 6px 15px; 
  border-radius: 6px; 
  cursor: pointer; 
  transition: 0.2s; 
  font-weight: bold; 
}

.seq-btn:hover { 
  background: #444; 
  border-color: #d3fa47; 
  color: #d3fa47; 
}

.seq-bpm { 
  width: 50px; 
  background: #222; 
  border: 1px solid #555; 
  color: #d3fa47; 
  padding: 6px; 
  border-radius: 4px; 
  text-align: center; 
  font-weight: bold; 
  outline: none; 
}

.seq-grid { 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
}

.seq-row { 
  display: flex; 
  gap: 4px; 
  align-items: center; 
}

.seq-label { 
  width: 55px; 
  font-size: 11px; 
  color: #aaa; 
  text-align: right; 
  margin-right: 10px; 
  font-weight: bold; 
  text-transform: uppercase; 
  letter-spacing: 1px; 
}

.seq-cell { 
  width: 22px; 
  height: 22px; 
  background: #222; 
  border-radius: 4px; 
  cursor: pointer; 
  border: 1px solid #333; 
  transition: background 0.1s, transform 0.1s; 
}

.seq-cell:hover { 
  background: #444; 
}

.seq-cell.active { 
  background: #d3fa47; 
  border-color: #b5de28; 
  box-shadow: 0 0 8px rgba(211, 250, 71, 0.4); 
}

.seq-cell.playing { 
  transform: scale(1.15); 
  border-color: white; 
  filter: brightness(1.3); 
}

#record-btn { 
  position: absolute; 
  top: 20px; 
  right: 20px; 
  z-index: 9999; 
  padding: 12px 24px; 
  font-size: 16px; 
  font-weight: bold; 
  background-color: #a83636; 
  color: white; 
  border: 2px solid white; 
  border-radius: 8px; 
  cursor: pointer; 
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4); 
  transition: all 0.3s ease; 
}

@keyframes pulse { 
  from { transform: scale(1); } 
  to { transform: scale(1.05); } 
}

#synth-container { 
  position: absolute; 
  bottom: 40px; 
  left: 50%; 
  transform: translateX(-50%); 
  display: none; 
  gap: 8px; 
  background-color: rgba(0,0,0,0.6); 
  padding: 15px; 
  border-radius: 12px; 
  z-index: 9999; 
  touch-action: none; 
}

.synth-key { 
  width: 45px; 
  height: 150px; 
  background-color: white; 
  border-radius: 0 0 8px 8px; 
  color: black; 
  text-align: center; 
  line-height: 260px; 
  font-weight: bold; 
  font-family: monospace; 
  font-size: 18px; 
  cursor: pointer; 
  user-select: none; 
}

#super-mobile-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  background-color: #222;
  color: #ffffff;
  border: 0px solid #ffffff;
  border-radius: 8px;
  font-size: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 2147483647;
  box-shadow: 0 4px 15px rgba(0,0,0,0.8);
  user-select: none;
  font-family: sans-serif;
}

kbd.active-kbd { 
  background: #d3fa47 !important; 
  color: black !important; 
  text-shadow: none !important; 
  transform: translateY(4px) !important; 
  border-bottom: 0px solid #000 !important;
  box-shadow: 0 0 15px rgba(211, 250, 71, 0.5) !important; 
  border-color: #b5de28 !important; 
}


    @media (max-width: 1024px) { 
      #record-btn { 
        top: 10px !important; 
        right: 10px !important; 
        padding: 8px 12px !important; 
        font-size: 12px !important; 
        border-width: 1px; 
      }
      
      #synth-container { 
        width: 95% !important; 
        bottom: 10px !important; 
        padding: 10px !important; 
        gap: 4px; 
        flex-wrap: wrap !important; 
        justify-content: center !important; 
      }
    
      #synth-container div { 
        width: calc(20% - 5px) !important; 
        height: 70px !important; 
        line-height: 100px !important; 
        font-size: 14px !important; 
        border-radius: 6px !important; 
      }
      
      #seq-panel { 
        left: 5px !important; 
        right: 5px !important; 
        bottom: 5px !important; 
        padding: 10px !important; 
        gap: 10px; 
        width: auto; 
      }
    
      .seq-row { gap: 2px; }
      .seq-cell { width: 16px; height: 16px; border-radius: 3px; }
      .seq-label { width: 35px; font-size: 9px; margin-right: 2px; }
      .seq-header h3 { font-size: 14px; }
      .seq-btn { padding: 4px 10px; font-size: 12px; }
    
      /* Súgó panel balra igazítva, a menügomb helyére */
      /* KISEBB MOBIL SÚGÓ PANEL */
      #help-overlay { 
        display: none; 
        top: 10px !important; 
        left: 10px !important; 
        transform: none !important; 
        width: auto !important; /* Csak akkora legyen, amekkora kell */
        max-width: 250px !important; /* Szigorú maximum szélesség mobilra */
        max-height: calc(100vh - 20px) !important; 
        padding: 12px !important; 
        overflow-y: auto !important; 
        box-sizing: border-box !important;
        border-radius: 12px !important;
      }
      
      /* Engedjük a sorok törését, hogy ne folyjon ki a tartalom */
      #help-overlay .row {
        flex-wrap: wrap !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
      }
      
      #help-overlay .row > span {
        text-align: left !important; /* Törésnél is balra igazítva maradjon */
      }
    }
    #help-overlay::-webkit-scrollbar { width: 6px; } 
    #help-overlay::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 3px; } 
    #help-overlay::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }


    .help-header-right {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .lang-switch {
      display: flex;
      gap: 4px;
    }
    .lang-btn {
      background: rgba(247, 255, 219, 0.08);
      color: var(--accent);
      border: 1px solid rgba(247, 255, 219, 0.25);
      border-radius: 6px;
      padding: 2px 8px;
      font-family: 'Consolas', monospace;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.5px;
      cursor: pointer;
      transition: background 0.15s ease, box-shadow 0.15s ease;
    }
    .lang-btn:hover {
      background: rgba(247, 255, 219, 0.18);
    }
    .lang-btn.active {
      background: var(--accent);
      color: #0a0a14;
      border-color: var(--accent);
      box-shadow: 0 0 10px var(--accent-glow);
    }