:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #121720;
  --surface-raised: #171d28;
  --surface-soft: #0f151d;
  --line: #263141;
  --line-soft: rgba(148, 163, 184, 0.15);
  --text: #f4f7fb;
  --muted: #9aa8ba;
  --green: #46df8f;
  --green-strong: #28bd72;
  --blue: #7aa2ff;
  --amber: #f4b45f;
  --red: #f06464;
  --discord: #5865f2;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(115deg, rgba(21, 128, 99, 0.16) 0%, transparent 38%),
    linear-gradient(250deg, rgba(244, 180, 95, 0.1) 0%, transparent 34%),
    linear-gradient(180deg, #0b0e13 0%, #090b10 58%, #0a0c10 100%);
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.panel-head,
.account,
.brand,
.file-item,
.file-actions,
.progress-label {
  display: flex;
  align-items: center;
}

.topbar {
  position: relative;
  z-index: 10;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 18px;
  background: transparent;
}

.is-authenticated .topbar {
  position: sticky;
  top: 0;
  padding-bottom: 24px;
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.94), rgba(9, 11, 16, 0));
  backdrop-filter: blur(12px);
}

.brand {
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(70, 223, 143, 0.36);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(70, 223, 143, 0.18), rgba(122, 162, 255, 0.08));
  color: #c9fadd;
  font-weight: 900;
}

.brand strong,
.account strong,
.file-name {
  display: block;
}

.brand strong {
  line-height: 1.1;
}

.brand small,
.account small,
.file-detail,
.dropzone small,
.login-copy p,
.preview-drop small,
.empty-state {
  color: var(--muted);
}

.account {
  gap: 12px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 23, 32, 0.84);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
}

.avatar-wrap {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
}

.account img,
.avatar-fallback {
  grid-area: 1 / 1;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
}

.account img {
  display: block;
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  border: 1px solid rgba(88, 101, 242, 0.45);
  color: #eef2ff;
  background: linear-gradient(135deg, var(--discord), var(--green-strong));
  font-size: 0.78rem;
  font-weight: 900;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 460px);
  gap: 64px;
  align-items: center;
  min-height: 0;
  padding: clamp(62px, 10vh, 118px) 0 72px;
}

.login-copy {
  max-width: 690px;
}

.login-copy h1 {
  max-width: 650px;
  margin: 12px 0 18px;
  font-size: clamp(2.85rem, 5.6vw, 4.95rem);
  line-height: 0.98;
}

.login-copy p {
  max-width: 560px;
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.75;
}

.eyebrow {
  margin: 0;
  color: #b8f7d2;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-button {
  margin-top: 28px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  background: var(--green-strong);
  font-weight: 850;
  box-shadow: 0 12px 30px rgba(40, 189, 114, 0.22);
}

.primary-button.discord {
  background: var(--discord);
  box-shadow: 0 12px 30px rgba(88, 101, 242, 0.24);
}

.secondary-button {
  padding: 0 16px;
  border: 1px solid rgba(70, 223, 143, 0.28);
  color: #062514;
  background: var(--green);
  font-weight: 850;
}

.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.ghost-button {
  padding: 0 14px;
}

.icon-button {
  min-width: 82px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.icon-button.danger {
  color: #ffd1d1;
  border-color: rgba(240, 100, 100, 0.42);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: rgba(154, 168, 186, 0.48);
  background: rgba(255, 255, 255, 0.05);
}

.preview-panel,
.uploader-panel,
.files-panel,
.stats-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 23, 32, 0.86);
  box-shadow: var(--shadow);
}

.preview-panel {
  padding: 18px;
  align-self: center;
  background:
    linear-gradient(180deg, rgba(23, 29, 40, 0.94), rgba(14, 19, 27, 0.94));
}

.preview-header {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.preview-header span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.preview-header span:nth-child(1) {
  background: var(--red);
}

.preview-header span:nth-child(2) {
  background: var(--amber);
}

.preview-header span:nth-child(3) {
  background: var(--green-strong);
}

.preview-drop {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed rgba(154, 168, 186, 0.48);
  border-radius: var(--radius);
  background: rgba(70, 223, 143, 0.055);
  text-align: center;
}

.preview-row {
  height: 12px;
  margin-top: 18px;
  border-radius: 999px;
  background: #202838;
}

.preview-row.short {
  width: 72%;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.stats-grid article {
  min-height: 98px;
  padding: 18px 20px;
  box-shadow: none;
}

.stats-grid small {
  color: #b7d2ee;
}

.stats-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.68rem;
  line-height: 1;
}

.uploader-panel,
.files-panel {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(23, 29, 40, 0.92), rgba(16, 21, 30, 0.92));
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 5px 0 0;
  font-size: 1.32rem;
  line-height: 1.2;
}

.dropzone {
  display: grid;
  min-height: 230px;
  place-items: center;
  gap: 10px;
  border: 1px dashed rgba(154, 168, 186, 0.52);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  outline: 0;
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.dropzone.is-active {
  border-color: var(--green);
  background: rgba(70, 223, 143, 0.075);
}

.drop-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius);
  color: #062514;
  background: var(--green);
  font-size: 2rem;
  font-weight: 800;
}

.progress {
  margin-top: 18px;
}

.progress-label {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #202838;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-item {
  gap: 14px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.024);
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.file-item:hover {
  border-color: rgba(154, 168, 186, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.file-icon {
  overflow: hidden;
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(244, 180, 95, 0.14);
  color: #ffe1a8;
  font-size: 0.72rem;
  font-weight: 900;
}

.file-icon.is-image {
  background: var(--surface-soft);
  color: transparent;
}

.file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-meta {
  min-width: 0;
  flex: 1;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-detail {
  margin-top: 5px;
}

.file-actions {
  gap: 8px;
}

.error-message {
  margin-top: 18px !important;
  color: #ffd1d1;
}

.empty-state {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  background: rgba(18, 23, 32, 0.97);
  box-shadow: var(--shadow);
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast strong {
  font-size: 0.95rem;
}

.toast span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.toast-error {
  border-left-color: var(--red);
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(8px);
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 16px;
  }

  .topbar,
  .panel-head,
  .file-item {
    align-items: stretch;
    flex-direction: column;
  }

  .login-view,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-view {
    min-height: 0;
    padding-top: 34px;
    gap: 26px;
  }

  .login-copy h1 {
    font-size: clamp(2.35rem, 12vw, 3.6rem);
  }

  .account {
    width: 100%;
    flex-direction: row;
  }

  .file-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .icon-button {
    width: 100%;
    min-width: 0;
  }
}
