/* 3dv - shared styles. Light palette on :root, dark applied both by system
   preference and by an explicit [data-theme] override from the toggle. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #14171c;
  --text-dim: #5b6472;
  --border: #dfe3e9;
  --accent: #2f6df6;
  --accent-text: #ffffff;
  --ok: #12854a;
  --err: #c2321f;
  --err-bg: #fdecea;
  --shadow: 0 1px 2px rgba(16, 22, 32, .06), 0 8px 24px rgba(16, 22, 32, .06);
  --radius: 14px;
  --viewer-bg: #e9ecf1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1d2430;
    --text: #e8edf4;
    --text-dim: #99a4b3;
    --border: #2a323d;
    --accent: #4c8dff;
    --accent-text: #08121f;
    --ok: #3ddc91;
    --err: #ff7a6b;
    --err-bg: #2a1613;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --viewer-bg: #0b0e13;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d2430;
  --text: #e8edf4;
  --text-dim: #99a4b3;
  --border: #2a323d;
  --accent: #4c8dff;
  --accent-text: #08121f;
  --ok: #3ddc91;
  --err: #ff7a6b;
  --err-bg: #2a1613;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --viewer-bg: #0b0e13;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--text);
}

.brand .cube { width: 26px; height: 26px; flex: none; color: var(--accent); }

.spacer { flex: 1; }

.tbtn {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 9px;
  height: 34px;
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tbtn:hover { color: var(--text); border-color: var(--text-dim); }
.tbtn svg { width: 15px; height: 15px; }

h1 {
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 8px;
}

.sub { color: var(--text-dim); margin: 0 0 26px; font-size: 15px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- drop zone ---------- */

#drop {
  padding: 44px 22px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
#drop:hover, #drop.hot { border-color: var(--accent); background: var(--surface-2); }
#drop.hot { border-style: solid; }

#drop .icon { width: 42px; height: 42px; color: var(--text-dim); margin-bottom: 10px; }
#drop.hot .icon { color: var(--accent); }
#drop .big { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
#drop .small { color: var(--text-dim); font-size: 13.5px; }

.btn {
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---------- upload progress ---------- */

#jobs { margin-top: 18px; display: grid; gap: 12px; }

.job { padding: 16px 18px; }

.job .row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.job .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.job .meta { color: var(--text-dim); font-size: 13px; white-space: nowrap; }

.bar {
  height: 7px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 12px;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .25s ease;
}
.bar.indet > i {
  width: 35% !important;
  animation: slide 1.15s ease-in-out infinite;
}
@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.job .err {
  margin-top: 10px;
  background: var(--err-bg);
  color: var(--err);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 190px;
  overflow: auto;
}

.share {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.share input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- history ---------- */

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  font-weight: 650;
  margin: 34px 0 12px;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tile:hover { border-color: var(--accent); }
.tile .thumb {
  aspect-ratio: 4 / 3;
  background: var(--surface-2) center/cover no-repeat;
  display: block;
}
.tile .cap { padding: 9px 11px; }
.tile .cap b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile .cap span { color: var(--text-dim); font-size: 12px; }

footer.foot {
  margin-top: 46px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
}

.hidden { display: none !important; }
