/* ----------------------------------------------------------------------
   Fileshare — Material 3 "Iris" expressive light theme
   Signature: aurora violet -> blue -> cyan gradient + MD3 elevation/shape
---------------------------------------------------------------------- */
:root {
  --primary:            #6246EA;
  --on-primary:         #FFFFFF;
  --primary-container:  #E7DEFF;
  --on-primary-container:#1B0066;
  --secondary-container:#E6E1F5;
  --tertiary:           #B3005F;
  --tertiary-container: #FFD9E3;
  --success:            #1E6B3A;
  --success-container:  #A6F2BE;
  --error:              #BA1A1A;
  --error-container:    #FFDAD6;

  --surface:                  #FBF8FF;
  --surface-container-low:    #F4F0FC;
  --surface-container:        #EEE9F7;
  --surface-container-high:   #E8E3F2;
  --surface-container-highest:#E2DDEC;
  --on-surface:         #1B1B21;
  --on-surface-variant: #48454E;
  --outline:            #79767F;
  --outline-variant:    #CBC4D2;
  --scrim:              rgba(20, 18, 40, .42);

  --grad:      linear-gradient(135deg, #7A5CFF 0%, #5573FF 46%, #2FCBE6 100%);
  --grad-soft: linear-gradient(135deg, #8E78FF 0%, #6B86FF 50%, #49D6E8 100%);

  --e1: 0 1px 2px rgba(28,24,60,.16), 0 1px 3px 1px rgba(28,24,60,.08);
  --e2: 0 1px 2px rgba(28,24,60,.16), 0 3px 9px 2px rgba(28,24,60,.10);
  --e3: 0 2px 5px rgba(28,24,60,.14), 0 10px 24px 4px rgba(28,24,60,.16);

  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 28px; --r-full: 999px;

  --font:      "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42rem 32rem at 10% -10%, rgba(122,92,255,.22), transparent 60%),
    radial-gradient(34rem 26rem at 102% 0%,  rgba(47,203,230,.18), transparent 55%),
    radial-gradient(40rem 34rem at 92% 112%, rgba(179,0,95,.10),   transparent 55%),
    radial-gradient(38rem 30rem at -6% 104%, rgba(85,115,255,.16), transparent 55%);
}

:focus-visible { outline: 3px solid rgba(98,70,234,.5); outline-offset: 2px; }

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 772px;
  margin: 0 auto;
  padding: 40px 22px 64px;
}

/* ---- Top bar / wordmark ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 44px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--on-surface); }
.brand .mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 15px;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--e2);
}
.brand .mark svg { width: 23px; height: 23px; }
.brand b { font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.topbar .hint { color: var(--on-surface-variant); font-size: 13px; font-weight: 500; }

/* ---- Hero ---- */
.hero { margin-bottom: 30px; }
.hero h1 {
  font-weight: 700;
  font-size: clamp(36px, 7vw, 60px);
  line-height: 1.04;
  letter-spacing: -.025em;
  margin: 0 0 14px;
  color: var(--on-surface);
}
.hero h1 .accent {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero p { margin: 0; color: var(--on-surface-variant); font-size: 17px; line-height: 1.5; max-width: 46ch; }

/* ---- Buttons (Material pill + state layers) ---- */
.btn {
  position: relative; overflow: hidden;
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--font); font-weight: 500; font-size: 15px; letter-spacing: .01em;
  border-radius: var(--r-full);
  padding: 12px 24px;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
  transition: box-shadow .2s, transform .2s, background .2s, border-color .2s, color .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; }
.btn:hover::after { opacity: .08; }
.btn:active::after { opacity: .12; }
.btn.primary { color: #fff; background: var(--grad); box-shadow: var(--e1); }
.btn.primary:hover { box-shadow: var(--e2); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); }
.btn.primary:disabled { background: rgba(27,27,33,.12); color: rgba(27,27,33,.38); cursor: not-allowed; box-shadow: none; transform: none; }
.btn.primary:disabled::after { opacity: 0; }
.btn.ghost { color: var(--primary); background: transparent; border: 1px solid var(--outline-variant); }
.btn.ghost:hover { border-color: var(--primary); }

.icon-btn {
  position: relative; overflow: hidden;
  appearance: none; cursor: pointer;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  border: 0; background: transparent;
  color: var(--on-surface-variant);
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(98,70,234,.10); color: var(--primary); }

/* ---- Dropzone ---- */
.dropzone {
  position: relative;
  border: 2px dashed var(--outline-variant);
  border-radius: var(--r-lg);
  background: var(--surface-container-low);
  padding: 56px 30px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .2s;
}
.dropzone:hover { border-color: var(--primary); background: var(--surface-container); box-shadow: var(--e1); }
.dropzone.drag {
  border-color: var(--primary); border-style: solid;
  background: var(--primary-container);
  box-shadow: var(--e2);
  transform: scale(1.005);
}
.dropzone .dz-icon {
  width: 74px; height: 74px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--primary-container);
  color: var(--primary);
  transition: transform .25s, background .2s;
}
.dropzone.drag .dz-icon { transform: translateY(-4px) scale(1.08); background: #fff; }
.dropzone .dz-icon svg { width: 32px; height: 32px; }
.dropzone h2 { font-weight: 500; font-size: 22px; margin: 0 0 6px; color: var(--on-surface); }
.dropzone p { margin: 0; color: var(--on-surface-variant); font-size: 14.5px; }
.dropzone .browse { color: var(--primary); font-weight: 500; }

/* ---- Selected list ---- */
.selected-wrap { margin-top: 24px; }
.selected-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 10px; }
.selected-head .label { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--on-surface-variant); }
.selected-head .total { font-size: 13px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }

.sel-list { display: flex; flex-direction: column; gap: 8px; }
.sel-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface-container-low);
  border-radius: var(--r-md);
  padding: 10px 12px;
  animation: rise .35s ease both;
}
.sel-row .ficon {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--primary);
  overflow: hidden;
}
.sel-row .ficon svg { width: 20px; height: 20px; }
.sel-row .ficon img { width: 100%; height: 100%; object-fit: cover; }
.sel-row .info { min-width: 0; flex: 1; }
.sel-row .name { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--on-surface); }
.sel-row .size { font-size: 12.5px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.sel-row .rm {
  position: relative; overflow: hidden;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 36px; height: 36px; flex: none;
  border-radius: var(--r-full);
  color: var(--on-surface-variant);
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.sel-row .rm:hover { color: var(--error); background: var(--error-container); }
.sel-row .rm svg { width: 18px; height: 18px; }

.actions-row { display: flex; gap: 12px; margin-top: 20px; }
.actions-row .grow { flex: 1; justify-content: center; }

/* ---- Modal (Material dialog) ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 22px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade .2s ease both;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 440px;
  background: var(--surface-container-high);
  border-radius: var(--r-xl);
  padding: 32px 28px 24px;
  box-shadow: var(--e3);
  text-align: center;
  animation: pop .3s cubic-bezier(.2,0,0,1) both;
}
.modal-card h3 { font-weight: 500; font-size: 23px; margin: 0 0 6px; color: var(--on-surface); }
.modal-card .sub { color: var(--on-surface-variant); font-size: 14.5px; margin: 0 0 20px; }
[data-state][hidden] { display: none; }

/* progress */
.prog-orb {
  width: 56px; height: 56px; margin: 4px auto 18px;
  border-radius: 50%;
  border: 4px solid var(--primary-container);
  border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
.progress-track { height: 8px; border-radius: var(--r-full); background: var(--primary-container); overflow: hidden; margin: 18px 0 10px; }
.progress-fill { height: 100%; width: 0%; border-radius: var(--r-full); background: var(--grad); transition: width .2s; }
.progress-fill.indeterminate { width: 40% !important; animation: slide 1.1s ease-in-out infinite; }
.progress-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; margin-bottom: 20px; }
.progress-meta .pct { font-weight: 700; color: var(--on-surface); }

/* success */
.check-orb {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--success-container);
  color: var(--success);
}
.check-orb svg { width: 32px; height: 32px; }
.check-orb svg path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .12s ease forwards; }

.url-chip {
  display: flex; align-items: center; gap: 8px;
  border-radius: var(--r-md);
  background: var(--surface-container-highest);
  padding: 6px 6px 6px 16px;
  margin-bottom: 18px;
}
.url-chip .url {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-size: 13px; color: var(--on-surface);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.copy-btn {
  position: relative; overflow: hidden;
  appearance: none; border: 0; cursor: pointer; flex: none;
  font-family: var(--font); font-weight: 500; font-size: 13.5px;
  color: #fff; background: var(--primary);
  border-radius: var(--r-full);
  padding: 10px 16px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .18s;
}
.copy-btn svg { width: 16px; height: 16px; }
.copy-btn::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity .15s; }
.copy-btn:hover::after { opacity: .10; }
.copy-btn.done { background: var(--success); }

.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; justify-content: center; }

.err-orb {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--error-container); color: var(--error);
}
.err-orb svg { width: 30px; height: 30px; }

/* ---- Transfer page ---- */
.xfer-head { margin-bottom: 22px; }
.xfer-head .eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-container);
  padding: 5px 12px; border-radius: var(--r-full);
  margin-bottom: 12px;
}
.xfer-head h1 { font-weight: 700; font-size: clamp(30px, 5.5vw, 44px); margin: 0 0 6px; letter-spacing: -.02em; color: var(--on-surface); }
.xfer-head .meta-line { color: var(--on-surface-variant); font-size: 14.5px; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 18px 0 26px; }
.toolbar .url-chip { flex: 1; min-width: 220px; margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card {
  position: relative;
  background: var(--surface-container-low);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--e1);
  transition: transform .2s cubic-bezier(.2,0,0,1), box-shadow .2s;
  animation: rise .4s ease both;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--e3); }
.thumb {
  position: relative; height: 160px;
  background: var(--grad-soft);
  display: grid; place-items: center;
  color: #fff; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .glyph { display: grid; place-items: center; }
.thumb .glyph svg { width: 48px; height: 48px; opacity: .95; }
.thumb .badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(255,255,255,.9); color: var(--on-surface);
  padding: 4px 10px; border-radius: var(--r-full);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.dl-corner {
  position: absolute; bottom: 10px; right: 10px;
  width: 44px; height: 44px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: #fff; color: var(--primary);
  box-shadow: var(--e2);
  transition: transform .16s, background .16s, color .16s;
}
.dl-corner svg { width: 20px; height: 20px; }
.card:hover .dl-corner { background: var(--primary); color: #fff; transform: scale(1.06); }
.card-body { padding: 14px 16px 16px; }
.card-body .fname { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--on-surface); }
.card-body .fsize { font-size: 12.5px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---- States ---- */
.center-state { text-align: center; padding: 64px 20px; }
.center-state .so {
  width: 72px; height: 72px; margin: 0 auto 18px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--error-container); color: var(--error);
}
.center-state .so svg { width: 32px; height: 32px; }
.center-state h2 { font-weight: 500; font-size: 24px; margin: 0 0 8px; color: var(--on-surface); }
.center-state p { color: var(--on-surface-variant); margin: 0 0 22px; }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.sk {
  height: 222px; border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--surface-container-low) 30%, var(--surface-container-high) 50%, var(--surface-container-low) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

.footnote { text-align: center; color: var(--on-surface-variant); font-size: 12.5px; margin-top: 40px; }
.footnote a { color: var(--primary); text-decoration: none; }

/* ---- Animations ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes slide { 0% { transform: translateX(-130%); } 100% { transform: translateX(330%); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.fade-up { animation: rise .5s ease both; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .1s; } .d3 { animation-delay: .16s; }

@media (max-width: 520px) {
  .shell { padding: 28px 16px 56px; }
  .actions-row { flex-direction: column; }
  .grid, .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .thumb { height: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
