:root {
  --bg: #f7f5ef;
  --navy: #1a2a3a;
  --navy-2: #243447;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --yel: #f59e0b;
  --yel-2: #fbbf24;
  --line: #e5e0d4;
  --line-soft: #efebe3;
  --ink: #1c1917;
  --mut: #78716c;
  --card: #ffffff;
  --success: #15803d;
  --shadow: 0 2px 8px rgba(28, 25, 23, 0.06), 0 8px 24px rgba(28, 25, 23, 0.04);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Roboto", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .brand, #num, .go, .sc b, .chip {
  font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
}

button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--yel);
  outline-offset: 2px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─── Layout ─── */
#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 480px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  height: 100vh;
  max-width: 100vw;
  padding: 12px 16px 14px;
  overflow: hidden;
  box-sizing: border-box;
}

/* ─── Header ─── */
#top {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--navy);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand {
  font-size: 34px;
  letter-spacing: .5px;
  color: var(--navy);
  line-height: 1;
}
.brand i {
  color: var(--teal);
  font-style: normal;
}

.vd {
  width: 1px;
  height: 28px;
  background: var(--line);
  margin: 0 2px;
}

.cred small {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--mut);
  font-weight: 600;
}
.cred span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.sp { flex: 1; }

.lab {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--mut);
  font-weight: 700;
}

.chip {
  display: flex;
  gap: 8px;
  align-items: center;
  border-radius: 11px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.15s;
}
.chip.on {
  background: var(--navy);
  color: #fff;
}

.sq {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 0;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.sq:hover { background: var(--navy-2); }

/* ─── Stage (3D) ─── */
#stage {
  position: relative;
  overflow: hidden;
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
}

#cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lb {
  position: absolute;
  left: 0;
  top: 0;
  padding: 4px 12px;
  border-radius: 8px;
  background: #fff;
  font: 600 12px Roboto, sans-serif;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.lb.hot {
  background: var(--navy);
  color: #fff;
}
.lb.next {
  outline: 2px solid var(--yel);
  outline-offset: 1px;
}

.sh {
  position: absolute;
  left: 16px;
  top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.ic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--yel-2);
  display: grid;
  place-items: center;
}
.sh h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.3px;
  color: var(--navy);
}
.sh p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--mut);
}

#zoom {
  position: absolute;
  right: 14px;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#zoom button {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  color: var(--navy);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s;
}
#zoom button:hover {
  background: #fafaf9;
  border-color: var(--yel);
}

#toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ─── Bottom nav ─── */
#bottom {
  grid-row: 3;
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-width: 0;
  overflow: hidden;
}

#steps {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
#steps::-webkit-scrollbar { display: none; }

.arr {
  flex: 0 0 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: #ebe7db;
  color: var(--navy);
  font-size: 20px;
  line-height: 1;
  transition: background 0.15s;
}
.arr:hover { background: #e0dccf; }
.arr.dark {
  background: var(--navy);
  color: #fff;
}
.arr.dark:hover { background: var(--navy-2); }

.sc {
  flex: 0 0 170px;
  display: flex;
  gap: 9px;
  align-items: center;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  transition: border-color 0.15s, background 0.15s;
}
.sc:hover { border-color: #d6d0c0; }
.sc.on {
  border-color: var(--yel);
  background: #fffbeb;
}

.th {
  flex: 0 0 54px;
  height: 40px;
  border-radius: 7px;
  background: #f0ede4;
  display: grid;
  place-items: center;
}
.th svg { width: 100%; height: 100%; }

.nm {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}
.nm i {
  font-style: normal;
  background: var(--yel-2);
  border-radius: 8px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  color: #422006;
}
.nm b {
  font-size: 17px;
  line-height: 1.15;
  color: var(--navy);
}

/* ─── Side panel ─── */
#side {
  grid-row: 2 / 4;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 22px 12px;
  display: flex;
  flex-direction: column;
}

.hd {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

#num {
  flex: 0 0 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--yel-2);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  color: #422006;
}

.hd small {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--mut);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--navy);
}

#desc {
  margin: 0 0 16px;
  font-size: 14.5px;
  color: #44403c;
  line-height: 1.6;
}

/* Part detail card */
.pd {
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 12px;
  background: #f0fdfa;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.pdh {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pdh small {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--teal);
  font-weight: 700;
}
#pclose {
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--mut);
  padding: 0 2px;
}
#pclose:hover { color: var(--ink); }
.pd h3 {
  margin: 2px 0 4px;
  font-size: 20px;
  color: var(--navy);
}
.pd p {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: #44403c;
  line-height: 1.5;
}
#prows { margin: 0; }
#prows div {
  display: flex;
  gap: 10px;
  border-top: 1px solid #d1e7e3;
  padding: 6px 0;
  font-size: 12.5px;
}
#prows dt {
  flex: 0 0 42%;
  color: var(--mut);
}
#prows dd {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

/* Materials */
.sec {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--mut);
}
.sec em {
  font-style: normal;
  background: #f5f0e6;
  border-radius: 10px;
  padding: 2px 9px;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--ink);
}

.it {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 11px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color 0.15s, background 0.15s;
}
.it:hover { border-color: var(--yel); background: #fffefb; }
.it.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.it input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  flex-shrink: 0;
}
.it b {
  background: var(--navy);
  color: #fff;
  border-radius: 7px;
  padding: 1px 8px;
  font-size: 12px;
  font-family: "Barlow Condensed", sans-serif;
  flex-shrink: 0;
}
.it span { flex: 1; line-height: 1.35; }

/* Side footer */
#side footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

#prev {
  background: #f5f0e6;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 16px;
  color: var(--navy);
  font-weight: 500;
  transition: background 0.15s;
}
#prev:hover:not(:disabled) { background: #ebe6da; }
#prev:disabled {
  opacity: 0.45;
  cursor: default;
}

.kb {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--mut);
}

.go {
  background: var(--yel);
  border: 0;
  border-radius: 11px;
  padding: 10px 18px;
  font-size: 18px;
  font-weight: 700;
  color: #422006;
  transition: background 0.15s;
}
.go:hover { background: #f59e0b; }

/* ─── IDE panel (daha uzun) ─── */
#ide {
  background: #0f1c20;
  border-radius: 12px;
  overflow: hidden;
  color: #d1e0e3;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  max-height: 580px; /* Artırıldı */
  min-height: 0;
  flex-shrink: 0;
}

.tabs {
  background: #0d9488;
  color: #fff;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.tabs em {
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  opacity: 0.9;
}

.tools {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: #162a30;
  flex-shrink: 0;
}
.tools button {
  background: #0f1c20;
  color: #c5d6da;
  border: 1px solid #2a454c;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  transition: background 0.15s, border-color 0.15s;
}
.tools button:hover {
  background: #1a2e34;
  border-color: #3a5a62;
}
.tools button.pri {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
  font-weight: 700;
}
.tools button.pri:hover { background: #0f766e; }

#code {
  margin: 0;
  padding: 10px 0;
  overflow-x: hidden;
  overflow-y: auto;
  font: 13px/1.6 ui-monospace, "SF Mono", Consolas, monospace;
  user-select: text;
  height: 340px; /* Artırıldı */
  max-height: 340px;
  flex-shrink: 0;
}

.ln {
  display: flex;
  white-space: pre;
  padding-right: 12px;
  border-left: 3px solid transparent;
}
.ln i {
  flex: 0 0 36px;
  text-align: right;
  padding-right: 10px;
  color: #4a6a70;
  font-style: normal;
  user-select: none;
}
.ln.on {
  background: #1a3530;
  border-left-color: var(--yel);
}
.ln em { font-style: normal; }
.c { color: #6b8a90; }
.k { color: #2dd4bf; }
.f { color: #fb923c; }
.o { color: #7dd3fc; }
.n { color: #a3e635; }

#con {
  height: 100px; /* Artırıldı */
  max-height: 100px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0a1417;
  padding: 8px 14px;
  font: 12px/1.55 ui-monospace, Consolas, monospace;
  color: #8fb4ba;
  flex-shrink: 0;
}

#prog {
  height: 3px;
  background: #0a1417;
  flex-shrink: 0;
}
#prog i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--yel);
}

/* ─── Settings ─── */
#sett {
  position: fixed;
  right: 16px;
  top: 68px;
  z-index: 20;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
  min-width: 220px;
}
#sett[hidden],
[hidden] { display: none !important; }

#sett b {
  font-size: 14px;
  color: var(--navy);
  margin-bottom: 2px;
}
#sett label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
#sett input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}
#sett button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--navy);
  transition: background 0.15s;
}
#sett button:hover { background: #f5f0e6; }

/* ─── Responsive ─── */
@media (max-width: 980px) {
  html, body { height: auto; overflow-x: hidden; }
  #app {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    padding: 10px;
    overflow: visible;
  }
  #stage {
    height: 55vh;
    min-height: 340px;
    width: 100%;
  }
  #side {
    min-height: 0;
    width: 100%;
    max-width: 100%;
  }
  #scroll { overflow: visible; }
  #bottom { width: 100%; }
  h1 { font-size: 30px; }
  .cred, .lab { display: none; }
  .sc { flex: 0 0 155px; }
  .nm b { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

/* ─── Projeler menüsü ─── */
.pbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 11px;
  background: var(--yel);
  color: #422006;
  font: 700 18px "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .5px;
  text-transform: uppercase;
  transition: background 0.15s;
}
.pbtn:hover { background: #f59e0b; }

#scrim {
  position: fixed;
  inset: 0;
  background: rgba(26, 42, 58, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 30;
}
#scrim.show { opacity: 1; pointer-events: auto; }

#drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(390px, 92vw);
  z-index: 40;
  border-radius: 0 var(--radius) var(--radius) 0;
  transform: translateX(-105%);
  transition: transform 0.28s ease, visibility 0s linear 0.28s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px;
  overflow: hidden;
  visibility: hidden;
}
#drawer.open { transform: none; visibility: visible; transition: transform 0.28s ease, visibility 0s; }

.dh { display: flex; justify-content: space-between; align-items: center; }
.dh small { font-size: 10px; letter-spacing: 1.5px; color: var(--mut); font-weight: 700; }
.dh h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--navy);
}
#dclose {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: #f5f0e6;
  color: var(--navy);
  font-size: 24px;
  line-height: 1;
}
#dclose:hover { background: #ebe6da; }

#plist { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pi {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.15s, background 0.15s;
}
.pi:hover { border-color: #d6d0c0; }
.pi.on { border-color: var(--yel); background: #fffbeb; }
.pi.soon { opacity: 0.62; }
.pn {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--yel-2);
  display: grid;
  place-items: center;
  font: 700 22px "Barlow Condensed", sans-serif;
  color: #422006;
}
.pi.soon .pn { background: #ebe7db; color: var(--mut); }
.pt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pt b { font: 700 19px/1.15 "Barlow Condensed", sans-serif; color: var(--navy); }
.pt small { font-size: 12.5px; color: var(--mut); line-height: 1.3; }
.pi em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 9px;
  background: #dcfce7;
  color: var(--success);
  white-space: nowrap;
}
.pi.soon em { background: #f5f0e6; color: var(--mut); }
.dn { margin: 0; font-size: 12.5px; color: var(--mut); }

/* ─── Buton basma düğmesi (Proje 2) ─── */
#pressBtn {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 10px 18px 10px 12px;
  background: var(--navy);
  color: #fff;
  font: 700 18px "Barlow Condensed", sans-serif;
  letter-spacing: .5px;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#pressBtn i {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e63c8;
  box-shadow: 0 4px 0 #14428a;
  display: block;
  transition: transform 0.05s, box-shadow 0.05s;
}
#pressBtn.down i { transform: translateY(3px); box-shadow: 0 1px 0 #14428a; }
#pressBtn small { display: block; font: 500 11.5px Roboto, sans-serif; opacity: .75; letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) {
  #scrim, #drawer { transition: none; }
}
/* Breadboard içi bağlantı ipucu */
#zoom button.off{opacity:.45}
#xhint{position:absolute;left:18px;top:74px;display:flex;gap:10px;align-items:center;background:#fff;border:1px solid var(--line);border-radius:12px;padding:8px 12px;font-size:13px;opacity:0;transform:translateY(-6px);transition:opacity .3s,transform .3s;pointer-events:none;max-width:calc(100% - 100px)}
#xhint.show{opacity:1;transform:none}
#xhint i{display:inline-flex;gap:3px}
#xhint i b{width:10px;height:22px;border-radius:4px}
@media (prefers-reduced-motion:reduce){#xhint{transition:none}}

/* ─── Ortam ışığı kontrolü (Proje 3) ─── */
#lightCtl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 250px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#lightCtl .lh, #lightCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#lightCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#lightCtl .lh b { font: 700 22px "Barlow Condensed", sans-serif; color: var(--navy); }
#lightCtl .lr { display: flex; align-items: center; gap: 8px; color: var(--navy); }
#lightCtl input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--yel) var(--p, 100%), #e5e0d4 var(--p, 100%));
  outline-offset: 4px;
}
#lightCtl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#lightCtl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#lightCtl .la { font-size: 12px; color: var(--mut); }
#lightCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }
#lightCtl .ls { font-size: 12.5px; font-weight: 700; color: var(--teal); }


/* ─── Servo açı göstergesi (Proje 4) ─── */
#servoCtl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 210px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#servoCtl .lh, #servoCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#servoCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#servoCtl .lh b { font: 700 24px "Barlow Condensed", sans-serif; color: var(--navy); }
#servoCtl .la { font-size: 12px; color: var(--mut); }
#servoCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }

/* ─── Nesne mesafesi kontrolü (Proje 5) ─── */
#distCtl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 250px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#distCtl .lh, #distCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#distCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#distCtl .lh b { font: 700 22px "Barlow Condensed", sans-serif; color: var(--navy); }
#distCtl .lr { display: flex; align-items: center; gap: 8px; color: var(--navy); }
#distCtl input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--yel) var(--p, 100%), #e5e0d4 var(--p, 100%));
  outline-offset: 4px;
}
#distCtl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#distCtl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#distCtl .la { font-size: 12px; color: var(--mut); }
#distCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }
#distCtl .ls { font-size: 12.5px; font-weight: 700; color: var(--teal); }



#distCtl .dm { font-size: 11px; font-weight: 700; color: var(--mut); }

#distCtl #sndBtn { align-self: flex-start; margin-top: 2px; border: 1px solid var(--line); background: #f5f0e6; color: var(--navy); border-radius: 999px; padding: 4px 12px; font: 700 12px Roboto, sans-serif; }
#distCtl #sndBtn:hover { background: #ebe6da; }
#distCtl #sndBtn.off { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ─── Toprak nemi kontrolü (Proje 6) ─── */
#soilCtl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 250px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#soilCtl .lh, #soilCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#soilCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#soilCtl .lh b { font: 700 22px "Barlow Condensed", sans-serif; color: var(--navy); }
#soilCtl .lr { display: flex; align-items: center; gap: 8px; color: var(--navy); }
#soilCtl input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--teal) var(--p, 45%), #e5e0d4 var(--p, 45%));
  outline-offset: 4px;
}
#soilCtl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#soilCtl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#soilCtl .la { font-size: 12px; color: var(--mut); }
#soilCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }
#soilCtl .ls { font-size: 12.5px; font-weight: 700; color: var(--teal); }
#soilCtl #lcdDom { background: #a5d63f; color: #16240a; border: 3px solid #2b2f33; border-radius: 6px; padding: 6px 8px; font: 700 15px/1.35 "Courier New", monospace; }
#soilCtl #lcdDom div { white-space: pre; height: 1.35em; overflow: hidden; }
#soilCtl #waterBtn { align-self: flex-start; margin-top: 2px; border: 1px solid var(--line); background: #f5f0e6; color: var(--navy); border-radius: 999px; padding: 4px 14px; font: 700 12px Roboto, sans-serif; cursor: pointer; }
#soilCtl #waterBtn:hover { background: #ebe6da; }

/* ─── Arduino’yu tanıyalım: seçili pin/parça etiketi ─── */
#labels .pt {
  position: absolute;
  left: 0;
  top: 0;
  margin-top: -14px;
  padding: 7px 13px;
  border-radius: 9px;
  background: #f26a1b;
  color: #fff;
  font: 700 15px/1 Roboto, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
#labels .pt::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #f26a1b;
  border-bottom: 0;
}

/* ─── Sınıf: öğretmenin konuşma balonu ─── */
#labels .say {
  position: absolute;
  left: 0;
  top: 0;
  margin-top: -12px;
  max-width: 230px;
  padding: 10px 14px;
  border: 2px solid #4fb4ff;
  border-radius: 14px;
  background: #fff;
  color: #17324d;
  font: 600 14px/1.35 Roboto, sans-serif;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 40, 80, .25);
  transition: opacity .5s;
}
#labels .say::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top-color: #4fb4ff;
  border-bottom: 0;
}

/* ─── Sıradaki parça / adım vurgusu ─── */
.it.nxt {
  border-color: var(--yel);
  background: #fffbe8;
  box-shadow: 0 0 0 2px rgba(249, 200, 70, .5);
  animation: nxp 1.4s ease-in-out infinite;
}
.sc.nx {
  outline: 2px dashed var(--yel);
  outline-offset: -3px;
}
@keyframes nxp {
  50% { box-shadow: 0 0 0 5px rgba(249, 200, 70, .18); }
}
/* ─── Arduino’yu tanıyalım: renk anahtarı ─── */
#xlegend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  pointer-events: none;
}
#xlegend b { font-size: 10px; letter-spacing: 1.5px; color: var(--mut); }
#xlegend span { display: flex; align-items: center; gap: 8px; color: var(--ink); }
#xlegend i { width: 14px; height: 14px; border-radius: 4px; display: block; }
#xlegend i.ringi { border-radius: 50%; border: 3px solid #38bdf8; background: none; }

/* ─── Potansiyometre kontrolü (Proje 7) ─── */
/* ─── Nesne mesafesi kontrolü (Proje 5) ─── */
#potCtl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 250px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#potCtl .lh, #potCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#potCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#potCtl .lh b { font: 700 22px "Barlow Condensed", sans-serif; color: var(--navy); }
#potCtl .lr { display: flex; align-items: center; gap: 8px; color: var(--navy); }
#potCtl input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--yel) var(--p, 100%), #e5e0d4 var(--p, 100%));
  outline-offset: 4px;
}
#potCtl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#potCtl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#potCtl .la { font-size: 12px; color: var(--mut); }
#potCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }
#potCtl .ls { font-size: 12.5px; font-weight: 700; color: var(--teal); }




/* ─── RGB LED durum kutusu (Proje 2) ─── */
#rgbCtl {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 220px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#rgbCtl .lh, #rgbCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#rgbCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#rgbCtl .lh b { font: 700 22px "Barlow Condensed", sans-serif; color: var(--navy); }
#rgbCtl .la { font-size: 12px; color: var(--mut); }
#rgbCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }
#rgbCtl .ls { font-size: 12.5px; font-weight: 700; color: var(--teal); }
#rgbCtl .rr { display: flex; align-items: center; gap: 10px; }
#rgbCtl #rsw { width: 46px; height: 46px; border-radius: 12px; background: #2a2f36; border: 2px solid var(--line); box-shadow: inset 0 2px 6px rgba(0,0,0,.2); transition: background .12s; }
#rgbCtl .rch { display: flex; gap: 6px; }
#rgbCtl .rch span { min-width: 30px; text-align: center; padding: 3px 0; border-radius: 8px; font: 700 13px Roboto, sans-serif; background: #f0ede4; color: var(--mut); }
#rgbCtl .rch span.on { color: #fff; }
#rgbCtl #rR.on { background: #d32f2f; }
#rgbCtl #rG.on { background: #2e9e47; }
#rgbCtl #rB.on { background: #1e63c8; }

/* sade sahne: başlık ve ek düğmeler gizli, yalnızca + / − kalır */
#stage .sh,#lyr,#xr{display:none!important}

/* ─── Adım şeridi: ilerleme oklarla görünür ─── */
#steps { gap: 4px; align-items: center; }
.sa { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; color: #c9c3b0; transition: color .2s; }
.sa.done { color: #22a06b; }
.sa.sgo { color: var(--yel); animation: sanudge 1s ease-in-out infinite; }
@keyframes sanudge { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(3px); } }
.sc { position: relative; }
.sc .th { position: relative; }
.sc .ck { display: none; position: absolute; right: -5px; top: -5px; width: 18px; height: 18px; border-radius: 50%; background: #22a06b; color: #fff; font-style: normal; font-size: 12px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.sc.done { background: #f1faf5; border-color: #bfe6d0; }
.sc.done .ck { display: block; }
.sc.done .nm i { color: #22a06b; }
.sc.on { background: #fff6d6; border-color: var(--yel); box-shadow: 0 0 0 3px rgba(249, 200, 70, .35); }
.sc:not(.on):not(.done):not(.nx) { opacity: .72; }
body.anim #steps, body.anim #next, body.anim #prev { pointer-events: none; opacity: .55; }

/* ─── Çarkıfelek paneli (Proje 10) ─── */
#wheelCtl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 250px;
  padding: 10px 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#wheelCtl .lh, #wheelCtl .la { display: flex; justify-content: space-between; align-items: baseline; }
#wheelCtl .lh span { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: var(--mut); }
#wheelCtl .lh b { font: 700 22px "Barlow Condensed", sans-serif; color: var(--navy); }
#wheelCtl .lr { display: flex; align-items: center; gap: 8px; color: var(--navy); }
#wheelCtl .la { font-size: 12px; color: var(--mut); }
#wheelCtl .la b { font: 700 18px "Barlow Condensed", sans-serif; color: var(--ink); }
#wheelCtl .ls { font-size: 12.5px; font-weight: 700; color: var(--teal); }

/* ═══ Mobil · yatay (telefon) düzeni ═══
   Kısa ekranlı yatay cihazlarda sahne solda, adım paneli sağda; her şey tek ekrana sığar. */
@media (orientation: landscape) and (max-height: 540px) {
  html, body { height: 100%; overflow: hidden; }
  body { font-size: 13px; line-height: 1.4; }
  #app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(250px, 34vw, 340px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 6px;
    height: 100vh; height: 100dvh;
    padding: 5px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
    overflow: hidden;
  }
  :root { --radius: 12px; }
  #top { min-height: 0; gap: 8px; }
  .logo { width: 30px; height: 30px; border-radius: 9px; }
  .logo svg { width: 22px; height: 22px; }
  .brand { font-size: 23px; }
  .vd, .cred, .lab { display: none; }
  .pbtn { padding: 5px 11px; font-size: 14px; border-radius: 9px; }
  .pbtn svg { width: 16px; height: 16px; }
  .chip { padding: 5px 10px; font-size: 13px; border-radius: 9px; }
  .chip svg { width: 14px; height: 14px; }
  .sq { width: 32px; height: 32px; border-radius: 9px; }
  .sq svg { width: 17px; height: 17px; }

  #stage { height: auto; min-height: 0; width: auto; grid-row: 2; grid-column: 1; }
  #side { grid-row: 2 / 4; grid-column: 2; min-height: 0; width: auto; max-width: 100%; }
  #bottom { grid-row: 3; grid-column: 1; width: auto; padding: 4px 6px; gap: 5px; }
  #scroll { overflow-x: hidden; overflow-y: auto; padding: 10px 12px 6px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  #side footer { padding: 6px 10px; gap: 6px; }
  #prev, #next { padding: 7px 12px; font-size: 14px; border-radius: 9px; min-height: 36px; }
  .kb { display: none; }
  h1 { font-size: 22px; }
  #num { font-size: 26px; }
  #desc { font-size: 13px; margin: 6px 0; }

  .arr { flex: 0 0 30px; height: 30px; font-size: 17px; }
  .sc { flex: 0 0 124px; padding: 4px 6px; gap: 5px; border-radius: 9px; }
  .th { flex: 0 0 34px; height: 26px; border-radius: 5px; }
  .nm b { font-size: 13px; }
  .nm i { font-size: 9.5px; padding: 0 5px; }
  .sc .ck { width: 15px; height: 15px; line-height: 15px; font-size: 10px; right: -4px; top: -4px; }

  #zoom { right: 8px; top: 8px; gap: 6px; }
  #zoom button { width: 36px; height: 36px; border-radius: 9px; font-size: 18px; }
  #toast { bottom: 8px; padding: 6px 12px; font-size: 12px; max-width: 78%; white-space: normal; text-align: center; }
  #xhint { left: 8px; top: 8px; padding: 5px 9px; font-size: 11.5px; max-width: calc(100% - 70px); }
  #xhint i b { height: 16px; }
  #xlegend { transform: scale(.78); transform-origin: left bottom; left: 6px !important; bottom: 6px !important; }

  /* proje kontrol panelleri: dar ve alçak */
  #lightCtl, #soilCtl, #wheelCtl, #rgbCtl, #potCtl, #distCtl, #servoCtl {
    left: 8px; bottom: 8px; width: 190px; padding: 6px 10px 8px; gap: 3px; border-radius: 11px;
  }
  #lightCtl .lh b, #soilCtl .lh b, #wheelCtl .lh b, #rgbCtl .lh b, #potCtl .lh b, #distCtl .lh b, #servoCtl .lh b { font-size: 18px; }
  #lightCtl .la, #soilCtl .la, #wheelCtl .la, #rgbCtl .la, #potCtl .la, #distCtl .la, #servoCtl .la { font-size: 11px; }
  #lightCtl .la b, #soilCtl .la b, #wheelCtl .la b, #potCtl .la b, #distCtl .la b { font-size: 15px; }
  #lightCtl .ls, #soilCtl .ls, #wheelCtl .ls, #rgbCtl .ls, #potCtl .ls, #distCtl .ls, #servoCtl .ls { font-size: 11px; }
  #pressBtn { left: 8px; bottom: 8px; padding: 7px 14px 7px 9px; font-size: 15px; border-radius: 11px; }
  #pressBtn small { font-size: 10px; }
  #waterBtn { min-height: 36px; }
  #lightCtl input[type="range"], #soilCtl input[type="range"], #potCtl input[type="range"], #distCtl input[type="range"] { height: 26px; }

  #drawer { width: min(340px, 70vw); padding: 10px 12px; gap: 8px; }
  #sett { right: 8px; top: 44px; max-height: calc(100vh - 56px); overflow: auto; }
  #ide pre, #code { font-size: 11.5px; }
  .tools button { min-height: 34px; }
}
/* çok dar telefonlar (≤ 700px) */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 700px) {
  #app { grid-template-columns: minmax(0, 1fr) 232px; }
  .brand { font-size: 20px; }
  .chip { display: none; }
  .sc { flex-basis: 108px; }
  #lightCtl, #soilCtl, #wheelCtl, #rgbCtl, #potCtl, #distCtl, #servoCtl { width: 168px; }
}
/* yatay telefonda dikey ekran uyarısı gerekmez; ama dikeyde sahne yeterince yüksek kalsın */
@media (orientation: portrait) and (max-width: 980px) { #stage { height: 52vh; min-height: 300px; } }
@media (orientation: landscape) and (max-height: 540px) {
  .pbtn { height: 30px; padding: 0 11px 0 8px; font-size: 15px; gap: 6px; }
  .hd { gap: 8px; margin-bottom: 6px; }
  #num { flex: 0 0 34px; height: 34px; font-size: 19px; }
  h1 { font-size: 19px; line-height: 1.05; }
  .hd small { font-size: 9px; letter-spacing: 1px; }
  #desc { font-size: 12.5px; line-height: 1.4; }
  #app { gap: 5px; }
  #distCtl .ls, #soilCtl .ls, #wheelCtl .ls { display: none; }
  #sndBtn { padding: 4px 10px; font-size: 11px; min-height: 0; }
  #distCtl .lr svg, #potCtl .lr svg, #lightCtl .lr svg, #soilCtl .lr svg { width: 15px; height: 15px; }
}
@media (orientation: landscape) and (max-height: 420px) {
  #top { gap: 6px; }
  .brand { font-size: 19px; }
  .logo { width: 26px; height: 26px; }
  .sq { width: 28px; height: 28px; }
  #lightCtl, #soilCtl, #wheelCtl, #rgbCtl, #potCtl, #distCtl, #servoCtl { padding: 5px 9px 6px; }
}
@media (orientation: landscape) and (max-height: 420px) {
  #lightCtl, #soilCtl, #wheelCtl, #rgbCtl, #potCtl, #distCtl, #servoCtl { background: rgba(255,255,255,.93); }
  #lightCtl .lh span, #soilCtl .lh span, #wheelCtl .lh span, #rgbCtl .lh span, #potCtl .lh span, #distCtl .lh span, #servoCtl .lh span { font-size: 9px; letter-spacing: .6px; white-space: nowrap; }
  #lightCtl .lh b, #soilCtl .lh b, #wheelCtl .lh b, #rgbCtl .lh b, #potCtl .lh b, #distCtl .lh b, #servoCtl .lh b { font-size: 16px; white-space: nowrap; }
  #xhint { display: none; }
}

/* ─── Telefon · dikey: üst çubuk sığsın ─── */
@media (max-width: 560px) {
  #top { gap: 8px; flex-wrap: nowrap; min-width: 0; }
  #top .logo { width: 38px; height: 38px; flex: none; }
  #top .brand { font-size: 22px; flex: none; }
  #top .vd, #top .chip, #top .cred, #top .lab { display: none; }
  .pbtn { height: 36px; padding: 0 12px 0 9px; font-size: 14px; flex: none; }
  .sp { flex: 1 1 0; min-width: 0; }
  #app { padding: 8px; }
  h1 { font-size: 26px; }
}
@media (max-width: 380px) {
  #top .brand { font-size: 19px; }
  .pbtn { font-size: 0; gap: 0; padding: 0 10px; }
}
