/* ==========================================================================
   shai.moe /subtick/ — Standalone Simulator Stylesheet & Theme Tokens (v1)
   Replaces internal Antigravity Tailwind runtime for public standalone web use
   ========================================================================== */

:root {
  --background: #eef0f4;
  --foreground: #1e2028;
  --card: rgba(255, 255, 255, 0.94);
  --card-border: rgba(20, 22, 30, 0.13);
  --border: rgba(20, 22, 30, 0.11);
  --muted-foreground: #575b6a;
  --primary: #8F6B10;
  --primary-fg: #ffffff;
  --primary-soft: rgba(143, 107, 16, 0.13);
  --primary-ring: rgba(143, 107, 16, 0.28);
  --success: #137a4f;
  --warning: #b36200;
  --error: #c92a2a;
  color-scheme: light;
}

html.dark {
  --background: #101217;
  --foreground: #e6e7ec;
  --card: rgba(20, 22, 29, 0.92);
  --card-border: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.09);
  --muted-foreground: #969aa8;
  --primary: #D4AF37;
  --primary-fg: #141519;
  --primary-soft: rgba(212, 175, 55, 0.15);
  --primary-ring: rgba(212, 175, 55, 0.32);
  --success: #3ddc97;
  --warning: #f5a623;
  --error: #ef5350;
  color-scheme: dark;
}

/* Tailwind Preflight Reset */
*, *::before, *::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: var(--border);
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: crosshair;
}

body {
  margin: 0;
  line-height: inherit;
  cursor: crosshair;
}

html.is-embed,
html.is-embed body {
  background: transparent !important;
  overflow: hidden;
}

html.is-embed body.lab-body {
  padding: 2px !important;
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1, h2, h3, h4 {
  font-size: inherit;
  font-weight: inherit;
}

strong, b {
  font-weight: 700;
}

code, pre {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

button, input, select {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button, select {
  text-transform: none;
  cursor: pointer;
}

button {
  background-color: transparent;
  background-image: none;
}

select option {
  background: #161820;
  color: #e6e7ec;
}
html:not(.dark) select option {
  background: #f5f6f9;
  color: #1e2028;
}

input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--primary);
  cursor: pointer;
  width: 100%;
}

table {
  text-indent: 0;
  border-color: inherit;
  border-collapse: collapse;
}

svg {
  display: block;
  vertical-align: middle;
}

/* Active tab high-contrast text on gold/amber primary */
button.tab-btn-active,
.tab-btn-active {
  background-color: var(--primary) !important;
  color: var(--primary-fg) !important;
  border-color: var(--primary) !important;
}

/* Scenario Preset Buttons + Custom Field Highlight State (instant 0ms state feedback) */
button.preset-btn {
  border-color: var(--border);
  color: var(--foreground);
  font-weight: 500;
  transition: none !important;
}
button.preset-btn.preset-active {
  border-color: var(--primary) !important;
  background-color: var(--primary-soft) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 0 1px var(--primary-ring);
}

.preset-custom {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px dashed var(--border);
  color: var(--muted-foreground);
  background-color: transparent;
  opacity: 0.55;
  font-weight: 500;
  user-select: none;
  transition: none !important;
}
.preset-custom.preset-active {
  border-style: solid !important;
  border-color: var(--primary) !important;
  background-color: var(--primary-soft) !important;
  color: var(--primary) !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  box-shadow: 0 0 0 1px var(--primary-ring);
}

/* Standalone /subtick/lab/ top chrome (hidden when embedded in article) */
.standalone-lab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
.standalone-lab-bar a,
.standalone-lab-bar button {
  color: var(--muted-foreground);
  text-decoration: none;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  transition: color 0.18s ease;
}
.standalone-lab-bar a:hover,
.standalone-lab-bar button:hover {
  color: var(--primary);
}
.standalone-lab-bar .gold-pill {
  color: var(--primary);
}
html.is-embed .standalone-lab-bar {
  display: none !important;
}

/* ======================== Compiled Utility Classes ======================== */
.block { display: block; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-3\.5 { gap: 0.875rem; }
.gap-4 { gap: 1rem; }
.gap-x-2 { column-gap: 0.5rem; }
.gap-y-0\.5 { row-gap: 0.125rem; }

.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-1\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.375rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-2\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.625rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem; }

.w-full { width: 100%; }
.w-9 { width: 2.25rem; }
.w-12 { width: 3rem !important; }
.h-\[78px\] { height: 78px; }
.h-\[152px\] { height: 152px; }

.m-0 { margin: 0; }
.mt-0\.5 { margin-top: 0.125rem; }
.mb-0\.5 { margin-bottom: 0.125rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }

.p-0 { padding: 0; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.pt-0\.5 { padding-top: 0.125rem; }
.pt-1 { padding-top: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pl-1 { padding-left: 0.25rem; }
.pl-2 { padding-left: 0.5rem; }
.pr-3 { padding-right: 0.75rem; }

.bg-transparent { background-color: transparent; }
.bg-\[var\(--background\)\] { background-color: var(--background); }
.bg-\[var\(--card\)\] { background-color: var(--card); }

.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-l { border-left-width: 1px; }
.border-collapse { border-collapse: collapse; }
.border-\[var\(--border\)\] { border-color: var(--border); }
.border-\[var\(--card-border\)\] { border-color: var(--card-border); }
.border-\[var\(--primary\)\] { border-color: var(--primary); }
.hover\:border-\[var\(--primary\)\]:hover { border-color: var(--primary) !important; }

.divide-y > :not([hidden]) ~ :not([hidden]) { border-top-width: 1px; }
.divide-\[var\(--border\)\] > :not([hidden]) ~ :not([hidden]) { border-color: var(--border); }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }

.font-sans { font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-\[8\.5px\] { font-size: 8.5px; }
.text-\[9px\] { font-size: 9px; }
.text-\[9\.5px\] { font-size: 9.5px; }
.text-\[10px\] { font-size: 10px; }
.text-\[10\.5px\] { font-size: 10.5px; }
.text-\[11px\] { font-size: 11px; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }

.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.tracking-wider { letter-spacing: 0.05em; }
.uppercase { text-transform: uppercase; }
.text-left { text-align: left; }

.text-\[var\(--foreground\)\] { color: var(--foreground); }
.text-\[var\(--muted-foreground\)\] { color: var(--muted-foreground); }
.text-\[var\(--primary\)\] { color: var(--primary); }
.text-\[var\(--success\)\] { color: var(--success); }

.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; -webkit-user-select: none; }
.outline-none { outline: 2px solid transparent; outline-offset: 2px; }
.transition {
  transition-property: color, background-color, border-color, opacity, box-shadow, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

#panelVersions table {
  min-width: 660px;
}

@media (min-width: 640px) {
  .sm\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:p-6 { padding: 1.5rem; }
  .md\:text-xl { font-size: 1.25rem; line-height: 1.75rem; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile ergonomic layout for compact widget & SVG viewports */
@media (max-width: 620px) {
  html.compact-sim .grid-cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  html.compact-sim #helpBar.truncate {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  #timelineSvg.h-\[78px\] {
    height: auto;
    aspect-ratio: 760 / 92;
    min-height: 58px;
  }
  #mainSvg.h-\[152px\] {
    height: auto;
    aspect-ratio: 820 / 164;
    min-height: 92px;
  }
}
