/* =========================================================
   Storage.to Uploader — design tokens
   Palette: deep blue-black "network" surface, electric-blue
   transfer accent, teal success, mono readout for telemetry
   (speed / eta / percent) to evoke a data-transfer console.
   ========================================================= */
:root{
  --bg: #0a0d14;
  --bg-grid-line: rgba(122, 150, 255, 0.05);
  --surface: #11151f;
  --surface-2: #171c28;
  --border: #232a3a;
  --border-soft: #1a2030;
  --text: #e8ebf2;
  --text-dim: #8993ab;
  --text-faint: #5c6580;
  --accent: #5b8cff;
  --accent-2: #8fb0ff;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --success: #2fd6a7;
  --success-soft: rgba(47, 214, 167, 0.12);
  --error: #ff6b6b;
  --error-soft: rgba(255, 107, 107, 0.1);
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 20px 60px -20px rgba(0,0,0,0.6);
}

*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-grid{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--bg-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, black 10%, transparent 75%);
}

.app{
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100%;
}

/* ===== Topbar ===== */
.topbar{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 22px;
}
.brand{ display:flex; align-items:flex-start; gap: 12px; min-width: 0; }
.brand-mark{
  flex: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(155deg, var(--accent), #3557c9);
  color: #fff;
  box-shadow: 0 6px 20px -6px rgba(91,140,255,0.55);
}
.brand-text h1{
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 3px;
  line-height: 1.2;
}
.brand-sub{
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.4;
}
.icon-btn{
  flex: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  display:flex; align-items:center; justify-content:center;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .15s;
}
.icon-btn:hover{ color: var(--text); border-color: var(--accent); }
.icon-btn:active{ transform: scale(0.94); }
.icon-btn[aria-expanded="true"]{ color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ===== Settings panel ===== */
.settings-panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  animation: dropIn .18s ease;
}
.settings-grid{ display: flex; flex-direction: column; gap: 16px; }
.field label{
  display:block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field-hint{ font-weight: 400; color: var(--text-faint); }
.field input[type="password"],
.field input[type="text"],
.field select{
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus{ border-color: var(--accent); }
.field-note{
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.45;
}
.field-note a{ color: var(--accent-2); }
.field-note--warn{ color: #d9a441; }
.field--row{ display: flex; gap: 14px; }
.field--row > div{ flex: 1; min-width: 0; }
.field--switch{ display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.switch{ position: relative; flex: none; }
.switch input{ position:absolute; opacity:0; width:0; height:0; }
.switch-track{
  display:block; width: 42px; height: 24px;
  background: var(--border); border-radius: 999px;
  position: relative; transition: background .15s; cursor: pointer;
}
.switch-thumb{
  position:absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-dim); transition: transform .15s, background .15s;
}
.switch input:checked + .switch-track{ background: var(--accent-soft); border: 1px solid var(--accent); }
.switch input:checked + .switch-track .switch-thumb{ transform: translateX(18px); background: var(--accent); }

/* ===== Panels ===== */
.stage{ display: flex; flex-direction: column; }
.panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  animation: dropIn .2s ease;
}
.panel-head{
  display:flex; align-items:center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2{
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0;
  color: var(--text);
}

/* ===== Dropzone ===== */
.dropzone{
  position: relative;
  overflow: hidden;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 52px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.dropzone:hover, .dropzone:focus-visible{ border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.is-dragover{ border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon{ color: var(--accent-2); margin-bottom: 14px; }
.dropzone-title{ font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.dropzone-sub{ font-size: 12.5px; color: var(--text-faint); margin: 0 0 14px; }
.dropzone-limit{ font-size: 11.5px; color: var(--text-faint); margin: 16px 0 0; }

.dropzone-beam{
  position: absolute;
  top: 0; left: -30%;
  width: 30%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  opacity: 0;
}
.dropzone.is-dragover .dropzone-beam{
  opacity: 1;
  animation: beamSweep 1.1s linear infinite;
}
@keyframes beamSweep{
  from{ transform: translateX(0); }
  to{ transform: translateX(430%); }
}

/* ===== Buttons ===== */
.btn{
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s, filter .15s, background .15s, border-color .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active{ transform: scale(0.97); }
.btn-primary{ background: var(--accent); color: #08101f; }
.btn-primary:hover{ filter: brightness(1.08); }
.btn-secondary{ background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover{ border-color: var(--accent); }
.btn-ghost{ background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover{ color: var(--text); border-color: var(--text-dim); }
.btn-sm{ padding: 7px 12px; font-size: 12.5px; }
.btn:disabled{ opacity: .45; cursor: not-allowed; transform: none; }

/* ===== File list ===== */
.file-list{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.file-item{
  display: flex; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.file-item-icon{
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-2);
  display:flex; align-items:center; justify-content:center;
}
.file-item-body{ flex: 1; min-width: 0; }
.file-item-top{ display:flex; align-items:center; justify-content: space-between; gap: 8px; }
.file-item-name{
  font-size: 13.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-item-remove{
  flex: none; background: transparent; border: none; color: var(--text-faint);
  cursor: pointer; padding: 4px; border-radius: 6px; display:flex;
}
.file-item-remove:hover{ color: var(--error); background: var(--error-soft); }
.file-item-meta{ display:flex; align-items:center; gap: 6px; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; font-family: var(--font-mono); }
.file-item-dot{ opacity: .5; }

.file-item-progress{ margin-top: 10px; }
.file-item-bar{ height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.file-item-fill{ height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .15s ease; }
.file-item-stats{ display:flex; align-items:center; justify-content: space-between; margin-top: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.file-item-detail{ color: var(--text-faint); }

.file-item.is-success .file-item-icon{ background: var(--success-soft); color: var(--success); }
.file-item.is-success .file-item-fill{ background: var(--success); }
.file-item.is-error .file-item-icon{ background: var(--error-soft); color: var(--error); }
.file-item.is-error .file-item-fill{ background: var(--error); }

/* ===== Overall progress ===== */
.overall-progress{ margin-bottom: 16px; }
.overall-progress-bar{ height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.overall-progress-fill{ height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width .2s ease; }
.overall-progress-meta{ display:flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }

.status-pill{
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  font-family: var(--font-mono); letter-spacing: .01em;
}
.status-pill--busy{ background: var(--accent-soft); color: var(--accent-2); }

/* ===== Panel actions ===== */
.panel-actions{ display: flex; gap: 10px; margin-top: 16px; }
.panel-actions .btn{ flex: 1; }

/* ===== Done panel ===== */
#panelDone, #panelError{ text-align: center; padding: 32px 20px; }
.done-badge{
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--success-soft); color: var(--success);
  display:flex; align-items:center; justify-content:center;
}
.error-badge{
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--error-soft); color: var(--error);
  display:flex; align-items:center; justify-content:center;
}
#panelDone h2, #panelError h2{ font-family: var(--font-display); font-size: 19px; margin: 0 0 6px; }
.done-sub{ color: var(--text-dim); font-size: 13px; margin: 0 0 20px; }
.error-message{ color: var(--text-dim); font-size: 13.5px; line-height: 1.5; margin: 0 0 22px; max-width: 380px; margin-left:auto; margin-right:auto; }

.link-card{
  display:flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 6px 6px 14px; margin-bottom: 16px;
}
.link-card input{
  flex: 1; min-width: 0; background: transparent; border: none; color: var(--accent-2);
  font-family: var(--font-mono); font-size: 12.5px; outline: none;
}
.done-actions{ display:flex; gap: 10px; }
.done-actions .btn{ flex: 1; }

.result-list{
  list-style: none; margin: 20px 0 0; padding: 0; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 240px; overflow-y: auto;
}
.result-list li{
  display:flex; align-items:center; justify-content: space-between; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12.5px;
}
.result-list .rl-name{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.result-list .rl-copy{ flex: none; background: none; border: none; color: var(--accent-2); font-size: 11.5px; font-weight: 600; cursor: pointer; }

.debug-box{
  margin-top: 22px; text-align: left; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
}
.debug-box summary{ cursor: pointer; font-size: 12px; color: var(--text-dim); font-weight: 600; }
.debug-box pre{
  margin: 10px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
  white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto;
}

/* ===== Footer ===== */
.foot{ text-align: center; margin-top: 26px; }
.foot p{ font-size: 11.5px; color: var(--text-faint); margin: 0; }

/* ===== Toast ===== */
.toast{
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 500;
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-soft);
  z-index: 50; opacity: 0; transition: opacity .18s, transform .18s;
  display: flex; align-items: center; gap: 8px;
}
.toast.is-visible{ opacity: 1; transform: translateX(-50%) translateY(0); }
.toast::before{ content: "✓"; color: var(--success); font-weight: 700; }

@keyframes dropIn{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ===== Mobile ===== */
@media (max-width: 480px){
  .app{ padding: 16px 12px 32px; }
  .dropzone{ padding: 40px 14px; }
  .panel{ padding: 16px; border-radius: 16px; }
  .field--row{ flex-direction: column; gap: 14px; }
  .brand-text h1{ font-size: 17px; }
  .done-actions{ flex-direction: column; }
}
