  :root{
    --bg:#ffffff;
    --bg-elev:#ffffff;
    --text:#0f0f0f;
    --text-dim:#606060;
    --text-faint:#909090;
    --border:#e5e5e5;
    --search-border:rgba(96,96,96,.22);
    --sidebar-bg:#f9f9f9;
    --panel-bg:#ffffff;
    --hover:#f2f2f2;
    --chip-bg:#f1f1f1;
    --chip-text:#0f0f0f;
    --chip-active-bg:#0ea5e9;
    --chip-active-text:#ffffff;
    --accent:#0ea5e9;
    --accent-text:#ffffff;
    --input-bg:#f1f1f1;
    --input-text:#0f0f0f;
    --overlay:rgba(0,0,0,.5);
    --shadow:0 1px 2px rgba(0,0,0,.08);
    --radius:12px;
  }
  html[data-theme="dark"]{
    --bg:#1a1a1a;
    --bg-elev:#1a1a1a;
    --text:#f1f1f1;
    --text-dim:#aaaaaa;
    --text-faint:#888888;
    --border:#2a2a2a;
    --search-border:#2a2a2a;
    --sidebar-bg:#1a1a1a;
    --panel-bg:#1a1a1a;
    --hover:#2a2a2a;
    --chip-bg:#2a2a2a;
    --chip-text:#f1f1f1;
    --chip-active-bg:#ff0033;
    --chip-active-text:#ffffff;
    --accent:#ff0033;
    --accent-text:#ffffff;
    --input-bg:#1a1a1a;
    --input-text:#f1f1f1;
    --overlay:rgba(0,0,0,.6);
    --shadow:0 1px 2px rgba(0,0,0,.4);
  }
  html[data-theme="dark"] .search-form input{background:#1a1a1a;border-color:#2a2a2a;}
  html[data-theme="dark"] .search-form button.search-submit{background:#222;border-color:#2a2a2a;color:var(--text);}
  html[data-theme="dark"] .search-form button.search-submit:hover{background:#303030;}
  *{box-sizing:border-box;}
  body{margin:0;}
  body, input, button, select, textarea{
    font-family:"ヒラギノ角ゴ ProN","Hiragino Kaku Gothic ProN","HiraKakuProN-W3","Hiragino Sans","Noto Sans JP","Yu Gothic UI",Roboto,Arial,sans-serif;
  }
  html, body{
    background:var(--bg);
    color:var(--text);
    min-height:100%;
    overflow-x:hidden;
  }
  a{color:inherit;text-decoration:none;}
  button{font:inherit;}

  #app{min-height:100vh;}

  /* ===== Top bar ===== */
  .topbar{
    position:fixed; top:0; left:0; right:0; height:56px;
    background:var(--bg);
    border-bottom:1px solid var(--border);
    display:flex; align-items:center;
    padding:0 16px 0 13px; gap:12px;
    z-index:100;
  }
  .hamburger{
    background:none;border:none;cursor:pointer;color:var(--text);
    width:44px;height:44px;border-radius:8px;
    display:flex;align-items:center;justify-content:center;
    flex:0 0 auto;
  }
  .hamburger:hover{background:var(--hover);}
  .hamburger svg{width:28px;height:28px;}
  .brand{
    display:flex;align-items:center;gap:6px;
    flex:0 0 auto; cursor:pointer; height:24px;
  }
  .brand{gap:5px;height:34px;}
  .brand .axe-logo{display:block;height:27px;width:auto;}
  .brand .axe-word{
    font-family:Roboto,Arial,Helvetica,sans-serif;
    font-size:24px;font-weight:800;letter-spacing:-1.5px;
    color:var(--text);line-height:1;white-space:nowrap;
  }
  @media (max-width:520px){ .brand .axe-logo{height:22px;} .brand .axe-word{font-size:19px;} }
  .search-wrap{flex:1 1 auto;display:flex;justify-content:center;}
  .search-form{display:flex;align-items:center;width:100%;max-width:760px;}
  .search-form input{
    flex:1 1 auto; background:var(--chip-bg); color:var(--input-text);
    border:1px solid var(--search-border); border-right:none;
    border-radius:40px 0 0 40px; padding:9px 18px 9px 20px; font-size:14px; outline:none;
    height:42px; box-sizing:border-box;
  }
  .search-form input:focus{border-color:var(--accent);}
  .search-form button.search-submit{
    width:48px;height:42px; background:var(--chip-bg);
    border:1px solid var(--search-border); border-left:1px solid var(--border);
    border-radius:0 40px 40px 0;
    cursor:pointer; display:flex;align-items:center;justify-content:center;
    color:var(--text);
  }
  .search-form button.search-submit:hover{background:var(--hover);}

  /* ===== Side nav (mini rail ↔ expanded) ===== */
  .nav-rail{
    position:fixed; left:0; top:56px; bottom:0;
    width:70px; background:var(--sidebar-bg);
    z-index:90; padding:8px 0 24px; overflow-y:auto; overscroll-behavior:contain;
    border-right:1px solid var(--border);
    transition:width .18s ease;
  }
  .nav-rail button{
    width:100%; background:none; border:none; cursor:pointer;
    display:flex; flex-direction:column; align-items:center; gap:4px;
    padding:14px 2px; color:var(--text); border-radius:0; /* 完全な四角 */
    text-align:center;
    position:relative;
  }
  .nav-rail button:hover{background:var(--hover);}
  .nav-rail button.active{background:var(--hover);}
  .nav-rail button.active svg{color:var(--accent);}
  .nav-rail svg{width:24px;height:24px;}
  .nav-rail .label{font-size:13px;line-height:1.2;font-weight:600;}

  /* アクティブな項目のインジケーター線 */
  .nav-rail:not(.expanded) button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent);
  }
  .nav-rail.expanded button.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
  }

  /* Expanded state — like YouTube full sidebar */
  .nav-rail.expanded{width:260px; padding:8px 0;}
  .nav-rail.expanded button{
    flex-direction:row; justify-content:flex-start;
    gap:22px; padding:10px 14px; text-align:left;
  }
  .nav-rail.expanded button.active{font-weight:700;}
  .nav-rail.expanded .label{font-size:16px;font-weight:600;}

  /* Backdrop only used on mobile when expanded */
  .drawer-backdrop{
    position:fixed; inset:0; background:var(--overlay);
    z-index:25; opacity:0; pointer-events:none;
    transition:opacity .2s ease;
  }
  .drawer-backdrop.show{opacity:1;pointer-events:auto;}

  @media (max-width:680px){
    .nav-rail{transform:translateX(-100%); width:240px; padding:8px 0;}
    .nav-rail button{
      flex-direction:row; justify-content:flex-start;
      gap:22px; padding:10px 14px; text-align:left;
    }
    .nav-rail .label{font-size:14px;}
    .nav-rail.expanded{transform:translateX(0);}
    /* モバイル時は常に左縦線を表示 */
    .nav-rail:not(.expanded) button.active::after {
      display: none;
    }
    .nav-rail button.active::after {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 3px;
      height: 100%;
      background: var(--accent);
    }
  }

  /* ===== Main ===== */
  .main{
    padding-top:56px;
    padding-left:70px;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    transition:padding-left .18s ease;
  }
  body.nav-expanded .main{padding-left:260px;}
  @media (max-width:680px){
    .main{padding-left:0;}
    body.nav-expanded .main{padding-left:0;}
  }
  .tabs{
    display:flex; justify-content:center; gap:8px;
    padding:14px 16px 4px; flex-wrap:wrap;
  }
  .tab-chip{
    background:var(--chip-bg); color:var(--chip-text);
    border:none; border-radius:4px; padding:8px 16px;
    font-size:14px; font-weight:700; cursor:pointer;
  }
  .tab-chip:hover{filter:brightness(0.95);}
  html[data-theme="dark"] .tab-chip:hover{filter:brightness(1.2);}
  .tab-chip.active{background:var(--accent); color:var(--accent-text);}

  /* Shorts row (horizontal scrolling) */
  .shorts-row-wrap{margin:4px 0 24px;}
  .shorts-row-head{display:flex;align-items:center;gap:8px;margin:0 4px 12px;}
  .shorts-row-head .shorts-icon{
    width:24px;height:24px;border-radius:6px;background:var(--accent);
    color:#fff;display:flex;align-items:center;justify-content:center;
    font-size:14px;font-weight:700;flex:0 0 auto;
  }
  .shorts-row-head h2{font-size:18px;font-weight:700;margin:0;color:var(--text);}
  .shorts-row{
    display:flex;gap:10px;overflow-x:auto;overflow-y:hidden;
    scroll-snap-type:x mandatory;
    padding:2px 4px 8px;
    scrollbar-width:thin;
  }
  .shorts-row::-webkit-scrollbar{height:6px;}
  .shorts-row::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px;}
  .shorts-row .short-card{
    flex:0 0 auto;width:170px;aspect-ratio:9/16;
    scroll-snap-align:start;
  }
  @media (max-width:600px){.shorts-row .short-card{width:140px;}}

  .content{flex:1 1 auto; width:100%; padding:16px 16px 0;}
  @media (max-width:760px){.content{padding:12px 10px 0;}}
  .section-title{font-size:20px;font-weight:700;margin:0 0 12px 4px;}

  .grid{
    display:grid;
    grid-template-columns:repeat(5, minmax(0,1fr));
    gap:24px 16px;
    width:100%;
  }
  @media (max-width:1750px){.grid{grid-template-columns:repeat(4, minmax(0,1fr));}}
  @media (max-width:1350px){.grid{grid-template-columns:repeat(3, minmax(0,1fr));}}
  @media (max-width:760px){.grid{grid-template-columns:repeat(2, minmax(0,1fr));gap:16px 12px;}}
  @media (max-width:460px){.grid{grid-template-columns:minmax(0,1fr);}}

  .card{cursor:pointer;}
  .thumb-wrap{
    position:relative; width:100%; aspect-ratio:16/9;
    border-radius:12px; overflow:hidden; background:var(--chip-bg);
  }
  .thumb-wrap img{width:100%;height:100%;object-fit:cover;display:block;}
  .duration{
    position:absolute; right:6px; bottom:6px;
    background:rgba(0,0,0,.85); color:#fff;
    font-size:12px; font-weight:600;
    padding:2px 5px; border-radius:4px; line-height:1.3;
  }
  .live-badge{
    position:absolute; left:6px; top:6px;
    background:var(--accent); color:#fff;
    font-size:11px;font-weight:700;
    padding:2px 6px;border-radius:4px;
  }
  .card-body{display:flex; gap:10px; margin-top:10px;}
  .ch-avatar{
    width:32px;height:32px;border-radius:50%;
    flex:0 0 auto;object-fit:cover;background:var(--chip-bg);
  }
  .card-meta{min-width:0;}
  .card-title{
    font-size:13px; font-weight:600; line-height:1.35;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
    overflow:hidden; margin-bottom:4px; color:var(--text);
  }
  .card-channel{
    font-size:13px;color:var(--text-dim);
    margin-bottom:1px;
  }
  .card-sub{font-size:13px;color:var(--text-dim);}

  .state-msg{
    text-align:center;color:var(--text-dim);padding:48px 0;font-size:14px;
  }
  .spinner{
    width:28px;height:28px;border-radius:50%;
    border:3px solid var(--border);
    border-top-color:var(--accent);
    margin:0 auto 12px;
    animation:spin 0.8s linear infinite;
  }
  @keyframes spin{to{transform:rotate(360deg);}}

  .load-more-indicator{
    display:flex; justify-content:center; padding:28px 0 4px;
  }
  .load-more-indicator .spinner{margin:0;}
  #scrollSentinel{height:1px;}

  /* ===== smooth scrolling ===== */
  html{scroll-behavior:smooth;}
  html, body{overflow-y:auto;}
  body{-webkit-overflow-scrolling:touch;}
  @media (prefers-reduced-motion: reduce){ html{scroll-behavior:auto;} }
  .card img, .related-item img, .hist-item img{ transform:translateZ(0); }
  .main{overflow:visible;}
  .content{padding-bottom:24px;}

  /* ===== blocked-API banner ===== */
  .blocked-banner{
    display:none;
    margin:12px 16px 0;
    background:#fdf6ec; border:1px solid #f0c98a; border-radius:10px;
    padding:14px 16px; color:#3a2a10;
    align-items:center; gap:14px;
  }
  .blocked-banner.show{display:flex;}
  html[data-theme="dark"] .blocked-banner{background:#2b2418;border-color:#7a5a20;color:#f5e7cf;}
  .blocked-banner .bb-body{flex:1 1 auto;min-width:0;}
  .blocked-banner .bb-title{display:flex;align-items:center;gap:8px;font-weight:700;font-size:15px;margin-bottom:4px;}
  .blocked-banner .bb-text{font-size:13px;line-height:1.5;opacity:.9;}
  .blocked-banner .bb-btn{
    background:#1a73e8;color:#fff;border:none;border-radius:6px;
    padding:9px 16px;font-size:13px;font-weight:700;cursor:pointer;flex:0 0 auto;
  }
  .blocked-banner .bb-btn:hover{background:#1666d0;}
  .blocked-banner .bb-close{background:none;border:none;color:inherit;font-size:18px;cursor:pointer;flex:0 0 auto;opacity:.7;}
  @media (max-width:640px){ .blocked-banner{flex-wrap:wrap;} .blocked-banner .bb-btn{width:100%;} }

  /* ===== proxy dialog ===== */
  .axe-modal{position:fixed;inset:0;background:var(--overlay);z-index:400;display:none;align-items:center;justify-content:center;padding:16px;}
  .axe-modal.show{display:flex;}
  .axe-modal-card{background:var(--panel-bg);color:var(--text);border:1px solid var(--border);border-radius:14px;max-width:460px;width:100%;padding:20px;}
  .axe-modal-card h3{margin:0 0 8px;font-size:17px;}
  .axe-modal-card p{margin:0 0 12px;font-size:13px;color:var(--text-dim);line-height:1.6;}
  .axe-modal-card input{width:100%;padding:10px 12px;border-radius:8px;border:1px solid var(--border);background:var(--input-bg);color:var(--input-text);font-size:13px;}
  .axe-modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:16px;flex-wrap:wrap;}
  .axe-btn{padding:9px 16px;border-radius:8px;border:1px solid var(--border);background:transparent;color:var(--text);cursor:pointer;font-size:13px;}
  .axe-btn.primary{background:var(--accent);color:var(--accent-text);border-color:transparent;font-weight:700;}

  /* ===== history list (YouTube-like rows) ===== */
  .hist-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0 16px;}
  .hist-head h2{margin:0;font-size:26px;font-weight:800;color:var(--text);}
  .hist-clear{background:var(--chip-bg);color:var(--text);border:none;border-radius:18px;padding:8px 16px;font-size:13px;cursor:pointer;}
  .hist-clear:hover{background:var(--hover);}
  .hist-list{display:flex;flex-direction:column;gap:14px;}
  .hist-item{
    display:flex;gap:18px;background:var(--chip-bg);border-radius:12px;padding:14px;cursor:pointer;
    transition:background .15s ease;
  }
  .hist-item:hover{background:var(--hover);}
  .hist-thumb{position:relative;flex:0 0 246px;width:246px;aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#000;}
  .hist-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
  .hist-thumb .duration{position:absolute;right:6px;bottom:6px;background:rgba(0,0,0,.8);color:#fff;font-size:12px;padding:1px 5px;border-radius:4px;}
  .hist-meta{flex:1 1 auto;min-width:0;}
  .hist-title{font-size:16px;font-weight:700;color:var(--text);line-height:1.4;margin-bottom:6px;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
  .hist-sub{font-size:12.5px;color:var(--text-dim);margin-bottom:8px;}
  .hist-desc{font-size:12.5px;color:var(--text-dim);line-height:1.6;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
  .hist-remove{background:none;border:none;color:var(--text-dim);font-size:18px;cursor:pointer;align-self:flex-start;padding:2px 6px;}
  @media (max-width:700px){
    .hist-item{flex-direction:column;gap:10px;}
    .hist-thumb{flex:0 0 auto;width:100%;}
  }

  /* ===== playlists (YouTube-like) ===== */
  .pl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px 16px;}
  .pl-card{cursor:pointer;}
  .pl-cover{
    position:relative;aspect-ratio:16/9;border-radius:12px;overflow:hidden;background:#000;
  }
  .pl-cover::before,.pl-cover::after{
    content:"";position:absolute;left:50%;transform:translateX(-50%);
    border-radius:8px 8px 0 0;background:var(--text-faint);
  }
  .pl-cover::before{top:-8px;width:92%;height:8px;opacity:.55;}
  .pl-cover::after{top:-4px;width:96%;height:4px;opacity:.8;}
  .pl-cover img{width:100%;height:100%;object-fit:cover;display:block;}
  .pl-count{
    position:absolute;right:4px;bottom:4px;top:auto;width:auto;
    background:rgba(0,0,0,.8);color:#fff;border-radius:4px;
    padding:3px 6px;font-size:12px;font-weight:600;
    display:flex;align-items:center;gap:5px;
  }
  .pl-play-overlay{
    position:absolute;inset:0;background:rgba(0,0,0,.7);color:#fff;
    display:flex;align-items:center;justify-content:center;gap:8px;
    font-size:14px;font-weight:600;opacity:0;transition:opacity .15s ease;
  }
  .pl-card:hover .pl-play-overlay{opacity:1;}
  .pl-body{padding:10px 2px 0;}
  .pl-name{
    font-size:15px;font-weight:700;color:var(--text);line-height:1.35;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  }
  .pl-sub{font-size:12.5px;color:var(--text-dim);margin-top:4px;}
  .pl-sub a,.pl-sub .pl-viewall{color:var(--text-dim);}
  .pl-toolbar{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:20px;flex-wrap:wrap;}
  .save-pl-btn{background:var(--chip-bg);color:var(--text);border:none;border-radius:18px;padding:8px 14px;font-size:13px;cursor:pointer;}
  .save-pl-btn:hover{background:var(--hover);}
  .pl-pick-item{display:flex;align-items:center;gap:10px;padding:8px 4px;font-size:14px;color:var(--text);cursor:pointer;}
  .pl-pick-item:hover{background:var(--hover);border-radius:8px;}

  /* playlist detail — YouTube two-column layout */
  .pl-detail{display:flex;gap:32px;align-items:flex-start;}
  .pl-panel{
    flex:0 0 340px;max-width:340px;border-radius:16px;padding:20px;
    background:linear-gradient(180deg,var(--chip-bg),var(--hover));
    position:sticky;top:76px;
  }
  .pl-panel .pl-panel-cover{border-radius:12px;overflow:hidden;aspect-ratio:16/9;background:#000;}
  .pl-panel .pl-panel-cover img{width:100%;height:100%;object-fit:cover;display:block;}
  .pl-panel h2{font-size:22px;font-weight:800;margin:14px 0 6px;color:var(--text);line-height:1.3;}
  .pl-panel .pl-panel-meta{font-size:13px;color:var(--text-dim);}
  .pl-panel-actions{display:flex;gap:8px;margin-top:16px;flex-wrap:wrap;}
  .pl-btn{
    border:none;border-radius:999px;padding:10px 18px;font-size:14px;font-weight:600;
    cursor:pointer;background:var(--text);color:var(--bg);
    display:inline-flex;align-items:center;gap:6px;
  }
  .pl-btn:hover{filter:brightness(1.15);}
  .pl-btn.ghost{background:rgba(128,128,128,.18);color:var(--text);}
  .pl-items{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:8px;}
  .pl-row{display:flex;align-items:center;gap:12px;padding:6px;border-radius:10px;cursor:pointer;}
  .pl-row:hover{background:var(--hover);}
  .pl-row .pl-idx{width:22px;text-align:center;font-size:13px;color:var(--text-dim);flex:0 0 auto;}
  .pl-row .pl-rthumb{
    position:relative;width:160px;height:90px;flex:0 0 auto;border-radius:8px;overflow:hidden;background:var(--chip-bg);
  }
  .pl-row .pl-rthumb img{width:100%;height:100%;object-fit:cover;display:block;}
  .pl-row .pl-rmeta{min-width:0;flex:1 1 auto;}
  .pl-row .pl-rtitle{
    font-size:14px;font-weight:600;color:var(--text);line-height:1.35;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  }
  .pl-row .pl-rsub{font-size:12px;color:var(--text-dim);margin-top:4px;}
  @media (max-width:1000px){
    .pl-detail{flex-direction:column;}
    .pl-panel{position:static;flex:1 1 auto;max-width:none;width:100%;}
  }
  @media (max-width:700px){
    .pl-row .pl-rthumb{width:120px;height:68px;}
  }

  /* ===== watch UI: three-dot menu ===== */
  .more-wrap{position:relative;display:inline-flex;}
  .more-btn{
    background:var(--chip-bg);color:var(--text);border:none;border-radius:50%;
    width:36px;height:36px;cursor:pointer;font-size:18px;line-height:1;
    display:inline-flex;align-items:center;justify-content:center;
  }
  .more-btn:hover{background:var(--hover);}
  .more-menu{
    position:absolute;right:0;top:calc(100% + 6px);min-width:220px;
    background:var(--panel-bg);border:1px solid var(--border);border-radius:12px;
    box-shadow:0 4px 24px rgba(0,0,0,.2);padding:6px;z-index:120;display:none;
  }
  .more-menu.show{display:block;}
  .more-menu button{
    width:100%;background:none;border:none;cursor:pointer;color:var(--text);
    text-align:left;font-size:14px;padding:10px 12px;border-radius:8px;
    display:flex;align-items:center;gap:10px;
  }
  .more-menu button:hover{background:var(--hover);}
  .more-menu .mi-icon{width:18px;text-align:center;font-size:15px;}

  /* Footer */
  .footer{text-align:center;padding:40px 16px 28px;color:var(--text-dim);font-size:13px;}
  .footer .f-brand{font-weight:700;font-size:14px;margin-bottom:8px;color:var(--text);}
  .footer .f-version{font-size:12px;color:var(--text-faint);}

  /* ===== Settings panel — transparent when closed ===== */
  .settings-panel{
    position:fixed; left:0; top:56px; bottom:0;
    width:360px; max-width:100vw;
    overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
    background:transparent;
    z-index:95;
    overflow-y:auto; overflow-x:hidden;
    transform:translateX(-110%);
    visibility:hidden;
    opacity:0;
    pointer-events:none;
    transition:transform .2s ease, opacity .15s ease, visibility 0s linear .2s, background .2s ease;
    padding:20px 20px 96px;
  }
  .settings-panel.show{
    transform:translateX(0);
    visibility:visible;
    opacity:1;
    pointer-events:auto;
    background:var(--panel-bg);
    border-right:1px solid var(--border);
    box-shadow:var(--shadow);
    transition:transform .2s ease, opacity .15s ease, visibility 0s, background .2s ease;
  }
  .settings-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px;}
  .settings-head h2{font-size:18px;margin:0;}
  .icon-btn{
    background:none;border:none;cursor:pointer;color:var(--text);
    width:32px;height:32px;border-radius:50%;
    display:flex;align-items:center;justify-content:center;
  }
  .icon-btn:hover{background:var(--hover);}
  .settings-group{
    border:1px solid var(--border); border-radius:10px;
    padding:14px 16px; margin-bottom:16px;
    width:100%; max-width:100%; overflow-wrap:anywhere;
  }
  .settings-group h3{font-size:13px;margin:0 0 10px;color:var(--text-dim);font-weight:700;}
  .radio-row, .check-row{
    display:flex;align-items:flex-start;gap:8px;
    font-size:14px;padding:6px 0;cursor:pointer;line-height:1.4;
  }
  .radio-row input, .check-row input{accent-color:var(--accent);width:15px;height:15px;flex:0 0 auto;margin-top:2px;}
  .endpoint-input{
    width:100%;max-width:100%;margin-top:4px;
    background:var(--input-bg);color:var(--input-text);
    border:1px solid var(--border);border-radius:6px;
    padding:8px 10px;font-size:13px;outline:none;
  }
  .endpoint-hint{font-size:11.5px;color:var(--text-faint);margin-top:6px;line-height:1.5;}
  .save-hint{font-size:12px;color:var(--text-faint);text-align:center;margin-top:4px;}
  .instance-list{display:flex;flex-direction:column;gap:6px;margin-top:4px;}
  .instance-list .inst-row{display:flex;gap:6px;}
  .instance-list input{flex:1 1 auto;background:var(--input-bg);color:var(--input-text);border:1px solid var(--border);border-radius:6px;padding:6px 8px;font-size:12.5px;outline:none;}
  .instance-list .rm{background:var(--chip-bg);color:var(--text);border:none;border-radius:6px;width:32px;cursor:pointer;}
  .instance-list .rm:disabled{opacity:.35;cursor:not-allowed;}
  .instance-list input:disabled{opacity:.7;cursor:not-allowed;}
  .instance-list .inst-row.locked .lock-badge{
    font-size:10.5px;color:var(--text-faint);align-self:center;padding:0 4px;letter-spacing:.04em;
  }
  .add-inst{margin-top:6px;background:var(--chip-bg);color:var(--text);border:none;border-radius:8px;padding:6px 12px;font-size:12.5px;cursor:pointer;}

  /* ===== Player (YouTube-like) ===== */
  .player-overlay{
    position:fixed;
    top:56px;
    left:70px;
    right:0;
    bottom:0;
    background:var(--bg);
    z-index:40;
    display:none;
    overflow-y:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    transition:left .18s ease;
  }
  body.nav-expanded .player-overlay{
    left:260px;
  }
  @media (max-width:680px){
    .player-overlay{
      left:0;
    }
    body.nav-expanded .player-overlay{
      left:0;
    }
  }
  .player-overlay.show{display:block;}

  .player-layout{
    display:grid;
    grid-template-columns:minmax(0,1fr) 402px;
    gap:24px;
    max-width:none; margin:0; padding:16px 16px 60px;
  }
  @media (max-width:1500px){
    .player-layout{grid-template-columns:minmax(0,1fr) 360px;}
  }
  @media (max-width:1100px){
    .player-layout{grid-template-columns:minmax(0,1fr); padding:12px 12px 60px;}
  }

  .video-frame{
    width:100%;aspect-ratio:16/9;background:#000;
    overflow:hidden;position:relative;
  }
  .video-frame video{width:100%;height:100%;background:#000;display:block;}
  .custom-controls{
    position:absolute; left:0; right:0; bottom:0;
    display:flex; align-items:center; gap:6px;
    padding:8px 12px; background:linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
    color:#fff; z-index:5;
    opacity:0; transition:opacity .2s ease; pointer-events:none;
  }
  .video-frame:hover .custom-controls,
  .video-frame:focus-within .custom-controls{opacity:1; pointer-events:auto;}
  .cc-btn{
    background:transparent;border:none;color:#fff;cursor:pointer;
    width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;
    border-radius:50%;
  }
  .cc-btn:hover{background:rgba(255,255,255,.15);}
  .cc-time{font-size:13px; font-weight:600; padding:0 8px;}
  .video-skeleton{
    position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#fff;
    overflow:hidden;background:#000;
  }
  .video-skeleton::before{
    content:"";position:absolute;inset:-20px;
    background-image:var(--thumb-url,none);
    background-size:cover;background-position:center;background-repeat:no-repeat;
    filter:blur(18px) brightness(.55);
    z-index:0;
  }
  .video-skeleton > *{position:relative;z-index:1;}
  .video-skeleton::after{
    content:"";position:absolute;inset:0;background:rgba(0,0,0,.35);z-index:0;
  }
  .player-title{color:var(--text);font-size:20px;font-weight:700;margin:14px 0 10px;line-height:1.3;}

  .player-channel{
    display:flex;align-items:center;gap:12px;
    padding:8px 0 14px; color:var(--text);
    flex-wrap:wrap;
  }
  .player-channel img{width:42px;height:42px;border-radius:50%;object-fit:cover;background:var(--chip-bg);}
  .player-channel .cname{font-weight:600;font-size:15px;color:var(--text);}
  .player-channel .csub{font-size:12px;color:var(--text-dim);}
  .player-channel .cinfo{min-width:0;}

  .subscribe-btn{
    background:#0f0f0f; color:#fff; border:none;
    border-radius:4px; padding:9px 18px;
    font-size:14px; font-weight:600; cursor:pointer;
    white-space:nowrap;
  }
  html[data-theme="dark"] .subscribe-btn{background:#f1f1f1;color:#0f0f0f;}
  .subscribe-btn:hover{filter:brightness(1.1);}
  .subscribe-btn.subscribed{background:var(--chip-bg);color:var(--text);}

  .player-actions{
    display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap;
  }
  .player-actions select{
    background:var(--chip-bg);color:var(--text);border:1px solid var(--border);
    border-radius:6px;padding:6px 10px;font-size:13px;outline:none;
  }
  .action-chip{
    background:var(--chip-bg);color:var(--text);border:none;border-radius:999px;
    padding:9px 14px;font-size:13px;font-weight:600;cursor:pointer;
    display:inline-flex;align-items:center;gap:6px;
  }
  .action-chip:hover{filter:brightness(0.95);}
  html[data-theme="dark"] .action-chip:hover{filter:brightness(1.2);}
  /* 概要欄「もっと見る」スタイル */
  .player-desc-text{
    color:var(--text);font-size:13.5px;line-height:1.6;
    display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
  }
  .player-desc-text.expanded{display:block;white-space:pre-wrap;}
  .player-desc-toggle{
    background:none;border:none;cursor:pointer;
    color:var(--text);font-size:13.5px;font-weight:700;
    padding:6px 0 0;display:block;
  }
  .player-desc-toggle:hover{text-decoration:underline;}
  .player-error{color:#ff6b6b;font-size:13px;margin-top:10px;}

  /* related sidebar */
  .related-list{display:flex;flex-direction:column;gap:8px;}
  .related-item{display:flex;gap:8px;cursor:pointer;border-radius:8px;padding:4px;}
  .related-item:hover{background:var(--hover);}
  .related-item .rt-thumb{
    width:168px;height:94px;flex:0 0 auto;border-radius:8px;overflow:hidden;
    background:var(--chip-bg);position:relative;
  }
  .related-item .rt-thumb img{width:100%;height:100%;object-fit:cover;}
  .related-item .rt-meta{min-width:0;}
  .related-item .rt-title{font-size:13px;font-weight:600;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:var(--text);}
  .related-item .rt-channel{font-size:12px;color:var(--text-dim);margin-top:4px;}
  .related-item .rt-sub{font-size:12px;color:var(--text-dim);}

  @media (max-width:680px){
    .settings-panel{width:100vw;}
  }



  /* ===== チャンネル画面のスタイル (YouTube風) ===== */
  .channel-container {
    max-width: 100%;
    margin: 0;
    padding: 0 0 8px;
  }
  .channel-banner {
    width: 100%;
    aspect-ratio: 6.2/1;
    max-height: 225px;
    background: var(--chip-bg);
    border-radius: 12px;
    overflow: hidden;
    margin: 8px 0 0;
  }
  .channel-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .channel-header {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 24px 0 16px;
  }
  .channel-avatar {
    width: 160px; height: 160px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--chip-bg);
    flex-shrink: 0;
  }
  .channel-info { flex: 1 1 auto; min-width: 0; }
  .channel-name {
    font-size: 36px; font-weight: 700; line-height: 1.2;
    margin: 0 0 6px; color: var(--text);
  }
  .channel-handle-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 14px; color: var(--text-dim); margin-bottom: 8px;
  }
  .channel-handle-row .handle { color: var(--text); font-weight: 500; }
  .channel-desc-preview {
    font-size: 14px; color: var(--text-dim);
    margin-bottom: 16px; cursor: pointer; line-height: 1.5; max-width: 680px;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  }
  .channel-desc-preview.expanded { display: block; white-space: pre-wrap; }
  .channel-desc-preview span { font-weight: 600; color: var(--text); }
  .channel-header .subscribe-btn { margin-top: 4px; border-radius: 999px; padding: 10px 16px; }
  /* チャンネルタブ */
  .channel-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid var(--border);
    margin: 0 0 24px;
    overflow-x: auto; scrollbar-width: none;
  }
  .channel-tabs::-webkit-scrollbar { display: none; }
  .ch-tab {
    background: none; border: none;
    padding: 12px 16px; font-size: 16px; font-weight: 500;
    color: var(--text-dim); cursor: pointer; position: relative;
    white-space: nowrap; flex-shrink: 0;
  }
  .ch-tab:hover { color: var(--text); }
  .ch-tab.active { color: var(--text); font-weight: 600; }
  .ch-tab.active::after {
    content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
    height: 2px; background: var(--text);
  }
  @media (max-width: 1024px) {
    .channel-avatar { width: 112px; height: 112px; }
    .channel-name { font-size: 28px; }
  }
  @media (max-width: 700px) {
    .channel-banner { aspect-ratio: 4/1; border-radius: 8px; }
    .channel-header { flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 16px 0 12px; }
    .channel-avatar { width: 80px; height: 80px; }
    .channel-name { font-size: 22px; }
    .channel-handle-row { justify-content: center; font-size: 12px; }
    .channel-desc-preview { font-size: 12.5px; }
    .ch-tab { font-size: 14px; padding: 12px 14px; }
  }

  /* ===== 登録チャンネル (横並びリスト) ===== */
  .subs-list { display: flex; flex-direction: column; gap: 0; max-width: 1100px; }
  .subs-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
  .subs-row {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 8px; cursor: pointer; border-bottom: 1px solid var(--border);
    border-radius: 12px;
  }
  .subs-row:hover { background: var(--hover); }
  .subs-row img, .subs-row .ph {
    width: 64px; height: 64px; border-radius: 50%;
    object-fit: cover; background: var(--chip-bg); flex: 0 0 auto;
  }
  .subs-row .subs-meta { flex: 1 1 auto; min-width: 0; }
  .subs-row .subs-name {
    font-size: 16px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .subs-row .subs-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
  .subs-row .sub-unsub-btn { flex: 0 0 auto; border-radius: 999px; }
  @media (max-width: 600px) {
    .subs-row img, .subs-row .ph { width: 48px; height: 48px; }
    .subs-row .subs-name { font-size: 14px; }
  }

  /* ===== ショートUI ===== */
  .shorts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 0 0 40px;
  }
  @media (max-width: 600px) { .shorts-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; } }
  /* チャンネルホーム用 横スクロール行 */
  .ch-row { margin: 4px 0 28px; }
  .ch-row-head { display:flex; align-items:center; justify-content:space-between; margin:0 4px 12px; }
  .ch-row-head h2 { font-size:16px; font-weight:700; margin:0; color:var(--text); }
  .ch-row-scroll { display:flex; gap:12px; overflow-x:auto; scroll-snap-type:x proximity; padding-bottom:8px; scrollbar-width:thin; }
  .ch-row-scroll::-webkit-scrollbar { height:6px; }
  .ch-row-scroll::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
  .ch-row-scroll .card { width:240px; flex:0 0 240px; scroll-snap-align:start; }
  .ch-row-scroll .short-card { width:170px; flex:0 0 170px; scroll-snap-align:start; }
  .ch-featured { display:grid; grid-template-columns: minmax(0, 480px) 1fr; gap:20px; margin:8px 0 28px; }
  .ch-featured video, .ch-featured img.ch-featured-thumb { width:100%; aspect-ratio:16/9; object-fit:cover; border-radius:12px; background:#000; cursor:pointer; }
  .ch-featured .ch-featured-meta h2 { font-size:18px; font-weight:600; margin:0 0 8px; }
  .ch-featured .ch-featured-meta .sub { font-size:13px; color:var(--text-dim); }
  @media (max-width: 800px) { .ch-featured { grid-template-columns: 1fr; } }
  .short-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 9/16;
    background: #000;
  }
  .short-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
  }
  .short-card:hover img { transform: scale(1.03); }
  .short-card-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    padding: 40px 10px 10px;
    color: #fff;
  }
  .short-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .short-card-views {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 4px;
  }
  .shorts-player-overlay {
    position: fixed; inset: 0;
    background: #000;
    z-index: 200;
    display: none;
  }
  .shorts-player-overlay.show { display: block; }
  .shorts-feed {
    width: 100%; height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
  }
  .shorts-feed::-webkit-scrollbar { display: none; }
  .shorts-feed-item {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    display: flex; align-items: center; justify-content: center;
    background: #000;
  }
  .shorts-feed-item video {
    max-width: min(450px, 100%);
    max-height: 100%;
    width: auto; height: 100%;
    object-fit: contain;
    background: #000;
  }
  .shorts-feed-info {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: min(450px, 100%);
    right: auto;
    bottom: 6px;
    padding: 60px 80px 18px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: #fff;
    pointer-events: none;
    box-sizing: border-box;
  }
  .shorts-feed-info > * { pointer-events: auto; }
  .shorts-feed-channel-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  }
  .shorts-feed-channel-row img, .shorts-feed-channel-row .ph {
    width: 36px; height: 36px; border-radius: 50%; background: #333; object-fit: cover; flex-shrink: 0;
  }
  .shorts-feed-channel-name {
    font-size: 14px; font-weight: 600; color: #fff;
  }
  .shorts-feed-sub {
    background: #fff; color: #000; border: none; border-radius: 999px;
    padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  }
  .shorts-feed-sub.subscribed { background: rgba(255,255,255,0.16); color: #fff; }
  .shorts-feed-title { font-size: 14.5px; font-weight: 500; margin-bottom: 8px; line-height: 1.35; color: #fff; }

  /* Right action rail (YouTube-like) */
  .shorts-actions {
    position: absolute;
    right: 12px;
    bottom: 80px;
    display: flex; flex-direction: row; gap: 10px;
    z-index: 5;
  }
  @media (max-width: 540px) {
    .shorts-actions { right: 8px; bottom: 88px; gap: 8px; }
  }
  .shorts-action-btn {
    background: rgba(0,0,0,0.45); border: none; cursor: pointer; color: #fff;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; padding: 6px 10px;
    border-radius: 999px; backdrop-filter: blur(4px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  }
  .shorts-action-btn .ico { font-size: 15px; line-height: 1; }
  .shorts-action-btn:hover { background: rgba(0,0,0,0.65); }
  .shorts-action-btn.active { background: rgba(255,255,255,0.22); }
  .shorts-action-btn .lbl { line-height: 1; }

  /* Comments panel */
  .shorts-comments-panel {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    width: min(420px, 100%);
    background: var(--bg);
    color: var(--text);
    z-index: 220;
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex; flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,.4);
  }
  .shorts-comments-panel.show { transform: translateX(0); }
  @media (max-width: 680px) {
    .shorts-comments-panel {
      right: 0; left: 0; top: auto; width: 100%;
      height: 70vh; border-radius: 16px 16px 0 0;
      transform: translateY(100%);
    }
    .shorts-comments-panel.show { transform: translateY(0); }
  }
  .shorts-comments-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    font-size: 15px; font-weight: 700;
  }
  .shorts-comments-close {
    background: none; border: none; color: var(--text);
    font-size: 20px; cursor: pointer; padding: 4px 8px;
  }
  .shorts-comments-body {
    flex: 1; overflow-y: auto; padding: 8px 16px 24px;
  }
  .shorts-player-close {
    position: fixed;
    top: 16px; right: 16px;
    background: rgba(0,0,0,0.6);
    border: none; border-radius: 50%;
    width: 40px; height: 40px;
    cursor: pointer; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; z-index: 210;
  }
  .shorts-quality-wrap {
    position: fixed;
    top: 16px; left: 16px;
    z-index: 211;
  }
  .shorts-quality-btn {
    background: rgba(0,0,0,0.6); color: #fff;
    border: none; border-radius: 999px;
    padding: 8px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  }
  .shorts-quality-btn:hover { background: rgba(0,0,0,0.8); }
  .shorts-quality-menu {
    position: absolute; top: calc(100% + 6px); left: 0;
    background: #212121; color: #fff; border-radius: 10px;
    min-width: 170px; padding: 6px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    display: none;
  }
  .shorts-quality-menu.show { display: block; }
  .shorts-quality-menu button {
    width: 100%; background: none; border: none; color: #fff;
    text-align: left; padding: 8px 14px; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }
  .shorts-quality-menu button:hover { background: rgba(255,255,255,0.1); }
  .shorts-quality-menu button.active::after { content: "✓"; }
  /* Shorts progress bar (YouTube-like red meter) */
  .shorts-progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(255,255,255,0.25);
    cursor: pointer;
    z-index: 6;
    touch-action: none;
    transition: height .12s ease;
  }
  .shorts-progress:hover, .shorts-progress.dragging { height: 6px; }
  .shorts-progress-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 0%;
    background: #ff0033;
    pointer-events: none;
  }
  .shorts-progress-knob {
    position: absolute; top: 50%;
    width: 12px; height: 12px; border-radius: 50%;
    background: #ff0033;
    transform: translate(-50%, -50%) scale(0);
    transition: transform .12s ease;
    pointer-events: none;
  }
  .shorts-progress:hover .shorts-progress-knob,
  .shorts-progress.dragging .shorts-progress-knob { transform: translate(-50%, -50%) scale(1); }

  /* ===== 登録チャンネル一覧のスタイル ===== */
  .sub-channel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    padding: 20px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  .sub-channel-card:hover {
    background: var(--hover);
  }
  .sub-channel-avatar-wrap {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--chip-bg);
    margin-bottom: 12px;
  }
  .sub-channel-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* ===== スケルトンスクリーン ===== */
  /* ===== コメント欄のスタイル (YouTube風) ===== */
  .comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-start;
  }
  .comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--chip-bg);
    flex-shrink: 0;
  }
  .comment-content-wrap {
    flex: 1;
    min-width: 0;
  }
  .comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
  }
  .comment-author {
    font-weight: 600;
    color: var(--text);
  }
  .comment-time {
    color: var(--text-dim);
  }
  .comment-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
  }
  .comment-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    color: var(--text-dim);
    font-size: 12px;
  }
  .comment-like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 2px 6px;
    border-radius: 12px;
  }
  .comment-like-btn:hover {
    background: var(--hover);
    color: var(--text);
  }
