/* ============================================================
   Timecode Calculator — studio console design system
   ============================================================ */

:root {
  --font-ui: 'Inter Tight', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* dark, cinematic console */
  --bg: #07080a;
  --panel-top: #15181d;
  --panel-bottom: #0f1115;
  --panel: #111317;
  --panel-2: #15181d;
  --panel-3: #1b1f25;
  --field: #0a0c0f;
  --field-deep: #07090b;
  --chip-bg: #0b0d10;
  --line: #262a32;
  --line-soft: #1c2026;
  --text: #f3f1ea;
  --text-2: #c7cad0;
  --muted: #8b919b;
  --dim: #616772;
  --amber: #ff7a2f;
  --amber-bright: #ffa268;
  --amber-soft: rgba(255, 122, 47, 0.13);
  --amber-line: rgba(255, 122, 47, 0.34);
  --mint: #c2f06a;
  --mint-soft: rgba(194, 240, 106, 0.09);
  --mint-line: rgba(194, 240, 106, 0.28);
  --ice: #7cc7ff;
  --ice-soft: rgba(124, 199, 255, 0.09);
  --red: #ff5b5b;
  --danger-text: #ff9d9d;
  --result-ink: #ffffff;
  --ink-on-accent: #1a0b02;
  --bar-result: #ece7db;
  --bar-result-ink: #141414;
  --glow-a: rgba(255, 122, 47, 0.14);
  --glow-b: rgba(124, 199, 255, 0.07);
  --grid-line: rgba(255, 255, 255, 0.024);
  --header-bg: rgba(7, 8, 10, 0.82);
  --shadow: 0 34px 80px -44px rgba(0, 0, 0, 0.95);
  --inset-highlight: rgba(255, 255, 255, 0.04);
  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f4f1e9;
  --panel-top: #fffef9;
  --panel-bottom: #fbf7ef;
  --panel: #fffdf8;
  --panel-2: #faf6ee;
  --panel-3: #f1ece1;
  --field: #f4f0e7;
  --field-deep: #efeade;
  --chip-bg: #f6f1e7;
  --line: #ded7c9;
  --line-soft: #eae4d8;
  --text: #17181a;
  --text-2: #3e4349;
  --muted: #656b73;
  --dim: #8a8e95;
  --amber: #d9550a;
  --amber-bright: #b94605;
  --amber-soft: rgba(217, 85, 10, 0.09);
  --amber-line: rgba(217, 85, 10, 0.28);
  --mint: #4c7c11;
  --mint-soft: rgba(76, 124, 17, 0.08);
  --mint-line: rgba(76, 124, 17, 0.24);
  --ice: #17699b;
  --ice-soft: rgba(23, 105, 155, 0.08);
  --red: #c63b3b;
  --danger-text: #a92b2b;
  --result-ink: #17181a;
  --ink-on-accent: #1a0b02;
  --bar-result: #1c1e22;
  --bar-result-ink: #faf7ef;
  --glow-a: rgba(255, 145, 64, 0.2);
  --glow-b: rgba(80, 170, 255, 0.1);
  --grid-line: rgba(20, 20, 20, 0.035);
  --header-bg: rgba(244, 241, 233, 0.84);
  --shadow: 0 28px 60px -40px rgba(60, 44, 18, 0.35);
  --inset-highlight: rgba(255, 255, 255, 0.75);
}

/* ---------- reset & base ---------- */

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(1100px 720px at 7% -12%, var(--glow-a), transparent 62%),
    radial-gradient(900px 620px at 98% 3%, var(--glow-b), transparent 58%),
    var(--bg);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 82%);
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

::selection {
  color: #180b02;
  background: var(--amber-bright);
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--chip-bg);
  box-shadow: inset 0 -1px 0 var(--line);
}

code {
  padding: 1px 5px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.86em;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--chip-bg);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 9px 14px;
  color: var(--ink-on-accent);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--amber);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Keep anchored sections clear of the sticky header. */
#calculator,
#workflows,
#anatomy,
#how-it-works,
#formulas,
#frame-rates,
#faq,
#calculators {
  scroll-margin-top: 86px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--line-soft);
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1288px;
  height: 70px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--amber);
  border: 1px solid var(--amber-line);
  border-radius: 10px;
  background:
    linear-gradient(145deg, var(--amber-soft), transparent 70%),
    var(--chip-bg);
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-mark.small {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.brand-mark.small svg {
  width: 18px;
  height: 18px;
}

.brand-word {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.brand-dot {
  color: var(--amber);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.site-header nav a {
  padding: 7px 13px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.site-header nav a:hover {
  color: var(--text);
  background: var(--panel-2);
}

.site-header nav a.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel-2);
}

/* ---------- tool menu ---------- */

.nav-drop {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px 7px 13px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.nav-drop-btn:hover,
.nav-drop:focus-within .nav-drop-btn,
.nav-drop.open .nav-drop-btn {
  color: var(--text);
  background: var(--panel-2);
}

.nav-drop-btn.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel-2);
}

.nav-chev {
  color: var(--dim);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-drop:hover .nav-chev,
.nav-drop:focus-within .nav-chev,
.nav-drop.open .nav-chev {
  color: var(--amber);
  transform: rotate(180deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  z-index: 70;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 20px;
  width: 240px;
  padding: 16px 16px 18px;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(420px 160px at 12% 0%, var(--amber-soft), transparent 70%),
    var(--panel);
  box-shadow: var(--shadow);
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), visibility 0.16s;
}

/* keeps the pointer inside the panel while crossing the gap */
.nav-menu::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 24px;
}

.nav-drop:hover .nav-menu,
.nav-drop:focus-within .nav-menu,
.nav-drop.open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.nav-menu-group {
  display: grid;
  gap: 1px;
  align-content: start;
}

.nav-menu-label {
  margin: 2px 0 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.site-header nav .nav-menu-label:not(:first-child) {
  margin-top: 12px;
}

.site-header nav .nav-menu-group > a {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: normal;
  border: 0;
  border-radius: 7px;
}

.site-header nav .nav-tool span {
  display: inline-block;
}
.nav-tool span::first-letter {
  text-transform: uppercase;
}
  color: var(--amber-bright);
  background: var(--amber-soft);
}

.site-header nav .nav-tool {
  display: grid;
  gap: 1px;
  padding: 7px 8px;
  border: 0;
}

.nav-tool b {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-tool span {
  color: var(--dim);
  font-size: 11.5px;
}

.nav-tool:hover b {
  color: var(--amber-bright);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.engine-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.status-dot,
.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: live-pulse 2.4s ease-in-out infinite;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--chip-bg);
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.theme-toggle:hover {
  color: var(--amber);
  border-color: var(--amber-line);
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- shared containers ---------- */

.calculator-container,
.section-inner,
.footer-inner {
  width: 100%;
  max-width: 1288px;
  margin: 0 auto;
  padding: 0 24px;
}

.calculator-section {
  padding-top: 58px;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  box-shadow: var(--shadow), inset 0 1px 0 var(--inset-highlight);
}

.panel::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background: linear-gradient(180deg, var(--inset-highlight), transparent 22%);
  opacity: 0.5;
  mask-image: linear-gradient(#000, transparent 60%);
  -webkit-mask-image: linear-gradient(#000, transparent 60%);
}

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

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: end;
  margin-bottom: 38px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.eyebrow-line {
  display: inline-block;
  width: 26px;
  height: 1px;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.hero-title h1 {
  margin: 18px 0 22px;
  font-size: clamp(34px, 6.9vw, 90px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.055em;
  overflow-wrap: break-word;
}

.hero-title h1 .h1-dash {
  color: var(--amber-bright);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}

.hero-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel-2);
}

.hero-tags strong {
  color: var(--text-2);
  font-weight: 600;
}

.timebase-card {
  position: relative;
  align-self: end;
  padding: 18px 20px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(320px 160px at 100% 0%, var(--amber-soft), transparent 65%),
    linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  box-shadow: var(--shadow), inset 0 1px 0 var(--inset-highlight);
}

.timebase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  color: var(--mint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  border: 1px solid var(--mint-line);
  border-radius: 999px;
  background: var(--mint-soft);
}

.live-pill.small {
  font-size: 8.5px;
  padding: 2px 6px;
}

.timebase-rows {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.timebase-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.timebase-rows > div:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.timebase-rows dt {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.timebase-rows dd {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.timebase-pulse {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.timebase-pulse::before {
  flex: 1;
  height: 3px;
  content: "";
  border-radius: 999px;
  background: var(--line-soft);
  order: 1;
}

.pulse-bar {
  position: absolute;
  right: 20px;
  bottom: 21px;
  width: calc(100% - 130px);
  height: 3px;
  pointer-events: none;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.2;
  animation: frame-pulse 1.8s ease-in-out infinite;
  order: 1;
}

.pulse-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  order: 2;
}

/* ---------- presets ---------- */

.presets-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.presets-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
}

.section-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  transition: color 0.18s, border-color 0.18s, background 0.18s, transform 0.18s;
}

.preset-btn svg {
  color: var(--amber);
  opacity: 0.9;
}

.preset-btn:hover {
  color: var(--text);
  border-color: var(--amber-line);
  background: var(--amber-soft);
  transform: translateY(-1px);
}

.preset-btn:active {
  transform: translateY(0);
}

/* ---------- calculator grid ---------- */

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
  gap: 18px;
  align-items: start;
}

.calculator-panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-kicker {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.17em;
  white-space: nowrap;
}

.panel-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--field);
}

.tab-btn {
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  border: 0;
  border-radius: 7px;
  background: transparent;
  transition: color 0.16s, background 0.16s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--ink-on-accent);
  font-weight: 600;
  background: var(--amber);
  box-shadow: 0 3px 12px -4px var(--amber-line);
}

/* ---------- form ---------- */

.form-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.form-group label,
.field-label,
.convert-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--field);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s, background 0.18s;
}

.select-wrap select:hover {
  border-color: var(--panel-3);
}

.select-wrap select:focus {
  border-color: var(--amber-line);
  background: var(--field-deep);
}

.select-wrap > svg {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--dim);
  pointer-events: none;
  transform: translateY(-50%);
}

.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
}

.toggle-btn {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  border: 0;
  border-radius: 7px;
  background: transparent;
  transition: color 0.16s, background 0.16s, box-shadow 0.16s;
}

.toggle-btn:hover:not(:disabled) {
  color: var(--text);
}

.toggle-btn.active {
  color: var(--amber);
  background: var(--amber-soft);
  box-shadow: inset 0 0 0 1px var(--amber-line);
}

.toggle-btn:disabled {
  color: var(--dim);
  cursor: not-allowed;
  opacity: 0.35;
}

.input-group + .input-group,
.input-group {
  margin-top: 2px;
  --input-size: clamp(20px, 2.35vw, 27px);
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.input-header label {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.link-btn {
  padding: 2px 0;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 500;
  border: 0;
  background: none;
  transition: color 0.16s;
}

.link-btn:hover {
  color: var(--amber);
}

.link-btn:disabled {
  color: var(--dim);
  cursor: not-allowed;
  opacity: 0.45;
}

.input-hint-inline {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.time-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field-deep);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.time-input-wrapper:focus-within {
  border-color: var(--amber-line);
  background: var(--field);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.input-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-2);
}

.time-input-wrapper input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 2px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--input-size);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  border: 0;
  outline: none;
  background: transparent;
}

.time-input-wrapper input::placeholder {
  color: var(--dim);
}

.input-unit {
  flex: none;
  padding: 3px 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.field-guide {
  display: grid;
  grid-template-columns: 2ch 1ch 2ch 1ch 2ch 1ch 2ch;
  width: fit-content;
  padding: 6px 0 0 44px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: var(--input-size);
  line-height: 1;
  text-align: center;
}

.field-guide span {
  font-size: 8px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.operator-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.operator-line {
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.operators {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--field);
}

.op-btn {
  width: 37px;
  height: 30px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  border: 0;
  border-radius: 7px;
  background: transparent;
  transition: color 0.16s, background 0.16s;
}

.op-btn:hover {
  color: var(--text);
  background: var(--panel-3);
}

.op-btn.active {
  color: var(--ink-on-accent);
  background: var(--amber);
  box-shadow: 0 3px 12px -4px var(--amber-line);
}

#conversion-settings {
  margin-top: 14px;
}

#conversion-settings .select-wrap {
  margin-top: 0;
}

#conversion-settings .convert-label {
  margin-bottom: 7px;
}

.input-hint {
  margin-top: 10px;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.5;
}

.error {
  margin-top: 9px;
  padding: 9px 11px;
  color: var(--danger-text);
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid rgba(255, 91, 91, 0.24);
  border-radius: 8px;
  background: rgba(255, 91, 91, 0.07);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: transform 0.18s var(--ease), background 0.18s, color 0.18s, border-color 0.18s;
}

.btn-primary {
  color: var(--ink-on-accent);
  background: linear-gradient(180deg, #ff9354, #f36a1d);
  box-shadow:
    0 12px 30px -14px rgba(255, 122, 47, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ffa66f, #ff7629);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary kbd {
  color: var(--ink-on-accent);
  border-color: rgba(30, 12, 0, 0.2);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.btn-lg {
  flex: 1;
  justify-content: space-between;
  height: 48px;
  padding: 0 17px;
  font-size: 14.5px;
}

.btn-icon {
  flex: none;
  width: 48px;
  height: 48px;
  color: var(--muted);
  border-color: var(--line);
  background: var(--field);
}

.btn-icon:hover {
  color: var(--amber);
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--dim);
  font-size: 10.5px;
}

.form-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.privacy-note svg {
  color: var(--mint);
}

.result-value.invalid {
  color: var(--dim);
  opacity: 0.55;
}

/* ---------- output column & result ---------- */

.output-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.result-panel {
  padding: 20px;
  background:
    radial-gradient(520px 260px at 88% 4%, var(--amber-soft), transparent 62%),
    linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.17em;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-badge {
  padding: 3px 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
}

.result-body {
  margin: 24px 0 0;
  --result-size: clamp(30px, 4.55vw, 52px);
}

.result-value {
  color: var(--result-ink);
  font-family: var(--font-mono);
  font-size: var(--result-size);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.02;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 0 44px var(--amber-soft);
  transition: color 0.2s, opacity 0.2s;
}

.result-value.bump {
  animation: result-bump 0.42s var(--ease);
}

.result-labels {
  display: grid;
  grid-template-columns: 2ch 1ch 2ch 1ch 2ch 1ch 2ch;
  width: fit-content;
  margin-top: 9px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: var(--result-size);
  line-height: 1;
  text-align: center;
}

.result-labels span {
  overflow: hidden;
  font-size: 8px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}

.stat-item {
  min-width: 0;
}

.stat-item span {
  display: block;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.stat-item strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 13px;
  color: var(--muted);
  font-size: 11.5px;
  border-top: 1px solid var(--line-soft);
}

#result-caption {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#result-caption::before {
  flex: none;
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}

.btn-copy {
  flex: none;
  padding: 6px 10px;
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 500;
  border-color: var(--line);
  background: var(--chip-bg);
}

.btn-copy:hover {
  color: var(--amber);
  border-color: var(--amber-line);
}

.btn-copy:disabled {
  color: var(--dim);
  cursor: not-allowed;
  opacity: 0.4;
}

/* ---------- live monitor ---------- */

.visual-panel {
  padding: 20px;
}

.visual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.visual-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  color: var(--mint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  border: 1px solid var(--mint-line);
  border-radius: 999px;
  background: var(--mint-soft);
}

.monitor {
  display: grid;
  gap: 9px;
}

.monitor-scene {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #2c3139;
  border-radius: 12px;
  background: #05070a;
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.8),
    0 18px 40px -28px rgba(0, 0, 0, 0.9);
}

.scene-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(130% 95% at 50% 76%, rgba(255, 143, 74, 0.42), transparent 58%),
    linear-gradient(180deg, #0a1726 0%, #123044 42%, #3c2d31 70%, #0c0b0c 100%);
  transition: filter 0.6s linear;
}

.scene-stars {
  position: absolute;
  inset: 0 0 45%;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 27% 12%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 63% 20%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 79% 9%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 88% 30%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 42% 6%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 51% 33%, rgba(255, 255, 255, 0.35), transparent);
  opacity: 0.55;
}

.scene-sun {
  position: absolute;
  top: var(--sun-y, 54%);
  left: var(--sun-x, 10%);
  width: 62px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff6d8 0%, #ffc979 36%, #ff7a2f 72%, #d94f0a 100%);
  box-shadow:
    0 0 34px 10px rgba(255, 158, 85, 0.5),
    0 0 90px 34px rgba(255, 122, 47, 0.24);
  transform: translate(-50%, -50%);
  transition: left 0.24s linear, top 0.24s linear;
}

.scene-ridge {
  position: absolute;
  right: -4%;
  bottom: 0;
  left: -4%;
  pointer-events: none;
}

.ridge-back {
  height: 47%;
  background: #0a1119;
  clip-path: polygon(0% 100%, 0% 68%, 9% 55%, 18% 66%, 28% 38%, 38% 60%, 47% 44%, 58% 64%, 69% 47%, 78% 62%, 88% 51%, 100% 66%, 100% 100%);
  opacity: 0.9;
}

.ridge-front {
  height: 31%;
  background: #05070a;
  clip-path: polygon(0% 100%, 0% 62%, 11% 74%, 21% 48%, 32% 70%, 43% 54%, 56% 76%, 67% 52%, 78% 72%, 89% 58%, 100% 76%, 100% 100%);
}

.scene-grain {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 150px 150px;
  animation: grain-shift 0.9s steps(3) infinite;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 26%, transparent 68%, rgba(0, 0, 0, 0.62)),
    radial-gradient(ellipse 90% 80% at 50% 48%, transparent 46%, rgba(0, 0, 0, 0.55) 100%);
}

.monitor-safe {
  position: absolute;
  inset: 11% 8%;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: 2px;
  pointer-events: none;
}

.monitor-hud {
  position: absolute;
  right: 11px;
  left: 11px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.monitor-hud-top {
  top: 9px;
}

.monitor-hud-bottom {
  bottom: 9px;
  align-items: flex-end;
}

.monitor-hud .rec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #ffd2d2;
  font-size: 8.5px;
}

.rec-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff4a4a;
  box-shadow: 0 0 7px #ff4a4a;
  animation: rec-blink 1.5s steps(2) infinite;
}

.hud-clip {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-rate {
  color: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
}

.monitor-tc {
  display: inline-block;
  padding: 2px 6px;
  color: #fff;
  font-size: clamp(11px, 1.6vw, 16px);
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.monitor-frame {
  color: rgba(255, 255, 255, 0.55);
  font-size: 8.5px;
  white-space: nowrap;
}

.monitor-corner {
  position: absolute;
  z-index: 3;
  width: 12px;
  height: 12px;
  border-color: rgba(255, 255, 255, 0.38);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}

.monitor-corner.tl {
  top: 7px;
  left: 7px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.monitor-corner.tr {
  top: 7px;
  right: 7px;
  border-top-width: 1px;
  border-right-width: 1px;
}

.monitor-corner.bl {
  bottom: 7px;
  left: 7px;
  border-bottom-width: 1px;
  border-left-width: 1px;
}

.monitor-corner.br {
  right: 7px;
  bottom: 7px;
  border-right-width: 1px;
  border-bottom-width: 1px;
}

.monitor-ribbon {
  padding: 8px 10px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--field);
}

.ribbon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.13em;
}

.ribbon-title {
  letter-spacing: 0.15em;
}

#ribbon-label {
  color: var(--muted);
  letter-spacing: 0.06em;
}

.frame-ribbon {
  display: flex;
  gap: 2px;
  height: 18px;
  align-items: stretch;
}

.frame-ribbon.dense {
  gap: 1px;
}

.ribbon-cell {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: 2px;
  background: var(--panel-3);
  transition: background 0.12s linear, box-shadow 0.12s linear, transform 0.12s linear;
}

.ribbon-cell.done {
  background: color-mix(in srgb, var(--amber) 42%, var(--panel-3));
}

.ribbon-cell.active {
  background: var(--amber);
  box-shadow: 0 0 9px var(--amber-line);
  transform: scaleY(1.18);
}

/* ---------- equation, timeline, scrubber ---------- */

.diagram-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--field);
}

.diagram-equation > div {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 5px;
  align-items: center;
  min-width: 0;
}

.diagram-equation > div small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagram-equation > div > span:not(.dot) {
  overflow: hidden;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagram-equation .diagram-total > span {
  color: var(--amber-bright);
  font-weight: 600;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: none;
}

.dot-a {
  background: var(--amber);
  box-shadow: 0 0 7px var(--amber-line);
}

.dot-b {
  background: var(--ice);
  box-shadow: 0 0 7px rgba(124, 199, 255, 0.4);
}

.diagram-op,
.diagram-eq {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.timeline {
  position: relative;
  margin-top: 10px;
  padding: 9px 10px 22px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--field-deep);
  cursor: crosshair;
}

.timeline-ticks {
  position: absolute;
  inset: 0 0 22px;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 25% 100%, 6.25% 100%;
  opacity: 0.8;
}

.timeline-tracks {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
}

.bar-a,
.bar-b {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 23px;
  min-width: 34px;
  padding: 0 8px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 4px;
  white-space: nowrap;
  transition: width 0.26s var(--ease);
}

.bar-a {
  color: #1a0b02;
  background: linear-gradient(90deg, #ffb57f, #ff7a2f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.bar-b {
  color: #04131d;
  background: linear-gradient(90deg, #a9ddff, #69b9f6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.bar-a span,
.bar-b span {
  margin-left: auto;
  overflow: hidden;
  opacity: 0.72;
  text-overflow: ellipsis;
}

.playhead {
  position: absolute;
  top: 7px;
  bottom: 20px;
  left: 0;
  z-index: 2;
  width: 1px;
  pointer-events: none;
  background: var(--amber);
  box-shadow: 0 0 9px var(--amber);
  transition: left 0.07s linear;
}

.playhead span {
  position: absolute;
  top: 0;
  left: -4px;
  width: 0;
  height: 0;
  border-top: 6px solid var(--amber);
  border-right: 4.5px solid transparent;
  border-left: 4.5px solid transparent;
  filter: drop-shadow(0 0 4px var(--amber));
}

.timeline-scale {
  position: absolute;
  right: 10px;
  bottom: 5px;
  left: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
}

.scrubber {
  margin-top: 10px;
}

.scrubber-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
}

.scrubber-header output {
  color: var(--amber-bright);
  font-size: 12px;
  letter-spacing: 0.02em;
}

#frame-scrubber {
  width: 100%;
  height: 20px;
  margin: 0;
  cursor: pointer;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

#frame-scrubber::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber) 0 var(--scrub, 0%), var(--panel-3) var(--scrub, 0%) 100%);
}

#frame-scrubber::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--panel-3);
}

#frame-scrubber::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--amber);
}

#frame-scrubber::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 3px solid var(--amber);
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 4px var(--amber-soft),
    0 0 12px var(--amber-line);
  appearance: none;
  -webkit-appearance: none;
}

#frame-scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--amber);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px var(--amber-soft);
}

#frame-scrubber:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}

.transport-buttons {
  display: flex;
  gap: 3px;
}

.transport-buttons button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--chip-bg);
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.transport-buttons button:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--line);
}

.transport-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.transport-buttons #preview-play {
  padding: 6px 11px;
  color: var(--text-2);
}

.transport-buttons #preview-play[aria-pressed="true"] {
  color: var(--amber);
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.play-glyph {
  font-size: 8px;
}

.transport-meta {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.transport-meta output {
  color: var(--text-2);
}

#diagram-caption {
  margin-top: 9px;
  padding-left: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  border-left: 2px solid var(--amber-line);
}

/* ---------- history ---------- */

.history-panel {
  margin-top: 18px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.history-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.history-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--chip-bg);
}

.history-icon svg {
  width: 14px;
  height: 14px;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--amber-line);
  border-radius: 999px;
  background: var(--amber-soft);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-actions .link-btn {
  font-size: 10.5px;
}

#history-list {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
}

.history-empty {
  margin: 2px;
  padding: 18px;
  color: var(--dim);
  font-size: 11.5px;
  text-align: center;
  border: 1px dashed var(--line-soft);
  border-radius: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  border-radius: 7px;
  transition: background 0.16s;
}

.history-row:hover {
  background: var(--panel-2);
}

.history-row > span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row strong {
  color: var(--text);
  font-weight: 500;
}

.history-row small {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.history-row button {
  padding: 3px 7px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: none;
  transition: color 0.16s, border-color 0.16s;
}

.history-row button:hover {
  color: var(--amber);
  border-color: var(--amber-line);
}

/* ---------- content sections ---------- */

.info-section {
  padding-top: clamp(66px, 8vw, 104px);
}

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.section-index {
  flex: none;
  margin-top: 3px;
  padding: 4px 7px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  border: 1px solid var(--amber-line);
  border-radius: 6px;
  background: var(--amber-soft);
}

.section-heading h2 {
  color: var(--text);
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.section-heading h2 em {
  color: var(--amber-bright);
  font-style: normal;
  font-weight: inherit;
}

.section-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ---------- tabs shared ---------- */

.interactive-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.info-tab {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 11px;
  align-items: start;
  padding: 13px 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.info-tab:hover {
  border-color: var(--amber-line);
  transform: translateY(-1px);
}

.info-tab .tab-number {
  grid-row: span 2;
  padding-top: 2px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.info-tab .tab-title {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
}

.info-tab .tab-desc {
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.35;
}

.info-tab.active,
.info-tab[aria-selected="true"] {
  border-color: var(--amber-line);
  background:
    linear-gradient(180deg, var(--amber-soft), transparent 85%),
    var(--panel);
}

.info-tab.active .tab-number,
.info-tab[aria-selected="true"] .tab-number {
  color: var(--amber);
}

.info-tab.active .tab-title,
.info-tab[aria-selected="true"] .tab-title {
  color: var(--text);
}

/* ---------- workflow console ---------- */

.workflow-console {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(620px 200px at 26% 0%, var(--amber-soft), transparent 68%),
    var(--field-deep);
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.workflow-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.console-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
}

.console-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
}

.workflow-equation {
  padding: clamp(24px, 4vw, 38px) 22px;
  overflow-x: auto;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(14px, 2.35vw, 25px);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 0 36px var(--amber-soft);
  scrollbar-width: none;
}

.workflow-equation::-webkit-scrollbar {
  display: none;
}

.workflow-console-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-soft);
}

.workflow-console-foot .btn-primary {
  height: 38px;
  padding: 0 15px;
  font-size: 12.5px;
}

.workflow-console-foot > span {
  color: var(--dim);
  font-size: 10.5px;
}

/* ---------- anatomy ---------- */

.anatomy-explorer {
  display: grid;
  gap: 12px;
}

.anatomy-readout {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.9vw, 10px);
  padding: clamp(18px, 3.4vw, 32px) clamp(10px, 2.5vw, 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(600px 220px at 50% 0%, var(--amber-soft), transparent 66%),
    var(--field-deep);
}

.anatomy-readout::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 40px);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}

.anatomy-unit {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 7px clamp(5px, 1.3vw, 13px);
  border: 1px solid transparent;
  border-radius: 11px;
  background: none;
  transition: background 0.18s, border-color 0.18s;
}

.anatomy-unit:hover {
  border-color: var(--line);
  background: var(--panel-2);
}

.anatomy-unit[aria-selected="true"] {
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.anatomy-digits {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: clamp(30px, 5.6vw, 64px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.055em;
  transition: color 0.18s;
}

.anatomy-unit[aria-selected="true"] .anatomy-digits {
  color: var(--amber-bright);
  text-shadow: 0 0 32px var(--amber-soft);
}

.anatomy-digits.tick {
  animation: digit-tick 0.34s var(--ease);
}

.anatomy-name {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.anatomy-unit[aria-selected="true"] .anatomy-name {
  color: var(--muted);
}

.anatomy-sep {
  position: relative;
  z-index: 1;
  padding-bottom: 18px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: clamp(22px, 4vw, 44px);
  font-weight: 300;
  line-height: 1;
}

.anatomy-panel {
  position: relative;
  padding: clamp(18px, 2.6vw, 26px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.anatomy-panel.is-switching {
  animation: panel-in 0.34s var(--ease);
}

.anatomy-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.anatomy-panel-index {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
}

.anatomy-panel-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.anatomy-panel-chip {
  margin-left: auto;
  padding: 3px 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
}

.anatomy-note {
  max-width: 760px;
  margin-top: 9px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}

.anatomy-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}

.anatomy-fact dt {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.anatomy-fact dd {
  margin-top: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.4;
}

.anatomy-meter {
  margin-top: 16px;
}

.anatomy-meter-track {
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.anatomy-meter-fill {
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--amber-bright));
  box-shadow: 0 0 10px var(--amber-line);
  transition: width 0.32s var(--ease);
}

/* ---------- how it works ---------- */

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: panel-in 0.38s var(--ease);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
}

.content-text,
.content-visual .visual-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.content-text h3 {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.content-text p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.example-box {
  margin-top: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--field);
}

.example-box > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.example-math {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.example-math .operator {
  color: var(--dim);
}

.example-math .result {
  color: var(--amber-bright);
  font-weight: 600;
}

.content-visual {
  display: flex;
}

.content-visual .visual-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: 170px;
  gap: 6px;
}

.visual-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  overflow: hidden;
  color: #1a0b02;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  border-radius: 5px;
  white-space: nowrap;
}

.visual-bar span:last-child {
  overflow: hidden;
  opacity: 0.74;
  text-overflow: ellipsis;
}

.visual-bar.primary {
  background: linear-gradient(90deg, #ffb27a, #ff7a2f);
}

.visual-bar.secondary {
  background: linear-gradient(90deg, #a9ddff, #69b9f6);
  color: #04131d;
}

.visual-bar.result {
  background: var(--bar-result);
  color: var(--bar-result-ink);
}

.visual-foot {
  margin-top: 4px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.timeline-range {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.range-point {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.range-point.out {
  align-self: flex-end;
}

.range-bar {
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--amber) 0 23%, var(--line-soft) 23% 100%);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.duration-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.duration-result span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.duration-result strong {
  color: var(--amber-bright);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.conversion-flow {
  display: flex;
  align-items: center;
  gap: 9px;
}

.flow-item {
  flex: 1;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--field);
}

.flow-item span {
  display: block;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.flow-item strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-arrow {
  flex: none;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 17px;
}

/* ---------- formulas ---------- */

.formulas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.formula-card {
  position: relative;
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}

.formula-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--amber-line), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.formula-card:hover {
  border-color: var(--amber-line);
  transform: translateY(-2px);
}

.formula-card:hover::before {
  opacity: 1;
}

.formula-header {
  display: flex;
  align-items: center;
  gap: 9px;
}

.formula-index {
  padding: 2px 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.formula-header h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.formula-display {
  margin-top: 12px;
  padding: 10px 12px;
  overflow-x: auto;
  color: var(--amber-bright);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--field-deep);
}

.formula-content p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.formula-variables {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.formula-variables span {
  padding: 3px 7px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
}

.formula-variables strong {
  color: var(--text-2);
  font-weight: 600;
}

.formula-note {
  margin-top: 11px;
  padding: 8px 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
  border: 1px solid var(--amber-line);
  border-radius: 7px;
  background: var(--amber-soft);
}

.formula-note strong {
  color: var(--amber-bright);
}

/* ---------- frame rates ---------- */

.rate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(280px, 0.58fr);
  gap: 12px;
}

.rate-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.table-header,
.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.62fr 0.58fr;
  gap: 10px;
  align-items: center;
  padding: 0 16px;
}

.table-header {
  height: 36px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-soft);
  background: var(--field);
}

.table-row {
  min-height: 41px;
  color: var(--muted);
  font-size: 11.5px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.16s;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row:hover {
  background: var(--panel-2);
}

.rate-value {
  display: inline-flex;
  align-items: center;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.rate-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.16s, box-shadow 0.16s;
}

.table-row:hover .rate-dot,
.table-row.featured .rate-dot {
  background: var(--amber);
  box-shadow: 0 0 7px var(--amber);
}

.table-row.featured {
  background: linear-gradient(90deg, var(--amber-soft), transparent 55%);
}

.table-row.featured .rate-value {
  color: var(--amber-bright);
}

.rate-use {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rate-region {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.rate-df {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.rate-df.yes {
  color: var(--mint);
}

.guide-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.guide-header h3 {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.guide-header span {
  display: block;
  margin-top: 4px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
  min-height: 92px;
  margin: 15px 0 12px;
  align-content: start;
}

.frame-cell {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--panel-3);
  transition: background 0.14s, border-color 0.14s, transform 0.14s;
}

.frame-cell:hover {
  border-color: var(--amber-line);
  background: var(--amber-soft);
  transform: scale(1.12);
}

.guide-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.45;
}

.legend-dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 7px var(--amber);
}

#apply-guide-rate {
  width: 100%;
  height: 40px;
  margin-top: 14px;
  padding: 0 14px;
  justify-content: space-between;
  font-size: 12.5px;
}

/* ---------- FAQ ---------- */

.faq-search {
  position: relative;
  max-width: 520px;
  margin-bottom: 12px;
}

.faq-search svg {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--dim);
  pointer-events: none;
  transform: translateY(-50%);
}

.faq-search input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  color: var(--text);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--panel);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.faq-search input::placeholder {
  color: var(--dim);
}

.faq-search input:focus {
  border-color: var(--amber-line);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.faq-list {
  border-top: 1px solid var(--line-soft);
}

.faq-item {
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.16s;
}

.faq-item[open] {
  background: linear-gradient(90deg, var(--amber-soft), transparent 42%);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 6px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
  transition: color 0.16s;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  color: var(--text);
}

.faq-plus {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--chip-bg);
  transition: transform 0.2s var(--ease);
}

.faq-item[open] .faq-plus {
  transform: rotate(45deg);
}

.faq-item p {
  max-width: 860px;
  padding: 0 44px 15px 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.faq-item p code {
  font-size: 10.5px;
}

.faq-empty {
  padding: 20px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  border: 1px dashed var(--line-soft);
  border-radius: 9px;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: clamp(70px, 9vw, 110px);
  border-top: 1px solid var(--line-soft);
  background:
    radial-gradient(700px 260px at 14% 0%, var(--amber-soft), transparent 65%),
    var(--bg);
}

.footer-inner {
  padding-top: 44px;
  padding-bottom: 26px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr 0.8fr 1.1fr 0.7fr;
  gap: 32px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.footer-desc {
  max-width: 340px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.footer-social {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}

.footer-social-link {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--dim);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel);
  transition: color 0.16s, border-color 0.16s;
}

.footer-social-link:hover {
  color: var(--amber);
  border-color: var(--amber-line);
}

.footer-heading {
  margin-bottom: 11px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 7px;
  list-style: none;
}

.footer-links a,
.footer-links span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  transition: color 0.16s;
}

.footer-links a:hover {
  color: var(--amber);
}

.footer-contact-item {
  color: var(--text-2) !important;
  font-family: var(--font-mono);
  font-size: 10.5px !important;
  word-break: break-word;
}

.footer-note {
  color: var(--dim) !important;
  font-size: 10px !important;
}

.footer-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.footer-langs a {
  padding: 4px 8px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.footer-langs a:hover {
  color: var(--text);
}

.footer-langs a.active {
  color: var(--amber);
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.footer-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 32px;
  padding-top: 16px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--line-soft);
}

/* ---------- floating UI ---------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease), color 0.18s, border-color 0.18s;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.to-top:hover {
  color: var(--amber);
  border-color: var(--amber-line);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 120;
  padding: 10px 16px;
  color: var(--text);
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast-in 0.24s var(--ease);
}

/* ---------- animations ---------- */

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes rec-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

@keyframes frame-pulse {
  0% { opacity: 0.16; transform: scaleX(0.86); }
  50% { opacity: 0.75; transform: scaleX(1); }
  100% { opacity: 0.16; transform: scaleX(0.86); }
}

@keyframes result-bump {
  0% { opacity: 0.55; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes digit-tick {
  0% { color: var(--amber-bright); transform: translateY(-4px); }
  100% { color: inherit; transform: translateY(0); }
}

@keyframes panel-in {
  from { opacity: 0.55; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-1.5%, 1%); }
  66% { transform: translate(1%, -1.5%); }
  100% { transform: translate(0, 0); }
}

/* ---------- page-load & scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal[data-reveal="left"] {
  transform: translateX(-24px);
}

.reveal[data-reveal="right"] {
  transform: translateX(24px);
}

.reveal[data-reveal="zoom"] {
  transform: scale(0.955);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .rate-layout {
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  }

  .hero {
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  }
}

@media (max-width: 900px) {
  .engine-status {
    display: none;
  }

  /* Six primary links crowd the header below this width; the section stays
     reachable from the footer and the page body. */
  .site-header nav a[data-nav="anatomy"] {
    display: none;
  }

  .site-header nav a {
    padding: 7px 10px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .timebase-card {
    max-width: 440px;
  }

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

  /* Narrower fields shrink the 2ch digit tracks, so tighten the guide
     labels before they start colliding with each other. */
  .field-guide span {
    font-size: 7px;
    letter-spacing: 0.02em;
  }

  .output-column {
    grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
    align-items: start;
  }

  .result-panel,
  .visual-panel {
    min-width: 0;
  }

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

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

  .guide-panel {
    max-width: none;
  }

  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
  }
}

/* Between tablet and desktop the 640px panel no longer fits when centered
   on the trigger, so anchor it to the header like the compact layout. */
@media (max-width: 980px) and (min-width: 741px) {
  .nav-drop {
    position: static;
  }

  .nav-menu {
    top: 100%;
    left: 24px;
    right: 24px;
    width: auto;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    transform: translateY(-6px);
  }

  .nav-drop:hover .nav-menu,
  .nav-drop:focus-within .nav-menu,
  .nav-drop.open .nav-menu {
    transform: translateY(0);
  }

  .nav-menu::before {
    display: none;
  }
}

@media (max-width: 740px) {
  .header-container {
    height: 62px;
    padding: 0 16px;
    gap: 12px;
  }

  .site-header nav {
    display: flex;
    margin-left: auto;
    gap: 0;
  }

  .site-header nav > a[href="about.html"],
  .site-header nav > a[href="contact.html"] {
    display: none;
  }

  /* the sticky header is the anchor, so the panel spans the screen */
  .nav-drop {
    position: static;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 10px;
    right: 10px;
    width: auto;
    grid-template-columns: minmax(0, 1fr);
    max-height: calc(100vh - 74px);
    overflow-y: auto;
    transform: translateY(-6px);
  }

  .nav-drop:hover .nav-menu,
  .nav-drop:focus-within .nav-menu,
  .nav-drop.open .nav-menu {
    transform: translateY(0);
  }

  .nav-menu::before {
    display: none;
  }

  .calculator-container,
  .section-inner,
  .footer-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .calculator-section {
    padding-top: 40px;
  }

  .hero-title h1 {
    font-size: clamp(30px, 8.4vw, 58px);
  }

  .presets-wrapper {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

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

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

  .result-body {
    --result-size: clamp(28px, 8.4vw, 44px);
  }

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

  .info-tab {
    padding: 11px 13px;
  }

  .anatomy-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

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

  .table-header,
  .table-row {
    grid-template-columns: 1.15fr 1fr 0.62fr;
  }

  .table-header span:nth-child(3),
  .table-row .rate-region {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
  }

  .workflow-console-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .history-row small {
    grid-column: 1;
  }

  .history-row button {
    grid-row: 1 / span 2;
    grid-column: 2;
  }
}

@media (max-width: 520px) {
  .brand-word {
    font-size: 15px;
  }

  .result-stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .result-stats .stat-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }

  .stat-item strong {
    margin-top: 0;
  }

  .result-body {
    --result-size: clamp(25px, 8.6vw, 38px);
  }

  .field-guide span,
  .result-labels span {
    font-size: 7px;
    letter-spacing: 0.06em;
  }

  .result-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-tabs {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    padding: 6px 4px;
    text-align: center;
  }

  .calculator-panel,
  .result-panel,
  .visual-panel {
    padding: 15px;
  }

  .monitor-hud {
    font-size: 7.5px;
  }

  .monitor-tc {
    font-size: 11px;
  }

  .monitor-frame {
    display: none;
  }

  .diagram-equation {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 4px;
  }

  .diagram-equation > .diagram-eq,
  .diagram-equation > .diagram-total {
    display: none;
  }

  .transport-meta {
    width: 100%;
  }

  .anatomy-readout {
    gap: 1px;
    padding: 16px 4px;
  }

  .anatomy-unit {
    padding: 5px 3px;
  }

  .anatomy-digits {
    font-size: clamp(27px, 12vw, 44px);
  }

  .anatomy-sep {
    padding-bottom: 14px;
    font-size: 22px;
  }

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

  .footer-copy {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .header-container {
    gap: 8px;
    padding: 0 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-word {
    font-size: 13.5px;
  }

  .site-header nav a {
    padding: 7px 8px;
  }

  .nav-drop-btn {
    padding: 7px 8px;
  }

  .theme-toggle {
    width: 30px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}


/* ---------- restraint pass ----------
   Sentences in sentence case, flat surfaces, one accent.
   Numerals keep the mono face; labels stop shouting. */

body { background: var(--bg); }
body::before { display: none; }

.nav-menu,
.timebase-card,
.result-panel,
.workflow-console,
.anatomy-readout,
.site-footer {
  background: var(--panel);
}

.panel {
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel::before { display: none; }

.eyebrow {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: none;
}

.eyebrow-line { box-shadow: none; }
.live-dot { box-shadow: none; }

.btn-primary {
  color: var(--ink-on-accent);
  background: var(--amber);
  box-shadow: none;
}

.btn-primary:hover { background: var(--amber-bright); }

.nav-menu-label,
.timebase-rows dt,
.convert-label,
.stat-item span,
.anatomy-name,
.anatomy-fact dt,
.example-box > strong,
.duration-result span,
.flow-item span,
.table-header,
.footer-heading {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}

.live-pill,
.live-badge,
.hero-tags span,
.result-badge,
.anatomy-panel-chip,
.count {
  border-radius: 5px;
}

/* A flat slate frame with one moving marker, not a sunset. */
.monitor-scene {
  border-color: var(--line);
  background: #0b0c0e;
  box-shadow: none;
}

.scene-sky {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 100% 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 40px 100%,
    #0b0c0e;
  transition: none;
}

.scene-stars,
.scene-ridge,
.scene-grain,
.scene-vignette {
  display: none;
}

.scene-sun {
  width: 9px;
  border-radius: 2px;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 122, 47, 0.16);
}

.hero-title h1 { letter-spacing: -0.04em; }
.section-heading h2 { letter-spacing: -0.03em; }
code { white-space: nowrap; }
