/* ---------- base ---------- */
:root {
  --bg: #0d0d12;
  --bg-card: #17171f;
  --bg-card-2: #1f1f2a;
  --border: #2a2a38;
  --text: #e7e7ee;
  --text-dim: #9090a0;
  --muted: #6b6b7c;
  --accent: #f5a524;
  --accent-2: #ff8a3d;
  --accent-soft: #f5a52422;
  --success: #22c55e;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 #ffffff08, 0 8px 24px #0008;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Noto Sans Thai", "Sarabun", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image: radial-gradient(1200px 600px at 50% -200px, #f5a52408, transparent 60%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 0.9em; }
button { font-family: inherit; cursor: pointer; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: #0d0d12cc;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo { font-size: 22px; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.brand-tag {
  font-size: 12px;
  color: var(--text-dim);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-left: 4px;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-right input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 200px;
  outline: none;
  transition: border-color 0.15s;
}
.topbar-right input:focus { border-color: var(--accent); }
.health { color: var(--success); font-size: 18px; text-decoration: none; padding: 0 6px; }

/* ---------- container ---------- */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.container.narrow { max-width: 720px; }

/* ---------- cards ---------- */
.upload-card, .recent-card, .file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sub { margin: 0 0 20px; color: var(--text-dim); font-size: 14px; }

/* ---------- dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  transition: all 0.15s;
  cursor: pointer;
  background: #11111a80;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone-icon { font-size: 40px; margin-bottom: 8px; opacity: 0.7; }
.dropzone-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.dropzone-hint { color: var(--text-dim); font-size: 14px; }
.pick-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.pick-link:hover { color: var(--accent-2); }

/* ---------- queue ---------- */
.queue { margin-top: 18px; }
.queue-item {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  transition: all 0.2s;
}
.queue-item.success { border-color: var(--success); background: #22c55e08; }
.queue-item.error { border-color: var(--danger); background: #ef444408; }
.qi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-size-inline { color: var(--text-dim); font-size: 12px; font-weight: normal; margin-left: 6px; }
.qi-size { color: var(--text-dim); font-size: 13px; }
.qi-status { font-size: 12px; color: var(--text-dim); min-width: 220px; text-align: right; font-variant-numeric: tabular-nums; }
.qi-status.success { color: var(--success); }
.qi-status.error { color: var(--danger); }
.qi-actions { display: flex; gap: 6px; }
.qi-link {
  background: var(--accent);
  color: #1a1a1a;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.qi-link:hover { background: var(--accent-2); text-decoration: none; }
.qi-bar {
  width: 100%;
  height: 3px;
  background: #2a2a38;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
  display: none;
}
.queue-item.uploading .qi-bar { display: block; }
.qi-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s;
}
.qi-text { flex: 1; min-width: 0; }
.qi-chunks {
  display: flex;
  gap: 2px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.qi-chunk {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #2a2a38;
  border-radius: 2px;
  transition: background 0.15s;
}
.qi-chunk.done { background: var(--accent); }

/* ---------- recent ---------- */
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-2);
  border: 1px solid transparent;
  transition: all 0.12s;
  text-decoration: none;
  color: inherit;
}
.recent-row:hover { border-color: var(--border); background: #1a1a25; text-decoration: none; }
.recent-icon { font-size: 18px; text-align: center; }
.recent-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { color: var(--text-dim); font-size: 13px; }
.recent-empty, .loading { color: var(--text-dim); padding: 24px; text-align: center; }

/* ---------- file card ---------- */
.file-card { text-align: center; }
.file-icon { font-size: 56px; margin-bottom: 12px; }
.file-name {
  font-size: 22px;
  font-weight: 700;
  word-break: break-all;
  margin: 0 0 10px;
}
.file-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}
.dl-count { color: var(--accent); font-weight: 600; }
.img-preview {
  max-width: 100%;
  max-height: 360px;
  margin: 0 auto 24px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.img-preview img { max-width: 100%; max-height: 360px; display: block; margin: 0 auto; }
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.link-box {
  text-align: left;
  background: var(--bg-card-2);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.link-box label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  outline: none;
}
.muted { color: var(--text-dim); font-size: 13px; margin-top: 8px; }

/* ---------- info box ---------- */
.info-box {
  text-align: left;
  background: var(--bg-card-2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 8px;
}
.info-box summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  user-select: none;
  font-weight: 500;
}
.info-box table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.info-box th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
  padding: 6px 8px 6px 0;
  width: 110px;
  vertical-align: top;
}
.info-box td { padding: 6px 0; font-size: 13px; word-break: break-all; }
code.hash { font-size: 11px; color: var(--text-dim); }

/* ---------- zip box ---------- */
.zip-box {
  text-align: left;
  background: var(--bg-card-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 18px;
  border: 1px solid var(--border);
}
.zip-box h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.zip-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.zip-table th, .zip-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #2a2a3820; }
.zip-table th { color: var(--text-dim); font-weight: 500; font-size: 12px; }
.zip-icon { width: 22px; text-align: center; }
.zip-name { font-family: ui-monospace, monospace; font-size: 12.5px; word-break: break-all; }
.zip-size, .zip-comp, .zip-date { font-family: ui-monospace, monospace; color: var(--text-dim); white-space: nowrap; font-size: 12px; }

/* ---------- buttons ---------- */
.btn-primary {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s;
}
.btn-primary:hover { background: var(--accent-2); text-decoration: none; }
.btn-primary.big { padding: 14px 28px; font-size: 16px; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.12s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- error ---------- */
.error { padding: 30px 10px; }
.error-icon { font-size: 48px; margin-bottom: 12px; }
.error h1 { margin-bottom: 8px; }
.error p { color: var(--text-dim); margin: 0 0 20px; }
.error code { background: var(--bg-card-2); padding: 2px 8px; border-radius: 4px; }

/* ---------- footer ---------- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0 0;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 8px 24px #0009;
  opacity: 0;
  transition: all 0.25s;
  z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .topbar-right input { width: 140px; }
  .container { padding: 16px 12px 60px; }
  .upload-card, .recent-card, .file-card { padding: 18px; }
  .dropzone { padding: 32px 16px; }
  .recent-row { grid-template-columns: 24px 1fr auto; }
  .recent-meta.hide-sm { display: none; }
  .file-name { font-size: 18px; }
}
