:root {
  /* Açık tema: yumuşak mavi-gri zemin, beyaz kartlar, koyu lacivert yazı */
  --bg: #eef3fa;
  --card: #ffffff;
  --card-hover: #f3f7fd;
  --card-active: #e6eef9;
  --surface: #e4ebf5;
  --input-bg: #ffffff;
  --line: #d3dde9;
  --text: #16243a;
  --muted: #55647a;
  --accent: #1f6fd6;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefc;
  --ok: #15803d;
  --ok-bg: #e5f6ea; --ok-line: #a5d8b5; --ok-text: #14532d;
  --err-bg: #fdecea; --err-line: #efb3ae; --err-text: #8f1d15; --err: #d92d20;
  --warn-bg: #fff5d9; --warn-line: #e6c565; --warn-text: #6b4e00;
  --chip-bg: #e4ebf5;
  --lcd-bg: #cdd8f3;
  --lcd-ink: #232b52;
  color-scheme: light;
}

* { box-sizing: border-box; }

button, summary { touch-action: manipulation; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 max(12px, env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom));
}

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

.top { padding: 10px 0 6px; }
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: none; font-weight: 600; }
.back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.top h1 { font-size: 1rem; color: var(--muted); font-weight: 600; }

main { display: grid; gap: 12px; max-width: 1100px; margin: 0 auto; }
.top, footer { max-width: 1100px; margin-inline: auto; }

.side { display: grid; gap: 12px; align-content: start; }

@media (min-width: 900px) {
  main { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); align-items: start; }
  .stage { position: sticky; top: 12px; }
}

.label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: 0 1px 2px rgba(22, 36, 58, 0.05); }

/* ---------- LCD ---------- */

.lcd-body {
  background: var(--lcd-bg);
  color: var(--lcd-ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  font-weight: 600;
  white-space: pre;
  overflow: hidden;
  line-height: 1.22;
}
.lcd-title { border-bottom: 0.08em solid var(--lcd-ink); margin-bottom: 0.15em; }
.lcd-line { min-height: 1.22em; }
.inv { background: var(--lcd-ink); color: var(--lcd-bg); }

.zoom { margin-bottom: 10px; }
@media (min-width: 700px) { .zoom { display: none; } }
.zoom .lcd-body {
  border-radius: 10px;
  border: 3px solid #8fa0bd;
  padding: 0.45em 0.7em;
  /* 20 karakter × 0.6em + dolgu ekrana sığacak şekilde */
  font-size: min(26px, calc((100vw - 60px) / 13));
  max-width: 420px;
}

/* ---------- Panel (gerçek cihaz görseli + katmanlar) ---------- */

.panel {
  position: relative;
  container-type: inline-size;
  max-width: 669px;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.panel img { display: block; width: 100%; height: auto; pointer-events: none; }

.panel-lcd {
  position: absolute;
  left: 32.2%; top: 24.6%; width: 35.6%; height: 25.3%;
  border-radius: 1.6cqw;
  padding: 0.7cqw 1.2cqw;
  font-size: 2.62cqw;
}

.led {
  position: absolute;
  width: 2.2%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #2b2b2b;
  border: 0.25cqw solid #111;
}
.led.on.green { background: #35e06a; box-shadow: 0 0 1.6cqw 0.5cqw rgba(53, 224, 106, 0.75); }
.led.on.red { background: #ff3b30; box-shadow: 0 0 1.6cqw 0.5cqw rgba(255, 59, 48, 0.75); }
.led.on.yellow { background: #ffe14a; box-shadow: 0 0 1.6cqw 0.5cqw rgba(255, 225, 74, 0.75); }
.led.blink { animation: blink 1s steps(2, start) infinite; }

@keyframes blink { to { visibility: hidden; } }

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.hotspot::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 3px solid transparent;
}
.hotspot.pressed::after { background: rgba(255, 255, 255, 0.28); }
.hotspot:focus-visible::after { border-color: #fff; }
.hotspot.hl::after { border-color: #ffc53d; animation: pulse 1s ease-in-out infinite; }
body.debug .hotspot::after { border-color: #0ff; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 61, 0.9); }
  50% { box-shadow: 0 0 0 9px rgba(255, 197, 61, 0); }
}

.horn {
  position: absolute;
  left: 50%; top: 3%;
  transform: translateX(-50%);
  background: #ff3b30;
  color: #fff;
  font-size: max(11px, 2.4cqw);
  font-weight: 700;
  padding: 0.2em 0.8em;
  border-radius: 99px;
  animation: blink 0.8s steps(2, start) infinite;
}

/* ---------- Koç ---------- */

.coach h2 { font-size: 1.05rem; margin-bottom: 4px; }
.coach .step-no { color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.coach .step-text { font-size: 1.08rem; margin: 4px 0 0; animation: step-in 0.45s ease-out; }
@keyframes step-in { from { background: rgba(74, 222, 128, 0.28); } to { background: transparent; } }
.coach .step-action { margin-top: 12px; width: 100%; text-align: center; }
.coach .intro { color: var(--muted); margin-bottom: 6px; }
.coach .hint { margin-top: 8px; color: var(--warn-text); font-size: 0.92rem; }
.coach .fail { margin-top: 8px; color: var(--err-text); }
.coach .done-title { color: var(--ok); font-weight: 700; }
.coach .password { margin-top: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.coach .password b { color: var(--text); letter-spacing: 0.3em; }

.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px auto 0; max-width: 669px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.hold-box { margin-top: 12px; }
.hold-box p { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }

.btn {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--card-hover); }
.btn:active, .btn.pressed { background: var(--card-active); }
.btn:focus-visible, .task:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #1a5fb8; }
.btn.primary:active { background: #164f9a; }
.btn.hold { width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn.hl { border-color: var(--accent); animation: pulse 1s ease-in-out infinite; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .btn { flex: 1 1 140px; font-size: 0.92rem; }

.tools summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.tools .intro { color: var(--muted); font-size: 0.9rem; margin: 6px 0 4px; }
.tools .label { margin-top: 14px; }

/* ---------- Görevler ---------- */

#tasks h2 { font-size: 1.1rem; margin-bottom: 4px; }
#tasks h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 6px; }
.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.task::after { content: "›"; color: var(--accent); font-size: 1.4rem; line-height: 1; }
.task:hover { background: var(--card-hover); }

footer { color: var(--muted); font-size: 0.8rem; padding: 16px 2px 0; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .coach .step-text { animation: none; }
  .hotspot.hl::after, .btn.hl { animation: none; box-shadow: 0 0 0 4px rgba(255, 197, 61, 0.6); }
  .horn { animation: none; }
}

.page-home { display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 22px auto 0; max-width: 320px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; text-decoration: none; }
.page-home:hover { background: var(--card-hover); }
.page-home:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.top-nav { display: flex; align-items: center; gap: 16px; }
