/* Robot workshop UI: dark navy glass panels floating over a full-screen 3D scene. */
:root {
  --bg: #0b0e24;
  --panel: rgba(17, 21, 52, 0.72);
  --panel-2: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef0ff;
  --muted: #9aa0c8;
  --dim: #6c729c;
  --orange: #f26a1b;
  --orange-2: #ff8a3d;
  --green: #34d399;
  --radius: 20px;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#scene:active { cursor: grabbing; }
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(4, 5, 16, 0.55) 100%);
}

/* Entry animation */
.top, .panel, .dock, .hint { opacity: 0; transform: translateY(10px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.panel.left { transform: translateX(-16px); }
.panel.right { transform: translateX(16px); }
body.loaded .top, body.loaded .panel, body.loaded .dock, body.loaded .hint { opacity: 1; transform: none; }
body.loaded .panel { transition-delay: .12s; }
body.loaded .dock { transition-delay: .24s; }

.glass, .top, .panel, .dock {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ---------- Top bar ---------- */
.top {
  position: fixed; top: 16px; left: 16px; right: 16px; height: 62px;
  border-radius: 18px; display: flex; align-items: center; gap: 16px; padding: 0 12px 0 16px; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand strong { display: block; font-family: var(--font-display); font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.brand span { font-size: 13.5px; color: var(--muted); }
.steps { margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.step { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 6px; border-radius: 12px; font-weight: 600; color: var(--dim); font-size: 14px; }
.step i {
  font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13.5px; font-weight: 700; border: 1px solid var(--line-2);
}
.step.on { color: var(--text); }
.step.on i { background: var(--orange); border-color: transparent; color: #fff; box-shadow: 0 0 0 4px rgba(242, 106, 27, .2); }
.step.lock::after {
  content: ""; width: 10px; height: 10px; opacity: .6;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0c8' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
}
.sep { width: 28px; height: 1px; background: var(--line-2); }
.tools { display: flex; align-items: center; gap: 6px; }
.proj {
  display: flex; flex-direction: column; justify-content: center; padding: 0 12px; height: 42px; margin-right: 6px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
}
.proj span { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
.proj input { background: none; border: 0; outline: 0; width: 96px; font-weight: 700; font-family: var(--font-display); font-size: 15px; padding: 0; }
/* Login state (account.js): nickname + Çıkış, or a Giriş link */
.account { display: flex; align-items: center; gap: 6px; margin-right: 6px; }
.acc-name {
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; font-family: var(--font-display); font-size: 14px; padding: 0 4px;
}
.acc-link {
  height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2);
  display: inline-flex; align-items: center; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: all .2s ease;
}
.acc-save { font-size: 13.5px; color: var(--muted); white-space: nowrap; padding: 0 4px; }
.acc-save[data-status="saved"]::before { content: "✓ "; color: #66bb6a; }
.acc-save[hidden] { display: none; }
.acc-link:hover { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, .07); }
.ic {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2);
  display: grid; place-items: center; color: var(--muted); transition: all .2s ease;
}
.ic svg { width: 19px; height: 19px; }
.ic:hover { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, .07); }
.ic.active { color: var(--orange-2); border-color: rgba(242, 106, 27, .45); background: rgba(242, 106, 27, .12); }

/* ---------- Panels ---------- */
.panel { position: fixed; top: 94px; bottom: 16px; border-radius: var(--radius); display: flex; flex-direction: column; z-index: 4; }
.panel.left { left: 16px; width: 300px; padding: 18px 14px 10px; }
.panel.right { right: 16px; width: 318px; padding: 18px 16px 14px; }
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
.ph { padding: 0 6px 12px; }
/* Task card (?gorev=, tasks.js) above the catalog */
.task { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(242, 106, 27, .35); background: rgba(242, 106, 27, .08); }
.task summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; cursor: pointer; list-style: none; }
.task summary::-webkit-details-marker { display: none; }
.task-tag { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #ffb070; }
.task-time { font-size: 13.5px; color: var(--muted); margin-left: auto; }
.task-title { flex-basis: 100%; font-family: var(--font-display); font-size: 17px; }
.task-goal, .task-ok { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--text); }
.task-ok b { color: #ffb070; }
.task-exit { display: inline-flex; align-items: center; min-height: 40px; margin-top: 2px; font-size: 14px; color: var(--muted); }
.task-status { margin: 8px 0 0; padding: 6px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #fcd34d; background: rgba(251, 191, 36, .1); }
.task-status.ok { color: #6ee7b7; background: rgba(52, 211, 153, .12); }
/* Homework details (?odev=, app.js → renderHomework) */
.hw-info { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(242, 106, 27, .25); }
.hw-info p { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }
.hw-due { font-weight: 700; color: #ffd1a8; }
.hw-due.closed { color: var(--muted); font-weight: 600; }
.hw-attempts { color: var(--muted); }
.hw-note { white-space: pre-line; }
.hw-note b { color: #ffb070; }
.hw-last { color: var(--muted); }
.hw-send { margin-top: 6px; height: 36px; padding: 0 16px; }
.hw-send:disabled { opacity: .5; cursor: not-allowed; }
.in-task .panel.left .ph, .cp-ex[hidden] { display: none; }
.ph h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.ph p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 12px; padding: 0 12px; height: 40px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
}
.search:focus-within { border-color: rgba(242, 106, 27, .5); }
.search svg { width: 17px; height: 17px; flex: none; }
.search input { background: none; border: 0; outline: 0; flex: 1; min-width: 0; align-self: stretch; }
.search input::placeholder { color: var(--dim); }
#catalog { flex: 1; margin: 0 -6px; padding: 0 6px; }
.cat { margin-bottom: 14px; }
.cat h3 {
  margin: 0 4px 7px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 700;
}
.cards { display: grid; gap: 6px; }
.card {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; width: 100%; text-align: left;
  border-radius: 14px; border: 1px solid transparent; background: var(--panel-2);
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.card[hidden] { display: none; } /* catalog search; display:flex above would override the attribute */
.card:hover { background: rgba(255, 255, 255, .08); border-color: var(--line-2); transform: translateX(2px); }
.card:active { transform: scale(.98); }
.thumb {
  width: 64px; height: 48px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, rgba(120, 140, 255, .2), rgba(255, 255, 255, .02) 70%);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; transition: transform .3s ease; }
.card:hover .thumb img { transform: scale(1.1) rotate(-2deg); }
.meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nm { font-weight: 700; font-size: 14.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh { font-size: 13px; color: var(--muted); }
.badge { font-size: 13px; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; }
.card.on { border-color: rgba(242, 106, 27, .35); }
.card.on .badge { color: var(--orange-2); }
.card.full { background: rgba(52, 211, 153, .06); border-color: rgba(52, 211, 153, .3); }
.card.full .badge { color: var(--green); }
.card.na { opacity: .38; }

/* Readiness */
.readiness { display: flex; align-items: center; gap: 14px; }
.ring { position: relative; width: 74px; height: 74px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { stroke: rgba(255, 255, 255, .08); stroke-width: 8; }
.ring-fg { stroke: url(#rg); stroke-width: 8; stroke-dasharray: 264; stroke-dashoffset: 264; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 18px; font-weight: 800; }
body.ready .ring-fg { stroke: var(--green); }
body.ready .ring { filter: drop-shadow(0 0 12px rgba(52, 211, 153, .45)); }
.readiness h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.readiness p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.checks { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.check {
  display: grid; grid-template-columns: 20px 1fr; column-gap: 8px; align-items: center; padding: 8px 9px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); transition: all .3s ease;
}
.tick { grid-row: span 2; width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed var(--line-2); display: grid; place-items: center; }
.tick svg { width: 13px; height: 13px; stroke: #062; stroke-width: 2.6; }
.cl { font-weight: 700; font-size: 14px; line-height: 1.2; }
.ch { font-size: 13px; color: var(--dim); line-height: 1.2; }
.check.ok { border-color: rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .07); }
.check.ok .tick { background: var(--green); border: 0; animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
.check.shake { animation: shake .45s ease; border-color: rgba(242, 106, 27, .6); }
@keyframes pop { from { transform: scale(.3); } to { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.divider { height: 1px; background: var(--line); margin: 16px -16px 14px; }

/* Inspector */
.inspector { flex: 1; min-height: 0; }
.inspector.flash { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ins-head { display: flex; align-items: center; gap: 12px; }
.ins-head img {
  width: 96px; height: 72px; object-fit: contain; border-radius: 14px; flex: none;
  background: radial-gradient(circle at 50% 40%, rgba(120, 140, 255, .22), rgba(255, 255, 255, .02) 70%);
}
.pill {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--orange-2); background: rgba(242, 106, 27, .12); padding: 3px 8px; border-radius: 99px;
}
.ins-head h4 { margin: 5px 0 1px; font-family: var(--font-display); font-size: 17px; font-weight: 700; line-height: 1.15; }
.gram { font-size: 13.5px; color: var(--muted); }
.what { color: #c9cdea; line-height: 1.5; margin: 12px 0; font-size: 14px; }
.specs { margin: 0; display: grid; gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.specs div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 11px; font-size: 14px; }
.specs div:nth-child(odd) { background: var(--panel-2); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; text-align: right; }
.tip { margin: 10px 0 0; font-size: 13.5px; color: var(--orange-2); font-weight: 600; text-align: center; }
.empty { text-align: center; padding: 18px 10px; color: var(--muted); }
.empty p { margin: 10px 0 0; line-height: 1.5; font-size: 14px; }
.empty-ic { width: 46px; height: 46px; margin: 0 auto; border-radius: 14px; display: grid; place-items: center; border: 1px dashed var(--line-2); color: var(--dim); }
.empty-ic svg { width: 22px; height: 22px; }

/* Buttons */
.btn { white-space: nowrap; border: 0; border-radius: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s ease; }
.btn.ghost { width: 100%; margin-top: 12px; height: 40px; background: var(--panel-2); border: 1px solid var(--line); }
.btn.danger:hover { border-color: rgba(248, 113, 113, .5); color: #fca5a5; background: rgba(248, 113, 113, .08); }
.btn.primary {
  height: 52px; padding: 0 22px 0 18px; font-family: var(--font-display); font-size: 16px; color: #fff;
  background: linear-gradient(180deg, var(--orange-2), var(--orange));
  box-shadow: 0 10px 28px rgba(242, 106, 27, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn.primary svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(242, 106, 27, .55), inset 0 1px 0 rgba(255, 255, 255, .3); }
body.ready .btn.primary { animation: glow 1.8s ease-in-out infinite; }
/* The run button in the code panel turns into "Durdur" while the program runs, so it stays clickable */
body.driving .btn.primary:not(#cp-run) { opacity: .5; pointer-events: none; animation: none; }
body.driving #cp-run { animation: none; }
@keyframes glow { 50% { box-shadow: 0 0 0 8px rgba(242, 106, 27, .18), 0 14px 40px rgba(242, 106, 27, .6); } }

/* Dock */
.dock {
  position: fixed; left: 50%; bottom: 16px; height: 72px; z-index: 4; translate: -50% 0;
  border-radius: var(--radius); display: flex; align-items: center; padding: 0 10px 0 8px; gap: 4px;
}
.dock .btn.primary { margin-left: 10px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; }
.stat span { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
.stat b { font-family: var(--font-display); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.hint {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); font-size: 13.5px; color: var(--dim);
  white-space: nowrap; pointer-events: none; z-index: 3;
}
body.loaded .hint { transform: translateX(-50%); }
body.dragging .hint { color: var(--orange-2); }

#toast {
  position: fixed; top: 92px; left: 50%; transform: translate(-50%, -12px); z-index: 10; opacity: 0; pointer-events: none;
  background: rgba(20, 24, 58, .92); border: 1px solid rgba(242, 106, 27, .4); color: var(--text);
  padding: 11px 18px; border-radius: 14px; font-weight: 600; box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
  transition: opacity .25s ease, transform .35s cubic-bezier(.2,.8,.2,1); backdrop-filter: blur(12px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .steps { display: none; }
  .panel.left { width: 260px; }
  .panel.right { width: 280px; }
  .stat { min-width: 58px; }
}
@media (max-width: 760px) {
  .top { top: 10px; left: 10px; right: 10px; height: 56px; gap: 8px; }
  .proj, #btn-sound, .brand span, .acc-name, .acc-save { display: none; }
  .panel.left {
    top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; height: 132px; padding: 10px;
  }
  .panel.left .ph, .search { display: none; }
  .task { margin-bottom: 8px; padding: 6px 10px; }
  .task summary { min-height: 40px; align-items: center; }
  .task-title { flex-basis: auto; font-size: 14px; }
  /* On a phone the card sits under the top bar (app.js puts it in <body>), closed until tapped */
  body > .task { position: fixed; top: 76px; left: 10px; right: 10px; z-index: 6; margin: 0; background: #1b1838; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
  body > .task[open] { max-height: 50vh; overflow-y: auto; }
  #catalog { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; }
  .cat { display: contents; }
  .cat h3 { display: none; }
  .cards { display: contents; }
  .card { flex-direction: column; width: 110px; flex: none; padding: 8px; gap: 4px; text-align: center; }
  .sh, .badge { display: none; }
  .nm { white-space: normal; font-size: 13px; }
  .panel.right { display: none; }
  .dock { bottom: 152px; height: 60px; }
  .stat { display: none; }
  .hint { display: none; }
}

/* ---------- Modes & wiring ---------- */
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 14px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); margin-right: 8px; }
.seg button {
  display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px; border: 0; border-radius: 10px;
  background: none; color: var(--muted); font-weight: 700; font-size: 14.5px; white-space: nowrap; transition: all .2s ease;
}
.seg button svg { width: 17px; height: 17px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, .09); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.seg button[data-mode="wire"].on { background: rgba(255, 209, 102, .14); color: #ffd166; }
body.wire-mode #scene { cursor: crosshair; }
body.wire-mode .hint { color: #ffd166; }
.check.wide { grid-column: span 2; }

#tip {
  position: fixed; left: 0; top: 0; z-index: 12; pointer-events: none; opacity: 0; transition: opacity .15s ease;
  background: rgba(14, 17, 44, .95); border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 10px;
  font-size: 13.5px; color: var(--muted); max-width: 240px; box-shadow: 0 10px 28px rgba(0,0,0,.4);
}
#tip b { display: block; color: var(--text); font-size: 14px; margin-bottom: 1px; }
#tip.show { opacity: 1; }

.inspector h5 { margin: 0 0 6px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.ports { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.ports li {
  display: grid; grid-template-columns: 10px 1fr; column-gap: 8px; align-items: center; padding: 6px 10px;
  border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13.5px;
}
.ports li i, .legend i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.ports li span { font-weight: 600; }
.ports li em { grid-column: 2; font-style: normal; color: var(--dim); font-size: 13px; }
.ports li.on { border-color: rgba(52, 211, 153, .3); }
.ports li.on em { color: var(--green); }
.legend { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.row { display: flex; gap: 8px; }
.row .btn.ghost { flex: 1; }
.tip.muted { color: var(--dim); font-weight: 500; }

@media (max-width: 1100px) {
  .seg button { padding: 0 10px; }
  .stat:nth-of-type(4), .stat:nth-of-type(5) { display: none; }
}

/* ---------- Real pins, circuit report, code ---------- */
.row { flex-wrap: wrap; }
.row .btn.ghost { min-width: calc(50% - 4px); }
.ports { max-height: 260px; overflow-y: auto; padding-right: 2px; }
.ports li[data-pin] { cursor: pointer; }
.ports li[data-pin]:hover { border-color: rgba(255, 209, 102, .45); }
.ports li.pend { border-color: #fff; background: rgba(255, 255, 255, .08); }
.ports li.bb-note { display: block; color: var(--dim); font-size: 13px; }
#tip em { display: block; font-style: normal; color: var(--green); margin-top: 2px; }

.report { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 5px; text-align: left; }
.report li { display: grid; grid-template-columns: 16px 1fr; column-gap: 7px; font-size: 13.5px; line-height: 1.4; padding: 7px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.report li em { grid-column: 2; font-style: normal; color: var(--dim); font-size: 13px; }
.report li.iss.err { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .08); color: #fecaca; }
.report li.iss.warn { border-color: rgba(255, 209, 102, .35); color: #fde68a; }
.report li.iss.info { color: var(--muted); }
.report li.need.ok { color: var(--green); }
.report li.need.ok b { font-weight: 600; }
.inspector > h5 { margin-top: 16px; }

.swatches { display: none; gap: 4px; padding: 0 6px; }
body.wire-mode .swatches { display: flex; }
body.wire-mode .dock .stat:nth-of-type(1), body.wire-mode .dock .stat:nth-of-type(3) { display: none; }
.sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); padding: 0; cursor: pointer; }
.sw.auto { background: var(--panel-2); color: var(--muted); font-size: 13px; font-weight: 800; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }

#code-dlg { width: min(640px, calc(100vw - 32px)); border: 1px solid var(--line-2); border-radius: 18px; background: #11153a; color: var(--text); padding: 18px; }
#code-dlg::backdrop { background: rgba(5, 7, 20, .6); }
#code-dlg .dlg-head { display: flex; justify-content: space-between; align-items: center; }
#code-dlg h4 { margin: 0; font-family: var(--font-display); }
#code-dlg p { color: var(--muted); font-size: 14px; }
#code-dlg pre { background: #0a0d26; border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: 50vh; overflow: auto; font-size: 14px; line-height: 1.5; }
#code-dlg .btn.primary { height: 42px; margin-left: auto; }
#reset-dlg { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line-2); border-radius: 18px; background: #11153a; color: var(--text); padding: 18px; }
#reset-dlg::backdrop { background: rgba(5, 7, 20, .6); }
#reset-dlg h4 { margin: 0; font-family: var(--font-display); }
#reset-dlg p { color: var(--muted); font-size: 14px; }
#submit-dlg { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line-2); border-radius: 18px; background: #11153a; color: var(--text); padding: 18px; }
#submit-dlg::backdrop { background: rgba(5, 7, 20, .6); }
#submit-dlg h4 { margin: 0 0 10px; font-family: var(--font-display); }
#submit-dlg p { color: var(--muted); font-size: 14px; }
#submit-dlg .sub-sum { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.6; }
#submit-dlg .sub-left { color: #ffd1a8; font-weight: 700; }

/* ---------- Physics test drive ---------- */
body.sim .panel, body.sim .dock, body.sim .hint { opacity: 0; pointer-events: none; }
#drive-hud, #arm-hud {
  position: fixed; right: 16px; top: 92px; z-index: 6; width: 290px; padding: 14px; display: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(16px);
}
#drive-hud.show, #arm-hud.show { display: block; }
.dh-row { display: flex; gap: 6px; }
.dh-modes button { flex: 1; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.dh-modes button.on { color: #fff; border-color: var(--orange); background: rgba(242, 106, 27, .18); }
.dh-speed { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; font-size: 13.5px; color: var(--muted); }
.dh-speed input { flex: 1; height: 28px; accent-color: var(--orange); }
.dh-speed b { width: 36px; text-align: right; color: var(--text); }
.dh-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dh-stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; }
.dh-stats dt { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 700; }
.dh-stats dd { margin: 2px 0 0; font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
#dh-l { display: flex; gap: 4px; align-items: center; height: 18px; }
#dh-l i { width: 12px; height: 12px; border-radius: 50%; background: #2b3060; border: 1px solid var(--line-2); }
#dh-l i.on { background: #111; border-color: #ffd166; }
.dh-keys { font-size: 13px; color: var(--dim); margin: 10px 0 0; }
#drive-hud .btn, #arm-hud .btn { height: 40px; margin-top: 10px; flex: 1; font-size: 14px; }
#drive-hud .btn.primary, #arm-hud .btn.primary { padding: 0 12px; }
@media (max-width: 760px) { #drive-hud, #arm-hud { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; } }
/* Task goal during a test drive (app.js → startJudge, success.js) */
#goal-live { position: fixed; right: 16px; bottom: 16px; z-index: 6; width: 290px; padding: 12px 14px; display: none; border-radius: 16px;
  background: rgba(20, 24, 58, .92); border: 1px solid rgba(242, 106, 27, .4); box-shadow: 0 16px 40px rgba(0, 0, 0, .4); }
#goal-live.show { display: grid; gap: 6px; }
#goal-live .gl-title { font-family: var(--font-display); font-size: 14px; color: #ffb070; }
#goal-live .gl-text { font-size: 14px; line-height: 1.4; }
#goal-live .gl-bar { display: block; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
#goal-live .gl-bar i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .3s; }
#goal-live.miss { border-color: rgba(251, 191, 36, .55); }
#goal-live.miss .gl-text { color: #fcd34d; }
#goal-live.pass { border-color: rgba(52, 211, 153, .6); background: rgba(16, 48, 44, .94); }
#goal-live.pass .gl-title, #goal-live.pass .gl-text { color: #6ee7b7; }
#goal-live.pass .gl-bar i { background: #34d399; }
@media (max-width: 760px) { #goal-live { left: 10px; right: 10px; top: 76px; bottom: auto; width: auto; padding: 8px 12px; } body.sim > .task { display: none; } }

/* Wire details, per-pin disconnect, reset */
.ports li { position: relative; }
.ports li .cut {
  position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 24px; height: 24px; border-radius: 8px; padding: 0;
  border: 1px solid var(--line); background: rgba(248, 113, 113, .08); color: #fca5a5; font-size: 13.5px; cursor: pointer;
}
.ports li .cut:hover { background: rgba(248, 113, 113, .25); border-color: rgba(248, 113, 113, .6); }
.wire-head { align-items: center; }
.wire-chip { width: 54px; height: 54px; border-radius: 14px; flex: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15); }
.wire-colors { display: flex; gap: 6px; margin-bottom: 4px; }
.wire-colors .sw { width: 26px; height: 26px; }
.btn.ghost.armed { color: #fecaca; border-color: rgba(248, 113, 113, .7); background: rgba(248, 113, 113, .16); }

/* ---------- Kodla step ---------- */
button.step { background: none; border: 0; padding: 4px 2px; cursor: pointer; font-family: inherit; }
button.step:hover { color: var(--text); }
.code-panel {
  position: fixed; left: 16px; top: 94px; bottom: 16px; width: min(54vw, 780px); z-index: 4; border-radius: var(--radius);
  display: none; flex-direction: column; overflow: hidden;
}
body.code .code-panel { display: flex; }
body.code .panel, body.code .dock, body.code .hint { display: none; }
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.cp-head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; }
.cp-head p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.cp-tools { display: flex; align-items: center; gap: 10px; }
.cp-ex { display: flex; flex-direction: column; gap: 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
.cp-ex select {
  height: 40px; min-width: 170px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 600 14px var(--font-body, inherit); padding: 0 8px; text-transform: none; letter-spacing: 0;
}
#cp-run { height: 44px; padding: 0 18px 0 14px; font-size: 15px; }
body.sim #cp-run { background: linear-gradient(180deg, #f87171, #dc2626); box-shadow: 0 10px 28px rgba(220, 38, 38, .35); }
body.sim #cp-run svg path { d: path("M7 7h10v10H7z"); }
.cp-warn { margin: 10px 14px 0; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; color: #fde68a; background: rgba(255, 209, 102, .08); border: 1px solid rgba(255, 209, 102, .3); }
.cp-warn b { margin-right: 4px; }
.cp-warn .link { background: none; border: 0; color: var(--orange-2); font-weight: 700; padding: 0; cursor: pointer; text-decoration: underline; }
.cp-blockly { flex: 1; min-height: 0; margin-top: 10px; }
.cp-blockly .blocklyToolboxDiv { padding-top: 6px; }
.cp-blockly .blocklyTreeRow { height: 34px; line-height: 34px; margin-bottom: 2px; border-radius: 0 10px 10px 0; }
.cp-blockly .blocklyTreeLabel { font: 600 14px Figtree, Arial, sans-serif; }

/* Serial monitor in the drive HUD */
.dh-serial-wrap { margin-top: 10px; }
.dh-serial-head { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; margin-bottom: 4px; }
.dh-serial-head span { text-transform: none; letter-spacing: 0; color: var(--green); }
#dh-serial, #ah-serial {
  margin: 0; height: 120px; overflow: auto; padding: 8px 10px; border-radius: 10px; background: #070a1f; border: 1px solid var(--line);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: #b8f5d0; white-space: pre-wrap;
}
@media (max-width: 760px) {
  .code-panel { left: 10px; right: 10px; width: auto; top: 76px; bottom: 45vh; }
  .cp-ex span { display: none; }
}
#drive-hud [hidden], #arm-hud [hidden] { display: none !important; }
/* Robot arm test: one slider per joint */
.ah-joint { margin: 8px 0 0; }
.ah-joint span { width: 52px; }
.ah-joint b { width: 40px; }
.ah-joint input:disabled { opacity: .55; }
/* The icon rule (svg { stroke: currentColor }) must not outline Blockly's text and shapes */
.cp-blockly svg, .blocklyWidgetDiv svg, .blocklyDropDownDiv svg, .blocklyTooltipDiv svg { stroke: none; stroke-width: 1; }
.cp-blockly .blocklyEditableText > .blocklyText:not(.blocklyDropdownText) { font-weight: 700; }
.cp-warn .link { display: inline-flex; align-items: center; min-height: 40px; }

/* Locked "Yarış" step: a click explains why it is locked (app.js → bindRaceLock) */
button.step.lock { cursor: help; }
.lock-pop {
  position: fixed; z-index: 12; width: min(320px, calc(100vw - 24px)); padding: 16px 18px; display: grid; gap: 8px; justify-items: start;
  border-radius: 16px; background: #1b1f4a; border: 1px solid rgba(242, 106, 27, .45); box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}
.lock-pop[hidden] { display: none; }
.lock-pop b { font-family: var(--font-display); font-size: 16px; }
.lock-pop p { margin: 0; font-size: 14px; line-height: 1.5; color: #d6d9f2; }
.lock-pop strong { color: var(--text); }
.lock-pop .btn { margin-top: 4px; height: 40px; padding: 0 20px; }

/* "Neden çalışmadı?" box (app.js → renderWhy): problems stay until fixed or "Anladım" */
.why {
  position: fixed; left: 16px; bottom: 16px; z-index: 7; width: 264px; max-height: 46vh; display: flex; flex-direction: column;
  border-radius: 16px; background: #1b1f4a; border: 1px solid rgba(251, 191, 36, .5); box-shadow: 0 18px 44px rgba(0, 0, 0, .5); overflow: hidden;
}
.why[hidden] { display: none; }
body.code .why { left: auto; right: 16px; bottom: 140px; }
.why-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; background: none;
  color: #fde68a; font: 700 15px var(--font-display, inherit); cursor: pointer; text-align: left;
}
.why-head::after { content: '▾'; color: var(--muted); margin-left: auto; }
.why:not(.open) .why-head::after { content: '▴'; }
.why-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: rgba(251, 191, 36, .2); color: #fde68a; font-size: 13px; display: grid; place-items: center; }
.why-list { list-style: none; margin: 0; padding: 0 12px 12px; display: grid; gap: 8px; overflow-y: auto; }
.why:not(.open) .why-list { display: none; }
.why-item { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); display: grid; gap: 6px; justify-items: start; }
.why-item.err { border-color: rgba(248, 113, 113, .45); }
.why-item p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text); }
.why-item ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; color: #d6d9f2; }
.why-ok { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; }
@media (max-width: 1100px) and (min-width: 761px) { .why { bottom: 96px; } }
@media (max-width: 760px) {
  .why { left: 10px; right: 10px; width: auto; bottom: 222px; max-height: 40vh; }
  body.code .why { left: 10px; right: 10px; bottom: 16px; }
}

/* First-run guide (tour.js) */
#tour { position: fixed; inset: 0; z-index: 60; }
#tour.dim { background: rgba(5, 6, 20, .72); }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(5, 6, 20, .72); outline: 3px solid rgba(242, 106, 27, .9); outline-offset: 2px; transition: all .25s ease; pointer-events: auto; }
.tour-hole[hidden] { display: none; }
.tour-bubble {
  position: fixed; width: min(340px, calc(100vw - 24px)); padding: 18px 20px; display: grid; gap: 8px;
  border-radius: 18px; background: #1b1f4a; border: 1px solid rgba(242, 106, 27, .55); box-shadow: 0 22px 50px rgba(0, 0, 0, .55);
}
.tour-count { font-size: 13px; font-weight: 700; color: #ffb070; }
.tour-bubble b { font-family: var(--font-display); font-size: 19px; }
.tour-text { margin: 0; font-size: 15px; line-height: 1.5; color: #d6d9f2; }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.tour-skip, .tour-back { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; }
.tour-skip { margin-right: auto; }
.tour-back[hidden], .tour-skip[hidden] { display: none; }
.tour-skip[hidden] + .tour-back { margin-left: auto; }
.tour-next { height: 42px; padding: 0 20px; margin-left: auto; }
.tour-back:not([hidden]) + .tour-next { margin-left: 0; }
