/* MicroBin — w3K Dark Theme */

:root {
  --bg:      #070b14;
  --surface: #0c1628;
  --card:    #121e34;
  --border:  #1b2d47;
  --muted:   #223354;
  --text:    #dce9f7;
  --dim:     #7a99b8;
  --faint:   #3d5a76;
  --accent:  #5b8af0;
  --accent-h:#7aa5f3;
  --link:    #60a5fa;
  --link-h:  #93c5fd;
  --danger:  #f87171;
  --ok:      #34d399;
  --warn:    #fbbf24;
  --r:       6px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem 5rem;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.wide { max-width: 1120px; }

/* ── Nav ─────────────────────────────────── */
#nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 -1rem 2.5rem;
  padding: 0.55rem 1rem;
  background: rgba(12, 22, 40, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 99;
}

#nav b {
  margin-right: auto;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

#nav b a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

#nav b img,
#nav img {
  max-width: 100px;
  width: auto;
  height: auto;
  max-height: 36px;
  object-fit: contain;
  margin: 0 0.6rem 0 0;
  vertical-align: middle;
  display: block;
}

/* first nav link gets a left border acting as a divider from the title */
#nav b + a {
  margin-left: 0.5rem;
  border-left: 1px solid var(--border);
  padding-left: 0.9rem;
}

#nav a {
  color: var(--dim);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.32rem 0.7rem;
  border-radius: 5px;
  transition: background 0.13s, color 0.13s;
  letter-spacing: 0.01em;
  margin: 0;
  white-space: nowrap;
}

#nav a:hover {
  background: var(--muted);
  color: var(--text);
  text-decoration: none;
}

/* ── Headings ────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  margin: 1.8rem 0 0.5rem;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }

h3 {
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

h4 {
  font-size: 0.7rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

h5, h6 { font-size: 0.9rem; color: var(--dim); }

p { margin: 0.65em 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-h); text-decoration: underline; }

hr { border: none; border-top: 1px solid var(--border); margin: 1.75rem 0; }

small { font-size: 0.8em; color: var(--dim); }

b, strong { font-weight: 600; }

/* ── Forms ───────────────────────────────── */
label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--dim);
  margin-bottom: 0.3rem;
}

input, textarea, select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.45rem 0.72rem;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,138,240,0.16);
}

input::placeholder, textarea::placeholder { color: var(--faint); }

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%233d5a76' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.2rem;
}

select option { background: var(--card); color: var(--text); }

textarea {
  resize: vertical;
  min-height: 200px;
  font-family: 'SFMono-Regular', 'Menlo', Consolas, 'Liberation Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  tab-size: 2;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="file"] {
  background: transparent;
  border-style: dashed;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--dim);
  padding: 0.65rem 0.75rem;
}

input[type="submit"], button {
  background: var(--accent) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--r);
  padding: 0.5rem 1.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  width: auto;
  letter-spacing: 0.01em;
}

input[type="submit"]:hover, button:hover {
  background: var(--accent-h) !important;
}

input[type="submit"]:active, button:active {
  transform: scale(0.97);
}

input[type="submit"]:disabled, button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

input[type="password"] {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

/* ── Tables ──────────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin: 1rem 0;
}

thead th {
  background: var(--surface);
  color: var(--dim);
  font-weight: 600;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface); }

td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
  color: var(--text);
  word-break: break-word;
}

/* ── Code ────────────────────────────────── */
code {
  font-family: 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.82em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.38em;
  color: #f0f6ff;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.875rem;
  margin: 0.75rem 0;
}

pre code { background: none; border: none; padding: 0; font-size: inherit; }

/* ── Template buttons ────────────────────── */
.small-button {
  display: inline-block;
  background: var(--card);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.22rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  vertical-align: middle;
  line-height: 1.4;
}

.small-button:hover {
  background: var(--muted);
  color: var(--text);
  text-decoration: none;
}

.download-button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: 0.35rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.12s;
  line-height: 1.4;
}

.download-button:hover {
  background: var(--accent-h);
  color: #fff;
  text-decoration: none;
}

.copy-button {
  display: inline-block;
  background: var(--card);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  vertical-align: middle;
  line-height: 1.4;
}

.copy-button:hover {
  background: var(--muted);
  color: var(--text);
}

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ── Footer ──────────────────────────────── */
p[style*="text-align: center"],
p[style*="text-align:center"] {
  color: var(--faint);
  font-size: 0.76rem;
  margin-top: 3rem;
}

p[style*="text-align: center"] a,
p[style*="text-align:center"] a {
  color: var(--dim);
}

p[style*="text-align: center"] a:hover,
p[style*="text-align:center"] a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ── Error / alert div ───────────────────── */
div[style*="background-color: rgba(255, 0, 0"] {
  background: rgba(248, 113, 113, 0.07) !important;
  border: 1px solid rgba(248, 113, 113, 0.28) !important;
  border-radius: var(--r);
  color: #fca5a5;
}

/* ── File input button ───────────────────── */
input::file-selector-button {
  background: var(--card);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin-right: 0.5rem;
  transition: background 0.12s, color 0.12s;
}

input::file-selector-button:hover {
  background: var(--muted);
  color: var(--text);
}

/* ── Images ──────────────────────────────── */
img:not(#nav img):not(#nav b img) {
  max-width: 100%;
  border-radius: var(--r);
}

/* ── Syntax highlight ────────────────────── */
.hljs, code-line {
  background: var(--surface);
  border-radius: var(--r);
  display: block;
  overflow-x: auto;
}
