:root {
  --bg: #0f3a40;
  --panel: #123f46;
  --chip: #1e5259;
  --chip-dark: #18484f;
  --text: #d7ecef;
  --muted: #9ec7cd;
  --border: #2b6a72;
  --accent: #e74c3c;

  /* Shadows */
  --shadow-h1:
    0 6px 18px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.25);
}

body {
  margin: 40px;
  background: #0b2c31;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
}

.bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  text-shadow: var(--shadow-subtle);
}

.chip.dark {
  background: var(--chip-dark);
}

.divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

.icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  flex: 0 0 14px;
}

.icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--chip);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.04);
  text-shadow: var(--shadow-subtle);
}

.plus {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--chip);
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

svg {
  display: block;
}

p {
  color: var(--text);
  text-shadow: var(--shadow-subtle);
}

h1,
h2,
h3 {
  color: var(--text);
  text-shadow: var(--shadow-h1);
}

img {
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-subtle);
  margin-top: 12px;
}

.clickable {
  cursor: zoom-in;
}

#overlay {
  position: fixed;
  display: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#overlay img {
  max-width: 50%; /* fix */
  max-height: 50%; /* fix */
  border-radius: 10px;
  transition: transform 0.2s;
  transform-origin: center center;
  cursor: n-resize;
}

#closeBtn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 50px;
  color: white;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

#closeBtn:hover {
  color: #ff4444;
}

#zoomHint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

a {
  color: var(--muted);
  text-decoration: wavy underline;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

code {
  background: var(--chip);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
}

/* Smooth scroll for hash links */
html {
  scroll-behavior: smooth;
}

/* TOC */
.toc {
  margin: 18px 0;
  background: var(--panel);
  padding: 10px;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toc .toc-item {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Heading anchor & copy */
.heading-anchor,
.heading-copy {
  margin-left: 8px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.heading-anchor {
  text-decoration: none;
}
.heading-copy {
  margin-left: 4px;
}

/* Copy tooltip */
.copy-tip {
  margin-left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  position: relative;
  top: 2px;
}

/* Highlight target */
h2:target,
h3:target {
  box-shadow:
    0 0 0 6px rgba(158, 199, 205, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  transform: translateY(-2px);
  transition:
    box-shadow 0.25s,
    transform 0.15s;
}
