*{box-sizing:border-box;margin:0;padding:0}
body{font-family:"Segoe UI Variable Text","SF Pro Display","Hiragino Sans","BIZ UDPGothic","Yu Gothic UI","Noto Sans JP",sans-serif;background:#111315;color:#e5e7eb;height:100vh;display:flex;flex-direction:column;font-size:14px;overflow:hidden}

/* Header */
header{background:#16191d;padding:14px 22px;border-bottom:1px solid #262c33;display:flex;align-items:center;gap:18px;flex-shrink:0;min-height:70px;box-shadow:0 12px 34px rgba(0,0,0,.2)}
header h1{font-size:17px;font-weight:800;color:#f3f4f6;white-space:nowrap;letter-spacing:.01em}
.site-title{font-size:20px;letter-spacing:.015em}
.hdr-right{margin-left:auto;display:flex;gap:12px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.hdr-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:6px;border:1px solid #262c33;border-radius:20px;background:#101315}
.mode-tabs{display:flex;gap:6px}
.mode-tabs-body{padding:6px;border:1px solid #262c33;border-radius:18px;background:#101315}
.mode-tab{padding:10px 18px;border-radius:12px;border:1px solid transparent;cursor:pointer;font-size:13px;font-weight:700;background:transparent;color:#8b949e;transition:all .15s}
.mode-tab:hover{color:#94a3b8}
.mode-tab.ap{background:#e5e7eb;border-color:#e5e7eb;color:#111315}
.mode-tab.an{background:#2a1618;border-color:#5b2a31;color:#f4c2c7}

/* Layout */
.layout{display:flex;flex:1;overflow:hidden;gap:16px;padding:12px}
.sets-rail{width:390px;flex-shrink:0;overflow-y:auto}
.left{flex:1;overflow-y:auto;padding:0 4px 14px;display:flex;flex-direction:column;gap:14px;min-width:0;align-items:center}
.left>*{width:min(100%,1180px)}
.right{width:390px;background:#1a1d20;border:1px solid #31363d;border-radius:16px;display:flex;flex-direction:column;padding:14px;gap:10px;flex-shrink:0;align-self:stretch;position:sticky;top:0}

/* Buttons */
.btn{padding:8px 14px;border-radius:14px;border:none;cursor:pointer;font-size:12px;font-weight:600;transition:all .15s;white-space:nowrap;text-decoration:none}
.bpri{background:#4b5563;color:white}.bpri:hover{background:#374151}
.bred{background:#dc2626;color:white}.bred:hover{background:#b91c1c}
.bghost{background:#1a1d20;border:1px solid #31363d;color:#9ca3af}.bghost:hover{border-color:#9ca3af;color:#e5e7eb}
.bgrn{background:#059669;color:white}.bgrn:hover{background:#047857}
.bsm{padding:7px 11px;font-size:11px}
.bedit{background:#2f353c;color:#f3f4f6;border:1px solid #4b5563}
.btn-icon{display:inline-flex;align-items:center;gap:8px;padding-inline:13px;min-height:36px}
.btn-ico{color:#f3f4f6;line-height:1;display:inline-grid;place-items:center;width:16px;height:16px}
.btn-ico svg{width:16px;height:16px;display:block}
.btn-label{line-height:1}

/* Search */
.topbar{display:flex;align-items:center;gap:14px;justify-content:space-between;flex-wrap:wrap}
.srow{display:flex;gap:8px;align-items:center;flex:1;min-width:min(100%,540px)}
.toolbar-right{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.sinput{flex:1;padding:6px 14px;background:#111315;border:1px solid #31363d;border-radius:20px;color:#e5e7eb;font-size:13px;outline:none;min-width:0}
.sinput::placeholder{color:#475569}
.sinput:focus{border-color:#9ca3af}

/* My Sets */
.myset-sec{background:#1a1d20;border:1px solid #31363d;border-radius:16px;padding:12px;display:flex;flex-direction:column;gap:10px;position:sticky;top:0}
.myset-hdr{display:flex;flex-direction:column;align-items:stretch;gap:8px;margin-bottom:0}
.myset-hdr .btn{padding:7px 12px;font-size:12px}
.gallery-cta{display:flex;align-items:center;justify-content:center;gap:10px;padding:12px 14px;border-radius:14px;background:#f3f4f6;border:1px solid #f3f4f6;color:#111315;font-weight:800;box-shadow:0 10px 24px rgba(0,0,0,.22)}
.gallery-cta:hover{background:#ffffff;border-color:#ffffff;color:#0f172a;transform:translateY(-1px)}
.gallery-cta .btn-ico{color:#111315}
.slbl{font-size:12px;color:#f3f4f6;font-weight:800;text-transform:uppercase;letter-spacing:.7px}
.myset-list{display:flex;flex-direction:column;gap:8px}
.mychip{display:flex;align-items:center;gap:6px;padding:9px 10px;background:#111315;border:1px solid #31363d;border-radius:12px;font-size:12px;cursor:pointer;transition:all .15s;color:#d1d5db}
.mychip:hover{border-color:#9ca3af;color:#f3f4f6}
.mychip.on{background:#2a2f35;border-color:#9ca3af;color:#f3f4f6}
.mychip-main{display:flex;align-items:center;gap:6px;min-width:0;flex:1}
.mychip-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mychip-badges{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.mychip-badge{padding:2px 6px;border-radius:999px;border:1px solid #3a4048;color:#cbd5e1;font-size:10px;letter-spacing:.03em}
.mychip-badge.pub{border-color:#d1a936;color:#f5d67a}
.mychip-tools{display:flex;align-items:center;gap:5px;margin-left:auto}
.mychip-tool{border:none;background:transparent;color:#94a3b8;font-size:11px;font-weight:700;cursor:pointer;padding:2px 4px}
.mychip-tool:hover{color:#f3f4f6}
.mychip-cnt{font-size:10px;color:#94a3b8}
.mychip-del{color:#475569;cursor:pointer;font-size:15px;line-height:1;margin-left:2px}
.mychip-del:hover{color:#ef4444}
.empty-h{font-size:12px;color:#cbd5e1}

/* Group (level 1) */
.group{border:1px solid color-mix(in srgb, var(--accent, #9ca3af) 32%, #31363d);border-radius:16px;overflow:hidden;background:#171a1e;margin-bottom:14px}
.ghdr{display:flex;align-items:center;gap:8px;padding:13px 16px;cursor:pointer;user-select:none;background:color-mix(in srgb, var(--accent, #9ca3af) 14%, #171a1e);transition:background .1s}
.ghdr:hover{background:color-mix(in srgb, var(--accent, #9ca3af) 18%, #171a1e)}
.garr{color:var(--accent, #9ca3af);font-size:11px;transition:transform .2s;flex-shrink:0}
.garr.open{transform:rotate(90deg)}
.gname{font-size:14px;font-weight:700;color:#f3f4f6;flex:1;min-width:0}
.gsel{font-size:11px;color:var(--accent, #d1d5db);font-weight:700}
.gcnt{font-size:11px;color:#cbd5e1;background:#111315;padding:2px 7px;border-radius:10px}
.gbody{padding:10px}
.gbody.closed{display:none}

/* Sub-category (level 2) */
.cat{background:#111315;border:1px solid color-mix(in srgb, var(--accent, #9ca3af) 22%, #31363d);border-radius:12px;overflow:hidden;margin-bottom:10px}
.cat:last-child{margin-bottom:0}
.chdr{display:flex;align-items:center;gap:6px;padding:8px 11px;cursor:pointer;user-select:none;transition:background .1s}
.chdr:hover{background:#171a1e}
.carr{color:var(--accent, #6b7280);font-size:10px;transition:transform .2s;flex-shrink:0}
.carr.open{transform:rotate(90deg)}
.cname{font-size:12px;font-weight:600;color:#e5e7eb;flex:1;min-width:0}
.csel{font-size:11px;color:var(--accent, #d1d5db);font-weight:600}
.ctot{font-size:11px;color:#cbd5e1;background:#16191d;padding:1px 7px;border-radius:10px}
.cbody{padding:10px;display:flex;flex-wrap:wrap;gap:8px}
.cbody.closed{display:none}

/* Tag */
.tbtn{display:inline-flex;flex-direction:column;padding:6px 10px;background:color-mix(in srgb, var(--accent, #9ca3af) 9%, #16191d);border:1px solid color-mix(in srgb, var(--accent, #9ca3af) 28%, #31363d);border-radius:10px;cursor:pointer;transition:all .12s;text-align:left;max-width:165px}
.tbtn:hover{border-color:var(--accent, #9ca3af);background:color-mix(in srgb, var(--accent, #9ca3af) 16%, #252a30);transform:translateY(-1px)}
.tbtn.sel{background:color-mix(in srgb, var(--accent, #9ca3af) 24%, #2a2f35);border-color:var(--accent, #9ca3af);box-shadow:0 0 0 1px color-mix(in srgb, var(--accent, #9ca3af) 35%, transparent)}
.tja{font-size:12px;color:#e2e8f0;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:145px;font-weight:500}
.ten{font-size:10px;color:#475569;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:145px}
.tbtn.sel .tja{color:#f3f4f6;font-weight:600}
.tbtn.sel .ten{color:#dbe4ee}
.tedit{display:flex;gap:3px;margin-top:3px}
.tmbtn{padding:2px 5px;font-size:10px;border-radius:3px;border:none;cursor:pointer}
.tmed{background:#374151;color:#e5e7eb}.tmed:hover{background:#4b5563}
.tmdel{background:#450a0a;color:#fca5a5}.tmdel:hover{background:#7f1d1d}

/* Add buttons */
.addbtn{display:inline-flex;align-items:center;gap:3px;padding:4px 8px;background:transparent;border:1px dashed #31363d;border-radius:5px;color:#6b7280;font-size:11px;cursor:pointer;transition:all .15s}
.addbtn:hover{border-color:#9ca3af;color:#e5e7eb}
.addcat{display:flex;align-items:center;justify-content:center;gap:5px;padding:7px;background:transparent;border:1px dashed #31363d;border-radius:8px;color:#6b7280;font-size:12px;cursor:pointer;transition:all .15s}
.addcat:hover{border-color:#9ca3af;color:#e5e7eb}

/* Right panel */
.plbl{font-size:12px;color:#f3f4f6;font-weight:800;text-transform:uppercase;letter-spacing:.6px}
.chips{display:flex;flex-wrap:wrap;gap:4px;padding:6px;background:#111315;border:1px solid #31363d;border-radius:6px;max-height:130px;overflow-y:auto;min-height:34px}
.chip{display:inline-flex;align-items:center;gap:3px;padding:3px 6px 3px 8px;background:color-mix(in srgb, var(--accent, #9ca3af) 22%, #2a2f35);border:1px solid color-mix(in srgb, var(--accent, #9ca3af) 36%, #31363d);border-radius:12px;font-size:11px;color:#f3f4f6;max-width:185px}
.chip-t{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chip-x{cursor:pointer;color:#9ca3af;font-size:14px;line-height:1;flex-shrink:0}
.chip-x:hover{color:#ef4444}
.chips-empty{font-size:12px;color:#cbd5e1}
.outa{flex:1;background:#111315;border:1px solid #31363d;border-radius:6px;color:#e5e7eb;padding:8px;font-size:12px;font-family:'Courier New',monospace;resize:none;outline:none;min-height:100px;line-height:1.5}
.outa:focus{border-color:#9ca3af}
.orow{display:flex;gap:6px}

/* Neg mode */
.nm .gname{color:#f3f4f6}
.nm .garr{color:#dc2626}
.nm .cname{color:#e5e7eb}
.nm .carr{color:#991b1b}
.nm .tbtn:hover{border-color:#dc2626}
.nm .tbtn.sel{background:#450a0a;border-color:#dc2626}
.nm .tbtn.sel .ten{color:#dbe4ee}
.nm .tbtn.sel .tja{color:#f3f4f6}
.nm .sinput:focus{border-color:#dc2626}
.nm .outa:focus{border-color:#dc2626}
.nm .chip{background:#450a0a;color:#f3f4f6}
.nm .chip-x{color:#fca5a5}
.nm .mychip:hover{border-color:#dc2626;color:#f3f4f6}
.nm .mychip.on{background:#450a0a;border-color:#dc2626;color:#f3f4f6}

/* Modal */
.mov{position:fixed;inset:0;background:rgba(0,0,0,.75);display:flex;align-items:center;justify-content:center;z-index:100}
.mov.hidden{display:none}
.modal{background:#1a1d20;border:1px solid #31363d;border-radius:12px;padding:20px;width:360px;max-width:90vw}
.modal h3{font-size:14px;font-weight:700;margin-bottom:14px;color:#e5e7eb}
.modal input,.modal select,.modal textarea{width:100%;padding:7px 10px;background:#111315;border:1px solid #31363d;border-radius:6px;color:#e5e7eb;font-size:13px;outline:none;margin-bottom:8px;font-family:inherit}
.modal input:focus,.modal select:focus{border-color:#9ca3af}
.modal select option{background:#1e293b}
.mhint{font-size:11px;color:#475569;margin-bottom:8px;margin-top:-4px}
.mact{display:flex;gap:8px;justify-content:flex-end;margin-top:6px}

/* Toast */
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#059669;color:white;padding:8px 20px;border-radius:20px;font-size:13px;font-weight:500;opacity:0;transition:opacity .3s;pointer-events:none;z-index:200}

::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#334155;border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:#6b7280}
.hidden{display:none!important}
/* Filter row */
.filter-row{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:4px}
.fbtn{padding:7px 15px;border-radius:999px;border:1.5px solid;cursor:pointer;font-size:11px;font-weight:700;transition:all .15s;white-space:nowrap;background:transparent;outline:none;line-height:1.4}
.fbtn:hover{filter:brightness(1.25)}
/* Auth */
.auth-user{display:flex;align-items:center;gap:10px;font-size:12px;color:#64748b;padding:6px 6px 6px 10px;border:1px solid #262c33;border-radius:18px;background:#101315}
.auth-avatar{width:28px;height:28px;border-radius:999px;display:grid;place-items:center;background:#353b42;border:1px solid #4b5563;color:#f8fafc;font-size:12px;font-weight:800;letter-spacing:.02em;flex-shrink:0}
.auth-meta{display:flex;align-items:flex-start;gap:2px;flex-direction:column;min-width:0}
.auth-uname{color:#e5e7eb;font-weight:700;line-height:1.1}
.auth-state{font-size:11px;color:#9ca3af;line-height:1.1}
#m-auth .modal{width:min(420px,92vw);padding:24px;border-radius:20px;background:#15181c;border:1px solid #2a3038;box-shadow:0 24px 80px rgba(0,0,0,.45)}
#m-auth h3{font-size:22px;font-weight:800;letter-spacing:-.02em;margin-bottom:8px}
.auth-lead{font-size:13px;color:#9ca3af;line-height:1.5;margin-bottom:14px}
#m-auth input{height:46px;border-radius:12px;margin-bottom:10px;padding:0 14px}
#m-auth .mact{margin-top:10px}
#m-auth .btn{height:42px;border-radius:12px}
#googleAuthWrap{margin:12px 0}
.auth-note{font-size:12px;line-height:1.6;color:#cbd5e1;background:#181c20;border:1px solid #2a3038;border-radius:12px;padding:12px 14px}
.auth-link{display:inline-flex;align-items:center;justify-content:center;margin-top:10px;height:40px;padding:0 14px;border-radius:10px;border:1px solid #4b5563;color:#f8fafc;text-decoration:none;font-size:13px;font-weight:600}
.auth-link:hover{background:#20252b}
.auth-debug-panel{position:fixed;right:16px;bottom:16px;width:min(460px,calc(100vw - 24px));max-height:min(70vh,720px);background:#15181c;border:1px solid #31363d;border-radius:18px;box-shadow:0 24px 60px rgba(0,0,0,.45);z-index:250;display:flex;flex-direction:column;overflow:hidden}
.auth-debug-hdr{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 14px;border-bottom:1px solid #2a3038}
.auth-debug-title{font-size:13px;font-weight:800;color:#f3f4f6;letter-spacing:.02em}
.auth-debug-actions{display:flex;gap:6px;flex-wrap:wrap}
.auth-debug-body{padding:14px;overflow:auto;display:flex;flex-direction:column;gap:12px}
.auth-debug-note{font-size:12px;line-height:1.6;color:#cbd5e1}
.auth-debug-pre{background:#0f1215;border:1px solid #252a30;border-radius:12px;padding:12px;font-size:11px;line-height:1.55;color:#dbe4ee;white-space:pre-wrap;word-break:break-word}
@media (max-width:1200px){
  .layout{flex-direction:column;overflow-y:auto}
  .sets-rail{width:100%;overflow:visible}
  .myset-sec{position:static}
  .left{overflow:visible;padding-right:0}
  .left>*{width:100%}
  .right{width:100%;position:static;min-height:320px}
  .hdr-right{width:100%;margin-left:0;justify-content:flex-start}
  .topbar{align-items:stretch}
  .toolbar-right{width:100%;justify-content:space-between}
  .mode-tabs-body{width:100%;justify-content:flex-start}
}
