:root {
  --bg: #000;
  --card: rgba(255, 255, 255, .065);
  --card2: rgba(255, 255, 255, .11);
  --card3: rgba(255, 255, 255, .16);
  --line: rgba(255, 255, 255, .1);
  --fg: #F5F5F7;
  --muted: rgba(245, 245, 247, .62);
  --faint: rgba(245, 245, 247, .4);
  --tint: #4F7CFF;
  --tint-hi: #6690FF;
  --tint-l: #91ADFF;
  --tint-soft: rgba(79, 124, 255, .18);
  --red: #FF453A;
  --green: #30D158;
  --sheet: #1e1e23;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(110% 420px at 0% 0%, rgba(79, 124, 255, .22), transparent 62%),
    radial-gradient(90% 380px at 100% 0%, rgba(191, 90, 242, .14), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
}
html.locked, html.locked body { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--tint-l); outline-offset: 2px; }
[hidden] { display: none !important; }

svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.s { width: 17px; height: 17px; stroke-width: 2.2; }
svg.l { width: 30px; height: 30px; stroke-width: 1.8; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px calc(120px + var(--safe-b)); }

/* header */
.top { padding: calc(env(safe-area-inset-top, 0px) + 22px) 4px 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top .tx { min-width: 0; }
.crumb { display: flex; align-items: center; gap: 2px; min-height: 20px; font-size: 14px; color: var(--faint); font-weight: 500; }
.crumb a { color: var(--tint-l); text-decoration: none; display: inline-flex; align-items: center; gap: 2px; margin-left: -4px; }
.crumb a svg { width: 18px; height: 18px; }
h1 { margin: 2px 0 0; font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 14px; color: var(--muted); margin-top: 4px; min-height: 20px; }
.ib { width: 40px; height: 40px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; flex: none; color: var(--muted); }

.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 12px; background: var(--card2); color: var(--faint); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; color: var(--fg); }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

/* upload progress */
.uploads:empty { display: none; }
.up { margin-top: 12px; padding: 12px 14px; border-radius: 18px; background: var(--card); }
.up .t { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 8px; }
.up .t span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .t span:last-child { color: var(--muted); flex: none; }
.up.err .t span:last-child { color: var(--red); }
.bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.bar > b { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--tint); transition: width .15s linear; }
.up.err .bar > b { background: var(--red); }

/* list */
.grp { margin-top: 14px; border-radius: 18px; background: var(--card); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; position: relative; cursor: pointer; user-select: none; -webkit-user-select: none; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; height: 1px; background: var(--line); }
.row:active { background: rgba(255, 255, 255, .05); }
.th { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); background: var(--card2); color: var(--muted); }
.th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th.dir { background: rgba(79, 124, 255, .16); color: var(--tint-l); }
.th.img { background: #222; }
.th.vid { background: linear-gradient(160deg, #2b3a66, #0d1117); color: #fff; }
.th.pdf { background: rgba(255, 69, 58, .16); color: #ff8a82; }
.th.zip { background: rgba(255, 184, 0, .16); color: #ffd166; }
.th.aud { background: rgba(191, 90, 242, .18); color: #d9a3ff; }
.row .tx { flex: 1; min-width: 0; }
.row .n { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .m { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--muted); transition: background .15s, color .15s; }
.rb.k { background: var(--tint-soft); color: var(--tint-l); }
.rb.ok { background: rgba(48, 209, 88, .18); color: var(--green); }
.chev { color: var(--faint); margin-right: 8px; display: grid; }

.empty { margin-top: 14px; padding: 46px 24px; border-radius: 18px; background: var(--card); text-align: center; color: var(--muted); font-size: 15px; line-height: 1.45; }
.empty b { display: block; color: var(--fg); font-size: 17px; margin-bottom: 4px; }
.empty a { color: var(--tint-l); }

/* dock */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 28px 16px calc(16px + var(--safe-b)); background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .88) 40%); pointer-events: none; }
.dock .in { max-width: 688px; margin: 0 auto; display: flex; gap: 10px; pointer-events: auto; }
.big { flex: 1; height: 54px; border-radius: 16px; background: var(--tint); color: #fff; display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 17px; font-weight: 600; box-shadow: 0 8px 22px rgba(79, 124, 255, .4); }
.big:active { background: var(--tint-hi); }
.sq { width: 54px; height: 54px; border-radius: 16px; background: #26262b; display: grid; place-items: center; flex: none; }

/* toast */
.toast { position: fixed; left: 0; right: 0; bottom: calc(96px + var(--safe-b)); z-index: 30; width: fit-content; max-width: calc(100vw - 32px); margin: 0 auto; transform: translateY(12px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 999px;
  background: rgba(44, 44, 50, .96); box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 10px 30px rgba(0, 0, 0, .45);
  font-size: 14px; font-weight: 600; transition: opacity .18s, transform .18s; }
.toast.on { opacity: 1; transform: none; pointer-events: auto; }
.toast > svg { color: var(--green); }
.toast.bad > svg { color: var(--red); }
.toast .msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast .act { flex: none; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--tint); color: #fff; font-size: 14px; font-weight: 600; }
.toast:not(:has(.act)) { padding-right: 16px; }

/* sheets */
.layer { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; padding: 0 10px calc(10px + var(--safe-b)); background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .18s; }
.layer.on { opacity: 1; }
.sheet { width: 100%; max-width: 440px; transform: translateY(24px); transition: transform .2s ease-out; }
.layer.on .sheet { transform: none; }
.ag { border-radius: 16px; background: #2c2c32; overflow: hidden; }
.ag + .ag { margin-top: 10px; }
.ahd { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ahd .th { width: 44px; height: 44px; border-radius: 10px; }
.ahd .tx { min-width: 0; }
.ahd .n { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahd .m { font-size: 13px; color: var(--muted); }
.ai { display: flex; align-items: center; gap: 14px; width: 100%; height: 56px; padding: 0 18px; font-size: 17px; text-align: left; }
.ai + .ai { border-top: 1px solid var(--line); }
.ai:active { background: rgba(255, 255, 255, .06); }
.ai.k { color: var(--tint-l); }
.ai.d { color: var(--red); }
.cancel { width: 100%; height: 56px; font-size: 17px; font-weight: 600; color: var(--tint-l); }

.dlg { border-radius: 20px; background: #2c2c32; padding: 20px 18px 18px; }
.dlg h2 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.dlg p { margin: 0 0 14px; font-size: 14px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.dlg input { width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); font-size: 16px; outline: 0; }
.dlg input:focus { border-color: var(--tint); }
.dlg .hint { margin: 8px 2px 0; font-size: 13px; color: var(--faint); min-height: 18px; }
.dlg .hint.bad { color: var(--red); }
.dlg .btns { display: flex; gap: 10px; margin-top: 16px; }
.btn { flex: 1; height: 48px; border-radius: 13px; background: var(--card2); font-size: 16px; font-weight: 600; }
.btn.t { background: var(--tint); color: #fff; }
.btn.d { background: var(--red); color: #fff; }

/* drag and drop */
.drop { position: fixed; inset: 12px; z-index: 50; border-radius: 28px; border: 2px dashed rgba(145, 173, 255, .6); background: rgba(10, 14, 30, .82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; pointer-events: none; font-size: 20px; font-weight: 700; }
.drop .c { width: 68px; height: 68px; border-radius: 50%; background: var(--tint); display: grid; place-items: center; box-shadow: 0 8px 22px rgba(79, 124, 255, .45); }
.drop span { font-size: 14px; font-weight: 500; color: var(--muted); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 20px calc(24px + var(--safe-b)); }
.login form { width: 100%; max-width: 360px; }
.logo { width: 68px; height: 68px; border-radius: 18px; background: linear-gradient(135deg, #4F7CFF, #7b5cff); display: grid; place-items: center; color: #fff; margin-bottom: 18px; box-shadow: 0 10px 30px rgba(79, 124, 255, .45); }
.logo svg { width: 32px; height: 32px; }
.login h1 { font-size: 30px; }
.login .sub { margin-bottom: 22px; }
.fields { border-radius: 14px; background: var(--card2); overflow: hidden; }
.fields label { display: block; position: relative; }
.fields label + label { border-top: 1px solid var(--line); }
.fields span { position: absolute; left: 14px; top: 8px; font-size: 12px; color: var(--faint); pointer-events: none; }
.fields input { width: 100%; height: 58px; padding: 22px 14px 6px; border: 0; outline: 0; background: none; font-size: 17px; }
.login .err { min-height: 20px; margin: 10px 2px 0; font-size: 14px; color: var(--red); }
.login .big { width: 100%; margin-top: 10px; }

@media (hover: hover) {
  .row:hover { background: rgba(255, 255, 255, .04); }
  .rb:hover { background: var(--card3); color: var(--fg); }
  .rb.k:hover { background: rgba(79, 124, 255, .3); color: #fff; }
  .ib:hover, .sq:hover { background: var(--card3); color: var(--fg); }
  .big:hover { background: var(--tint-hi); }
  .ai:hover { background: rgba(255, 255, 255, .06); }
  .btn:hover { filter: brightness(1.12); }
}

@media (min-width: 640px) {
  .top { padding-top: 48px; }
  h1 { font-size: 36px; }
  .layer { align-items: center; padding: 24px; }
  .sheet { max-width: 400px; }
  .toast { bottom: calc(104px + var(--safe-b)); }
}

@media (prefers-reduced-motion: reduce) {
  .layer, .sheet, .toast, .bar > b, .rb { transition: none; }
}

button, .row, .ai { touch-action: manipulation; }
.offscreen { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nojs { padding: 24px; }
