/* מסך Dragon 32: משותף לכל דף שמציב מחשב (class="d32"). המבנה ב-docs/DRAGON.md. */
/* הצבעים הקבועים הם של המסך המקורי (ירוק עם אותיות כהות), לכן הם לא משתנים במצב לילה */
.d32 { margin-top: 26px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prose .d32-title { margin: 0 0 4px; font-size: 19px; }
.prose .d32-help { margin: 0 0 12px; font-size: 16px; color: var(--muted); }
.d32-tv { max-width: 560px; padding: 14px; background: #111; border-radius: 14px; box-shadow: 0 6px 18px var(--shadow); }
.d32-screen {
  position: relative; background: #13d613; color: #032a03; padding: 10px 12px; border-radius: 6px;
  font: 700 clamp(11px, 2.9vw, 15px)/1.35 'Courier New', ui-monospace, monospace; text-align: left;
  cursor: text; box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.28); min-height: calc(16 * 1.35em + 20px); box-sizing: border-box;
}
.prose .d32-out { margin: 0; border: 0; border-radius: 0; box-shadow: none; max-width: none; white-space: pre; overflow: hidden; font: inherit; color: inherit; background: none; padding: 0; }
.d32-prompt { display: block; }
.d32-input {
  width: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: inherit;
  font: inherit; text-transform: uppercase; caret-color: #032a03; outline: none;
}
/* הסמן המהבהב של ה-Dragon: מופיע כשאפשר להקליד ועוד לא התחלתם */
.d32-prompt { position: relative; }
.d32-prompt::after {
  content: ''; position: absolute; left: 0; top: 0.12em; width: 0.62em; height: 1.1em;
  background: currentColor; animation: dragon-blink 1s steps(1) infinite; pointer-events: none;
}
.d32-prompt.has-text::after, .d32.is-running .d32-prompt::after { display: none; }
/* כל עוד השורה ריקה, הריבוע המהבהב הוא הסמן; כשמתחילים להקליד חוזר הסמן הרגיל */
.d32-prompt:not(.has-text) .d32-input { caret-color: transparent; }
.d32-screen:focus-within { box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.28), 0 0 0 3px var(--focus); }
.d32-shelf { max-width: 560px; margin-top: 14px; }
.prose .d32-shelf-title { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.d32-tapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
/* קלטת: גוף כהה, תווית נייר בכתב יד, ושני גלגלים */
.d32-tape {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 8px 6px; cursor: pointer;
  background: #2b2f3a; border: 0; border-radius: 6px; box-shadow: 0 3px 8px var(--shadow); color: #1b2a4a; font: inherit;
}
.d32-tape:hover { transform: translateY(-2px); }
.d32-tape:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.d32-tape-label { background: #fff7c7; border-bottom: 3px solid #c23a27; padding: 5px 6px; font: 700 19px/1.05 var(--font-hand); text-align: center; color: #1b2a4a; }
.d32-tape-reels { display: flex; justify-content: center; gap: 26px; }
.d32-tape-reels i { width: 16px; height: 16px; border-radius: 50%; background: #e8e8e8; box-shadow: inset 0 0 0 4px #555; }
.d32-tape-file { font: 700 11px/1 'Courier New', ui-monospace, monospace; color: #c9cfdb; text-align: center; }
.d32.is-running .d32-tape-reels i { animation: d32-spin 0.6s linear infinite; background: conic-gradient(#555 0 25%, #e8e8e8 0 50%, #555 0 75%, #e8e8e8 0); }
@keyframes d32-spin { to { transform: rotate(360deg); } }
.d32-try { max-width: 560px; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.d32-try button {
  font: 600 13px/1.2 'Courier New', ui-monospace, monospace; padding: 7px 10px; border-radius: 6px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
.d32-try button:hover { border-color: var(--ink); }
.d32-try button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.d32-try .d32-break { display: none; border-color: var(--red); color: var(--red); }
.d32.is-running .d32-break { display: inline-block; }
.d32-screen.is-dark { color: #f2f2f2; }
.d32-screen.is-dark .d32-input { caret-color: #f2f2f2; }
.prose .d32-tip { margin: 10px 0 0; font-size: 14px; }
.d32-then { max-width: 560px; margin-top: 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card); }
.d32-then summary { cursor: pointer; padding: 10px 14px; font-weight: 700; color: var(--ink); }
.d32-then summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.prose .d32-then-lead { margin: 0 14px 12px; font-size: 16px; color: var(--ink-2); }
.d32-pair { margin: 0 14px 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.prose .d32-code { margin: 0; padding: 8px 10px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; background: #13d613; color: #032a03; border: 0; font-weight: 700; }
.prose .d32-now { margin: 8px 0 0; font-size: 16px; color: var(--ink); }
.d32:not(.is-ready) .d32-tv, .d32:not(.is-ready) .d32-try { display: none; }
@media (max-width: 640px) { .d32-tv { padding: 8px; border-radius: 10px; } .d32-screen { padding: 8px; } }

/* קישור מעמוד ההיסטוריה לחדר */
.prose .d32-room-link { margin: 14px 0 0; font-weight: 700; }

/* ---------- חדר ה-Dragon (/dragon/): מסך גדול יותר, מחסניות ומדריך ---------- */
.room-machine { padding-top: 6px; }
.d32-room { margin-top: 0; }
.d32-room .d32-tv, .d32-room .d32-shelf, .d32-room .d32-try, .d32-room .d32-then { max-width: 760px; }
.d32-room .d32-screen { font-size: clamp(11px, 2.9vw, 20px); }
.d32-carts { display: flex; gap: 12px; flex-wrap: wrap; }
/* מחסנית: קופסה אפורה, תווית נייר, ומגעים מוזהבים בתחתית */
.d32-cart {
  position: relative; width: 132px; min-height: 92px; border: 0; border-radius: 6px 6px 3px 3px; background: #3a3f4b; cursor: pointer;
  box-shadow: 0 3px 8px var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 18px; font: inherit;
}
.d32-cart::after { content: ''; position: absolute; bottom: 0; left: 18px; right: 18px; height: 9px; background: repeating-linear-gradient(90deg, #b8913a 0 5px, #3a3f4b 5px 8px); }
button.d32-cart:hover { transform: translateY(-2px); }
button.d32-cart:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.d32-cart-label { background: #fff7c7; color: #1b2a4a; font: 700 22px/1 var(--font-hand); padding: 6px 10px; border-bottom: 3px solid #c23a27; text-align: center; }
.d32-cart-file { font: 700 11px/1 'Courier New', ui-monospace, monospace; color: #c9cfdb; }
.d32-cart.is-empty { cursor: default; opacity: 0.55; }
.d32-cartshelf { margin-bottom: 4px; }

/* המסך הגרפי של המחסנית מחליף את מסך הטקסט */
.d32-canvas { display: none; width: 100%; height: auto; aspect-ratio: 4 / 3; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 6px; background: #000; }
.d32.is-cart .d32-screen { display: none; }
.d32.is-cart .d32-canvas { display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
/* כפתורי מגע: גדולים, בלי גלילה ובלי בחירת טקסט כשמחזיקים */
.d32-pad { display: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; max-width: 760px; margin-top: 12px; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.d32.is-cart .d32-pad { display: flex; }
.d32-pad-btn {
  flex: 1 1 0; min-width: 52px; min-height: 56px; border: 2px solid var(--ink); border-radius: 10px; background: var(--card); color: var(--ink);
  font: 700 20px/1 'Courier New', ui-monospace, monospace; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer;
}
.d32-pad-btn.is-down { background: var(--ink); color: var(--card); }
.d32-pad-fire { flex-grow: 1.6; border-color: var(--red); color: var(--red); }
.d32-pad-fire.is-down { background: var(--red); color: var(--on-red); }
.d32-eject { flex: 1 0 100%; padding: 8px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.d32-pad-btn:focus-visible, .d32-eject:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* בזמן משחק, הכפתורים של ה-BASIC והמדפים לא רלוונטיים */
.d32.is-cart .d32-try, .d32.is-cart .d32-tip { display: none; }
.d32-manual { margin: 14px 0; display: grid; gap: 8px; }
.d32-manual > div { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.d32-manual dt { font: 700 14px/1.4 'Courier New', ui-monospace, monospace; color: var(--ink); text-align: left; background: var(--code-bg); padding: 3px 8px; border-radius: 4px; }
.d32-manual dd { margin: 0; color: var(--ink-2); }
.room-back { margin: 0; font-weight: 700; }
@media (max-width: 560px) {
  .d32-manual > div { grid-template-columns: 1fr; gap: 4px; }
  .d32-manual dt { justify-self: start; }
}

/* ---------- הדלקה: המסך מתחיל כבוי, ומתחמם כמו טלוויזיה ישנה ---------- */
.d32-tv { position: relative; }
.d32-power { display: none; }
.d32.is-off .d32-screen { background: #0c0f0c !important; box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.04); }
.d32.is-off .d32-out, .d32.is-off .d32-prompt { visibility: hidden; }
.d32.is-off .d32-power {
  display: inline-flex; align-items: center; gap: 10px; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  padding: 12px 20px; border: 2px solid #3d3d3d; border-radius: 10px; background: #1d1d1d; color: #e8e8e8; font: 700 17px/1 var(--font-body); cursor: pointer; z-index: 1;
}
.d32-power:hover { border-color: #13d613; }
.d32-power:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.d32-power-led { width: 10px; height: 10px; border-radius: 50%; background: #5a1010; box-shadow: inset 0 0 2px #000; }
.d32.is-warming .d32-screen { animation: d32-warm 1s ease-out both; }
.d32.is-warming .d32-out, .d32.is-warming .d32-prompt { visibility: hidden; }
@keyframes d32-warm {
  0% { clip-path: inset(50% 0 50% 0); filter: brightness(3); }
  35% { clip-path: inset(49% 0 49% 0); filter: brightness(2.5); }
  70% { clip-path: inset(10% 0 10% 0); filter: brightness(1.4); }
  100% { clip-path: inset(0 0 0 0); filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) { .d32.is-warming .d32-screen { animation: none; } }

/* שיתוף בקישור */
.prose .d32-share-row { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 15px; }
.d32-share { padding: 7px 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.d32-share:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.d32-share-note { color: var(--muted); overflow-wrap: anywhere; }
.d32.is-cart .d32-share-row { display: none; }

/* ---------- תוכנית מעיתון: עמוד נייר עיתון ישן ---------- */
.mag-page {
  max-width: 760px; padding: clamp(18px, 4vw, 34px); background: #f4ecd2; color: #2a2418;
  border: 1px solid #d9cba0; box-shadow: 0 10px 24px var(--shadow); transform: rotate(-0.4deg);
  background-image: radial-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px); background-size: 4px 4px;
}
.mag-kicker { margin: 0; font: 700 12px/1 'Courier New', ui-monospace, monospace; letter-spacing: 2px; color: #8a2a1a; text-align: left; }
.mag-title { margin: 6px 0 12px; font: 900 clamp(30px, 7vw, 46px)/1 Georgia, 'Times New Roman', serif; text-align: left; color: #2a2418; }
.mag-lead { margin: 0 0 10px; font-size: 16px; line-height: 1.6; color: #3a3222; }
.mag-listing {
  margin: 14px 0; padding: 12px 14px; background: #fffaf0; border: 1px dashed #b9a875; color: #1c1a14;
  font: 700 clamp(12px, 3.2vw, 15px)/1.55 'Courier New', ui-monospace, monospace; white-space: pre-wrap; text-align: left; overflow-x: auto;
}
.mag-note { margin: 0 0 12px; font-size: 14px; color: #5a4e34; }
.mag-actions { margin: 0; }
.mag-typein { padding: 10px 16px; border: 2px solid #2a2418; border-radius: 8px; background: #2a2418; color: #f4ecd2; font: 700 16px/1 var(--font-body); cursor: pointer; }
.mag-typein:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { .mag-page { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); } }

/* ---------- היכל התהילה ---------- */
.d32-hof { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.d32-hof-card { background: #000; color: #13d613; border-radius: 8px; padding: 12px 14px; font-family: 'Courier New', ui-monospace, monospace; }
.prose .d32-hof-card h3 { margin: 0 0 8px; color: #f2f20e; font: 700 22px/1 var(--font-hand); }
.d32-hof-file { font: 700 11px/1 'Courier New', ui-monospace, monospace; color: #13d613; opacity: 0.7; }
.d32-hof-card ol { margin: 0; padding: 0 0 0 22px; font-weight: 700; }
.d32-hof-card li { padding: 2px 0; }
.d32-hof-card li span:first-child { display: inline-block; min-width: 4ch; }
.d32-hof-card li span:last-child { float: right; }
.prose .d32-hof-empty { margin: 0; font-size: 14px; color: #13d613; }

/* המסך הגרפי של ה-BASIC (PMODE/SCREEN) */
.d32-gcanvas { display: none; width: 100%; height: auto; aspect-ratio: 4 / 3; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 6px; background: #000; }
.d32.is-gfx .d32-screen { display: none; }
.d32.is-gfx .d32-gcanvas { display: block; }
