:root {
  --bg: #0a0608;
  --panel: rgba(24, 10, 14, 0.78);
  --panel-border: rgba(255, 100, 120, 0.16);
  --text: #f8ecef;
  --muted: #b08a94;
  --accent: #ff4d6d;
  --accent-2: #ff8fab;
  --accent-glow: rgba(255, 77, 109, 0.38);
  --danger: #ff3355;
  --radius: 18px;
  --font-display: "Orbitron", system-ui, sans-serif;
  --font-body: "Outfit", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background: var(--bg);
}

body {
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 77, 109, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 77, 109, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.32;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}

.bg-glow-a {
  top: -120px;
  left: -80px;
  background: #ff4d6d;
}

.bg-glow-b {
  right: -100px;
  bottom: -140px;
  background: #c9184a;
  animation-delay: -6s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, 30px) scale(1.08); }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.shell-narrow {
  width: min(560px, calc(100% - 2rem));
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  min-height: 2.5rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-compact {
  margin-bottom: 1.5rem;
}

.logo-mark {
  font-size: 2rem;
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.8rem);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.hero h1 span {
  color: var(--accent);
}

.tagline {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.dashboard-sub {
  margin: 0.25rem 0 0;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.dropzone {
  border: 2px dashed rgba(255, 77, 109, 0.28);
  border-radius: calc(var(--radius) - 4px);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(255, 77, 109, 0.06);
  transform: translateY(-1px);
}

.dropzone-inner h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 500;
}

.dropzone-inner p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.hint {
  font-size: 0.9rem;
  margin-top: 0.75rem !important;
}

.drop-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--accent);
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.upload-options {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field-label {
  display: block;
  text-align: left;
  font-size: 0.85rem;
  color: var(--muted);
}

.optional {
  opacity: 0.75;
}

.field input,
.field select,
.copy-row input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
}

.copy-row input {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
  cursor: pointer;
}

.checkbox-field.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.progress-wrap {
  margin-top: 1rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.progress-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-meta span:last-child {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c9184a, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.15s ease;
  box-shadow: 0 0 16px var(--accent-glow);
}

.result-panel,
.password-gate,
.download-ready {
  text-align: center;
}

.result-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 77, 109, 0.14);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.result-panel h2,
.download-ready h2,
.password-gate h2 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  word-break: break-word;
}

.result-size,
.file-date,
.gate-copy {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.download-progress {
  margin: 1rem 0 1.25rem;
  text-align: left;
}

.download-progress .progress-bar {
  margin-bottom: 0.75rem;
}

.download-progress .hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.download-hint {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: left;
}

.download-fast-help {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 80, 100, 0.22);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  text-align: left;
}

.download-fast-help .hint {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.hint-list {
  margin: 0 0 0.75rem 1.1rem;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

.hint-list code {
  word-break: break-all;
}

.download-ready .btn-large + .btn-large {
  margin-top: 0.65rem;
}

.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: 0.65;
  pointer-events: none;
}

.copy-row {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #1a0509;
  box-shadow: 0 8px 24px rgba(255, 77, 109, 0.28);
  background: var(--accent);
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #c9184a, var(--accent) 45%, var(--accent-2));
  z-index: -1;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.btn-danger {
  background: rgba(255, 51, 85, 0.12);
  border-color: rgba(255, 51, 85, 0.35);
  color: #ff8fa3;
}

.btn-large {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.badges {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.badge {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 77, 109, 0.12);
  color: var(--accent-2);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-list {
  display: grid;
  gap: 0.75rem;
}

.file-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.file-item-main {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.file-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-main span {
  color: var(--muted);
  font-size: 0.88rem;
}

.file-item-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty-note {
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.file-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  text-shadow: 0 0 20px var(--accent-glow);
}

.file-icon.muted {
  color: var(--muted);
  text-shadow: none;
}

.loader {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted);
}

.upload-panel {
  margin-bottom: 1rem;
}

.server-status-panel {
  margin-bottom: 1rem;
}

.server-status-inner {
  text-align: center;
  padding: 2rem 1rem 1.75rem;
}

.server-status-inner h2 {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  color: #ffb3c1;
}

.server-status-inner .hint {
  max-width: 28rem;
  margin: 0 auto;
}

.loader-ring {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border: 3px solid rgba(255, 77, 109, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.not-found {
  text-align: center;
}

.not-found p {
  color: var(--muted);
}

.error {
  margin-top: 1rem;
  text-align: center;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.auth-dialog {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 0;
  background: rgba(18, 8, 12, 0.96);
  color: var(--text);
  max-width: calc(100vw - 2rem);
  width: min(420px, calc(100vw - 2rem));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  width: min(420px, calc(100vw - 2rem));
  background: rgba(18, 8, 12, 0.98);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.admin-link,
.nav-link {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-link:hover,
.nav-link:hover {
  color: var(--accent);
}

.topbar-home {
  margin-right: auto;
}

.topbar {
  justify-content: flex-end;
}

.shell-wide {
  width: min(960px, calc(100% - 2rem));
}

.storage-panel {
  margin-bottom: 1.25rem;
}

.storage-summary {
  display: grid;
  gap: 0.65rem;
}

.storage-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.storage-meta span:last-child {
  flex-shrink: 0;
  font-family: var(--font-display);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.storage-bar {
  height: 12px;
}

.storage-bar .progress-fill[data-tone="ok"] {
  background: linear-gradient(90deg, #c9184a, var(--accent), var(--accent-2));
}

.storage-bar .progress-fill[data-tone="warn"] {
  background: linear-gradient(90deg, #d97706, #f59e0b, #fbbf24);
}

.storage-bar .progress-fill[data-tone="critical"] {
  background: linear-gradient(90deg, #991b1b, #dc2626, #ef4444);
}

.storage-hint {
  margin: 0;
  text-align: left;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.35rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent);
}

.admin-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.admin-hint {
  margin: 0;
  text-align: left;
}

.panel-sub.status-ok {
  color: #7dffb2;
}

.panel-sub.status-bad {
  color: #ff8fa3;
}

.user-list {
  display: grid;
  gap: 0.75rem;
}

.file-meta-line {
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.auth-form {
  padding: 1.75rem;
  display: grid;
  gap: 0.85rem;
  position: relative;
}

.auth-form h2 {
  margin: 0;
}

.auth-sub {
  margin: 0;
  color: var(--muted);
}

.dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.auth-switch {
  margin: 0;
  text-align: center;
}

@media (max-width: 640px) {
  .shell {
    padding-top: 1.25rem;
  }

  .copy-row,
  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn,
  .copy-row .btn {
    width: 100%;
  }

  .file-item {
    flex-direction: column;
    align-items: stretch;
  }

  .file-item-actions {
    justify-content: stretch;
  }

  .file-item-actions .btn {
    flex: 1;
  }
}
