:root {
  --bg-0: #0d0a11;
  --bg-1: #17121d;
  --bg-2: #1d1723;
  --panel: rgba(28, 22, 34, 0.95);
  --panel-2: rgba(34, 27, 41, 0.97);
  --line: rgba(214, 177, 123, 0.38);
  --line-soft: rgba(214, 177, 123, 0.2);
  --text: #f5eee6;
  --muted: #dccfb9;
  --accent: #c4955c;
  --accent-2: #8f80ba;
  --hana-soft: rgba(239, 179, 206, 0.16);
  --hana-mid: rgba(212, 149, 182, 0.14);
  --moon-haze: rgba(170, 156, 223, 0.14);
  --good: #75d5a2;
  --bad: #f17373;
  --shadow: rgba(0, 0, 0, 0.62);
  --pointer-x: 82vw;
  --pointer-y: 20vh;
  --vw: 1vw;
  --vh: 1vh;
  --curve-h: 320px;
  --desktop-scale: 1;
  --radius-md: 12px;
  --radius-lg: 16px;
  --input-h: 42px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  color: var(--text);
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  line-height: 1.45;
  overflow-x: clip;
  background:
    radial-gradient(1100px 580px at 20% -8%, rgba(88, 39, 62, 0.26), transparent 64%),
    radial-gradient(900px 420px at 88% 8%, rgba(73, 64, 108, 0.23), transparent 64%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1) 52%, var(--bg-2));
}

html {
  min-height: 100dvh;
  min-height: calc(var(--vh, 1vh) * 100);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  min-height: calc(var(--vh, 1vh) * 100);
}

body.platform-ios {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.platform-ios * {
  -webkit-tap-highlight-color: rgba(240, 203, 150, 0.18);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px 220px at 82% 14%, rgba(246, 229, 201, 0.06), transparent 72%);
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.56;
  background: radial-gradient(
    360px 220px at var(--pointer-x) var(--pointer-y),
    rgba(245, 219, 185, 0.12),
    rgba(197, 150, 93, 0.06) 38%,
    rgba(197, 150, 93, 0) 75%
  );
  transition: opacity 0.22s ease;
}

#cursor-fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  opacity: 0;
  background: radial-gradient(circle, rgba(252, 230, 195, 0.42), rgba(252, 230, 195, 0.08) 60%, rgba(252, 230, 195, 0) 75%);
  transition: opacity 0.12s ease, transform 0.03s linear;
}

#cursor-fx-layer.is-visible .cursor-glow {
  opacity: 1;
}

#cursor-fx-layer.is-down .cursor-glow {
  transform: scale(0.86);
  opacity: 0.85;
}

.cursor-pulse {
  position: fixed;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(248, 221, 182, 0.78);
  box-shadow: 0 0 14px rgba(214, 177, 123, 0.35);
  transform: translate(-50%, -50%);
  animation: cursorPulseOut 300ms ease-out forwards;
}

@keyframes cursorPulseOut {
  0% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(0.75);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.7);
  }
}

body.fx-lite::after {
  opacity: 0.22;
  transition: none;
}

body.fx-lite .bg-grid::before,
body.fx-lite .bg-grid::after,
body.fx-lite .hero::after,
body.fx-lite .moon-altar::after {
  animation: none !important;
}

body.fx-lite .bg-grid::before,
body.fx-lite .bg-grid::after {
  opacity: 0.32;
}

body.fx-lite .hero,
body.fx-lite .kpi,
body.fx-lite .table-wrap,
body.fx-lite .post,
body.fx-lite .post-modal-card,
body.fx-lite .post-modal-backdrop,
body.fx-lite .mobile-quick-nav,
body.fx-lite .mobile-action-bar {
  backdrop-filter: none !important;
}

body.fx-lite .panel::after {
  display: none;
}

body.fx-lite .tilt-card {
  transform: translate3d(0, var(--lift-y, 0px), 0);
  transition: border-color 0.18s ease, box-shadow 0.2s ease;
  will-change: auto;
}

body.fx-lite .tilt-card.is-tilting {
  box-shadow: 0 10px 22px -18px rgba(0, 0, 0, 0.85);
}

body.fx-lite .cursor-pulse {
  display: none;
}

body.fx-lite .cursor-glow {
  transition: opacity 0.12s ease;
}

body.fx-lite .press-ripple {
  animation-duration: 340ms;
}

body.fx-lite .hero {
  box-shadow: 0 8px 20px -18px var(--shadow);
}

body.fx-lite .panel {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 10px 20px -20px rgba(0, 0, 0, 0.75);
}

body.fx-lite .card,
body.fx-lite .servant-card,
body.fx-lite .backtest-item,
body.fx-lite .kpi {
  box-shadow: 0 8px 18px -20px rgba(0, 0, 0, 0.8);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 14px,
      rgba(196, 149, 92, 0.018) 14px 15px
    ),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.018), transparent 35%),
    radial-gradient(circle at 80% 90%, rgba(255, 255, 255, 0.014), transparent 40%);
  mix-blend-mode: normal;
}

.bg-grid::before,
.bg-grid::after {
  content: "";
  position: absolute;
  inset: -18% -8%;
  pointer-events: none;
}

.bg-grid::before {
  opacity: 0.56;
  background:
    radial-gradient(9px 7px at 8% 20%, rgba(243, 205, 223, 0.2), transparent 70%),
    radial-gradient(7px 6px at 18% 62%, rgba(238, 188, 210, 0.16), transparent 70%),
    radial-gradient(8px 6px at 37% 33%, rgba(231, 176, 201, 0.17), transparent 70%),
    radial-gradient(8px 6px at 58% 74%, rgba(234, 187, 211, 0.14), transparent 70%),
    radial-gradient(7px 5px at 76% 40%, rgba(238, 198, 219, 0.16), transparent 70%),
    radial-gradient(9px 7px at 92% 68%, rgba(235, 185, 210, 0.18), transparent 70%);
  animation: hanamiDriftA 54s linear infinite;
}

.bg-grid::after {
  opacity: 0.5;
  background:
    radial-gradient(420px 220px at 18% 30%, var(--moon-haze), transparent 72%),
    radial-gradient(360px 180px at 84% 72%, var(--hana-soft), transparent 72%),
    radial-gradient(260px 150px at 72% 24%, var(--hana-mid), transparent 72%);
  animation: hanamiDriftB 72s linear infinite;
}

#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero {
  position: sticky;
  top: 0;
  z-index: 12;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  background:
    linear-gradient(90deg, rgba(23, 17, 30, 0.96), rgba(18, 14, 24, 0.93)),
    radial-gradient(circle at top left, rgba(169, 112, 128, 0.1), transparent 48%);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px -20px var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(236, 190, 164, 0.06), transparent 34%),
    radial-gradient(320px 140px at 84% 0%, rgba(181, 153, 224, 0.2), transparent 72%);
}

.hero::after {
  content: "";
  position: absolute;
  right: -64px;
  top: -44px;
  z-index: 0;
  width: 360px;
  height: 210px;
  pointer-events: none;
  opacity: 0.54;
  background:
    radial-gradient(11px 8px at 24% 58%, rgba(244, 207, 223, 0.36), transparent 72%),
    radial-gradient(10px 8px at 36% 45%, rgba(235, 187, 209, 0.34), transparent 72%),
    radial-gradient(11px 8px at 52% 60%, rgba(238, 195, 216, 0.32), transparent 72%),
    radial-gradient(10px 8px at 66% 46%, rgba(231, 180, 203, 0.32), transparent 72%),
    radial-gradient(10px 8px at 78% 57%, rgba(236, 194, 215, 0.3), transparent 72%),
    linear-gradient(140deg, rgba(120, 95, 147, 0.2), rgba(33, 23, 42, 0.02) 74%);
  transform-origin: top right;
  animation: heroBloomFloat 11s ease-in-out infinite;
}

.hero > * {
  position: relative;
  z-index: 2;
}

.panel[id] {
  scroll-margin-top: 88px;
}

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

.mobile-quick-nav a {
  text-decoration: none;
}

.mobile-action-bar {
  display: none;
}

.eyebrow {
  margin: 0;
  font-family: "Cinzel", serif;
  letter-spacing: 0.16em;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 4px 0 2px;
  font-family: "Shippori Mincho", "Cinzel", "Noto Serif SC", serif;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: 0.05em;
  text-shadow: 0 0 24px rgba(141, 90, 154, 0.32), 0 0 36px rgba(196, 149, 92, 0.16);
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-contact {
  margin: 6px 0 0;
  color: #e6d5be;
  font-size: 14px;
  font-family: "JetBrains Mono", monospace;
}

.hero-contact a {
  color: #f0c891;
  text-decoration: none;
  border-bottom: 1px dotted rgba(240, 200, 145, 0.5);
}

.hero-contact a:hover {
  color: #fff1db;
  border-bottom-color: rgba(255, 241, 219, 0.85);
}

.hero-main {
  position: relative;
  z-index: 2;
}

.hero-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-link {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: "Cinzel", serif;
  letter-spacing: 0.05em;
  background: rgba(27, 12, 24, 0.72);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(141, 90, 154, 0.3);
}

.moon-altar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(196, 149, 92, 0.4);
  background: radial-gradient(circle, rgba(141, 90, 154, 0.28), rgba(14, 8, 16, 0.72));
  box-shadow: 0 0 24px rgba(141, 90, 154, 0.36);
  animation: altarPulse 4s ease-in-out infinite;
}

.moon-altar::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(215, 183, 140, 0.28);
  box-shadow: 0 0 24px rgba(173, 144, 226, 0.24);
  opacity: 0.62;
  animation: moonHaloPulse 6s ease-in-out infinite;
}

.moon-disc {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #f7e8cc 0%, #ddbd90 42%, #8f6a4b 100%);
}

.moon-shadow {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 50%, rgba(10, 6, 12, 0.9) 0%, rgba(10, 6, 12, 0.98) 100%);
  animation: moonPhase 10s ease-in-out infinite;
}

.layout {
  position: relative;
  z-index: 2;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.layout > .panel {
  opacity: 0;
  transform: translateY(14px);
  animation: panelRise 0.75s ease forwards;
}

.layout > .panel:nth-child(2) {
  animation-delay: 0.08s;
}

.layout > .panel:nth-child(3) {
  animation-delay: 0.15s;
}

.layout > .panel:nth-child(4) {
  animation-delay: 0.22s;
}

.layout > .panel:nth-child(5) {
  animation-delay: 0.28s;
}

.hidden {
  display: none;
}

.panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background:
    linear-gradient(165deg, var(--panel), var(--panel-2)),
    radial-gradient(circle at top right, rgba(141, 90, 154, 0.1), transparent 42%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 16px 32px -22px var(--shadow);
}

.panel::before {
  content: "✦";
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 11px;
  color: rgba(196, 149, 92, 0.55);
  z-index: 2;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    300px 180px at var(--mx, 52%) var(--my, 40%),
    rgba(248, 230, 198, 0.1),
    rgba(208, 154, 95, 0.04) 42%,
    rgba(208, 154, 95, 0) 76%
  );
  transition: opacity 0.24s ease;
}

.panel.panel-hover::after {
  opacity: 1;
}

.panel > * {
  position: relative;
  z-index: 2;
}

.nested {
  margin-top: 10px;
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(10px) scale(0.992);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

body.fx-reduced-motion .reveal-on-scroll {
  opacity: 1;
  transform: none;
  transition: none;
}

.tilt-card {
  --lift-y: 0px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform: translate3d(0, var(--lift-y), 0) perspective(920px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.24s ease;
}

.tilt-card.is-tilting {
  box-shadow: 0 14px 28px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(214, 177, 123, 0.13) inset;
}

body.fx-reduced-motion .tilt-card {
  transform: translate3d(0, var(--lift-y, 0px), 0);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.fx-reduced-motion .panel::after {
  display: none;
}

.ripple-host {
  position: relative;
  overflow: hidden;
}

.press-ripple {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(255, 234, 208, 0.58), rgba(255, 234, 208, 0.08) 56%, rgba(255, 234, 208, 0) 76%);
  animation: pressRipple 480ms cubic-bezier(0.22, 0.8, 0.25, 1) forwards;
}

@keyframes pressRipple {
  0% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

h2 {
  position: relative;
  display: inline-block;
  margin: 6px 0 10px;
  padding-right: 74px;
  font-family: "Shippori Mincho", "Cinzel", "Noto Serif SC", serif;
  font-size: 26px;
  letter-spacing: 0.06em;
}

h2::after {
  content: "";
  position: absolute;
  left: calc(100% + 10px);
  top: 58%;
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, rgba(214, 177, 123, 0.52), rgba(214, 177, 123, 0.08));
  box-shadow: 0 0 12px rgba(214, 177, 123, 0.2);
}

h3 {
  margin: 8px 0;
  color: var(--muted);
  font-size: 17px;
  font-family: "Noto Serif SC", serif;
}

input,
select,
button,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  background: rgba(21, 11, 20, 0.86);
  padding: 10px 12px;
  font: inherit;
}

input,
select,
button {
  min-height: var(--input-h);
}

button {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(214, 177, 123, 0.16);
}

button:active {
  box-shadow: 0 0 0 1px rgba(214, 177, 123, 0.1);
}

button[data-busy="1"] {
  cursor: progress;
  opacity: 0.82;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(127, 94, 151, 0.45), 0 0 0 4px rgba(196, 149, 92, 0.22);
  border-color: rgba(214, 177, 123, 0.72);
}

.primary {
  border-color: rgba(0, 0, 0, 0.1);
  background: linear-gradient(90deg, #7d3148, #6a3759 48%, #7f5e97);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  font-weight: 600;
}

.danger {
  border-color: rgba(241, 115, 115, 0.55) !important;
  background: linear-gradient(90deg, rgba(119, 35, 46, 0.95), rgba(95, 34, 49, 0.96)) !important;
  color: #ffe5e5;
}

.danger:hover {
  box-shadow: 0 0 0 1px rgba(241, 115, 115, 0.42), 0 0 18px rgba(171, 61, 85, 0.25);
}

.connection {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
}

.connection label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.connection input {
  min-width: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 100%;
  display: inline-block;
}

.offline {
  background: var(--bad);
}

.online {
  background: var(--good);
}

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

.servant-card {
  --lift-y: 0px;
  text-align: left;
  border: 1px solid rgba(196, 149, 92, 0.3);
  border-radius: 14px;
  background:
    linear-gradient(170deg, rgba(29, 19, 35, 0.95), rgba(39, 25, 45, 0.93)),
    radial-gradient(circle at top right, rgba(141, 90, 154, 0.14), transparent 48%);
  color: var(--text);
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.servant-card:hover,
.servant-card.active {
  --lift-y: -2px;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 149, 92, 0.18), 0 10px 24px -16px rgba(0, 0, 0, 0.8);
}

.servant-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-family: "Cinzel", serif;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-size: 12px;
}

.servant-class {
  border: 1px solid rgba(196, 149, 92, 0.45);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(23, 11, 22, 0.55);
}

.servant-rank {
  font-size: 13px;
  text-shadow: 0 0 14px rgba(196, 149, 92, 0.45);
}

.servant-title {
  margin: 2px 0 4px;
  font-size: 20px;
  font-family: "Noto Serif SC", serif;
}

.servant-summary {
  margin: 8px 0 0;
  color: #e1d0b8;
  font-size: 16px;
}

.card {
  --lift-y: 0px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(25, 18, 31, 0.9);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover,
.card.active {
  --lift-y: -1px;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 149, 92, 0.15);
}

.card .meta,
.meta {
  color: #ddccb1;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

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

.check-list {
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 8px;
  background: rgba(30, 21, 36, 0.9);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: end;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid label input,
.form-grid label select,
.form-grid label textarea {
  width: 100%;
  min-width: 0;
}

.form-grid .full {
  grid-column: 1 / -1;
}

textarea {
  width: 100%;
}

.editor-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-tools button {
  font-size: 13px;
  padding: 6px 10px;
}

#blog-preview {
  min-height: 140px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(16, 12, 20, 0.86);
  padding: 10px;
}

.msg {
  min-height: 20px;
  color: var(--muted);
}

.wf-readiness {
  margin-bottom: 10px;
  border: 1px solid rgba(214, 177, 123, 0.28);
  border-radius: 12px;
  padding: 10px;
  background: rgba(25, 17, 32, 0.86);
}

.wf-readiness-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wf-readiness-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 6px;
}

#wf-risk-form input {
  font-family: "JetBrains Mono", monospace;
}

#bt-risk-form input,
#backtest-form input {
  font-family: "JetBrains Mono", monospace;
}

#wf-risk-hint {
  margin-top: 10px;
}

#bt-build-summary,
#bt-risk-hint {
  margin-top: 10px;
}

.wf-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(214, 177, 123, 0.28);
  background: rgba(34, 24, 42, 0.9);
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}

.wf-check-item::before {
  content: "•";
  opacity: 0.75;
}

.wf-check-item.ok {
  border-color: rgba(117, 213, 162, 0.58);
  color: #d8ffe9;
}

.wf-check-item.warn {
  border-color: rgba(226, 173, 86, 0.64);
  color: #ffe8c4;
}

.wf-check-item.bad {
  border-color: rgba(241, 115, 115, 0.68);
  color: #ffd8d8;
}

.value-pos {
  color: #86e3b1 !important;
}

.value-neg {
  color: #f39a9a !important;
}

.value-neutral {
  color: #e6d6bf !important;
}

.toast-root {
  position: fixed;
  right: 14px;
  top: 92px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 20px));
  pointer-events: none;
}

.toast {
  opacity: 0;
  transform: translateY(-8px);
  border-radius: 10px;
  border: 1px solid rgba(214, 177, 123, 0.34);
  background: rgba(32, 22, 39, 0.94);
  color: #f3e6d3;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px 12px;
  box-shadow: 0 10px 24px -16px rgba(0, 0, 0, 0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(117, 213, 162, 0.54);
}

.toast-warn {
  border-color: rgba(226, 173, 86, 0.58);
}

.toast-error {
  border-color: rgba(241, 115, 115, 0.64);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(20, 13, 24, 0.72);
}

.workflow-cell-stack {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.workflow-cell-main {
  color: #f6e5c9;
  line-height: 1.45;
  font-weight: 600;
}

.workflow-cell-sub {
  color: #cfbea8;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 8px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(30, 21, 36, 0.96);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: #e9d6b8;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.014);
}

tbody tr:hover {
  background: rgba(196, 149, 92, 0.08);
}

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

.kpi {
  --lift-y: 0px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(30, 20, 35, 0.94);
  padding: 10px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi strong {
  font-family: "JetBrains Mono", monospace;
  font-size: 20px;
}

.curve-head {
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.curve-head label {
  display: grid;
  gap: 6px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  border: 1px solid var(--line-soft);
  background: rgba(29, 20, 35, 0.92);
}

.health-unknown {
  color: #d9ccb8;
  border-color: rgba(180, 170, 150, 0.4);
}

.health-good {
  color: #d4ffe8;
  border-color: rgba(117, 213, 162, 0.68);
  box-shadow: 0 0 0 2px rgba(117, 213, 162, 0.18);
}

.health-warn {
  color: #ffe7bd;
  border-color: rgba(226, 173, 86, 0.72);
  box-shadow: 0 0 0 2px rgba(226, 173, 86, 0.16);
}

.health-bad {
  color: #ffd2d2;
  border-color: rgba(241, 115, 115, 0.78);
  box-shadow: 0 0 0 2px rgba(241, 115, 115, 0.16);
}

.health-board {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.health-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.health-stat {
  border: 1px solid rgba(196, 149, 92, 0.28);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(24, 16, 30, 0.88);
}

.health-stat span {
  display: block;
  color: #d8c8b1;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.health-stat strong {
  display: block;
  margin-top: 4px;
  color: #f5e7d2;
  font-family: "JetBrains Mono", monospace;
  font-size: 20px;
}

.health-chip-block h3 {
  margin: 0 0 6px;
  color: #eadbc4;
  font-size: 14px;
  letter-spacing: 0.03em;
}

.health-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.health-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(196, 149, 92, 0.35);
  background: rgba(27, 18, 34, 0.88);
  color: #f2e3ce;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.health-chip-empty {
  color: #c8b89f;
  border-color: rgba(165, 145, 122, 0.35);
}

.health-fail-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.health-fail-item {
  color: #ffd3d3;
  line-height: 1.45;
}

.health-fail-empty {
  color: #cfbea8;
}

.health-status-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  text-transform: lowercase;
}

.health-status-tag.status-ok {
  color: #d4ffe8;
  border-color: rgba(117, 213, 162, 0.68);
  background: rgba(18, 45, 33, 0.38);
}

.health-status-tag.status-warn {
  color: #ffe7bd;
  border-color: rgba(226, 173, 86, 0.72);
  background: rgba(68, 49, 21, 0.36);
}

.health-status-tag.status-muted {
  color: #d6c9b6;
  border-color: rgba(180, 170, 150, 0.42);
  background: rgba(40, 34, 28, 0.38);
}

#curve-canvas {
  width: 100%;
  height: var(--curve-h);
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(420px 180px at 50% -10%, rgba(141, 90, 154, 0.12), transparent 75%),
    rgba(8, 5, 10, 0.95);
}

#margin-util-canvas {
  width: 100%;
  height: min(280px, calc(var(--curve-h) * 0.9));
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(420px 180px at 50% -10%, rgba(141, 90, 154, 0.12), transparent 75%),
    rgba(8, 5, 10, 0.95);
  margin: 10px 0 12px;
}

#backtest-thumb-canvas {
  width: 100%;
  height: min(220px, calc(var(--curve-h) * 0.72));
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(420px 180px at 50% -10%, rgba(141, 90, 154, 0.12), transparent 75%),
    rgba(8, 5, 10, 0.95);
}

#backtest-curve-canvas {
  width: 100%;
  height: max(280px, var(--curve-h));
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(420px 180px at 50% -10%, rgba(141, 90, 154, 0.12), transparent 75%),
    rgba(8, 5, 10, 0.95);
}

#backtest-curve-canvas.interactive {
  cursor: crosshair;
}

.backtest-curve-stage {
  position: relative;
}

.backtest-curve-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 210px;
  max-width: min(280px, calc(100% - 16px));
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(196, 149, 92, 0.38);
  background: rgba(17, 12, 22, 0.96);
  color: #f4e8d8;
  box-shadow: 0 16px 36px -24px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.5;
}

.backtest-curve-tooltip-title {
  margin-bottom: 4px;
  color: #f6e5c9;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.backtest-curve-tooltip-sub {
  margin-top: 4px;
  color: #d4c2aa;
}

.backtest-kpis {
  margin: 12px 0;
}

.backtest-scope-strip {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backtest-scope-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(180, 160, 136, 0.28);
  background: rgba(31, 21, 39, 0.88);
  color: #ead9c3;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.backtest-scope-chip.tone-ok {
  border-color: rgba(117, 213, 162, 0.48);
  color: #d4ffe8;
}

.backtest-scope-chip.tone-warn {
  border-color: rgba(226, 173, 86, 0.56);
  color: #ffe7bd;
}

.backtest-scope-chip.tone-muted {
  border-color: rgba(180, 170, 150, 0.34);
  color: #d4c8b5;
}

.backtest-fine-stats {
  margin: 12px 0 14px;
}

.backtest-compare-toolbar {
  margin: 6px 0 10px;
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(108px, 0.7fr) minmax(108px, 0.7fr);
  gap: 10px;
  align-items: end;
}

.backtest-compare-toolbar label {
  display: grid;
  gap: 6px;
  color: #e8d9c0;
  font-size: 12px;
}

.backtest-compare-toolbar input,
.backtest-compare-toolbar button {
  border-radius: 8px;
  border: 1px solid rgba(196, 149, 92, 0.35);
  background: rgba(21, 14, 27, 0.92);
  color: #f2e7d5;
  min-height: 34px;
  padding: 6px 10px;
}

.backtest-compare-toolbar button {
  cursor: pointer;
}

.backtest-stat-card small {
  display: block;
  margin-top: 6px;
  color: #cfbea8;
  font-size: 12px;
  line-height: 1.45;
}

.backtest-preview-head {
  margin: 8px 0 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.backtest-preview-head .meta {
  margin: 0;
}

.backtest-preview-head button {
  border-radius: 8px;
  border: 1px solid rgba(196, 149, 92, 0.42);
  background: rgba(24, 15, 29, 0.9);
  color: #f2e7d5;
  min-height: 34px;
  padding: 6px 12px;
  cursor: pointer;
}

.backtest-preview-head button:hover {
  border-color: rgba(216, 171, 110, 0.82);
  box-shadow: 0 0 0 2px rgba(216, 171, 110, 0.12);
}

.backtest-range-toolbar {
  margin: 8px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.backtest-range-toolbar label {
  color: #e8d9c0;
  font-size: 13px;
}

.backtest-range-toolbar select,
.backtest-range-toolbar input,
.backtest-range-toolbar button {
  border-radius: 8px;
  border: 1px solid rgba(196, 149, 92, 0.35);
  background: rgba(21, 14, 27, 0.92);
  color: #f2e7d5;
  min-height: 34px;
  padding: 6px 10px;
}

.backtest-range-toolbar button {
  cursor: pointer;
}

.backtest-trade-toolbar {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  align-items: end;
}

.backtest-trade-toolbar label {
  display: grid;
  gap: 6px;
  color: #e8d9c0;
  font-size: 12px;
}

.backtest-trade-toolbar select,
.backtest-trade-toolbar button {
  border-radius: 8px;
  border: 1px solid rgba(196, 149, 92, 0.35);
  background: rgba(21, 14, 27, 0.92);
  color: #f2e7d5;
  min-height: 34px;
  padding: 6px 10px;
}

.backtest-trade-toolbar button {
  cursor: pointer;
}

.backtest-trade-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(196, 149, 92, 0.28);
  background: rgba(18, 12, 22, 0.86);
  color: #f4e8d8;
  font-size: 14px;
  line-height: 1.65;
}

.backtest-trade-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 14px;
}

.backtest-detail-label {
  display: block;
  margin-bottom: 2px;
  color: #cfbea8;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.backtest-trade-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.backtest-trade-table-meta {
  color: #d8c9b3;
  font-size: 13px;
}

.backtest-trade-table-wrap {
  max-height: 520px;
}

.backtest-trade-table td {
  font-size: 12px;
  line-height: 1.45;
}

.backtest-trade-row {
  cursor: pointer;
}

.backtest-trade-row.active {
  background: rgba(196, 149, 92, 0.14);
}

.backtest-trade-row.active td {
  box-shadow: inset 0 1px 0 rgba(214, 172, 112, 0.18), inset 0 -1px 0 rgba(214, 172, 112, 0.18);
}

.backtest-trade-subline {
  margin-top: 3px;
  color: #cbbba3;
  font-size: 11px;
  word-break: break-word;
}

.backtest-empty-filter {
  color: #e7d7c1;
}

.backtest-item {
  --lift-y: 0px;
  text-align: left;
  border: 1px solid rgba(196, 149, 92, 0.28);
  border-radius: 12px;
  padding: 10px;
  background: rgba(28, 20, 35, 0.9);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.backtest-item:hover,
.backtest-item.active {
  --lift-y: -1px;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 149, 92, 0.16);
}

.backtest-item h4 {
  margin: 4px 0;
  font-size: 18px;
}

.backtest-item .rank {
  color: var(--accent);
  font-family: "Cinzel", serif;
  letter-spacing: 0.04em;
  font-size: 12px;
}

.backtest-item .score {
  color: #f2e2ca;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}

.servant-card,
.card,
.kpi,
.backtest-item {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.servant-card::after,
.card::after,
.kpi::after,
.backtest-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    122deg,
    rgba(255, 240, 220, 0) 20%,
    rgba(255, 236, 212, 0.14) 35%,
    rgba(192, 151, 212, 0.12) 48%,
    rgba(255, 240, 220, 0) 62%
  );
  transform: translateX(-24%);
  transition: transform 0.6s ease, opacity 0.22s ease;
}

.servant-card:hover::after,
.servant-card.active::after,
.card:hover::after,
.card.active::after,
.kpi:hover::after,
.backtest-item:hover::after,
.backtest-item.active::after {
  opacity: 1;
  transform: translateX(22%);
}

.servant-card > *,
.card > *,
.kpi > *,
.backtest-item > * {
  position: relative;
  z-index: 2;
}

.post {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px;
  background: rgba(30, 21, 36, 0.94);
}

.md {
  margin: 8px 0 0;
  white-space: pre-wrap;
  line-height: 1.72;
  color: #fbf4ea;
  font-size: 17px;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.65);
}

.md-html {
  white-space: normal;
}

.md-html h1,
.md-html h2,
.md-html h3 {
  margin: 14px 0 10px;
  color: #f8e6cc;
}

.md-html p {
  margin: 10px 0;
}

.md-html ul,
.md-html ol {
  margin: 8px 0 10px 20px;
}

.md-html blockquote {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(13, 9, 16, 0.45);
}

.md-html code {
  font-family: "JetBrains Mono", monospace;
  background: rgba(8, 6, 10, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.9em;
}

.md-html pre {
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(8, 6, 10, 0.88);
}

.md-html img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}

.md-html a {
  color: #e9c798;
}

.md-html hr {
  border: none;
  border-top: 1px solid rgba(214, 177, 123, 0.36);
  margin: 16px 0;
}

.md-html table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
}

.md-html table th,
.md-html table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(214, 177, 123, 0.16);
}

.md-html table th {
  background: rgba(196, 149, 92, 0.12);
  color: #f2dfc2;
}

.md-html table tr:last-child td {
  border-bottom: none;
}

.md-html .task-item {
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.md-html .task-item.checked {
  opacity: 0.9;
}

.md-html .task-checkbox {
  width: 14px;
  height: 14px;
  margin-top: 0.2em;
  accent-color: #d8ad75;
}

.md-html del {
  color: #b9a894;
  text-decoration-color: rgba(241, 115, 115, 0.62);
}

.md-html mark {
  background: rgba(214, 177, 123, 0.24);
  color: #fff5e8;
  border-radius: 3px;
  padding: 0 3px;
}

.md-footnotes {
  margin-top: 14px;
  font-size: 0.95em;
}

.md-footnotes ol {
  margin-top: 8px;
}

.post-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

#blog-title.post-enter,
#blog-meta.post-enter,
#blog-content.post-enter,
#post-modal-title.post-enter,
#post-modal-meta.post-enter,
#post-modal-content.post-enter {
  animation: postEnter 340ms cubic-bezier(0.22, 0.7, 0.25, 1) both;
}

.post-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.post-modal.hidden {
  display: none;
}

.post-modal.visible,
.post-modal.opening {
  opacity: 1;
}

.post-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.post-modal-card {
  position: relative;
  width: min(920px, calc(100vw - 24px));
  max-height: calc(var(--vh, 1vh) * 100 - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(28, 20, 35, 0.98), rgba(20, 15, 28, 0.97));
  box-shadow: 0 25px 60px -25px rgba(0, 0, 0, 0.9);
  transform: translateY(14px) scale(0.985);
  opacity: 0;
}

.backtest-modal-card {
  width: min(1180px, calc(100vw - 24px));
}

.post-modal.opening .post-modal-card,
.post-modal.visible .post-modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: modalCardIn 300ms cubic-bezier(0.22, 0.72, 0.28, 1) forwards;
}

.post-modal.closing .post-modal-card {
  animation: modalCardOut 190ms ease forwards;
}

.post-modal.opening .post-modal-backdrop,
.post-modal.visible .post-modal-backdrop {
  animation: modalBackdropIn 260ms ease forwards;
}

.post-modal.closing .post-modal-backdrop {
  animation: modalBackdropOut 160ms ease forwards;
}

.post-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

#post-modal-close {
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
  padding: 2px 10px;
}

body:not(.admin-authenticated) #sec-admin-auth {
  border-color: rgba(214, 177, 123, 0.44);
  box-shadow: 0 18px 38px -22px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(214, 177, 123, 0.18) inset;
}

body:not(.admin-authenticated) #sec-admin-auth h2 {
  color: #f3dfbf;
}

@keyframes moonPhase {
  0% {
    transform: translateX(18px);
  }
  50% {
    transform: translateX(-18px);
  }
  100% {
    transform: translateX(18px);
  }
}

@keyframes altarPulse {
  0% {
    box-shadow: 0 0 18px rgba(141, 90, 154, 0.24);
  }
  50% {
    box-shadow: 0 0 26px rgba(141, 90, 154, 0.45);
  }
  100% {
    box-shadow: 0 0 18px rgba(141, 90, 154, 0.24);
  }
}

@keyframes panelRise {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes postEnter {
  0% {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes modalCardIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalCardOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

@keyframes modalBackdropIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes modalBackdropOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes moonHaloPulse {
  0% {
    opacity: 0.46;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.74;
    transform: scale(1.04);
  }
  100% {
    opacity: 0.46;
    transform: scale(0.96);
  }
}

@keyframes heroBloomFloat {
  0% {
    transform: translateY(0) rotate(-7deg);
  }
  50% {
    transform: translateY(8px) rotate(-3deg);
  }
  100% {
    transform: translateY(0) rotate(-7deg);
  }
}

@keyframes hanamiDriftA {
  0% {
    transform: translate3d(0, 0, 0) rotate(0.001deg);
  }
  50% {
    transform: translate3d(-2.4%, 2.2%, 0) rotate(-1deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0.001deg);
  }
}

@keyframes hanamiDriftB {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(2.8%, -1.8%, 0) rotate(1.2deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
}

@media (min-width: 901px) {
  body::before {
    background:
      radial-gradient(520px 260px at 80% 16%, rgba(246, 229, 201, 0.08), transparent 74%),
      radial-gradient(420px 200px at 16% 22%, rgba(184, 157, 224, 0.08), transparent 72%);
  }

  body::after {
    opacity: 0.66;
  }

  .hero {
    border-bottom-color: rgba(214, 177, 123, 0.28);
    box-shadow: 0 16px 34px -22px rgba(0, 0, 0, 0.86);
  }

  .hero-main {
    max-width: min(72vw, 920px);
  }

  .eyebrow {
    letter-spacing: 0.2em;
    color: #d7b482;
  }

  h1 {
    font-size: clamp(30px, 3.4vw, 46px);
    letter-spacing: 0.065em;
  }

  .sub {
    font-size: 15px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #d8c4ad;
  }

  .layout {
    gap: 18px;
  }

  .panel {
    border-color: rgba(214, 177, 123, 0.34);
    background:
      linear-gradient(164deg, rgba(31, 23, 38, 0.96), rgba(26, 20, 33, 0.96)),
      radial-gradient(circle at 84% 2%, rgba(156, 120, 189, 0.18), transparent 44%),
      radial-gradient(circle at -6% 88%, rgba(222, 170, 126, 0.08), transparent 44%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 18px 38px -24px rgba(0, 0, 0, 0.8);
  }

  .panel:hover {
    border-color: rgba(224, 189, 137, 0.54);
  }

  .kpi {
    backdrop-filter: blur(1px);
  }

  .table-wrap,
  .post,
  .post-modal-card {
    backdrop-filter: blur(2px);
  }
}

@media (min-width: 1180px) {
  .admin-grid {
    grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr);
  }

  .two-col {
    grid-template-columns: minmax(360px, 0.9fr) minmax(440px, 1.1fr);
  }
}

body.device-desktop {
  --curve-h: clamp(340px, calc(300px + (100vw - 1080px) * 0.06), 390px);
}

body.device-desktop .hero {
  padding: clamp(18px, 1.2vw + 8px, 28px) clamp(24px, 1.8vw + 10px, 42px);
}

body.device-desktop .hero-main {
  max-width: min(68vw, 980px);
}

body.device-desktop .layout {
  width: min(calc(1460px * var(--desktop-scale)), 100%);
  padding: clamp(18px, 1.2vw + 10px, 30px);
  gap: clamp(16px, 0.6vw + 12px, 22px);
}

body.device-desktop .panel {
  padding: clamp(16px, 0.5vw + 12px, 22px);
}

body.device-desktop .two-col {
  grid-template-columns: minmax(380px, 0.86fr) minmax(520px, 1.14fr);
}

body.device-desktop .admin-grid {
  grid-template-columns: minmax(460px, 0.94fr) minmax(620px, 1.06fr);
}

body.device-desktop.desktop-compact {
  --curve-h: 330px;
}

body.device-desktop.desktop-compact .layout {
  width: min(1360px, 100%);
}

body.device-desktop.desktop-compact .two-col {
  grid-template-columns: minmax(340px, 0.9fr) minmax(460px, 1.1fr);
}

body.device-desktop.desktop-compact .admin-grid {
  grid-template-columns: minmax(380px, 0.96fr) minmax(500px, 1.04fr);
}

body.device-desktop.desktop-wide {
  --curve-h: 410px;
}

body.device-desktop.desktop-wide .layout {
  width: min(calc(1700px * var(--desktop-scale)), 100%);
}

body.device-desktop.desktop-wide .two-col {
  grid-template-columns: minmax(430px, 0.84fr) minmax(660px, 1.16fr);
}

body.device-desktop.desktop-wide .admin-grid {
  grid-template-columns: minmax(560px, 0.92fr) minmax(760px, 1.08fr);
}

body.device-desktop.desktop-ultrawide {
  --curve-h: 440px;
}

body.device-desktop.desktop-ultrawide .layout {
  width: min(calc(2060px * var(--desktop-scale)), 100%);
}

body.device-desktop.desktop-ultrawide .hero-main {
  max-width: min(62vw, 1120px);
}

body.device-desktop.desktop-4k {
  --curve-h: 480px;
}

body.device-desktop.desktop-4k .layout {
  width: min(calc(2280px * var(--desktop-scale)), 100%);
  gap: clamp(18px, 0.8vw + 14px, 26px);
}

body.device-desktop.desktop-4k .hero-main {
  max-width: min(58vw, 1320px);
}

body.device-desktop.desktop-4k .two-col {
  grid-template-columns: minmax(520px, 0.82fr) minmax(900px, 1.18fr);
}

body.device-desktop.desktop-4k .admin-grid {
  grid-template-columns: minmax(660px, 0.9fr) minmax(980px, 1.1fr);
}

body.device-desktop.desktop-short {
  --curve-h: 300px;
}

body.device-desktop.desktop-short .hero {
  padding-top: 14px;
  padding-bottom: 14px;
}

body.device-desktop.desktop-tall {
  --curve-h: min(460px, calc(var(--curve-h) + 26px));
}

body.device-desktop.desktop-retina .panel {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 38px -24px rgba(0, 0, 0, 0.84);
}

body.device-desktop.desktop-hires .table-wrap {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), 0 14px 24px -20px rgba(0, 0, 0, 0.78);
}

body.device-tablet .hero {
  padding: 16px 18px;
}

body.device-tablet .layout {
  padding: 16px;
  gap: 14px;
}

body.device-tablet {
  --curve-h: 300px;
}

body.device-phone .hero {
  padding-top: calc(12px + env(safe-area-inset-top));
}

body.device-phone .layout {
  padding: 10px;
  gap: 10px;
}

body.device-phone .kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.device-phone {
  --curve-h: 230px;
}

body.device-phone.phone-xs {
  --curve-h: 196px;
}

body.device-phone.phone-xs .hero {
  padding-left: 8px;
  padding-right: 8px;
}

body.device-phone.phone-xs h1 {
  font-size: clamp(20px, 7.6vw, 28px);
}

body.device-phone.phone-xs .sub {
  font-size: 13px;
}

body.device-phone.phone-xs .panel {
  padding: 8px;
}

body.device-phone.phone-xs .kpis {
  grid-template-columns: 1fr;
}

body.device-phone.phone-sm {
  --curve-h: 228px;
}

body.device-phone.phone-md {
  --curve-h: 246px;
}

body.device-phone.phone-lg {
  --curve-h: 278px;
}

body.device-phone .post-modal-card {
  width: calc(100vw - 10px);
  max-height: calc(var(--vh, 1vh) * 100 - 10px);
}

body.device-phone .backtest-modal-card {
  width: calc(100vw - 8px);
}

body.device-phone .backtest-compare-toolbar {
  grid-template-columns: 1fr;
}

body.device-phone .backtest-trade-toolbar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.device-phone .backtest-trade-toolbar button {
  grid-column: 1 / -1;
}

body.device-phone .backtest-trade-detail {
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.55;
}

body.device-phone .backtest-trade-detail-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

body.device-phone .backtest-trade-table-wrap {
  max-height: none;
}

body.device-phone .backtest-trade-subline {
  font-size: 10px;
}

body.platform-ios .hero {
  padding-top: calc(12px + env(safe-area-inset-top));
}

body.platform-ios .mobile-quick-nav {
  top: env(safe-area-inset-top);
}

body.platform-ios.ios-standard .hero {
  padding-top: calc(14px + env(safe-area-inset-top));
}

body.platform-ios.ios-max .hero {
  padding-top: calc(16px + env(safe-area-inset-top));
}

body.device-phone.orientation-landscape {
  --curve-h: 210px;
}

body.device-phone.orientation-landscape .hero {
  padding-top: calc(6px + env(safe-area-inset-top));
  padding-bottom: 8px;
}

body.device-phone.compact-height .sub {
  font-size: 14px;
}

body.device-phone.compact-height .mobile-quick-nav {
  padding-top: 6px;
  padding-bottom: 6px;
}

body.device-phone.keyboard-open .mobile-action-bar {
  display: none !important;
}

body.device-phone.keyboard-open .layout {
  padding-bottom: 10px !important;
}

body.device-phone #sec-admin-auth {
  scroll-margin-top: calc(8px + env(safe-area-inset-top));
}

body.device-phone #sec-admin-auth .form-grid {
  gap: 10px;
}

body.device-phone #sec-admin-auth input,
body.device-phone #sec-admin-auth select,
body.device-phone #sec-admin-auth button {
  min-height: 46px;
  font-size: 16px;
}

body.device-tablet.tablet-lg .layout {
  width: min(1280px, 100%);
}

body.device-tablet.tablet-md .layout {
  width: min(1120px, 100%);
}

@media (max-width: 1080px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-main {
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  :root {
    --curve-h: 260px;
  }

  #sec-admin-auth {
    order: -8;
    scroll-margin-top: 74px;
  }

  #sec-admin-auth .form-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body::after {
    opacity: 0.36;
  }

  .toast-root {
    top: auto;
    right: 10px;
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
  }

  .hero {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 14px 12px;
    gap: 12px;
  }

  .connection {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "label label label"
      "input input button"
      "dot text text";
  }

  .connection label {
    grid-area: label;
  }

  .connection input {
    grid-area: input;
  }

  .connection button {
    grid-area: button;
    white-space: nowrap;
  }

  #conn-dot {
    grid-area: dot;
  }

  #conn-text {
    grid-area: text;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .panel {
    padding: 12px;
  }

  h1 {
    font-size: clamp(24px, 8vw, 34px);
  }

  h2 {
    font-size: 22px;
    margin-bottom: 8px;
    padding-right: 0;
  }

  h2::after {
    display: none;
  }

  h3 {
    font-size: 16px;
  }

  .sub {
    font-size: 16px;
  }

  .hero-side {
    width: 100%;
    justify-content: space-between;
  }

  .mobile-quick-nav {
    position: sticky;
    top: 0;
    z-index: 13;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(20, 14, 26, 0.98), rgba(20, 14, 26, 0.9));
    backdrop-filter: blur(10px);
    -webkit-overflow-scrolling: touch;
  }

  .mobile-quick-nav a {
    flex: 0 0 auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(214, 177, 123, 0.3);
    color: var(--text);
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    background: rgba(35, 25, 43, 0.85);
  }

  .mobile-quick-nav a.active {
    border-color: rgba(214, 177, 123, 0.66);
    box-shadow: 0 0 0 2px rgba(214, 177, 123, 0.14);
    color: #fff6ea;
  }

  .admin-link {
    padding: 10px 14px;
  }

  .card-list,
  .two-col,
  .admin-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi strong {
    font-size: 18px;
  }

  .curve-head {
    gap: 8px;
  }

  .curve-head > * {
    width: 100%;
  }

  .post {
    padding: 10px;
  }

  .md {
    font-size: 16px;
    line-height: 1.64;
  }

  .post-modal-card {
    width: calc(100vw - 16px);
    max-height: calc(var(--vh, 1vh) * 100 - 16px);
    padding: 14px;
  }

  body.has-mobile-action-bar .layout {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .mobile-action-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 22;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(214, 177, 123, 0.3);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(28, 20, 35, 0.95), rgba(18, 13, 24, 0.95));
    box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
  }

  .mobile-action-bar.hidden {
    display: none;
  }

  .mobile-action-bar button {
    min-height: 40px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 13px;
  }

  body.device-phone.keyboard-open .mobile-quick-nav {
    position: static;
  }
}

@media (max-width: 560px) {
  :root {
    --curve-h: 240px;
  }

  .hero {
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  }

  .layout {
    padding: 9px;
    gap: 9px;
  }

  .panel {
    border-radius: 12px;
    padding: 10px;
  }

  #sec-admin-auth .form-grid {
    gap: 10px;
  }

  #sec-admin-auth .form-grid button {
    min-height: 44px;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  .mobile-quick-nav {
    padding-left: 10px;
    padding-right: 10px;
    gap: 6px;
  }

  .mobile-quick-nav a {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .connection {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label label"
      "input button"
      "dot text";
  }

  .connection button {
    padding: 0 10px;
  }

  .curve-head {
    gap: 6px;
  }

  .post-modal-card {
    width: calc(100vw - 8px);
    max-height: calc(var(--vh, 1vh) * 100 - 8px);
    border-radius: 12px;
    padding: 12px;
  }
}

@media (max-width: 420px) {
  :root {
    --curve-h: 220px;
  }

  h1 {
    font-size: clamp(22px, 8.2vw, 30px);
  }

  .sub {
    font-size: 14px;
  }

  .hero-contact {
    font-size: 12px;
  }

  .panel {
    padding: 9px;
  }

  .kpi strong {
    font-size: 17px;
  }

  .mobile-action-bar {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-action-bar button {
    min-height: 38px;
    font-size: 12px;
  }
}

@media (max-width: 700px) {
  .table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .backtest-curve-tooltip {
    display: none;
  }

  table.stack-on-mobile {
    min-width: 0;
  }

  table.stack-on-mobile thead {
    display: none;
  }

  table.stack-on-mobile,
  table.stack-on-mobile tbody,
  table.stack-on-mobile tr,
  table.stack-on-mobile td {
    display: block;
    width: 100%;
  }

  table.stack-on-mobile tr {
    margin-bottom: 10px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: rgba(30, 21, 36, 0.9);
    overflow: hidden;
  }

  table.stack-on-mobile td {
    border-bottom: 1px solid rgba(214, 177, 123, 0.12);
    padding: 8px 10px;
    display: grid;
    grid-template-columns: minmax(92px, 44%) 1fr;
    align-items: start;
    gap: 8px;
    word-break: break-word;
  }

  table.stack-on-mobile td:last-child {
    border-bottom: none;
  }

  table.stack-on-mobile td::before {
    content: attr(data-label);
    color: #d7c3a3;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.03em;
  }

  table.stack-on-mobile td[colspan] {
    display: block;
  }

  table.stack-on-mobile td[colspan]::before {
    content: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.fx-force-full) {
    scroll-behavior: auto;
  }

  html:not(.fx-force-full) #fx-canvas {
    opacity: 0.6;
  }

  html:not(.fx-force-full) .bg-grid::before,
  html:not(.fx-force-full) .bg-grid::after,
  html:not(.fx-force-full) .hero::after,
  html:not(.fx-force-full) .moon-altar::after {
    animation: none;
  }

  html:not(.fx-force-full) body::after {
    opacity: 0.2;
  }

  html:not(.fx-force-full) .mobile-quick-nav a,
  html:not(.fx-force-full) .admin-link,
  html:not(.fx-force-full) .card,
  html:not(.fx-force-full) .servant-card,
  html:not(.fx-force-full) .backtest-item,
  html:not(.fx-force-full) button {
    transition: none;
  }

  html:not(.fx-force-full) #blog-title.post-enter,
  html:not(.fx-force-full) #blog-meta.post-enter,
  html:not(.fx-force-full) #blog-content.post-enter,
  html:not(.fx-force-full) #post-modal-title.post-enter,
  html:not(.fx-force-full) #post-modal-meta.post-enter,
  html:not(.fx-force-full) #post-modal-content.post-enter,
  html:not(.fx-force-full) .post-modal.opening .post-modal-card,
  html:not(.fx-force-full) .post-modal.visible .post-modal-card,
  html:not(.fx-force-full) .post-modal.closing .post-modal-card,
  html:not(.fx-force-full) .post-modal.opening .post-modal-backdrop,
  html:not(.fx-force-full) .post-modal.visible .post-modal-backdrop,
  html:not(.fx-force-full) .post-modal.closing .post-modal-backdrop {
    animation: none !important;
  }
}
