/*
 * Akış şeması (BT Atölyesi) — yalnızca bu simülasyona özgü stiller.
 * Editör (SVG, palet, ok, port, seçim), düzen (tek sütun), kontroller ve tam ekran çekirdekte
 * (core/editor/editor.css, core/theme.css). Burada: kutu çizimleri, çalıştırma panelleri, sözde kod,
 * akıllı tahta ölçekleri ve yazdırma sayfası.
 */

/* ------------------------------------------------------------------ renkler */
/* Hata kırmızısı: açık + iki koyu seçici (metin/kenar kontrastı ≥ 3). */

.lab {
  --lab-fc-error: #d70015;
  --lab-fc-error-soft: #fff0f1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lab:not([data-theme="light"]) {
    --lab-fc-error: #ff6961;
    --lab-fc-error-soft: #3a1d1f;
  }
}

:root[data-theme="dark"] .lab:not([data-theme="light"]),
.lab[data-theme="dark"] {
  --lab-fc-error: #ff6961;
  --lab-fc-error-soft: #3a1d1f;
}

/* --------------------------------------------------------------- parça çizimi */

.fc-shape {
  fill: var(--lab-bg);
  stroke: var(--lab-text);
  stroke-width: 2.5;
  stroke-linejoin: round;
  transition: fill 160ms ease, stroke 160ms ease;
}

.fc-text {
  fill: var(--lab-text);
  font: 600 16px/1 var(--lab-font);
}

.fc-text.is-placeholder {
  fill: var(--lab-text-2);
  font-style: italic;
  font-weight: 500;
}

/* "Evet"/"Hayır" etiketleri karar kutusunun çıkışlarının yanında */
.fc-branch {
  fill: var(--lab-text-2);
  font: 700 14px/1 var(--lab-font);
}

/* Şu an çalışacak kutu: vurgu rengiyle dolgu + kalın kenar; hata: kırmızı */
.fc-art.is-active .fc-shape {
  fill: var(--lab-accent-soft);
  stroke: var(--lab-accent);
  stroke-width: 4;
}

.fc-art.is-error .fc-shape {
  fill: var(--lab-fc-error-soft);
  stroke: var(--lab-fc-error);
  stroke-width: 4;
}

/* Siyah-beyaz çıktı (yazdırma): renk yok */
.fc-art.is-mono .fc-shape {
  fill: #fff;
  stroke: #000;
  stroke-width: 2;
}

.fc-art.is-mono .fc-text {
  fill: #000;
}

.fc-art.is-mono .fc-text.is-placeholder {
  fill: #555;
}

.fc-art.is-mono .fc-branch {
  fill: #000;
}

/* ---------------------------------------------------------------- düzen */

.fc .lab-visual {
  position: static;
  margin-inline: 0;
  padding: 0;
  background: none;
}

.fc .ed {
  height: clamp(440px, 66vh, 760px);
}

@container lab (max-width: 560px) {
  /* Telefonda palet altta: alan biraz daha yüksek, sayfayla birlikte kayar (sabit değil). */
  .fc .ed {
    height: clamp(460px, 72vh, 660px);
  }
}

.fc-narration {
  font-size: 17px;
}

/* Seçili kutunun yazısı */
.fc-textbar {
  padding: 12px 16px;
  border-radius: var(--lab-radius);
  background: var(--lab-bg-sunken);
}

.fc-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sorunlar: sade, kırmızı çerçeveli kart; çocuk dilinde cümleler */
.fc-issues {
  padding: 12px 16px;
  border-radius: var(--lab-radius);
  background: var(--lab-fc-error-soft);
  box-shadow: inset 0 0 0 2px var(--lab-fc-error);
}

.fc-issues__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 17px;
  line-height: 1.45;
}

/* Değişkenler + çıktı */
.fc-run {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@container lab (min-width: 700px) {
  .fc-run {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.fc-card {
  min-width: 0;
  padding: 12px 18px 14px;
  border-radius: var(--lab-radius);
  background: var(--lab-bg-sunken);
}

.fc-card__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lab-text-2);
}

.fc-empty {
  margin: 0;
}

.fc-vars__list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.fc-vars__list dt {
  font-weight: 700;
}

.fc-vars__list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Son adımda değişen değişken: vurgu rengi + hafif zemin */
.fc-vars__list .is-changed {
  color: var(--lab-accent);
  background: var(--lab-accent-soft);
  border-radius: 8px;
  padding-inline: 8px;
  margin-inline: -8px;
}

.fc-console {
  min-height: 3.2em;
  max-height: 220px;
  margin: 0;
  overflow: auto;
  font: 500 18px/1.5 ui-monospace, "SF Mono", Consolas, monospace;
  white-space: pre-wrap;
}

.fc-console.is-empty {
  font-family: var(--lab-font);
  font-size: 16px;
  color: var(--lab-text-2);
}

.fc-input {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.fc-input .lab-textfield {
  flex: 1 1 200px;
}

/* Sözde kod + "Nasıl çalışır?" */
.fc-below {
  grid-area: code;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.fc-pseudo,
.fc-how {
  padding: 8px 18px;
  border-radius: var(--lab-radius);
  background: var(--lab-bg-sunken);
}

.fc-pseudo > summary,
.fc-how > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

.fc-how p {
  margin: 0 0 12px;
  max-width: 72ch;
  font-size: 17px;
  line-height: 1.55;
}

.fc-pseudo__list {
  margin: 0 0 12px;
  padding-left: 1.8em;
  font-size: 17px;
  line-height: 1.7;
}

.fc-pseudo__list li {
  padding-inline: 8px;
  margin-inline: -8px;
  border-radius: 8px;
}

.fc-pseudo__list li::marker {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fc-pseudo__list li.is-current {
  background: var(--lab-accent-soft);
  font-weight: 600;
}

/* Palet: örnek düğmeleri uzun adlı */
.ed-palette__item.fc-example {
  grid-column: 1 / -1;
  width: auto;
  min-width: 96px;
  min-height: 44px;
  padding: 6px 10px;
}

.fc-example__name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

/* ============================================ akıllı tahta (tam ekran) */
/* Editör ekranı doldurur; değişkenler ve çıktı görünür kalır, kontroller büyür. */

.fc-board:not(.lab--app) .lab-header,
.fc-board:not(.lab--app) .lab-footer,
.fc-board:not(.lab--app) .lab-settings,
.fc-board:not(.lab--app) .fc-below,
.fc-board:not(.lab--app) .fc-textbar {
  display: none;
}

.fc-board:not(.lab--app) {
  gap: 12px;
}

.fc-board:not(.lab--app) .fc-visual {
  min-height: 0;
}

.fc-board:not(.lab--app) .ed {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.fc-board:not(.lab--app) .fc-narration {
  min-height: calc(2 * 1.4em + 24px);
  font-size: clamp(18px, 1.6cqw, 28px);
}

.fc-board:not(.lab--app) .fc-console {
  max-height: 14vh;
  font-size: clamp(18px, 1.6cqw, 28px);
}

.fc-board:not(.lab--app) .fc-vars__list {
  font-size: clamp(20px, 1.8cqw, 30px);
}

.fc-board:not(.lab--app) .lab-transport .lab-btn {
  min-height: 64px;
  padding: 0 28px;
  font-size: 22px;
}

.fc-board:not(.lab--app) .lab-transport .lab-btn--icon {
  width: 64px;
  padding: 0;
}

.fc-board:not(.lab--app) .lab-transport .lab-btn__icon svg {
  width: 28px;
  height: 28px;
}

/* ================================================================ yazdırma */
/* Siyah-beyaz A4 dikey: şema + sözde kod. Ekranda hiç görünmez. */

.fc-print {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  html,
  body {
    background: #fff !important;
  }

  .fc-root {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    color: #000;
  }

  .fc-root .lab-header,
  .fc-root .lab-footer,
  .fc-root .fc {
    display: none !important;
  }

  .fc-root .fc-print {
    display: block;
    color: #000;
    font-family: var(--lab-font);
  }

  .fc-print__title {
    margin: 0 0 6mm;
    font-size: 18pt;
  }

  .fc-print__diagram svg {
    display: block;
    max-width: 100%;
    max-height: 190mm;
    width: auto;
    height: auto;
  }

  .fc-print__sub {
    margin: 8mm 0 3mm;
    font-size: 14pt;
  }

  .fc-print__pseudo {
    margin: 0;
    padding-left: 1.6em;
    font-size: 12pt;
    line-height: 1.6;
  }

  .fc-print__pseudo li {
    break-inside: avoid;
  }
}
