:root{--bpm:120;--color1:#00f2ff;--color2:#ff00ff;--ui-color1:#00f2ff;--ui-text-on-color1:#000000;--ui-bg-main:#104e70;--ui-bg-card:rgba(10,26,37,0.9);--base-size:320px;--main-v-x:0px;--main-v-y:0px;--main-img-x:0px;--main-img-y:0px;--main-img-scale:1;--bg-img-x:0px;--bg-img-y:0px;--bg-img-scale:1;--bg-opacity:0.6;--tint-sepia:0;--tint-hue:0deg;--tint-brightness:1;--crt-filter:none;}
body{margin:0;background:#020205;display:flex;align-items:center;justify-content:center;height:100vh;color:white;font-family:'Consolas',monospace;overflow:hidden;}
#master-container{width:100%;height:100%;position:relative;filter:sepia(var(--tint-sepia)) hue-rotate(var(--tint-hue)) brightness(var(--tint-brightness)) contrast(1.0);transition:filter 0.3s;background:#020205;}
.layer{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;}
#bg-image-layer{display:none;opacity:var(--bg-opacity);z-index:1;overflow:visible;}
#grid-canvas-container{width:100%;height:100%;top:0;left:0;z-index:2;display:none;}
#grid-canvas{width:100%;height:100%;}
canvas#main-canvas{z-index:10;position:absolute;top:0;left:0;filter:var(--crt-filter);transition:filter 0.2s;}
#neon-glow{z-index:5;width:160%;height:160%;top:-30%;left:-30%;background:radial-gradient(circle at 30% 30%,var(--color2) 0%,transparent 50%),radial-gradient(circle at 70% 30%,var(--color1) 0%,transparent 50%),radial-gradient(circle at 30% 70%,var(--color1) 0%,transparent 50%),radial-gradient(circle at 70% 70%,var(--color2) 0%,transparent 50%);opacity:0.4;display:none;mix-blend-mode:screen;filter:blur(90px);animation:fog-vibe 40s linear infinite;}
#scanlines{z-index:100;display:none;background:linear-gradient(rgba(18,16,16,0) 50%,rgba(0,0,0,0.3) 50%),url('https://www.transparenttextures.com/patterns/stardust.png');background-size:100% 4px,200px 200px;opacity:0.6;pointer-events:none;}
#vignette{z-index:110;display:none;background:radial-gradient(circle at calc(50% + var(--main-v-x)) calc(50% + var(--main-v-y)),transparent 15%,rgba(0,0,0,0.3) 30%,rgba(0,0,0,0.7) 45%,rgba(0,0,0,0.92) 65%,#000 85%,#000 100%);}
.controls{position:absolute;top:15px;left:15px;z-index:200;background:var(--ui-bg-main);padding:10px;border-radius:20px;width:280px;max-height:calc(100vh - 30px);overflow-y:auto;box-shadow:0 10px 30px rgba(0,0,0,0.5);opacity:0.5;transition:opacity 0.3s;}
.controls:hover{opacity:1;}
.app-header{text-align:center;margin-bottom:4px;}
.app-logo{font-size:16px;font-weight:900;color:#fff;letter-spacing:2px;}
.ui-section{background:var(--ui-bg-card);margin-bottom:6px;padding:10px;border-radius:8px;border:1px solid rgba(255,255,255,0.05);}
.section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;padding-left:6px;border-left:3px solid var(--ui-color1);}
.section-title{font-size:10px;font-weight:900;color:#fff;text-transform:uppercase;letter-spacing:1px;margin:0;}
.sync-trigger{background:none;border:none;color:var(--ui-color1);cursor:pointer;padding:0;display:flex;align-items:center;opacity:0.6;transition:all 0.2s;}
.sync-trigger:hover{opacity:1;transform:rotate(-30deg);}
.sync-trigger:active{transform:scale(0.8);}
.label-group{display:flex;justify-content:space-between;align-items:center;margin-top:4px;margin-bottom:0px;}
.label-text{font-size:9px;color:#8899aa;font-weight:bold;text-transform:uppercase;}
.value-badge{font-size:9px;color:var(--ui-text-on-color1)!important;background:var(--ui-color1);padding:1px 8px;border-radius:4px;font-weight:bold;}
.select-style{width:100%;padding:5px;background:#050a10;color:#fff;border:1px solid #223344;border-radius:4px;font-size:11px;margin-bottom:6px;outline:none;text-align:center;}
.btn-row{display:flex;gap:4px;margin-bottom:6px;}
.small-btn{flex:1;padding:5px;font-size:9px;background:#1a2a35;border:none;color:#eee;cursor:pointer;border-radius:4px;font-weight:bold;}
.small-btn:hover{background:#2a3a45;}
.small-btn.danger{color:#ff6666;}
input[type="range"]{width:100%;margin-top:-4px;margin-bottom:6px;accent-color:var(--ui-color1);cursor:pointer;height:3px;}
.effects-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;align-items:center;}
.check-row{display:flex;align-items:center;gap:5px;font-size:9px;cursor:pointer;color:#ccddee;}
.grid-full-row{grid-column:1 / span 2;display:flex;flex-direction:column;gap:6px;margin-bottom:4px;padding-bottom:4px;border-bottom:1px solid rgba(255,255,255,0.05);}
.grid-toggle-group{display:inline-flex;background:#000;border-radius:4px;overflow:hidden;border:1px solid #333;height:20px;}
.grid-radio{display:none;}
.grid-label{padding:0 8px;cursor:pointer;font-size:12px;color:#555;line-height:20px;font-weight:bold;text-align:center;min-width:24px;}
.grid-radio:checked+.grid-label.mode-btn{background:var(--ui-color1);color:var(--ui-text-on-color1);}
#gc-1:checked+.grid-label.c1-btn{background:var(--color1);color:#000;}
#gc-2:checked+.grid-label.c2-btn{background:var(--color2);color:#000;}
.color-edit-area{display:flex;gap:6px;align-items:center;background:rgba(0,0,0,0.3);padding:6px;border-radius:6px;border:1px dashed rgba(255,255,255,0.1);margin-bottom:6px;}
.color-swap-btn{
  width:30px;
  height:28px;
  flex:0 0 30px;
  border:none;
  border-radius:6px;
  background:#1a2a35;
  color:var(--ui-color1);
  font-size:11px;
  font-weight:900;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  transition:background 0.18s, transform 0.12s, color 0.18s;
}

.color-swap-btn:hover{
  background:#243744;
}

.color-swap-btn:active{
  transform:scale(0.94);
}

.color-edit-icon{color:var(--ui-color1);opacity:0.6;flex-shrink:0;}
.picker-wrapper{flex:1;height:28px;position:relative;cursor:pointer;transition:transform 0.1s;border-radius:4px;overflow:hidden;}
.color-input{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:200%;height:200%;border:none;border-radius:0;cursor:pointer;background:none;padding:0;}
.preset-row{display:flex;gap:6px;margin-top:6px;justify-content:space-between;align-items:center;}
.preset-btn{width:22px;height:22px;border-radius:50%;border:1.5px solid #333;cursor:pointer;background:linear-gradient(135deg,var(--p1) 50%,var(--p2) 50%);transition:transform 0.2s;flex-shrink:0;}
.status-panel{position:absolute;z-index:200;background:var(--ui-bg-main);padding:8px;border-radius:20px;width:160px;box-sizing:border-box;}
.status-panel-top{top:15px;right:15px;bottom:auto;}
.status-panel-bottom{top:auto;right:15px;bottom:15px;}
.status-card{background:var(--ui-bg-card);padding:10px;border-radius:8px;margin-bottom:6px;transition:all 0.2s;height:auto;box-sizing:border-box;}

/* ========== PC BPMコントロール ========== */
.bpm-ctrl-wrap{display:flex;align-items:stretch;gap:4px;}
.bpm-ctrl-row{display:flex;align-items:center;justify-content:center;gap:4px;}
.bpm-adj-group{display:flex;gap:3px;}
.adj-btn{width:28px;background:#1a2a35;border:none;color:#fff;cursor:pointer;border-radius:8px;font-size:16px;padding:6px 0;transition:background 0.15s;display:flex;align-items:center;justify-content:center;}
.adj-btn:hover{background:#2a3a45;}
.adj-btn:active{background:#3a4a55;transform:scale(0.93);}
.adj-btn.small{font-size:13px;color:#aaa;padding:0;}
.status-value{font-size:24px;font-weight:900;text-align:center;flex:1;transition:color 0.2s;min-width:60px;}
.bpm-display{display:flex;align-items:center;justify-content:center;}
.bpm-val{
  font-size:32px;
  font-weight:900;
  color:#0ff;
  line-height:1;
  letter-spacing:-1px;
  display:inline-flex;
  align-items:flex-start;
  white-space:nowrap;
}

#disp-bpm-int{
  display:inline-block;
  line-height:1;
}

#disp-bpm-frac{
  display:inline-flex;
  align-items:flex-start;
  font-size:0.68em;
  line-height:1;
  margin-left:-2px;
  opacity:0.9;
  position:relative;
  top:0.08em;
}

.bpm-dot{
  display:inline-block;
  font-size:0.62em;
  line-height:1;
  opacity:0.8;
  margin-right:-1px;
  transform:translateY(0.52em);
}

#disp-bpm-dec{
  display:inline-block;
  line-height:1;
}
.bpm-fine-row{display:flex;gap:4px;width:100%;}
.bpm-fine-row .adj-btn.small{flex:1;height:14px;font-size:11px;padding:0;border-radius:4px;}

.pause-card{cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:2px;}
.pause-card:hover{background:#1a2a35;}
.pause-card.active{background:var(--ui-color1);}
.pause-card.active .section-title{color:var(--ui-text-on-color1)!important;border-left-color:rgba(0,0,0,0.3);opacity:0.7;}
.pause-card.active .pause-info{color:var(--ui-text-on-color1)!important;}
.pause-info{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:900;color:#fff;margin-top:2px;}
.offset-ctrl{display:flex;align-items:center;gap:4px;margin-top:4px;}
.offset-btn{flex:1;height:24px;background:#1a2a35;border:none;color:#fff;cursor:pointer;border-radius:4px;font-size:14px;font-weight:bold;}
.offset-display{flex:2;background:#000;font-size:11px;font-weight:bold;text-align:center;line-height:24px;border-radius:4px;cursor:pointer;transition:color 0.2s;}
.beat-dots{display:flex;justify-content:center;margin-top:10px;flex-wrap:nowrap;align-items:flex-end;height:35px;width:100%;box-sizing:border-box;}
.beat-item{display:flex;flex-direction:column;align-items:center;cursor:pointer;min-width:0;}
.beat-checkbox{display:none;}
.dot-box{width:22px;height:22px;border:1px solid #1a2a35;border-radius:3px;background:#050a10;transition:all 0.1s cubic-bezier(0.4,0,0.2,1);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:900;color:rgba(255,255,255,0.1);}
.beat-checkbox:checked+.dot-box{border-color:#667788;color:#ffffff;background:#101a25;transform:translateY(-6px);}
.dot-box.active{border-color:#ffffff!important;box-shadow:0 0 12px rgba(255,255,255,0.4);color:#ffffff!important;transform:translateY(-4px);}
.beat-checkbox:checked+.dot-box.active{border-color:var(--ui-color1)!important;box-shadow:0 0 18px var(--ui-color1);color:var(--ui-text-on-color1)!important;background:var(--ui-color1)!important;transform:translateY(-12px);}
.tap-card{cursor:pointer;padding:0!important;overflow:hidden;position:relative;height:54px;display:flex;align-items:center;justify-content:center;background:var(--ui-bg-card);}
.tap-card:active,.tap-card.flash{background:#fff!important;}
.tap-card-text{font-size:12px;font-weight:900;z-index:2;pointer-events:none;text-transform:uppercase;text-align:center;line-height:1.3;transition:color 0.2s;}
.tap-sub-text{font-size:9px;opacity:0.7;display:block;margin-top:2px;}
.tap-card.flash .tap-card-text{color:#000!important;}
.tap-bar{position:absolute;bottom:0;left:0;height:4px;background:var(--color2);width:0%;z-index:1;pointer-events:none;transition:width 3s linear;}
.visual-area{position:absolute;top:0;left:0;width:100%;height:100%;z-index:50;display:flex;align-items:center;justify-content:center;pointer-events:none;}
#drag-overlay{position:absolute;width:100%;height:100%;z-index:60;pointer-events:auto;cursor:move;}
#capture-guide{position:fixed;inset:0;z-index:50;pointer-events:none;display:block;}
#capture-guide-frame{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);border:2px dashed rgba(255,255,255,0.75);border-radius:12px;box-shadow:0 0 0 1px rgba(0,0,0,0.35);}
.rec-row{display:flex;gap:6px;align-items:center;margin-top:6px;}
.rec-btn{width:100%;padding:8px;font-size:10px;background:var(--ui-color1);border:none;color:var(--ui-text-on-color1);cursor:pointer;border-radius:6px;font-weight:900;letter-spacing:1px;box-shadow:0 0 10px var(--ui-color1);transition:all 0.2s;display:flex;align-items:center;justify-content:center;gap:6px;}
.rec-btn:hover{filter:brightness(1.2);box-shadow:0 0 18px var(--ui-color1);}
.rec-btn.recording{background:#1a2a35;color:#fff;box-shadow:none;}
@keyframes blink-dot{0%,100%{opacity:1;}50%{opacity:0;}}
.rec-btn.recording .rec-dot{animation:blink-dot 1s ease-in-out infinite;}
.mini-label{font-size:8px;color:#8899aa;font-weight:900;text-transform:uppercase;letter-spacing:0.6px;}
.mini-value{font-size:10px;color:#fff;font-weight:900;text-align:right;}

/* ========== GUIDE MODAL ========== */
#guide-overlay{display:none;position:fixed;inset:0;z-index:9000;background:rgba(0,0,0,0.7);align-items:center;justify-content:center;}
#welcome-overlay{display:none;position:fixed;inset:0;z-index:9100;background:rgba(0,0,0,0.62);align-items:center;justify-content:center;backdrop-filter:blur(4px);}
#welcome-modal{position:relative;background:#0a1a25;border:1px solid rgba(255,255,255,0.1);border-radius:16px;width:min(420px, calc(100vw - 32px));box-shadow:0 20px 60px rgba(0,0,0,0.8);padding:20px 18px 16px;text-align:center;}
#welcome-title{font-size:14px;font-weight:900;letter-spacing:2px;color:var(--ui-color1);margin-bottom:12px;text-transform:uppercase;}
#welcome-message{font-size:14px;line-height:1.8;color:#d7e3ec;margin-bottom:16px;}
.brand-zoom1{
  font-weight:900;
  letter-spacing:0.6px;
  color:var(--color1);
  text-shadow:
    0 0 6px color-mix(in srgb, var(--color1) 70%, transparent),
    0 0 14px color-mix(in srgb, var(--color1) 45%, transparent);
}
.brand-zoom2{
  font-weight:900;
  letter-spacing:0.6px;
  color:var(--color2);
  text-shadow:
    0 0 6px color-mix(in srgb, var(--color2) 70%, transparent),
    0 0 14px color-mix(in srgb, var(--color2) 45%, transparent);
}
.brand-maker{
  font-weight:900;
  letter-spacing:0.6px;
  color:#ffffff;
  text-shadow:
    0 0 5px rgba(255,255,255,0.35),
    0 0 12px rgba(0,242,255,0.22);
}
.brand-suno{
  font-weight:900;
  letter-spacing:0.5px;
  color:#ff9f1a;
  text-shadow:
    0 0 6px rgba(255,159,26,0.50),
    0 0 14px rgba(255,110,26,0.35);
}
.created-by{
  display:inline-block;
  margin-top:6px;
  font-size:12px;
  font-weight:700;
  color:#9fe8ff;
  letter-spacing:0.4px;
}
.created-note{
  display:inline-block;
  margin-top:2px;
  font-size:12px;
  color:#c8d7e6;
}
#welcome-close{width:100%;height:40px;border:none;border-radius:10px;background:var(--ui-color1);color:var(--ui-text-on-color1);font-size:12px;font-weight:900;cursor:pointer;}
#welcome-close:active{transform:scale(0.98);}
#guide-overlay.open{display:flex;}
#guide-modal{position:relative;background:#0a1a25;border:1px solid rgba(255,255,255,0.1);border-radius:16px;width:min(680px, calc(100vw - 48px));max-height:calc(100vh - 80px);display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,0.8);overflow:hidden;}
#guide-modal-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 0;flex-shrink:0;gap:12px;}
#guide-modal-title{font-size:15px;font-weight:900;color:#fff;letter-spacing:2px;text-transform:uppercase;white-space:nowrap;}
#guide-lang-wrap{display:flex;align-items:center;gap:8px;min-width:0;}
#guide-lang-switch{display:inline-flex;align-items:center;gap:4px;background:#08141c;border:1px solid rgba(255,255,255,0.08);border-radius:999px;padding:3px;}
.guide-lang-btn{border:none;background:transparent;color:#8899aa;font-size:10px;font-weight:900;letter-spacing:0.5px;padding:6px 10px;border-radius:999px;cursor:pointer;transition:all 0.18s;white-space:nowrap;}
.guide-lang-btn:hover{color:#fff;background:rgba(255,255,255,0.06);}
.guide-lang-btn.active{background:var(--ui-color1);color:var(--ui-text-on-color1);}
#guide-close{background:none;border:none;color:#8899aa;cursor:pointer;font-size:20px;line-height:1;padding:4px 8px;border-radius:4px;transition:color 0.2s, background 0.2s;}
#guide-close:hover{color:#fff;background:rgba(255,255,255,0.1);}
.guide-tabs{display:flex;gap:4px;padding:10px 16px 0;flex-shrink:0;border-bottom:1px solid rgba(255,255,255,0.07);padding-bottom:0;}
.guide-tab{padding:8px 16px;font-size:12px;font-weight:900;color:#8899aa;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;letter-spacing:0.5px;text-transform:uppercase;transition:color 0.2s, border-color 0.2s;white-space:nowrap;}
.guide-tab:hover{color:#fff;}
.guide-tab.active{color:var(--ui-color1);border-bottom-color:var(--ui-color1);}
.guide-body{overflow-y:auto;padding:20px;flex:1;}
.guide-body::-webkit-scrollbar{width:4px;}
.guide-body::-webkit-scrollbar-track{background:transparent;}
.guide-body::-webkit-scrollbar-thumb{background:#1a3a4a;border-radius:2px;}
.guide-panel{display:none;}
.guide-panel.active{display:block;}
.guide-section{margin-bottom:20px;}
.guide-section-title{font-size:12px;font-weight:900;color:var(--ui-color1);text-transform:uppercase;letter-spacing:1px;margin-bottom:10px;padding-left:10px;border-left:3px solid var(--ui-color1);}
.guide-item{display:flex;gap:12px;align-items:baseline;margin-bottom:8px;font-size:14px;line-height:1.7;color:#ccd8e0;}
.guide-item-label{font-size:11px;font-weight:900;color:#fff;background:#1a2a35;padding:2px 9px;border-radius:3px;white-space:nowrap;flex-shrink:0;}
.guide-item-en{font-size:11px;color:#556677;margin-left:4px;}
.guide-key{display:inline-block;font-size:11px;font-weight:900;color:#fff;background:#1a2a35;border:1px solid #334455;border-bottom:2px solid #556677;padding:3px 10px;border-radius:4px;font-family:'Consolas',monospace;white-space:nowrap;}
.guide-divider{border:none;border-top:1px solid rgba(255,255,255,0.05);margin:14px 0;}
.guide-note{font-size:13px;color:#8899aa;background:rgba(255,255,255,0.03);border-radius:6px;padding:10px 12px;line-height:1.8;margin-top:10px;}

/* ========== MOBILE STYLES ========== */
@media (max-width: 768px) {
  .controls { display: none !important; }
  .status-panel { display: none !important; }
  #master-container { width: 100vw; height: 100vh; }

  #mobile-bottom-bar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 300;
    background: rgba(10, 20, 30, 0.95);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
  }

  .mb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .mb-row-top {
    justify-content: space-between;
  }

  .mb-row-bottom {
    justify-content: space-between;
  }

  #mb-bpm-area {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
  }

  .mb-bpm-btn {
    width: 26px;
    height: 28px;
    background: #1a2a35;
    border: none;
    color: #fff;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .mb-bpm-btn.small {
    font-size: 12px;
    color: #aaa;
    width: 22px;
  }

  .mb-bpm-btn:active { background: #2a3a45; }

  #mb-bpm-value {
    font-size: 18px;
    font-weight: 900;
    color: var(--ui-color1);
    min-width: 52px;
    text-align: center;
    line-height: 1;
  }

  #mb-bpm-label {
    font-size: 7px;
    color: #8899aa;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    display: block;
  }

  #mb-edit-target-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  #mb-edit-target {
    width: 100%;
    height: 40px;
    padding: 0 8px;
    background: #050a10;
    color: #fff;
    border: 1px solid #223344;
    border-radius: 8px;
    font-size: 12px;
    outline: none;
    text-align: center;
  }

  #mb-beat-dots {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    flex: 1 1 auto;
    justify-content: flex-start;
    height: 32px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  #mb-beat-dots::-webkit-scrollbar {
    display: none;
  }

  .mb-dot-box {
    width: 18px;
    height: 18px;
    border: 1px solid #1a2a35;
    border-radius: 3px;
    background: #050a10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 900;
    color: rgba(255,255,255,0.2);
    transition: all 0.1s cubic-bezier(0.4,0,0.2,1);
    cursor: pointer;
    flex: 0 0 auto;
  }

  .mb-dot-box.dot-on {
    border-color: #667788;
    color: #fff;
    background: #101a25;
    transform: translateY(-4px);
  }

  .mb-dot-box.dot-active {
    border-color: #fff !important;
    box-shadow: 0 0 8px rgba(255,255,255,0.4);
    color: #fff !important;
    transform: translateY(-3px);
  }

  .mb-dot-box.dot-on.dot-active {
    border-color: var(--ui-color1) !important;
    box-shadow: 0 0 14px var(--ui-color1);
    color: var(--ui-text-on-color1) !important;
    background: var(--ui-color1) !important;
    transform: translateY(-8px);
  }

  #mb-tap-btn {
    width: 48px;
    height: 40px;
    background: var(--ui-bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--ui-color1);
    font-size: 8px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 0 0 auto;
    transition: background 0.1s;
    position: relative;
    overflow: hidden;
  }

  #mb-tap-btn.flash { background: #fff !important; color: #000 !important; }

  #mb-tap-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--color2);
    width: 0%;
    transition: width 3s linear;
  }

  #mb-settings-btn,
  #mb-rec-btn {
    width: 44px;
    height: 40px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 0 0 auto;
    font-size: 7px;
    font-weight: 900;
  }

  #mb-settings-btn {
    background: #1a2a35;
    color: var(--ui-color1);
  }

  #mb-rec-btn {
    background: #1a2a35;
    color: #ff4444;
  }

  #mb-rec-btn.recording {
    background: #ff4444;
    color: #fff;
  }

    #mb-loop-btn {
    width: 48px;
    height: 40px;
    background: #1a2a35;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--ui-color1);
    font-size: 8px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    flex: 0 0 auto;
  }

  #mb-loop-value {
    font-size: 16px;
    line-height: 1;
    color: #fff;
    pointer-events: none;
  }

  .mobile-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(2, 2, 5, 0.97);
    flex-direction: column;
    overflow: hidden;
  }
  .mobile-panel.open { display: flex !important; }
  .mobile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
  }
  .mobile-panel-title { font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 2px; text-transform: uppercase; }
  .mobile-panel-close { background: none; border: none; color: #8899aa; cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 4px; }
  .mobile-panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .mobile-panel-body::-webkit-scrollbar { width: 3px; }
  .mobile-panel-body::-webkit-scrollbar-thumb { background: #1a3a4a; border-radius: 2px; }
  .mobile-panel-body .ui-section { margin-bottom: 8px; }
  .mobile-panel-body .select-style { font-size: 14px; padding: 8px; }
  .mobile-panel-body input[type="range"] { height: 6px; }
  .mobile-panel-body .check-row { font-size: 12px; gap: 8px; }
  .mobile-panel-body .check-row input[type="checkbox"] { width: 16px; height: 16px; }
  .mobile-panel-body .small-btn { font-size: 12px; padding: 8px; }
  .mobile-panel-body .dot-box { width: 28px; height: 28px; font-size: 11px; }
  .mobile-panel-body .adj-btn { height: 32px; font-size: 16px; padding: 0 10px; }
  .mobile-panel-body .adj-btn.small { font-size: 13px; padding: 0 7px; }
  .mobile-panel-body .status-value { font-size: 28px; }
  .mobile-panel-body .offset-btn { height: 32px; font-size: 16px; }
  .mobile-panel-body .offset-display { font-size: 13px; line-height: 32px; }
  .mobile-panel-body .rec-btn { font-size: 13px; padding: 12px; }
  .mobile-panel-body .preset-btn { width: 28px; height: 28px; }
  .mobile-panel-body .color-swap-btn { width: 36px; height: 32px; flex: 0 0 36px; font-size: 12px; border-radius: 8px; }
  .mobile-panel-body .tap-card { height: 70px; }
  .mobile-panel-body .tap-card-text { font-size: 15px; }
  .mobile-panel-body .label-text { font-size: 11px; }
  .mobile-panel-body .section-title { font-size: 11px; }
  .mobile-panel-body .mini-label { font-size: 10px; }
  .mobile-panel-body .mini-value { font-size: 12px; }

  /* モバイルパネル内 BPMコントロール */
  .mobile-panel-body .bpm-ctrl-row { gap: 6px; }
  .mobile-panel-body .bpm-adj-group { gap: 4px; }

  #guide-modal { width: calc(100vw - 24px); max-height: calc(100vh - 40px); }
  #guide-modal-header { align-items: flex-start; }
  #guide-lang-wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
  #guide-modal-title { white-space: normal; line-height: 1.4; }
  #guide-lang-switch { flex-wrap: wrap; }
  .guide-lang-btn { font-size: 10px; padding: 6px 9px; }
  .guide-tab { padding: 8px 10px; font-size: 10px; }
  .guide-item { font-size: 12px; }
  #welcome-modal{width:calc(100vw - 24px);padding:18px 14px 14px;}
  #welcome-message{font-size:13px;line-height:1.75;}
}

@media (min-width: 769px) {
  #mobile-bottom-bar { display: none !important; }
  #mobile-visual-panel { display: none !important; }
  #mobile-rec-panel { display: none !important; }
}

/* ========== MOBILE TAP OVERLAY ========== */
#mb-tap-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(2, 10, 20, 0.6);
  backdrop-filter: blur(4px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
#mb-tap-overlay.open { display: flex; }
#mb-tap-overlay-hint { font-size: 13px; color: rgba(255,255,255,0.4); letter-spacing: 2px; text-transform: uppercase; pointer-events: none; }
#mb-tap-overlay-bpm { font-size: 80px; font-weight: 900; color: var(--ui-color1); line-height: 1; pointer-events: none; text-shadow: 0 0 40px var(--ui-color1); transition: transform 0.05s; }
#mb-tap-overlay-label { font-size: 11px; color: rgba(255,255,255,0.3); letter-spacing: 3px; text-transform: uppercase; pointer-events: none; }
#mb-tap-overlay-close { position: absolute; top: 20px; right: 20px; width: 44px; height: 44px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%; color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
#mb-tap-overlay-bar { width: 200px; height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
#mb-tap-overlay-bar-inner { height: 100%; background: var(--color2); width: 0%; transition: width 3s linear; }
.target-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:6px;
  align-items:start;
}

.target-col{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}

.target-mode-btn{
  width:100%;
  padding:5px 5px;
  font-size:9px;
  font-weight:900;
  border-radius:999px;
  border:1px solid #2a3a45;
  background:#14222c;
  color:#ccddee;
  cursor:pointer;
  transition:all 0.18s;
  text-align:center;
  white-space:nowrap;
  line-height:1.05;
}

.target-mode-btn:hover{
  background:#1b2d39;
}

.target-mode-btn.active{
  background:var(--ui-color1);
  color:var(--ui-text-on-color1);
  border-color:transparent;
  box-shadow:0 0 12px rgba(0,242,255,0.28);
}

.target-mode-btn.disabled{
  opacity:0.35;
  pointer-events:none;
  box-shadow:none;
}

.pos-card{
  background:#081018;
  border:1px solid rgba(255,255,255,0.06);
  border-radius:8px;
  padding:1px 3px;
  min-height:26px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  transition:border-color 0.18s, box-shadow 0.18s, background 0.18s, opacity 0.18s;
}

.pos-card.active{
  border-color:var(--ui-color1);
  box-shadow:0 0 0 1px rgba(0,242,255,0.18) inset;
  background:rgba(0,242,255,0.06);
}

.pos-card-value{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:0;
  font-size:9px;
  color:#ffffff;
  font-weight:900;
  line-height:0.95;
  width:100%;
}

.pos-line{
  display:block;
  white-space:nowrap;
  margin:0;
  padding:0;
}

.caution-btn{
  font-size:8px;
  letter-spacing:0.2px;
}

.compact-reset-btn{
  padding:4px 5px;
  line-height:1;
}
.zoom-link-wrap{
  margin:6px 0;
}

.zoom-link-btn{
  width:100%;
  padding:6px 10px;
  min-height:28px;
  border-radius:6px;
  border:1px solid #2a3a45;
  background:#16242f;
  color:#cfd9e6;
  font-size:10px;
  font-weight:900;
  letter-spacing:0.4px;
  cursor:pointer;
  transition:all 0.18s;
  text-align:center;
  line-height:1.1;
}

.zoom-link-btn:hover{
  background:#1c2d39;
}

.zoom-link-btn.active{
  background:rgba(0,242,255,0.10);
  border-color:var(--ui-color1);
  color:var(--ui-color1);
  box-shadow:0 0 0 1px rgba(0,242,255,0.18) inset;
}

.zoom-link-btn:active{
  transform:translateY(1px);
}

.caution-btn:hover{
  filter:brightness(1.08);
}

.controls-version{
  margin-top:2px;
  padding-top:0;
  text-align:center;
  font-size:7px;
  color:#556677;
  letter-spacing:0.8px;
  line-height:0.9;
}

@media (max-width: 768px) {
  #mb-edit-target-wrap{
    flex:1 1 auto;
    min-width:0;
  }
}
.color-chip-wrap{
  position:relative;
  flex:1;
  height:28px;
  min-width:0;
}

.color-chip-wrap .picker-wrapper{
  width:100%;
}

.alpha-toggle{
  position:absolute;
  top:4px;
  right:4px;
  z-index:3;
  min-width:22px;
  height:18px;
  padding:0 5px;
  border:1px solid rgba(255,255,255,0.18);
  border-radius:999px;
  background:rgba(0,0,0,0.42);
  color:rgba(255,255,255,0.72);
  font-size:10px;
  font-weight:700;
  line-height:16px;
  text-align:center;
  cursor:pointer;
  user-select:none;
  backdrop-filter:blur(2px);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.alpha-toggle:hover{
  border-color:rgba(255,255,255,0.35);
  color:rgba(255,255,255,0.92);
}

.alpha-toggle.active,
.alpha-toggle[aria-pressed="true"]{
  background:rgba(255,255,255,0.96);
  color:#111;
  border-color:rgba(255,255,255,0.96);
  box-shadow:0 0 8px rgba(255,255,255,0.28);
}

.picker-wrapper.is-transparent::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.00) 0px,
      rgba(255,255,255,0.00) 8px,
      rgba(255,255,255,0.16) 8px,
      rgba(255,255,255,0.16) 12px
    );
}

@media (max-width: 768px){
  .mobile-panel-body .color-chip-wrap{
    height:32px;
  }

  .mobile-panel-body .alpha-toggle{
    top:4px;
    right:4px;
    min-width:24px;
    height:19px;
    padding:0 5px;
    font-size:10px;
    line-height:17px;
  }
}


