/* Load after the page stylesheet. View visibility and grid areas stay page-owned. */
body.candle-site {
  --bg: #11191c;
  --panel: #19252a;
  --line: #33444b;
  --border: #33444b;
  --text: #eaf0ee;
  --muted: #9eafb5;
  --yellow: #ffc875;
  --gold: #ffc875;
  --green: #82dcba;
  --aqua: #82dcba;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, 'Segoe UI', sans-serif;
  letter-spacing: 0;
}

body.candle-site :where(h1, h2, h3, .eyebrow, .language b, .simple-player > p:first-child) {
  letter-spacing: 0;
}

body.candle-site > .candle-site-header,
body.candle-site > main {
  max-width: 1440px;
  padding: 24px;
  min-width: 0;
}

body.candle-site > .candle-site-header {
  gap: 16px 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

body.candle-site .candle-site-header h1 {
  margin: 4px 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

body.candle-site .candle-site-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

body.candle-site .candle-site-header .eyebrow {
  color: var(--yellow);
  font-size: 11px;
  letter-spacing: 0;
}

body.candle-site .candle-navigation {
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
  align-items: stretch;
  grid-area: navigation;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.candle-navigation-bar,
.candle-navigation-links,
.candle-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.candle-navigation-bar { justify-content: space-between; }
.candle-navigation-links { flex: 1 1 auto; }

body.candle-site .candle-navigation-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

body.candle-site .candle-navigation-link:hover {
  color: var(--text);
  background: #19252a;
}

body.candle-site .candle-navigation-link[aria-current='page'] {
  color: var(--green);
  border-bottom-color: var(--green);
}

body.candle-site .candle-account-actions > :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  text-decoration: none;
  white-space: normal;
}

.candle-navigation-source { min-width: 0; }

body.candle-site .candle-navigation-source-label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

body.candle-site .candle-navigation-picker {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  font-size: 16px;
  text-overflow: ellipsis;
}

.candle-navigation-status {
  display: block;
  margin-top: 4px;
  color: var(--yellow);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* Existing IDs remain in the DOM, but never duplicate the common navigation. */
body.candle-site .candle-navigation-legacy,
body.candle-site.candle-navigation-embedded > .candle-site-header,
body.candle-site [hidden] {
  display: none !important;
}

body.candle-site :where(button, input, select, textarea) {
  max-width: 100%;
  border-radius: 6px;
  font-family: inherit;
  letter-spacing: 0;
}

body.candle-site :where(button, select, textarea, input:not([type='range']):not([type='checkbox']):not([type='radio'])) {
  min-height: 44px;
}

body.candle-site :where(button, .button) {
  white-space: normal;
  overflow-wrap: anywhere;
}

body.candle-site :where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

body.candle-site :where(input[type='range'], input[type='checkbox'], input[type='radio']) {
  accent-color: var(--green);
}

/* Flatten page sections without changing their display or positioning rules. */
body.candle-site :where(main) .panel {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 20px 0;
  min-width: 0;
}

body.candle-site :where(main h2) { font-size: 21px; }
body.candle-site :where(main h3) { font-size: 17px; }

body.candle-site :where(.cards article, .pill, .tag, .notice, .runtime-status,
  .spectral-time-settings, .audio-start-panel),
body.candle-site #personal-player,
body.candle-site #avatar-canvas {
  border-radius: 8px;
}

body.candle-site :where(.panel-head > *, .section-head > *, .form-grid > *,
  .columns > *, .player-top > *, .avatar-layout > *, .candle-site-header > div) {
  min-width: 0;
}

@media (min-width: 1000px) {
  body.candle-site .candle-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
    align-items: center;
    gap: 12px 24px;
  }
  .candle-navigation-bar:only-child { grid-column: 1 / -1; }
  body.candle-site .candle-navigation-source-label { max-width: none; }
}

@media (max-width: 600px) {
  body.candle-site > .candle-site-header,
  body.candle-site > main { padding: 16px 12px; }
  body.candle-site .candle-site-header h1 { font-size: 24px; }
  body.candle-site .candle-navigation-link { padding-inline: 8px; }
  .candle-navigation-links { gap: 2px 4px; }
  .candle-account-actions { width: 100%; }
  body.candle-site .candle-navigation-source-label { max-width: none; }
  body.candle-site :where(input, select, textarea) { font-size: 16px; }
  body.candle-site :where(main) .panel { padding: 16px 0; }
}

.candle-tools{position:relative;margin:0}.candle-tools>summary{list-style:none;padding:9px 12px;min-height:44px;color:var(--muted);font-size:14px;font-weight:600}.candle-tools>summary::after{content:' ▾'}.candle-tools[open]{z-index:20}.candle-tools[open]>summary{background:var(--panel)}.candle-tools>a.candle-navigation-link{display:flex!important;position:relative;min-width:180px;background:var(--panel)!important;justify-content:flex-start!important}
.viewer-page .candle-navigation-bar{align-items:flex-start}.viewer-page .candle-navigation-links{align-items:flex-start}.viewer-page .candle-tools[open]>a{position:absolute;right:0;top:44px;box-shadow:0 12px 30px #0005}.viewer-page .candle-tools[open]>a:nth-of-type(2){top:88px}.viewer-page .candle-tools[open]>a:nth-of-type(3){top:132px}
body.viewer-page.candle-site>.candle-site-header{padding-block:16px}.viewer-page .candle-site-header h1{font-size:22px}.viewer-page .candle-navigation{display:grid!important;grid-template-columns:minmax(200px,1fr) auto;align-items:center;gap:12px}.viewer-page .candle-navigation-bar{grid-column:2;grid-row:1}.viewer-page .candle-navigation-source{grid-column:1;grid-row:1}.viewer-page .candle-navigation-source-label{max-width:440px}.viewer-page .candle-navigation-links{gap:2px}
@media(max-width:600px){.viewer-page .candle-navigation{grid-template-columns:1fr!important}.viewer-page .candle-navigation-bar{grid-column:1;grid-row:2}.viewer-page .candle-navigation-source{grid-column:1;grid-row:1}.viewer-page .candle-navigation-links{width:100%;justify-content:space-between}.viewer-page .candle-navigation-source-label{grid-template-columns:auto minmax(0,1fr)}.viewer-page .candle-navigation-source-label select{margin:0}}
