@import url('https://cdnjs.cloudflare.com/ajax/libs/JetBrains-Mono/2.304/css/jetbrains-mono.min.css');

:root {
  --bg: #0E1015;
  --surface: #171A21;
  --surface-2: #1D212A;
  --border: #2A2F3A;
  --text: #E9E7E2;
  --text-dim: #8B909C;
  --accent: #FF6B35;
  --accent-dim: #B34A24;
  --accent-soft: rgba(255, 107, 53, 0.12);
  --info: #5EA8E0;
  --info-soft: rgba(94, 168, 224, 0.12);
  --danger: #E05252;
  --success: #4FBE83;
  --radius: 12px;
  --font-display: 'JetBrains Mono', 'Space Mono', monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[data-theme="light"] {
  --bg: #F3F1EC;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --border: #E3E0D8;
  --text: #1C1B18;
  --text-dim: #6B6A64;
  --accent: #D9531E;
  --accent-dim: #B7451A;
  --accent-soft: rgba(217, 83, 30, 0.1);
  --info: #2E6DA4;
  --info-soft: rgba(46, 109, 164, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.25;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-mark { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-size: 15px; }
.brand-sub { font-size: 10px; color: var(--text-dim); font-weight: 400; letter-spacing: 0.04em; }

.nav-links { display: flex; align-items: center; gap: 20px; }

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle:hover { border-color: var(--accent); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.stat-card:hover { border-color: var(--accent-dim); transform: translateY(-1px); }

.stat-head { display: flex; align-items: center; gap: 8px; }
.stat-icon { width: 15px; height: 15px; color: var(--text-dim); flex-shrink: 0; }

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 8px 24px -16px rgba(0, 0, 0, 0.4);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.panel-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 20px;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }

.dropzone-icon { width: 28px; height: 28px; color: var(--text-dim); margin-bottom: 8px; }

.dropzone-text { margin: 0; font-size: 14px; }
.dropzone-or { margin: 8px 0; font-size: 12px; color: var(--text-dim); }

.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); }

.selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 12px;
  font-size: 13px;
}
.selected-file-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.selected-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.selected-size { color: var(--text-dim); font-size: 12px; }
.btn-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.btn-clear:hover { color: var(--danger); }

.field { margin-top: 16px; }
.field label, .field-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

select, input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-body);
}
select:focus, input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

#uploadBtn { margin-top: 20px; }

.progress-wrap { margin-top: 16px; }
.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.progress-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-display);
}

.error-message {
  margin-top: 14px;
  background: rgba(224, 82, 82, 0.1);
  border: 1px solid rgba(224, 82, 82, 0.3);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.result-panel { text-align: left; }
.result-check {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(79, 190, 131, 0.12);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.result-check svg { width: 20px; height: 20px; }

.result-list { margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.result-list > div { display: flex; justify-content: space-between; font-size: 13px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.result-list dt { color: var(--text-dim); margin: 0; }
.result-list dd { margin: 0; font-weight: 600; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.url-row { display: flex; gap: 8px; margin-bottom: 18px; }
.url-row input { flex: 1; font-family: var(--font-display); font-size: 12px; }

.result-actions { display: flex; gap: 10px; }

.section-title {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 14px;
}

.recent-section { margin-top: 36px; }

.recent-list { display: flex; flex-direction: column; gap: 10px; }

.empty-state {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 0;
}

.recent-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.recent-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.recent-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-display);
  flex-shrink: 0;
}

.fuse-track {
  height: 4px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.fuse-fill {
  height: 100%;
  background: var(--accent);
  transition: width 1s linear;
}

.fuse-fill.expiring { background: var(--danger); }

.monitor-section { margin-top: 36px; }

.monitor-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.monitor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s ease;
}
.monitor-card:hover { border-color: var(--accent-dim); }

.gauge { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--surface-2); stroke-width: 4; }
.gauge-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100.53;
  stroke-dashoffset: 100.53;
  transition: stroke-dashoffset 0.6s ease;
}

.monitor-flat-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.monitor-flat-icon svg { width: 20px; height: 20px; }
.monitor-icon-down { color: var(--success); }
.monitor-icon-up { color: var(--info); }

.monitor-info { display: flex; flex-direction: column; gap: 2px; }
.monitor-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.monitor-value { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.monitor-sub { font-size: 11px; color: var(--text-dim); }

.docs-section { margin-top: 44px; }

.docs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.doc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.doc-method {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.doc-method.post { color: var(--accent); background: var(--accent-soft); }
.doc-method.get { color: var(--info); background: var(--info-soft); }

.doc-path {
  font-family: var(--font-display);
  font-size: 14px;
  word-break: break-all;
}

.doc-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 12px;
  line-height: 1.55;
}

.inline-code {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11.5px;
  color: var(--text);
  white-space: nowrap;
}

.doc-param-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-param-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12.5px;
  align-items: baseline;
}
.param-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 52px;
}
.param-desc {
  color: var(--text-dim);
}
.param-values {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.doc-card pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  overflow-x: auto;
  margin: 0;
  color: var(--text-dim);
  font-family: var(--font-display);
}

.doc-resp {
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 0;
  line-height: 1.6;
}

.docs-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 16px;
  line-height: 1.6;
}

.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .docs-grid { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .navbar { padding: 14px 16px; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 13px; }
}

@media (min-width: 900px) {
  main { max-width: 780px; }
}
