/* =========================
   TOKENS
   ========================= */

:root {
  /* monochrome chassis + 單一 oxblood accent */
  --color-bg: #ffffff;
  --color-text: #0a0a0a;
  --color-text-soft: #2a2a2a;
  --color-muted: #6a6a6a;
  --color-muted-faint: #999999;
  --color-border: #d0d0d0;
  --color-border-soft: #e8e8e8;
  --color-surface: #f5f5f5;

  --color-accent: #333333;     /* 深灰 — 不用色彩、強調靠 weight */
  --color-hover-red: #ff0000;   /* hover 用 */

  --space-sm: 6px;
  --space-md: 10px;
  --space-lg: 18px;

  --radius-md: 2px;             /* 不要 8px+ 大圓角（design spec） */
}

/* =========================
   BASE
   ========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: var(--space-lg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 13px;
  letter-spacing: 0;
  line-height: 1.5;
}

/* =========================
   NAV
   ========================= */

nav {
  margin-bottom: var(--space-lg);
}

nav a {
  margin-right: var(--space-md);
  text-decoration: none;
  color: var(--color-muted);
}

nav a:hover {
  color: var(--color-hover-red);
}

/* =========================
   TYPOGRAPHY
   ========================= */

h1, h2, h3 {
  font-weight: 500;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--color-text);
  letter-spacing: 0;
  line-height: 1.35;
}

h1 { font-size: 15px; }
h2 { font-size: 13px; }
h3 { font-size: 12px; }

p {
  margin: var(--space-sm) 0;
  line-height: 1.5;
}

.text-muted {
  color: var(--color-muted);
  font-size: 11px;
}

/* =========================
   CONTENT (DOCUMENT)
   ========================= */

.home-prose {
  max-width: 720px;
}

/* list 基本結構 */
.home-prose ul,
.home-prose ol {
  padding-left: 1.4em;
}

.home-prose li {
  margin: 6px 0;
}

/* =========================
   PANEL
   ========================= */

.panel {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: #fcfcfc;
}

/* =========================
   TASK (CHECKLIST)
   ========================= */

.task {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.task input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 3px;
}

.task-text {
  flex: 0 1 auto;
  text-align: left;
}

.task-marker {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, "Courier New", Menlo, monospace;
  white-space: pre;
}

/* 完成狀態 */
.task-done .task-text {
  text-decoration: line-through;
  color: var(--color-muted);
}

.cl-pre > div,
.cl-para > div {
  font-family: ui-monospace, SFMono-Regular, "Courier New", Menlo, monospace;
  white-space: pre;
}

.block {
  border-left: 3px solid var(--color-accent);
  padding-left: 12px;
  margin: 10px 0;
}

.module {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
}

.module-note {
  color: var(--color-muted);
}

.module-warning {
  color: var(--color-accent);
}

/* =========================
   UTILITIES
   ========================= */

.text-accent {
  color: var(--color-accent);
}

a {
  color: inherit;
}

a:hover {
  color: var(--color-hover-red);
}
/* =========================
   DOCUMENT LIST RESET (CRITICAL)
   ========================= */

.page-doc .home-prose ul,
.page-doc .home-prose ol {
  list-style: initial;
  padding-left: 1.4em;
}

.page-doc .home-prose li {
  display: block !important;
  grid-template-columns: none !important;
}

.page-doc .home-prose li.task {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
}

.page-doc .home-prose li.task input[type="checkbox"] {
  margin-top: 3px;
}

/* =========================
   DESIGN TOKENS
   ========================= */

:root {
  /* color */
  --color-bg: #fff;
  --color-text: #111;
  --color-muted: #666;
  --color-border: #d0d0d0;
  --color-border-soft: #e9e9e9;
  --color-panel: #fcfcfc;
  --color-accent: #333333;
  --color-accent-soft: var(--color-border);
  --color-hover-red: #ff0000;

  /* spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 24px;

  /* radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 24px;

  /* motion */
  --t-fast: 120ms;
  --t-mid: 220ms;
  --t-slow: 400ms;

  /* =========================
     UI MODE TOKENS
     ========================= */

  /* typography */
  --ui-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ui-letter-spacing: 0;

  /* surface */
  --ui-bg: var(--color-bg);
  --ui-text: var(--color-text);

  /* decoration */
  --ui-border-style: solid;
  --ui-shadow: none;

  /* motion */
  --ui-animation: enabled;

  /* accent behavior */
  --ui-link-color: #444;
  --ui-link-hover: underline;
}

/* =========================
   LAYER 1: BASE
   ========================= */

/* =========================
   LAYER 2: LAYOUT
   ========================= */

body {
  font-family: var(--ui-font-family);
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  line-height: 1.5;
  color: var(--ui-text);
  background: var(--ui-bg);
  letter-spacing: 0;
}

nav {
  margin-bottom: 28px;
  font-size: 14px;
}

nav a {
  margin-right: 14px;
  color: var(--ui-link-color);
  text-decoration: none;
}

nav a:hover {
  text-decoration: var(--ui-link-hover);
}

main {
  margin-top: 20px;
}

h1, h2, h3 {
  margin-top: 28px;
  margin-bottom: 12px;
  line-height: 1.3;
}

pre {
  overflow-x: auto;
  padding: 14px;
  background: #f6f6f6;
  border-radius: 2px;
}

code {
  font-family: ui-monospace, SFMono-Regular, "Courier New", Menlo, monospace;
  font-size: 0.9em;
}

article {
  margin-top: 16px;
}

input[type="checkbox"] {
  cursor: pointer;
}

.panel {
  margin: 16px 0;
  padding: 14px;
  border: 1px var(--ui-border-style) var(--color-border-soft);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--ui-shadow);
}

label {
  display: block;
  margin: 8px 0 6px;
}

select,
textarea,
input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
}

select,
textarea {
  border: 1px solid #d6d6d6;
  border-radius: 2px;
  padding: 10px 12px;
  background: #fff;
}

button {
  border: 0;
  border-radius: var(--radius-md);
  padding: 11px 14px;
  background: var(--color-text);
  color: #fff;
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-mid);
}

button:hover {
  opacity: 0.92;
}

.muted {
  color: var(--color-muted);
  font-size: 14px;
}

.panel-explain {
  font-size: 12.5px;
  color: var(--color-muted);
  margin: 6px 0 10px;
  line-height: 1.5;
}

.action-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.action-row--spread {
  justify-content: space-between;
}

/* =========================
   LAYER 3: COMPONENTS
   ========================= */

.btn {
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-mid);
}

.btn:active {
  transform: translateY(1px);
}

.icon-btn {
  width: auto;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  background: #efefef;
  color: #333;
  line-height: 1;
}

.icon-btn:hover {
  opacity: 1;
  background: #e8e8e8;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid #ececec;
  border-radius: 2px;
  padding: 12px;
  background: #fafafa;
}

.metric h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #666;
}

.metric .big {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.streak-flames {
  letter-spacing: 0;
  font-size: 15px;
}

.track-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.track-list li {
  padding: 8px 0;
  border-top: 1px solid #efefef;
}

.track-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.track-name {
  font-size: 14px;
}

.track-percent {
  font-size: 13px;
  color: #666;
}

.bar {
  margin-top: 6px;
  height: 8px;
  border-radius: 2px;
  background: #ebebeb;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--color-text);
}

.aquarium {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.aquarium-box {
  min-height: 240px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2), transparent 45%),
    var(--color-surface), var(--color-surface));
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* =========================
   TYPOGRAPHY
   ========================= */

.text-muted {
  color: var(--color-muted);
}

.text-accent {
  color: var(--color-accent);
}

/* =========================
   LAYER 4: SCOPE OVERRIDES
   (theme / mode / page scope)
   ========================= */

.evolution-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--color-muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--color-muted);
  opacity: 0.5;
  font-size: 14px;
  line-height: 1.5;
}

.creature {
  position: absolute;
  line-height: 1;
  user-select: none;
  transition: transform 0.2s ease;
  animation: float 4s ease-in-out infinite;
}

.creature:hover {
  transform: scale(1.2);
}

.creature.starter {
  filter: saturate(1.15);
}

.fish-name {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 14px;
  font-size: 9px;
  text-align: center;
  border-radius: 2px;
  border: 1px solid var(--color-accent);
  background: rgba(255, 255, 255, 0.85);
  padding: 0;
  outline: none;
  color: var(--color-accent);
}

.creature.newborn {
  animation: pop-in 280ms ease-out, float 4s ease-in-out 280ms infinite;
}

.creature.tired {
  opacity: 0.7;
  animation-duration: 7s;
}

.creature.dormant {
  opacity: 0.35;
  filter: grayscale(0.9);
  animation: none !important;
}

.creature.merge-out {
  transition: transform 0.22s ease, opacity 0.22s ease, left 0.22s ease, top 0.22s ease;
  transform: scale(0.8);
  opacity: 0;
  left: 50% !important;
  top: 50% !important;
}

.aquarium-action-row {
  justify-content: center;
  margin-top: 14px;
}

.worm-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  background: #eeeeee;
  color: #222;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.worm-btn:hover {
  opacity: 1;
  background: #e6e6e6;
}

.worm-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.worm-drop {
  position: fixed;
  z-index: 20;
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
  transition: left 0.4s ease-in, top 0.4s ease-in, transform 0.4s ease-in, opacity 0.4s ease-in;
}

.bubble {
  position: absolute;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.65);
  pointer-events: none;
  animation: rise 1.2s ease-out forwards;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

@keyframes pop-in {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes rise {
  0% { transform: translateY(0); opacity: 0.6; }
  100% { transform: translateY(-40px); opacity: 0; }
}

/* ============================================================
   Home (start.md) — manifesto-mode styling
   Scoped via body.home so other pages stay untouched.
   ============================================================ */

body.home {
  background: var(--color-surface);          /* warm cream paper */
  color: var(--color-text);                /* warm near-black ink */
}

/* greeting line above the title — small, mono, oxblood */
body.home .home-greeting {
  font-family: ui-monospace, SFMono-Regular, "Courier New", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 4px 0 28px;
  display: flex;
  gap: 18px;
  opacity: 0;
  animation: home-fade 600ms 0ms forwards;
}
body.home .home-greeting .day-marker {
  color: var(--color-accent);
}

/* core-targets pre — tone down so it doesn't steal focus from manifesto */
body.home main > pre {
  background: transparent;
  border: 1px dashed rgba(122, 46, 46, 0.28);
  color: var(--color-muted);
  font-size: 12.5px;
  margin: 0 0 36px;
  padding: 12px 14px;
  opacity: 0;
  animation: home-fade 600ms 200ms forwards;
}

/* manifesto article */
body.home .home-prose {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  animation: home-fade 800ms 250ms forwards;
}

/* h1 — monumental */
body.home .home-prose h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 8px 0 28px;
  color: var(--color-text);
  position: relative;
}
body.home .home-prose h1::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-right: 14px;
  vertical-align: middle;
  position: relative;
  top: -8px;
  animation: home-pulse 2.6s ease-in-out infinite;
}
body.home .home-prose h1::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  background: var(--color-accent);
  margin-top: 18px;
  border-radius: 2px;
}

/* h2 — chapter markers, oxblood with em-dash lead-in */
body.home .home-prose h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-accent);
  margin: 56px 0 18px;
  letter-spacing: 0;
}
body.home .home-prose h2::before {
  content: "—— ";
  color: var(--color-border);
  font-weight: 400;
}

/* paragraphs */
body.home .home-prose p {
  margin: 14px 0;
}

/* strong — oxblood, weighted, optional subtle bg */
body.home .home-prose strong {
  color: var(--color-accent);
  font-weight: 700;
}

/* blockquote — inscription style */
body.home .home-prose blockquote {
  margin: 40px 0;
  padding: 12px 0 12px 24px;
  border-left: 3px solid var(--color-accent);
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: transparent;
}
body.home .home-prose blockquote p {
  margin: 8px 0;
}

/* hr — thin, tinted, centered short */
body.home .home-prose hr {
  border: 0;
  border-top: 1px solid rgba(122, 46, 46, 0.22);
  margin: 36px auto;
  width: 80px;
}

/* trailing italic line — quiet, centered (top-level only) */
body.home .home-prose > p:last-of-type em {
  color: var(--color-muted);
  font-size: 14px;
}
body.home .home-prose > p:last-of-type {
  text-align: center;
  margin-top: 32px;
}

/* nav softening on home */
body.home nav a {
  color: var(--color-muted);
}
body.home nav a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* animations */
@keyframes home-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes home-pulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.4); }
}

/* mobile */
@media (max-width: 600px) {
  body.home .home-prose h1 { font-size: 15px; }
  body.home .home-prose h2 { font-size: 15px; }
  body.home .home-prose    { font-size: 15px; }
}

/* ============================================================
   UI mode toggle (top-right mini button)
   Default = plain mode
   ============================================================ */

#ui-mode-toggle {
  position: fixed;
  top: 2px;
  right: 2px;
  z-index: 9999;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #666;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

#ui-mode-toggle:hover {
  opacity: 1;
}

#theme-mode-toggle {
  position: fixed;
  top: 2px;
  right: 2px;
  z-index: 9999;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #666;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

#theme-mode-toggle:hover {
  opacity: 1;
}

#theme-mode-toggle {
  display: none !important;
}

#corner-mascot {
  position: fixed;
  top: 2px;
  left: 2px;
  z-index: 9999;
  width: 33px;
  height: 33px;
  min-width: 33px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0.95;
  cursor: pointer;
}

#corner-mascot,
#corner-mascot:hover,
#corner-mascot:focus,
#corner-mascot:active,
#corner-mascot:focus-visible {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#corner-mascot-img {
  width: 29px;
  height: 29px;
  object-fit: contain;
  display: block;
}

#corner-mascot:hover {
  opacity: 1;
}

.mini-aquarium {
  position: fixed;
  top: 21px;
  left: 15px;
  z-index: 9998;
  width: 300px;
  max-width: calc(100vw - 12px);
  border: 1px solid var(--color-border-soft);
  border-radius: 2px;
  background: #ffffff;
  box-shadow: none;
  padding: 10px;
}

.mini-aquarium.collapsed {
  display: none;
  pointer-events: none;
}

.mini-aquarium-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.mini-aquarium-count {
  font-size: 13px;
  color: #555;
}

.mini-aquarium-feed {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  background: #eeeeee;
  color: #222;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-aquarium-box {
  min-height: 92px;
  max-height: 170px;
  overflow: hidden;
  border: 1px dashed #d7d7d7;
  border-radius: 2px;
  padding: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-soft);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.32), transparent 45%),
    var(--color-surface), var(--color-surface));
}

.mini-tank {
  position: relative;
}

.mini-creature {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  line-height: 1;
  user-select: none;
}

/* plain mode = previous "unstyled-ish" baseline */
body.ui-plain {
  --ui-font-family: ui-monospace, SFMono-Regular, "Courier New", Menlo, monospace;
  --ui-letter-spacing: 0;
  --ui-bg: #fff;
  --ui-text: #111;
  --ui-border-style: dashed;
  --ui-shadow: none;
  --ui-animation: none;
  --ui-link-color: var(--color-accent);
}

body.ui-enhanced {
  --ui-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ui-letter-spacing: 0;
  --ui-border-style: solid;
  --ui-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --ui-animation: enabled;
}

body.ui-plain nav a {
  color: var(--color-accent) !important;
  transition: transform 120ms ease, opacity 160ms ease, color 160ms ease;
  display: inline-block;
}

body.ui-plain nav a:hover {
  transform: translateY(-1px);
  opacity: 0.88;
}

body.ui-plain nav a:active {
  transform: translateY(1px);
}

body.ui-plain nav a:focus-visible {
  outline: 1px dashed var(--color-accent);
  outline-offset: 2px;
}

body.ui-plain .home-greeting {
  display: none !important;
}

body.ui-plain main > pre {
  background: transparent !important;
  border: none !important;
  color: inherit !important;
  font-size: inherit !important;
  opacity: 1 !important;
  animation: none !important;
}

body.ui-plain .home-prose,
body.ui-plain .home-prose h1,
body.ui-plain .home-prose h2,
body.ui-plain .home-prose p,
body.ui-plain .home-prose strong,
body.ui-plain .home-prose blockquote {
  font-family: inherit !important;
  color: inherit !important;
  opacity: 1 !important;
  animation: none !important;
}

body.ui-plain .home-prose h1 {
  font-size: 1em !important;
  margin: 0.67em 0 !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  transition: opacity 200ms ease;
}

body.ui-plain .home-prose h1::before,
body.ui-plain .home-prose h1::after,
body.ui-plain .home-prose h2::before {
  content: none !important;
}

body.ui-plain .home-prose h2 {
  font-size: 1em !important;
  margin: 0.83em 0 !important;
  font-weight: 700 !important;
  color: var(--color-accent) !important;
  transition: opacity 200ms ease;
}

body.ui-plain .home-prose hr {
  border: 0;
  border-top: 1px solid var(--color-accent) !important;
  width: auto !important;
  margin: 1em 0 !important;
}

body.ui-plain .home-prose strong {
  color: var(--color-accent) !important;
}

body.ui-plain .home-prose blockquote {
  border-left-color: var(--color-accent) !important;
}

body.ui-plain .panel {
  background: #fcfcfc !important;
  border: 1px solid #e9e9e9 !important;
  box-shadow: none !important;
  transition: border-color 180ms ease, background 180ms ease;
}

body.ui-plain .aquarium-box {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2), transparent 45%),
    var(--color-surface), var(--color-surface)) !important;
  border: none !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  min-height: 240px !important;
  padding: 24px !important;
  overflow: hidden !important;
  transition: transform 180ms ease, opacity 180ms ease;
}

body.ui-plain .evolution-hint,
body.ui-plain .empty-state,
body.ui-plain .muted {
  color: inherit !important;
  opacity: 1 !important;
}

body.ui-plain .evolution-hint {
  color: var(--color-accent) !important;
}

body.ui-plain .empty-state {
  color: var(--color-muted) !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
}

body.ui-plain .creature {
  animation: none !important;
  position: absolute !important;
  display: inline-block !important;
  margin: 0 !important;
  left: unset;
  top: unset;
  transition: transform 120ms ease;
}

body.ui-plain .creature:hover {
  transform: scale(1.08);
}

body.ui-plain .aquarium-action-row .worm-btn {
  padding-top: 3px !important;
}

body.ui-plain button,
body.ui-plain .icon-btn,
body.ui-plain .worm-btn {
  transition: transform 120ms ease, opacity 160ms ease, filter 160ms ease;
}

body.ui-plain button:hover,
body.ui-plain .icon-btn:hover,
body.ui-plain .worm-btn:hover {
  filter: brightness(1.03);
}

body.ui-plain button:active,
body.ui-plain .icon-btn:active,
body.ui-plain .worm-btn:active {
  transform: translateY(1px);
}

body.ui-plain button:focus-visible,
body.ui-plain .icon-btn:focus-visible,
body.ui-plain .worm-btn:focus-visible {
  outline: 1px dashed var(--color-accent);
  outline-offset: 2px;
}

body.ui-plain section.letter {
  border-top-color: rgba(0, 0, 255, 0.28) !important;
}

body.ui-plain hr.letters-divider {
  border-top-color: var(--color-accent) !important;
}

body.ui-plain section.letters-index th,
body.ui-plain section.letters-index a {
  color: var(--color-accent) !important;
}

body.ui-plain section.letters-index a {
  transition: transform 120ms ease, opacity 160ms ease;
  display: inline-block;
}

body.ui-plain section.letters-index a:hover {
  transform: translateX(1px);
  opacity: 0.88;
}

body.ui-plain main {
  animation: plain-fade 260ms ease-out;
}

@keyframes plain-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================
   SCOPE: DARK MODE
   ========================= */

/* ============================================================
  Dark mode (works with both ui-plain / ui-enhanced)
  ============================================================ */

body.theme-dark {
  background: var(--color-text) !important;
  color: #e8e8ea !important;
}

body.theme-dark nav a {
  color: var(--color-border) !important;
}

body.theme-dark nav a:hover {
  color: var(--color-surface) !important;
}

body.theme-dark.ui-enhanced .home-prose h1::before,
body.theme-dark.ui-enhanced .home-prose h1::after {
  background: #ff0000 !important;
}

body.theme-dark.ui-enhanced .home-prose h2,
body.theme-dark.ui-enhanced .home-prose strong,
body.theme-dark.ui-enhanced section.letters-index th,
body.theme-dark.ui-enhanced section.letters-index a {
  color: #ff0000 !important;
}

body.theme-dark.ui-enhanced .home-prose h2::before {
  color: #ff0000 !important;
}

body.theme-dark.ui-enhanced .home-prose blockquote {
  border-left-color: #ff0000 !important;
}

body.theme-dark.ui-enhanced hr.letters-divider,
body.theme-dark.ui-enhanced section.letter {
  border-top-color: rgba(255, 0, 0, 0.55) !important;
}

/* Dark + enhanced: hover text glows to pure white then fades */
body.theme-dark.ui-enhanced .home-prose h1,
body.theme-dark.ui-enhanced .home-prose h2,
body.theme-dark.ui-enhanced .home-prose h3,
body.theme-dark.ui-enhanced .home-prose p,
body.theme-dark.ui-enhanced .home-prose li,
body.theme-dark.ui-enhanced .home-prose strong,
body.theme-dark.ui-enhanced .home-prose a,
body.theme-dark.ui-enhanced .home-prose blockquote p {
  transition: color 520ms ease-out;
}

body.theme-dark.ui-enhanced .home-prose h1:hover,
body.theme-dark.ui-enhanced .home-prose h2:hover,
body.theme-dark.ui-enhanced .home-prose h3:hover,
body.theme-dark.ui-enhanced .home-prose p:hover,
body.theme-dark.ui-enhanced .home-prose li:hover,
body.theme-dark.ui-enhanced .home-prose strong:hover,
body.theme-dark.ui-enhanced .home-prose a:hover,
body.theme-dark.ui-enhanced .home-prose blockquote p:hover {
  color: #ffffff !important;
}

body.theme-dark pre {
  background: var(--color-text) !important;
  color: var(--color-border-soft) !important;
}

body.theme-dark .panel {
  background: var(--color-text) !important;
  border-color: var(--color-text) !important;
}

body.theme-dark .muted {
  color: var(--color-muted) !important;
}

body.theme-dark select,
body.theme-dark textarea {
  background: var(--color-text) !important;
  color: var(--color-surface) !important;
  border-color: var(--color-text) !important;
}

body.theme-dark button {
  background: var(--color-border-soft) !important;
  color: var(--color-text) !important;
}

body.theme-dark .icon-btn,
body.theme-dark .worm-btn {
  background: var(--color-text) !important;
  color: var(--color-surface) !important;
  border-color: var(--color-muted) !important;
}

body.theme-dark .worm-btn {
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

body.theme-dark .worm-btn:hover,
body.theme-dark .worm-btn:focus-visible {
  background: var(--color-text) !important;
  border-color: var(--color-muted) !important;
}

body.theme-dark .worm-btn:active {
  background: var(--color-text-soft) !important;
  border-color: var(--color-muted) !important;
  transform: translateY(1px);
}

body.theme-dark .aquarium-box {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    var(--color-surface), var(--color-text)) !important;
}

body.theme-dark .evolution-hint {
  color: var(--color-border) !important;
}

body.theme-dark .empty-state {
  color: var(--color-border) !important;
}

body.theme-dark .bubble {
  background: rgba(210, 225, 245, 0.55) !important;
}

body.theme-dark #ui-mode-toggle,
body.theme-dark #theme-mode-toggle {
  color: var(--color-border);
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.theme-dark .mini-aquarium {
  background: var(--color-text) !important;
  border-color: var(--color-text) !important;
  box-shadow: none !important;
}

body.theme-dark .mini-aquarium-count {
  color: var(--color-border) !important;
}

body.theme-dark .mini-aquarium-feed {
  background: var(--color-text) !important;
  color: var(--color-surface) !important;
  border-color: var(--color-muted) !important;
}

body.theme-dark .mini-aquarium-box {
  border-color: var(--color-text-soft) !important;
  color: var(--color-border-soft) !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    var(--color-surface), var(--color-text)) !important;
}

/* =========================
   SCOPE: HOME
   ========================= */

/* ============================================================
   Letters page — multi-letter manifesto layout
   ============================================================ */

body.home section.letter {
  scroll-margin-top: 24px;
  padding-top: 36px;
  margin-top: 48px;
  border-top: 1px solid rgba(122, 46, 46, 0.18);
}
body.home section.letter:first-of-type {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 0;
}

body.home section.letter h1 {
  font-size: 15px;
  margin-top: 0;
}
body.home section.letter h1::after,
body.home section.letter h1::before {
  display: none;
}

body.home hr.letters-divider {
  width: 100%;
  margin: 28px 0 0;
  border: 0;
  border-top: 1.5px solid var(--color-accent);
  opacity: 0.55;
}

body.home section.letters-index table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 16px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body.home section.letters-index th,
body.home section.letters-index td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(122, 46, 46, 0.14);
  vertical-align: middle;
}
body.home section.letters-index th {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}
body.home section.letters-index td:last-child {
  text-align: right;
  white-space: nowrap;
}
body.home section.letters-index a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
body.home section.letters-index a:hover {
  text-decoration: underline;
}

.paren-accent {
  color: var(--color-accent) !important;
}

.milestone-item {
  color: var(--color-hover-red) !important;
}

.task {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task .task-text {
  transition: color 140ms ease, opacity 140ms ease, text-decoration-color 140ms ease;
}

.task input:checked + .task-text,
.task.task-done .task-text {
  text-decoration: line-through;
  color: var(--color-accent);
  opacity: 0.75;
}

.task input:checked + .task-text strong,
.task.task-done .task-text strong {
  color: var(--color-accent) !important;
}

.task input:checked {
  accent-color: var(--color-accent);
}

.task:hover .task-text {
  opacity: 0.9;
}

.task:hover .task-marker {
  color: #ff0000;
}

.writeups-manager h2,
.writeups-stats-live h2 {
  margin-top: 0;
}

.writeups-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px 12px;
}

.writeups-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.writeups-form-grid input,
.writeups-form-grid select {
  width: 100%;
}

.wu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.wu-table th,
.wu-table td {
  border-bottom: 1px solid #ececec;
  padding: 8px 6px;
  text-align: left;
  vertical-align: middle;
}

.wu-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #666;
}

/* Writeups quick-add area - terminal color style */

.writeups-manager {
  background: transparent !important;
  color: var(--color-accent) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.writeups-manager h2 {
  color: var(--color-accent) !important;
  letter-spacing: 0;
}

body.ui-plain .writeups-manager {
  background: transparent !important;
}

body.ui-enhanced .writeups-manager,
body.ui-enhanced .writeups-manager * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.writeups-form-grid {
  display: block !important;
}

.writeups-form-grid label {
  display: block !important;
  margin: 0 0 10px 0;
  color: var(--color-accent) !important;
}

.writeups-form-grid input,
.writeups-form-grid select,
.writeups-manager button {
  background: transparent !important;
  color: var(--color-accent) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  padding-left: 0 !important;
}

.writeups-form-grid input,
.writeups-form-grid select {
  border-bottom: 1px solid var(--color-accent) !important;
}

.writeups-manager .action-row {
  justify-content: flex-start;
  gap: 12px;
}

/* Scoreboards editable terminal color block */

.scoreboards-manager {
  background: transparent !important;
  color: var(--color-accent) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.ui-plain .scoreboards-manager {
  background: transparent !important;
}

body.ui-enhanced .scoreboards-manager,
body.ui-enhanced .scoreboards-manager * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Enhanced mode: unify all manager blocks with home/roadmap language */
body.ui-enhanced .writeups-manager,
body.ui-enhanced .scoreboards-manager,
body.ui-enhanced .coach-manager {
  background: transparent !important;
  color: inherit !important;
  border: 1px solid #e9e9e9 !important;
  border-radius: 2px !important;
  box-shadow: none !important;
}

body.ui-enhanced .writeups-manager *,
body.ui-enhanced .scoreboards-manager *,
body.ui-enhanced .coach-manager * {
  color: inherit !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.ui-enhanced .writeups-manager h1,
body.ui-enhanced .writeups-manager h2,
body.ui-enhanced .scoreboards-manager h1,
body.ui-enhanced .scoreboards-manager h2,
body.ui-enhanced .coach-manager h1,
body.ui-enhanced .coach-manager h2 {
  color: var(--color-accent) !important;
}

body.ui-enhanced .writeups-form-grid input,
body.ui-enhanced .writeups-form-grid select,
body.ui-enhanced .scoreboards-manager input[type="text"],
body.ui-enhanced .scoreboards-manager input[type="url"],
body.ui-enhanced .scoreboards-manager textarea,
body.ui-enhanced .scoreboards-manager select,
body.ui-enhanced .coach-manager input,
body.ui-enhanced .coach-manager textarea,
body.ui-enhanced .coach-manager select {
  border: 1px solid #d6d6d6 !important;
  border-radius: 2px !important;
  background: #fff !important;
  color: var(--color-text) !important;
  padding: 8px 10px !important;
}

body.ui-enhanced .scoreboards-manager .sb-item {
  font-weight: 700;
}

/* Enhanced mode: keep fillable sections in pink scheme */
body.ui-enhanced .writeups-manager,
body.ui-enhanced .scoreboards-manager,
body.ui-enhanced .coach-manager {
  color: var(--color-accent) !important;
}

body.ui-enhanced .writeups-manager *,
body.ui-enhanced .scoreboards-manager *,
body.ui-enhanced .coach-manager * {
  color: var(--color-accent) !important;
}

body.ui-enhanced .writeups-manager h1,
body.ui-enhanced .writeups-manager h2,
body.ui-enhanced .scoreboards-manager h1,
body.ui-enhanced .scoreboards-manager h2,
body.ui-enhanced .coach-manager h1,
body.ui-enhanced .coach-manager h2 {
  color: var(--color-accent) !important;
}

body.ui-enhanced .writeups-form-grid input,
body.ui-enhanced .writeups-form-grid select,
body.ui-enhanced .scoreboards-manager input[type="text"],
body.ui-enhanced .scoreboards-manager input[type="url"],
body.ui-enhanced .scoreboards-manager textarea,
body.ui-enhanced .scoreboards-manager select,
body.ui-enhanced .coach-manager input,
body.ui-enhanced .coach-manager textarea,
body.ui-enhanced .coach-manager select {
  border: 1px solid var(--color-accent) !important;
  background: #fff !important;
  color: var(--color-accent) !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.scoreboards-manager h1,
.scoreboards-manager h2,
.scoreboards-manager p,
.scoreboards-manager .sb-note {
  color: var(--color-accent) !important;
}

.scoreboards-manager h1,
.scoreboards-manager h2 {
  color: var(--color-accent) !important;
}

.scoreboards-manager .sb-grid {
  display: block;
  margin-bottom: 14px;
}

.scoreboards-manager .sb-grid > label,
.scoreboards-manager .sb-grid > input,
.scoreboards-manager .sb-grid > .sb-note {
  display: block;
  margin: 0 0 6px 0;
}

.scoreboards-manager .sb-item {
  font-weight: 700;
}

/* Scoreboards keep input state logic, but render as text checklist */
.scoreboards-manager .sb-item,
.scoreboards-manager .sb-cve-row label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
}

.scoreboards-manager .sb-item input[type="checkbox"],
.scoreboards-manager .sb-cve-row label input[type="checkbox"] {
  display: none;
}

.scoreboards-manager .sb-item::before,
.scoreboards-manager .sb-cve-row label::before {
  content: "[ ] ";
  font-family: ui-monospace, SFMono-Regular, "Courier New", Menlo, monospace;
  white-space: pre;
}

.scoreboards-manager .sb-item[data-checked="1"]::before,
.scoreboards-manager .sb-cve-row label[data-checked="1"]::before {
  content: "[x] ";
}

.scoreboards-manager .sb-item:hover::before,
.scoreboards-manager .sb-cve-row label:hover::before {
  color: #ff0000;
}

.scoreboards-manager .sb-htb { color: var(--color-accent) !important; }
.scoreboards-manager .sb-pico { color: var(--color-accent) !important; }
.scoreboards-manager .sb-ctf { color: var(--color-muted) !important; }
.scoreboards-manager .sb-pwn { color: var(--color-text) !important; }
.scoreboards-manager .sb-linkedin { color: var(--color-muted) !important; }
.scoreboards-manager .sb-github { color: var(--color-muted) !important; }
.scoreboards-manager .sb-blog { color: var(--color-muted) !important; }

.scoreboards-manager input[type="text"],
.scoreboards-manager input[type="url"],
.scoreboards-manager button {
  background: transparent !important;
  color: var(--color-accent) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  padding-left: 0 !important;
}

.scoreboards-manager input[type="text"],
.scoreboards-manager input[type="url"] {
  border-bottom: 1px solid var(--color-accent) !important;
  width: 100%;
}

.sb-cve-list {
  display: grid;
  gap: 10px;
}

.sb-cve-row {
  border-top: 1px solid rgba(255, 79, 216, 0.35);
  padding-top: 8px;
}

.sb-cve-row > * {
  display: block;
  margin-bottom: 5px;
}

/* Coach form alignment + typography */
.coach-manager {
  background: transparent;
}

.coach-manager label {
  margin-top: 10px;
}

.coach-manager select,
.coach-manager textarea,
.coach-manager button {
  font: inherit;
}

body.ui-enhanced .coach-shell,
body.ui-enhanced .coach-shell * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wu-table button[data-del],
.sb-cve-row button[data-del],
#wu-add,
.btn-severine-standard {
  color: #444 !important;
  background: transparent !important;
  border: 1px solid #bdbdbd !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: auto !important;
  min-width: 0 !important;
  line-height: 1.05 !important;
  transition: none !important;
}

.wu-table button[data-del]:hover,
.sb-cve-row button[data-del]:hover,
#wu-add:hover,
.btn-severine-standard:hover {
  color: #ff0000 !important;
  border-color: #ff0000 !important;
}

body.theme-dark .btn-severine-standard {
  color: var(--color-border-soft) !important;
  background: transparent !important;
  border-color: var(--color-border) !important;
}

body.theme-dark .btn-severine-standard:hover {
  color: #ff0000 !important;
  border-color: #ff0000 !important;
}

body.theme-dark button:not(:hover),
body.theme-dark .icon-btn:not(:hover),
body.theme-dark .worm-btn:not(:hover),
body.theme-dark .mini-aquarium-feed:not(:hover),
body.theme-dark .btn-severine-standard:not(:hover) {
  color: var(--color-border-soft) !important;
}

#data-io-corner {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 9999;
  font-size: 12px;
  color: #8a8a8a;
  user-select: none;
}

#data-io-corner button {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #8a8a8a !important;
  padding: 0 !important;
  width: auto !important;
  min-width: 0 !important;
  line-height: 1;
}

#data-io-corner button:hover {
  color: #555 !important;
  opacity: 1 !important;
}

/* FINAL OVERRIDE (keep at end):
   Dark + plain readability remap
   deep-blue -> var(--color-muted), purple -> var(--color-accent) */
body.theme-dark.ui-plain nav a,
body.theme-dark.ui-plain .muted,
body.theme-dark.ui-plain .mini-aquarium-count,
body.theme-dark.ui-plain .mini-aquarium-box,
body.theme-dark.ui-plain .evolution-hint,
body.theme-dark.ui-plain .scoreboards-manager,
body.theme-dark.ui-plain .scoreboards-manager p,
body.theme-dark.ui-plain .writeups-manager,
body.theme-dark.ui-plain .writeups-manager p,
body.theme-dark.ui-plain .journal-manager,
body.theme-dark.ui-plain .coach-manager {
  color: var(--color-muted) !important;
}

body.theme-dark.ui-plain .scoreboards-manager h1,
body.theme-dark.ui-plain .scoreboards-manager h2,
body.theme-dark.ui-plain .writeups-manager h1,
body.theme-dark.ui-plain .writeups-manager h2,
body.theme-dark.ui-plain .journal-manager h1,
body.theme-dark.ui-plain .journal-manager h2,
body.theme-dark.ui-plain .coach-manager h1,
body.theme-dark.ui-plain .coach-manager h2 {
  color: var(--color-accent) !important;
}

body.theme-dark.ui-plain .aquarium-box {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    var(--color-surface), var(--color-muted)) !important;
}

body.theme-dark.ui-plain .writeups-form-grid input,
body.theme-dark.ui-plain .writeups-form-grid select,
body.theme-dark.ui-plain .scoreboards-manager input[type="text"],
body.theme-dark.ui-plain .scoreboards-manager input[type="url"],
body.theme-dark.ui-plain .scoreboards-manager textarea,
body.theme-dark.ui-plain .scoreboards-manager select,
body.theme-dark.ui-plain .journal-manager input,
body.theme-dark.ui-plain .journal-manager textarea,
body.theme-dark.ui-plain .coach-manager input,
body.theme-dark.ui-plain .coach-manager textarea,
body.theme-dark.ui-plain .coach-manager select {
  color: var(--color-muted) !important;
  border-color: var(--color-muted) !important;
}

/* keep competition labels colorful */
body.theme-dark.ui-plain .scoreboards-manager .sb-htb { color: var(--color-accent) !important; }
body.theme-dark.ui-plain .scoreboards-manager .sb-pico { color: var(--color-accent) !important; }
body.theme-dark.ui-plain .scoreboards-manager .sb-ctf { color: var(--color-muted) !important; }
body.theme-dark.ui-plain .scoreboards-manager .sb-pwn { color: var(--color-text) !important; }
body.theme-dark.ui-plain .scoreboards-manager .sb-linkedin { color: var(--color-muted) !important; }
body.theme-dark.ui-plain .scoreboards-manager .sb-github { color: var(--color-muted) !important; }
body.theme-dark.ui-plain .scoreboards-manager .sb-blog { color: var(--color-muted) !important; }

/* Dark + plain: unified prose palette (roadmap/resources/quests/etc.) */
body.theme-dark.ui-plain .home-prose,
body.theme-dark.ui-plain .home-prose p,
body.theme-dark.ui-plain .home-prose li,
body.theme-dark.ui-plain .home-prose ul,
body.theme-dark.ui-plain .home-prose ol {
  color: var(--color-muted) !important;
}

body.theme-dark.ui-plain .home-prose h1,
body.theme-dark.ui-plain .home-prose h2,
body.theme-dark.ui-plain .home-prose h3,
body.theme-dark.ui-plain .home-prose strong {
  color: var(--color-accent) !important;
}

body.theme-dark.ui-plain .home-prose a {
  color: var(--color-muted) !important;
}

body.theme-dark.ui-plain .home-prose blockquote {
  border-left-color: var(--color-accent) !important;
  color: var(--color-muted) !important;
}

body.theme-dark.ui-plain .home-prose hr {
  border-top-color: var(--color-accent) !important;
}

/* FINAL remap (dark mode):
   - normal prose -> bright yellow
   - existing red accents -> deep brown-red
   - all hover highlights -> red
   - white-ish text -> red
*/
body.theme-dark .home-prose p,
body.theme-dark .home-prose li,
body.theme-dark .home-prose blockquote p {
  color: var(--color-muted) !important;
}

body.theme-dark .home-prose h1,
body.theme-dark .home-prose h2,
body.theme-dark .home-prose h3,
body.theme-dark .home-prose strong,
body.theme-dark .home-prose blockquote {
  color: var(--color-border-soft) !important;
  border-left-color: var(--color-border-soft) !important;
}

body.theme-dark .home-prose h1:hover,
body.theme-dark .home-prose h2:hover,
body.theme-dark .home-prose h3:hover,
body.theme-dark .home-prose p:hover,
body.theme-dark .home-prose li:hover,
body.theme-dark .home-prose strong:hover,
body.theme-dark .home-prose a:hover,
body.theme-dark .home-prose blockquote p:hover {
  transition: color 0s !important;
  color: #ffffff !important;
}

body.theme-dark .home-prose h1:not(:hover),
body.theme-dark .home-prose h2:not(:hover),
body.theme-dark .home-prose h3:not(:hover),
body.theme-dark .home-prose p:not(:hover),
body.theme-dark .home-prose li:not(:hover),
body.theme-dark .home-prose strong:not(:hover),
body.theme-dark .home-prose a:not(:hover),
body.theme-dark .home-prose blockquote p:not(:hover) {
  transition: color 520ms ease-out !important;
}

/* white-like text to red */
body.theme-dark nav a:hover,
body.theme-dark .icon-btn,
body.theme-dark .worm-btn,
body.theme-dark .mini-aquarium-feed,
body.theme-dark button {
  color: #ff0000 !important;
}

/* Dark mode override: writeups/scoreboards text -> neon green */
body.theme-dark .writeups-manager,
body.theme-dark .writeups-manager *,
body.theme-dark .scoreboards-manager,
body.theme-dark .scoreboards-manager * {
  color: var(--color-text) !important;
}

body.theme-dark .writeups-manager h1,
body.theme-dark .writeups-manager h2,
body.theme-dark .scoreboards-manager h1,
body.theme-dark .scoreboards-manager h2 {
  color: var(--color-text) !important;
}

body.theme-dark .writeups-form-grid input,
body.theme-dark .writeups-form-grid select,
body.theme-dark .scoreboards-manager input[type="text"],
body.theme-dark .scoreboards-manager input[type="url"],
body.theme-dark .scoreboards-manager textarea,
body.theme-dark .scoreboards-manager select {
  color: var(--color-text) !important;
  border-color: var(--color-text) !important;
}

/* Dark + enhanced: form inputs should not be bright white */
body.theme-dark.ui-enhanced .writeups-form-grid input,
body.theme-dark.ui-enhanced .writeups-form-grid select,
body.theme-dark.ui-enhanced .scoreboards-manager input[type="text"],
body.theme-dark.ui-enhanced .scoreboards-manager input[type="url"],
body.theme-dark.ui-enhanced .scoreboards-manager textarea,
body.theme-dark.ui-enhanced .scoreboards-manager select,
body.theme-dark.ui-enhanced .coach-manager input,
body.theme-dark.ui-enhanced .coach-manager textarea,
body.theme-dark.ui-enhanced .coach-manager select {
  background: var(--color-text) !important;
}

/* keep competition labels colorful */
body.theme-dark .scoreboards-manager .sb-htb { color: var(--color-accent) !important; }
body.theme-dark .scoreboards-manager .sb-pico { color: var(--color-accent) !important; }
body.theme-dark .scoreboards-manager .sb-ctf { color: var(--color-muted) !important; }
body.theme-dark .scoreboards-manager .sb-pwn { color: var(--color-text) !important; }
body.theme-dark .scoreboards-manager .sb-linkedin { color: var(--color-muted) !important; }
body.theme-dark .scoreboards-manager .sb-github { color: var(--color-muted) !important; }
body.theme-dark .scoreboards-manager .sb-blog { color: var(--color-muted) !important; }

/* Dark + plain readability remap:
   replace deep-blue with var(--color-muted) and purple with var(--color-accent) for easier reading. */
body.theme-dark.ui-plain .aquarium-box {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    var(--color-surface), var(--color-muted)) !important;
}

body.theme-dark.ui-plain .mini-aquarium-box {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    var(--color-surface), var(--color-muted)) !important;
}

body.theme-dark.ui-plain .evolution-hint,
body.theme-dark.ui-plain .mini-aquarium-count,
body.theme-dark.ui-plain .mini-aquarium-box,
body.theme-dark.ui-plain .muted {
  color: var(--color-muted) !important;
}

body.theme-dark.ui-plain .scoreboards-manager .sb-linkedin,
body.theme-dark.ui-plain .scoreboards-manager .sb-item,
body.theme-dark.ui-plain .writeups-manager h1,
body.theme-dark.ui-plain .writeups-manager h2,
body.theme-dark.ui-plain .scoreboards-manager h1,
body.theme-dark.ui-plain .scoreboards-manager h2,
body.theme-dark.ui-plain .journal-manager h1,
body.theme-dark.ui-plain .journal-manager h2,
body.theme-dark.ui-plain .coach-manager h1,
body.theme-dark.ui-plain .coach-manager h2 {
  color: var(--color-accent) !important;
}

/* Dark mode: boost roadmap parentheses accent readability */
body.theme-dark .paren-accent {
  color: var(--color-accent) !important;
}

/* Dark mode: unify all hyperlink colors */
body.theme-dark a {
  color: var(--color-accent) !important;
}

/* =========================
   HARD FIX — DOCUMENT ALIGN
   ========================= */

.home-prose {
  text-align: left !important;
}

.home-prose * {
  text-align: left !important;
}

.home-prose li {
  justify-content: flex-start !important;
}

.home-prose li > * {
  margin-left: 0 !important;
}

html {
  scroll-behavior: auto !important;
}

body.ui-plain {
  background: #ffffff !important;
}

body.ui-plain,
body.ui-plain * {
  animation: none !important;
  transition: none !important;
}

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  z-index: 1000;
}

.nav-inner {
  display: flex;
  gap: 18px;
  margin: 0 auto;
  max-width: calc(100% - 60px);
  overflow-x: auto;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.nav-inner a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
  padding: 2px 4px;
  white-space: nowrap;
  background: transparent !important;
  border: none !important;
}

.nav-inner a:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.nav-inner a.nav-exe-root {
  margin-right: 0.5rem;
  opacity: 0.9;
}

.nav-toggle-mobile {
  display: none;
}

.top-nav * {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

body.has-top-nav {
  padding-top: 48px !important;
}

@media (max-width: 768px) {
  .nav-inner {
    position: fixed;
    top: 44px;
    left: 0;
    width: 100%;
    background: transparent !important;
    display: none;
    flex-direction: column;
    padding: 12px;
    margin: 0;
    max-width: 100%;
    overflow-x: visible;
  }

  .nav-inner.open {
    display: flex;
  }

  .nav-toggle-mobile {
    display: inline-flex;
    position: absolute;
    right: 12px;
    top: 8px;
    background: none;
    border: none;
    color: #f2f2f2;
    font-size: 15px;
    padding: 0;
    line-height: 1;
  }
}

/* Native-mode hard lock:
   keep plain mode deterministic even when theme class exists */
body.ui-plain,
body.ui-plain.theme-dark {
  background: #ffffff !important;
  color: #111111 !important;
}

body.ui-plain *,
body.ui-plain.theme-dark * {
  animation: none !important;
  transition: none !important;
}

body.ui-plain .home-prose,
body.ui-plain .home-prose *,
body.ui-plain .panel,
body.ui-plain .mini-aquarium,
body.ui-plain .mini-aquarium-box,
body.ui-plain .aquarium-box,
body.ui-plain pre {
  background: #ffffff !important;
  box-shadow: none !important;
}

/* Dark mode background must stay black. */
body.theme-dark,
body.ui-plain.theme-dark {
  background: #000000 !important;
}

body.ui-plain.theme-dark .home-prose,
body.ui-plain.theme-dark .home-prose *,
body.ui-plain.theme-dark .panel,
body.ui-plain.theme-dark .mini-aquarium,
body.ui-plain.theme-dark .mini-aquarium-box,
body.ui-plain.theme-dark .aquarium-box,
body.ui-plain.theme-dark pre {
  background: #000000 !important;
}
