/* G4 TUBE — g4-url 디자인 시스템 위에 얹는 전용 스타일 */
html{-webkit-text-size-adjust:100%}
body{padding-bottom:env(safe-area-inset-bottom)}
select,textarea{font:inherit}
.topbar{padding-top:env(safe-area-inset-top);height:calc(72px + env(safe-area-inset-top))}
.top-actions{align-items:center}
.top-icon{font-size:18px;width:40px;height:40px;border-radius:11px}
.button.small{padding:7px 12px;font-size:12px}
.button span{margin-left:4px}
.danger-text{color:var(--danger)!important}
.spinner{display:inline-block;width:22px;height:22px;border:3px solid #e3e2fb;border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite;vertical-align:-5px}
.spinner.sm{width:15px;height:15px;border-width:2px;border-color:rgba(255,255,255,.4);border-top-color:#fff;margin-right:4px;vertical-align:-2px}
@keyframes spin{to{transform:rotate(360deg)}}
.form-error.center{text-align:center;margin-top:12px}
.tube-shell{background:radial-gradient(circle at 50% -8%,#dcd7ff 0,transparent 36rem)}
.tube-content{max-width:1180px;padding-top:44px}

/* grab */
.grab-card{max-width:760px;margin:0 auto 46px;text-align:center}
.grab-card h1{font-size:clamp(34px,6vw,58px);line-height:1.08;letter-spacing:-.06em;margin:6px 0 30px}
.grab-card h1 em{font-style:normal;background:linear-gradient(110deg,var(--accent),#9a58dd);-webkit-background-clip:text;background-clip:text;color:transparent}
.grab-form{display:flex;gap:10px;background:rgba(255,255,255,.95);border:1px solid rgba(225,227,232,.9);border-radius:20px;padding:10px;box-shadow:0 24px 70px rgba(48,45,105,.12)}
.grab-input{flex:1;display:flex;align-items:center;gap:10px;min-width:0;padding-left:10px}
.grab-icon{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:#fff0f1;color:#e5342f;font-size:13px;flex:0 0 auto}
.grab-input input{flex:1;min-width:0;height:48px;border:0;outline:0;background:transparent;font-size:15px;color:var(--ink)}
.paste-btn{flex:0 0 auto;border:1px solid var(--line);background:#f8f9fb;color:#4f5560;border-radius:10px;padding:8px 12px;font-weight:600;font-size:12.5px;cursor:pointer}
.paste-btn:hover{background:#fff;color:var(--ink)}
.grab-submit{height:52px;padding:0 22px;font-size:15px;border-radius:14px;white-space:nowrap}

/* probe card */
.probe{margin-top:16px;text-align:left;background:#fff;border:1px solid rgba(225,227,232,.9);border-radius:22px;padding:18px;box-shadow:var(--shadow);animation:panelIn .22s ease}
.probe-media{display:flex;gap:16px;align-items:center}
.probe-thumb{position:relative;width:200px;aspect-ratio:16/9;border-radius:13px;overflow:hidden;background:#eef0f4;flex:0 0 auto}
.probe-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.probe-thumb.noimg img{display:none}
.duration{position:absolute;right:6px;bottom:6px;background:rgba(15,16,20,.78);color:#fff;font-size:11px;font-weight:650;padding:2px 6px;border-radius:6px;font-variant-numeric:tabular-nums}
.probe-info{min-width:0}
.probe-info h2{margin:0;font-size:17px;line-height:1.4;letter-spacing:-.02em;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.probe-info p{margin:6px 0 0;color:var(--muted);font-size:13px}
.playlist{margin-top:16px;border:1px solid var(--line);border-radius:14px;overflow:hidden}
.playlist-head{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;background:#fafbfc;border-bottom:1px solid var(--line);font-size:12px;color:var(--muted)}
.playlist ul{list-style:none;margin:0;padding:4px 0;max-height:260px;overflow:auto}
.playlist li{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 14px}
.playlist li .check{min-width:0;flex:1}
.pl-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;color:var(--ink)}
.pl-dur{font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}
.opt-group{margin-top:18px}
.opt-label{display:block;font-size:12px;font-weight:650;color:#4e535d;margin-bottom:8px}
.segmented{display:grid;grid-template-columns:1fr 1fr;background:#f1f2f5;border-radius:13px;padding:4px;gap:4px}
.segmented button{border:0;background:transparent;border-radius:10px;height:42px;font-weight:650;color:#6f7580;cursor:pointer;transition:.15s}
.segmented button.active{background:#fff;color:var(--ink);box-shadow:0 2px 8px rgba(20,24,40,.08)}
.chips-row{display:flex;flex-wrap:wrap;gap:7px}
.qchip{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;min-width:76px;height:52px;border:1.5px solid var(--line);background:#fff;border-radius:12px;font-weight:700;font-size:13.5px;color:#454b55;cursor:pointer;transition:.15s;padding:0 12px}
.qchip small{font-size:10.5px;font-weight:500;color:#9a9ea6;margin-top:2px}
.qchip:hover{border-color:#cfd0f5}
.qchip.active{border-color:var(--accent);background:#f4f3ff;color:var(--accent)}
.qchip.active small{color:#8586e6}
.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:14px;padding:13px 14px;border-radius:13px;background:#fafbfc;border:1px solid var(--line);cursor:pointer;position:relative}
.toggle-row span{display:flex;flex-direction:column;gap:3px}
.toggle-row strong{font-size:13px}.toggle-row small{font-size:11.5px;color:var(--muted)}
.toggle-row input{position:absolute;opacity:0}
.toggle-row i{width:44px;height:25px;border-radius:20px;background:#d6d8dd;padding:3px;transition:.18s;flex:0 0 auto}
.toggle-row i:after{content:"";display:block;width:19px;height:19px;background:#fff;border-radius:50%;box-shadow:0 2px 5px rgba(0,0,0,.18);transition:.18s}
.toggle-row input:checked+i{background:var(--accent)}
.toggle-row input:checked+i:after{transform:translateX(19px)}
.probe-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
.probe-actions .primary{min-width:160px;height:48px;font-size:15px}

/* checkbox */
.check{display:inline-flex;align-items:center;gap:9px;cursor:pointer;font-size:12.5px;color:#4e535d;position:relative}
.check input{position:absolute;opacity:0;width:0;height:0}
.check i{width:18px;height:18px;border-radius:6px;border:1.5px solid #cdd0d7;background:#fff;display:grid;place-items:center;transition:.12s;flex:0 0 auto}
.check input:checked+i{background:var(--accent);border-color:var(--accent)}
.check input:checked+i:after{content:"";width:9px;height:5px;border:2px solid #fff;border-top:0;border-right:0;transform:rotate(-45deg) translate(1px,-1px)}

/* library */
.lib-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:14px}
.lib-head h2{margin:0;font-size:24px;letter-spacing:-.04em}
.lib-head p{margin:5px 0 0;color:var(--muted);font-size:12.5px}
.lib-head .search{background:#fff}
.filter-bar{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;margin-bottom:18px;padding-bottom:2px}
.filter-bar::-webkit-scrollbar{display:none}
.filter{flex:0 0 auto;border:1px solid var(--line);background:#fff;color:#5d636d;padding:8px 14px;border-radius:999px;font-size:12.5px;font-weight:600;cursor:pointer;transition:.15s}
.filter b{color:var(--accent);margin-left:2px}
.filter:hover{border-color:#cfd0f5;color:var(--ink)}
.filter.active{background:var(--ink);border-color:var(--ink);color:#fff}
.filter.active b{color:#c9c6ff}
.lib-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:18px}
.vcard{background:#fff;border:1px solid rgba(225,227,232,.9);border-radius:18px;overflow:hidden;box-shadow:0 10px 30px rgba(30,35,55,.05);transition:.18s;display:flex;flex-direction:column}
.vcard.status-done{cursor:pointer}
.vcard.status-done:hover{transform:translateY(-2px);box-shadow:0 18px 40px rgba(30,35,55,.1)}
.vthumb{position:relative;aspect-ratio:16/9;background:linear-gradient(135deg,#eeeefe,#f6f1fe);overflow:hidden}
.vthumb img{width:100%;height:100%;object-fit:cover;display:block}
.vthumb.audio img{filter:saturate(.9)}
.vthumb-icon{position:absolute;inset:0;display:grid;place-items:center;font-size:30px;color:#a9aaf0}
.badge-audio{position:absolute;left:8px;top:8px;background:rgba(255,255,255,.92);color:var(--accent);font-size:10.5px;font-weight:700;padding:3px 8px;border-radius:999px}
.vprogress{position:absolute;inset:0;background:rgba(18,19,28,.55);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;color:#fff}
.vp-text{font-size:26px;font-weight:700;letter-spacing:-.03em;font-variant-numeric:tabular-nums;position:relative;z-index:1}
.ring{position:absolute;width:56px;height:56px;border:3px solid rgba(255,255,255,.18);border-top-color:#fff;border-radius:50%;animation:spin 1.1s linear infinite}
.vcard.status-downloading .ring{display:none}
.vp-bar{position:absolute;left:0;right:0;bottom:0;height:4px;background:rgba(255,255,255,.18)}
.vp-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#8b8cff,#c49bff);transition:width .8s ease}
.verror{position:absolute;inset:0;background:rgba(255,240,241,.82);display:grid;place-items:center;color:var(--danger);font-weight:800;font-size:28px}
.vbody{padding:13px 15px 14px;flex:1}
.vbody h3{margin:0;font-size:14px;line-height:1.42;letter-spacing:-.01em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.vmeta{margin:7px 0 0;font-size:11.5px;color:var(--muted);display:flex;flex-direction:column;gap:2px}
.vch{color:#4f5560;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vsub{font-variant-numeric:tabular-nums}
.status-error .vsub{color:var(--danger)}
.vactions{display:flex;gap:6px;padding:0 15px 14px}
.vactions:empty{display:none}
.chip-button{border:0;background:#f4f3ff;color:var(--accent);padding:7px 12px;border-radius:9px;font-size:12px;font-weight:650;cursor:pointer}
.chip-button:hover{background:#ecebff}
.chip-button.muted{background:#f2f3f6;color:#6f7580}
.library .empty-state{background:#fff;border:1px solid var(--line);border-radius:22px}

/* player */
.player-dialog{width:min(900px,calc(100vw - 24px));max-height:calc(100vh - 24px)}
.player{display:flex;flex-direction:column;max-height:calc(100vh - 24px)}
.player-stage{background:#000;display:flex;align-items:center;justify-content:center}
.player-stage video{display:block;width:100%;max-height:62vh;background:#000}
.player-stage.audio{flex-direction:column;gap:18px;padding:28px 24px 22px;background:linear-gradient(160deg,#2b2a5e,#4a3c8c)}
.audio-art{width:min(260px,60vw);aspect-ratio:1;border-radius:18px;overflow:hidden;background:rgba(255,255,255,.1);display:grid;place-items:center;color:#fff;font-size:48px;box-shadow:0 18px 40px rgba(0,0,0,.35)}
.audio-art img{width:100%;height:100%;object-fit:cover}
.player-stage audio{width:100%;max-width:520px}
.player-body{padding:20px 24px 24px;overflow:auto}
.player-title{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.player-title h2{margin:0;font-size:18px;line-height:1.4;letter-spacing:-.025em}
.player-meta{margin:6px 0 0;color:var(--muted);font-size:12.5px}
.player-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}
.player-hint{margin:12px 0 0;font-size:11.5px;color:var(--muted);line-height:1.6}

/* settings */
.set-list{display:flex;flex-direction:column}
.set-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px 0;border-bottom:1px solid var(--line)}
.set-row:first-child{padding-top:0}
.set-row>span:first-child{display:flex;flex-direction:column;gap:4px;min-width:0}
.set-row strong{font-size:13px}
.set-row small{font-size:11.5px;color:var(--muted);word-break:break-all}
.set-actions{display:flex;gap:6px;flex:0 0 auto}
.set-row>.button{flex:0 0 auto}
.file-btn{cursor:pointer}
.set-note{margin:0;font-size:11.5px;color:var(--muted);line-height:1.7}
.set-note code{font-family:ui-monospace,Menlo,monospace;font-size:11px;background:#f2f3f6;padding:2px 5px;border-radius:5px;word-break:break-all}

@media(max-width:720px){
  .topbar{height:calc(60px + env(safe-area-inset-top))}
  .top-actions .ghost{display:inline-block}
  .top-actions .button{padding:8px 12px;font-size:13px}
  .tube-content{padding:26px 14px 60px}
  .grab-card{margin-bottom:34px}
  .grab-card h1{font-size:34px;margin-bottom:22px}
  .grab-form{flex-direction:column;padding:8px;border-radius:18px}
  .grab-input{padding-left:6px}
  .grab-submit{width:100%;height:50px}
  .probe{padding:14px;border-radius:18px}
  .probe-media{flex-direction:column;align-items:stretch;gap:12px}
  .probe-thumb{width:100%}
  .qchip{flex:1 1 calc(33% - 7px);min-width:0}
  .probe-actions .button{flex:1}
  .lib-head{flex-direction:column;align-items:stretch;gap:12px}
  .lib-head .search{min-width:0;width:100%}
  .lib-grid{grid-template-columns:1fr 1fr;gap:12px}
  .vbody{padding:10px 11px 11px}
  .vbody h3{font-size:12.5px}
  .vmeta{font-size:10.5px}
  .vactions{padding:0 11px 11px;flex-wrap:wrap}
  .vp-text{font-size:20px}
  .player-dialog{width:100vw;max-width:100vw;height:auto;max-height:94dvh;margin:0;inset:auto 0 0 0;border-radius:22px 22px 0 0}
  .player{max-height:92dvh}
  .player-body{padding:16px 18px calc(20px + env(safe-area-inset-bottom))}
  .player-actions .button{flex:1 1 calc(50% - 8px)}
  .set-row{flex-wrap:wrap}
}
@media(max-width:380px){.lib-grid{grid-template-columns:1fr}}
