﻿.efc-card {
  --efc-theme-surface: var(--color-surface, #1c1c1c);
  --efc-theme-surface-hover: var(--color-surface-hover, #222222);
  --efc-theme-text: var(--color-text, #d0d0d0);
  --efc-theme-heading: var(--color-heading, #f0f0f0);
  --efc-theme-border: var(--color-border, #2a2a2a);
  --efc-theme-border-light: var(--color-border-light, #363636);
  --efc-theme-accent: var(--color-accent, #e8c87a);
  --efc-bg: color-mix(in srgb, var(--efc-theme-surface) 90%, #0b0f14 10%);
  --efc-panel: color-mix(in srgb, var(--efc-theme-surface-hover) 88%, #0f172a 12%);
  --efc-panel-strong: color-mix(in srgb, var(--efc-theme-surface-hover) 78%, #0b1220 22%);
  --efc-text: var(--efc-theme-text);
  --efc-text-soft: color-mix(in srgb, var(--efc-text) 68%, transparent);
  --efc-border: color-mix(in srgb, var(--efc-theme-border-light) 82%, transparent);
  --efc-accent: color-mix(in srgb, var(--efc-theme-accent) 92%, #ffffff 8%);
  --efc-accent-soft: color-mix(in srgb, var(--efc-theme-accent) 12%, var(--efc-bg));
  --efc-error-soft: color-mix(in srgb, #dc2626 10%, var(--efc-bg));
  --efc-control-height: 32px;
  width: 100%;
  max-width: 980px;
  margin: 24px auto;
  padding: 24px;
  border: 1px solid var(--efc-border);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--efc-bg) 0%, color-mix(in srgb, var(--efc-bg) 92%, #000000 8%) 100%);
  box-shadow: 0 20px 48px color-mix(in srgb, var(--efc-text) 8%, transparent);
  color: var(--efc-text);
}

.efc-card,
.efc-card *,
.efc-card *::before,
.efc-card *::after {
  box-sizing: border-box;
}

.efc-card [hidden],
.efc-card .is-hidden {
  display: none !important;
}

.efc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.efc-header h3 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.3vw, 1.9rem);
  line-height: 1.15;
  color: var(--efc-theme-heading);
}

.efc-header p {
  margin: 0;
  max-width: 68ch;
  color: var(--efc-text-soft);
}

.efc-version {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--efc-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--efc-panel-strong) 92%, #000000 8%);
  color: var(--efc-text-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.efc-section {
  margin-top: 22px;
}

.efc-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.efc-section-heading {
  margin-bottom: 12px;
}

.efc-section-heading h4 {
  margin: 0 0 6px;
  color: var(--efc-theme-heading);
  font-size: 1.04rem;
}

.efc-section-heading p {
  margin: 0;
  color: var(--efc-text-soft);
  font-size: 0.92rem;
}

.efc-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.efc-topology-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.efc-option-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 0;
  padding: 6px 16px;
  border: 1px solid var(--efc-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--efc-panel-strong) 92%, #000000 8%);
  color: var(--efc-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  transition: 160ms ease;
}

.efc-option-button:hover {
  border-color: color-mix(in srgb, var(--efc-accent) 40%, var(--efc-border));
  transform: translateY(-1px);
}

.efc-option-button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--efc-accent) 0%, color-mix(in srgb, var(--efc-accent) 78%, #0f172a 22%) 100%);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--efc-accent) 20%, transparent);
  color: #ffffff;
}

.efc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--efc-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--efc-panel) 92%, #ffffff 8%);
  color: var(--efc-text);
  font-size: 0.92rem;
  font-weight: 700;
}

.efc-topology-controls .efc-toggle {
  min-height: 46px;
  border-radius: 999px;
  padding: 9px 14px;
}

.efc-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--efc-theme-accent);
}

.efc-schematic {
  overflow: hidden;
  padding: 10px 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.efc-schematic-link {
  display: block;
  width: 100%;
  min-width: 0;
}

.efc-schematic-image {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}


.efc-stage-grid {
  display: grid;
  gap: 12px;
}

.efc-stage-panel {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--efc-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--efc-panel) 94%, #ffffff 6%);
}

.efc-stage-title {
  color: var(--efc-theme-heading);
  font-size: 0.94rem;
  font-weight: 800;
}

.efc-stage-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.efc-mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--efc-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--efc-panel-strong) 92%, #000000 8%);
  color: var(--efc-text);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.efc-mini-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--efc-theme-accent);
}

.efc-mini-toggle:has(input:not(:checked)),
.efc-mini-toggle:has(input:disabled) {
  color: var(--efc-text-soft);
  opacity: 0.72;
}

.efc-stage-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.efc-mode-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.efc-mode-title {
  min-height: 20px;
  color: var(--efc-text-soft);
  font-size: 0.86rem;
  font-weight: 800;
}

.efc-mode-group.is-muted .efc-mode-title {
  opacity: 0.58;
}

.efc-field {
  display: grid;
  grid-template-columns: minmax(72px, 92px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.efc-field-label {
  color: var(--efc-text);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.15;
}

.efc-control {
  display: grid;
  grid-template-columns: minmax(74px, 1fr) minmax(66px, 78px);
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.efc-control input,
.efc-control select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--efc-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--efc-panel-strong) 92%, #000000 8%);
  color: var(--efc-text);
  font: inherit;
  font-size: 0.88rem;
}

.efc-control input {
  padding: 6px 12px;
}

.efc-control select {
  padding: 6px 8px;
}

.efc-control input::placeholder {
  color: color-mix(in srgb, var(--efc-text) 54%, transparent);
}

.efc-control input[type='number'] {
  -moz-appearance: textfield;
}

.efc-control input[type='number']::-webkit-outer-spin-button,
.efc-control input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.efc-control input:focus,
.efc-control select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--efc-accent) 52%, var(--efc-border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--efc-accent) 14%, transparent);
}

.efc-system-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px 14px;
  max-width: 680px;
}

.efc-system-grid .efc-field {
  grid-template-columns: minmax(142px, 180px) minmax(0, 1fr);
  max-width: 520px;
}

.efc-system-grid .efc-field-label {
  font-size: 0.83rem;
}

.efc-results {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.efc-status {
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--efc-accent) 22%, transparent);
  border-radius: 18px;
  background: var(--efc-accent-soft);
  color: var(--efc-text);
  font-size: 0.92rem;
  font-weight: 700;
}

.efc-status[data-tone='error'] {
  border-color: color-mix(in srgb, #dc2626 24%, transparent);
  background: var(--efc-error-soft);
  color: #fecaca;
}

.efc-status[data-tone='success'] {
  border-color: color-mix(in srgb, #15803d 28%, transparent);
  background: color-mix(in srgb, #15803d 14%, var(--efc-bg));
}

.efc-chart-card {
  padding: 18px;
  border: 1px solid var(--efc-border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--efc-panel) 96%, #ffffff 4%);
}

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

.efc-chart-header h4 {
  margin: 0;
  color: var(--efc-theme-heading);
  font-size: 0.98rem;
}

.efc-chart-header span {
  color: var(--efc-text-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.efc-chart {
  width: 100%;
  min-height: 390px;
  border: 1px solid var(--efc-border);
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--efc-accent) 10%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--efc-panel-strong) 94%, #000000 6%) 0%, color-mix(in srgb, var(--efc-bg) 96%, #000000 4%) 100%);
}

.efc-note {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px dashed var(--efc-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--efc-panel) 92%, #ffffff 8%);
  color: var(--efc-text-soft);
  font-size: 0.92rem;
}

.efc-note strong {
  color: var(--efc-theme-heading);
}

body.light-mode .efc-card {
  --efc-theme-surface: #fbfaf6;
  --efc-theme-surface-hover: #f3f0e8;
  --efc-theme-text: #4a4a4a;
  --efc-theme-heading: #111111;
  --efc-theme-border: #dddbd0;
  --efc-theme-border-light: #c8c5b8;
  --efc-theme-accent: #7a4f1a;
  --efc-bg: #fbfaf6;
  --efc-panel: #f3f0e8;
  --efc-panel-strong: #f7f5ee;
  --efc-text: var(--efc-theme-text);
  --efc-text-soft: color-mix(in srgb, var(--efc-text) 68%, transparent);
  --efc-border: color-mix(in srgb, var(--efc-theme-border-light) 88%, transparent);
  --efc-accent: color-mix(in srgb, var(--efc-theme-accent) 92%, #ffffff 8%);
  --efc-accent-soft: color-mix(in srgb, var(--efc-theme-accent) 10%, var(--efc-bg));
  background: linear-gradient(180deg, #fbfaf6 0%, #f2efe7 100%);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.06);
}

body.light-mode .efc-card .efc-option-button,
body.light-mode .efc-card .efc-mini-toggle,
body.light-mode .efc-card .efc-control input,
body.light-mode .efc-card .efc-control select,
body.light-mode .efc-card .efc-version {
  background: color-mix(in srgb, var(--efc-theme-surface) 96%, #ece7dc 4%);
}

body.light-mode .efc-card .efc-option-button.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--efc-theme-accent) 0%, color-mix(in srgb, var(--efc-theme-accent) 82%, #5c3a10 18%) 100%);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--efc-theme-accent) 18%, transparent);
}

body.light-mode .efc-card .efc-status[data-tone='error'] {
  color: #b91c1c;
}

body.light-mode .efc-card .efc-chart {
  background:
    radial-gradient(circle at top left, rgba(122, 79, 26, 0.08), transparent 34%),
    linear-gradient(180deg, #f5f3ec 0%, #eeeae0 100%);
}

@media (max-width: 980px) {
  .efc-control {
    grid-template-columns: minmax(74px, 1fr) minmax(66px, 78px);
  }
}

@media (max-width: 820px) {
  .efc-stage-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .efc-card {
    padding: 18px;
    border-radius: 18px;
  }

  .efc-header,
  .efc-chart-header {
    align-items: flex-start;
    flex-direction: column;
  }


  .efc-chart {
    min-height: 340px;
  }
}

@media (max-width: 540px) {
  .efc-field,
  .efc-system-grid .efc-field {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}
