  /* 色は index.html と同じ（操作画面側の色だけ使う） */
  :root{
    --ui-bg:#15131c;
    --ui-card:#211f2c;
    --ui-line:#38354a;
    --ui-text:#f1ede1;
    --ui-mut:#a29c8c;
    --teal:#3e7c74;
    --stamp:#c1442d;
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:
      radial-gradient(circle, rgba(241,237,225,0.05) 1px, transparent 1px) 0 0/16px 16px,
      var(--ui-bg);
    color:var(--ui-text);
    font-family:'Zen Kaku Gothic New', sans-serif;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    align-items:center;
    padding:32px 16px 64px;
  }
  header{max-width:640px;text-align:center;margin-bottom:24px;}
  h1{font-weight:900;font-size:clamp(26px,5.5vw,36px);letter-spacing:0.02em;margin:0 0 8px;}
  h1 span{color:var(--stamp);display:inline-block;}
  header p{color:var(--ui-mut);font-size:14px;line-height:1.7;margin:0;}
  main{width:100%;max-width:560px;}
  #app{width:100%;max-width:560px;}

  .howto{
    background:var(--ui-card);border:1px solid var(--ui-line);border-radius:10px;
    margin-bottom:14px;font-size:13px;
  }
  .howto summary{padding:11px 14px;cursor:pointer;font-weight:700;list-style:none;}
  .howto summary::-webkit-details-marker{display:none;}
  .howto summary::before{content:'▸ ';color:var(--teal);}
  .howto[open] summary::before{content:'▾ ';}
  .howto ol{margin:0;padding:0 16px 12px 34px;color:var(--ui-mut);line-height:1.9;}
  .howto b{color:var(--ui-text);}

  /* プレビューは出力そのままの16:9。余白の黒も出力と同じに見える */
  .panel-frame{
    background:var(--ui-card);border:1px solid var(--ui-line);border-radius:10px;
    padding:12px;box-shadow:0 20px 40px -12px rgba(0,0,0,0.6);
  }
  #stage{width:100%;aspect-ratio:16/9;display:block;background:#000;border-radius:2px;}
  .stage-note{color:var(--ui-mut);font-size:11px;text-align:center;margin:8px 0 0;line-height:1.6;}
  /* コマ送り。数字は桁が増えても位置が動かないよう、等幅の書体で真ん中に置く */
  .stage-nav:not([hidden]){display:flex;align-items:center;justify-content:center;gap:14px;margin-top:10px;}
  .stage-nav button{
    width:34px;height:34px;padding:0;
    background:transparent;color:var(--ui-text);border:1px solid #4a4660;border-radius:50%;
    font-family:inherit;font-size:12px;line-height:1;cursor:pointer;
  }
  .stage-nav button:active{background:var(--teal);border-color:var(--teal);}
  .stage-nav span{
    min-width:64px;text-align:center;
    font-family:'Space Grotesk',sans-serif;font-weight:700;font-size:13px;color:var(--ui-text);
  }

  /* 追加した画像の一覧。並び順がそのまま動画の順番 */
  .drop{
    margin-top:14px;border:1px dashed #4a4660;border-radius:10px;
    padding:16px;text-align:center;color:var(--ui-mut);font-size:13px;line-height:1.8;
  }
  .drop.dragover{border-color:var(--teal);border-style:solid;color:var(--ui-text);}
  .list{list-style:none;margin:12px 0 0;padding:0;display:flex;flex-direction:column;gap:8px;}
  .list li{
    display:flex;align-items:center;gap:10px;
    background:var(--ui-card);border:1px solid var(--ui-line);border-radius:8px;padding:8px;
  }
  .list .no{
    flex:none;width:22px;text-align:center;
    font-family:'Space Grotesk',sans-serif;font-weight:700;font-size:13px;color:var(--ui-mut);
  }
  /* サムネイルは中身が見分けられる大きさにする。出力は正方形なので枠も正方形。
     正方形でない画像を入れられても切らずに収める（contain） */
  .list img{flex:none;width:76px;height:76px;object-fit:contain;background:#000;border-radius:3px;}
  .list .nm{flex:1;min-width:0;font-size:12px;color:var(--ui-mut);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  /* 見つけたマス目の数と、その手直し。「全体と1枚ずつ」で何コマになるかが押す前に分かり、
     外していたらその場で正しいレイアウトに直せる */
  .list .nm select{
    display:block;margin-top:3px;max-width:100%;
    background:var(--ui-bg);color:var(--teal);
    border:1px solid var(--ui-line);border-radius:5px;padding:2px 4px;
    font-family:inherit;font-size:11px;cursor:pointer;
  }
  .list .nm select.picked{color:var(--ui-text);border-color:var(--teal);}
  .list .nm select.miss{color:#f0a08c;border-color:var(--stamp);}
  .list button{
    flex:none;width:30px;height:30px;padding:0;
    background:transparent;color:var(--ui-text);border:1px solid #4a4660;border-radius:6px;
    font-family:inherit;font-size:13px;line-height:1;cursor:pointer;
  }
  .list button:disabled{opacity:0.3;cursor:default;}
  .list .del{color:var(--stamp);border-color:var(--stamp);}

  .controls{margin-top:10px;display:flex;flex-wrap:wrap;gap:10px;justify-content:center;}
  .controls button{
    background:var(--ui-card);color:var(--ui-text);
    border:1px solid var(--ui-line);border-radius:20px;
    padding:8px 16px;font-family:inherit;font-size:13px;cursor:pointer;
  }
  .controls button.active{background:var(--teal);border-color:var(--teal);color:#f1ede1;}
  .controls-label{text-align:center;color:var(--ui-mut);font-size:11px;letter-spacing:0.08em;margin:18px 0 -4px;}

  .output-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0;}
  .output-actions button{
    width:100%;min-height:48px;padding:8px 6px;border:1px solid transparent;border-radius:8px;
    background:var(--teal);color:var(--ui-text);cursor:pointer;
    font-family:inherit;font-size:14px;font-weight:700;line-height:1.4;
  }
  .output-actions button:disabled{background:var(--ui-card);border-color:var(--ui-line);color:var(--ui-mut);cursor:default;}
  .output-actions .hint{margin:5px 0 0;}
  .discord-invite{display:flex;align-items:center;gap:7px;margin-top:8px;min-height:28px;font-size:13px;cursor:pointer;}
  .discord-invite input{flex:none;margin:0;accent-color:var(--teal);}
  .video-settings summary{color:var(--ui-text);cursor:pointer;font-size:14px;font-weight:700;margin-bottom:10px;}
  .hint{text-align:center;color:var(--ui-mut);font-size:12px;margin-top:10px;line-height:1.7;}
  /* コードから読めた「何枚目か」。一覧の名前のとなりに小さく出す */
  .tag{display:inline-block;background:rgba(45,212,191,.16);color:var(--teal);
       border-radius:4px;padding:1px 6px;font-size:11px;font-weight:700;white-space:nowrap;}
  .hint.bad{color:#f0a08c;}

  footer{margin:40px auto 0;color:#5c5848;font-size:11px;text-align:center;max-width:480px;line-height:1.6;}
  footer a{color:inherit;}
  input[type=file]{display:none;}

  /* index.css の .overlay と同じ。<dialog> を透明な箱にして、暗幕は ::backdrop で敷く */
  .overlay{
    width:100%;height:100%;max-width:none;max-height:none;margin:0;box-sizing:border-box;
    border:0;background:transparent;color:inherit;
    align-items:center;justify-content:center;flex-direction:column;
    padding:24px;overscroll-behavior:contain;
  }
  .overlay[open]{display:flex;}
  .overlay::backdrop{background:rgba(21,19,28,0.92);overflow:hidden;overscroll-behavior:contain;}
  .overlay-card{background:var(--ui-card);border-radius:8px;padding:16px;max-width:460px;width:100%;text-align:center;}
  .overlay-card video{width:100%;border-radius:4px;display:block;background:#000;}
  .overlay-card p{font-size:13px;line-height:1.6;margin:14px 0 4px;}
  .overlay-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:14px;}
  .overlay-actions a,.overlay-actions button{
    font-family:inherit;font-size:13px;line-height:19px;
    border-radius:20px;padding:9px 18px;text-decoration:none;border:1px solid transparent;cursor:pointer;
  }
  .overlay-actions a{background:var(--teal);color:#f1ede1;}
  .overlay-actions button,.overlay-actions .ghost{background:transparent;color:var(--ui-text);border:1px solid #4a4660;}
  #resultShare{display:inline-flex;align-items:center;gap:7px;}
  #resultShare svg{width:15px;height:15px;flex:none;}
  .share-error{color:#f0a08c;font-size:12px;margin:10px 0 0;}
  .share-error:empty{display:none;}
