/* Logic Ninja */

* { box-sizing: border-box; }

.ln-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #e6e9f2;
    background: linear-gradient(180deg, #070b1c 0%, #0c1230 55%, #141b3e 100%);
    overflow: hidden;
}

#ln-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---------- header ---------- */

.ln-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 26px 6px;
    flex: 0 0 auto;
}

.ln-wordmark {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ln-wordmark span {
    margin-left: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #9aa3c7;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ln-header-right {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 13px;
    color: #9aa3c7;
}

.ln-counter { font-variant-numeric: tabular-nums; }

.ln-header-link {
    color: #6db8d8;
    font-size: 13px;
    text-decoration: none;
}

.ln-header-link:hover { color: #9fd8f0; text-decoration: underline; }

/* ---------- house ---------- */

.ln-house-viewport {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ln-house-wrap {
    width: min(92vw, 112vh);
    transition: transform 0.75s cubic-bezier(0.5, 0, 0.2, 1);
    will-change: transform;
}

.ln-house { width: 100%; height: auto; display: block; }

.ln-room-glow { opacity: 0; transition: opacity 0.8s ease; }

/* the moon (night finale): dim until reachable, halo pulses when active */
.ln-moon-body { opacity: 0.85; transition: opacity 0.8s ease; }
.ln-room-moon.locked .ln-moon-body { opacity: 0.3; }
.ln-room-moon.complete .ln-room-glow { opacity: 0.9; }

/* ---------- three laps, one map ---------- */

/* celestial slots belong to their lap's sky */
.ln-house:not(.mode-night) .ln-room-moon { display: none; }
.ln-house:not(.mode-day) .ln-room-sun { display: none; }
.ln-room-sun .ln-sun-body, .ln-room-sun .ln-sun-rays { opacity: 0.9; transition: opacity 0.8s ease; }
.ln-room-sun.locked .ln-sun-body, .ln-room-sun.locked .ln-sun-rays { opacity: 0.35; }
.ln-room-sun.complete .ln-room-glow { opacity: 0.9; }

/* the tree only becomes a level on the year lap */
.ln-house:not(.mode-year) .ln-room-tree .ln-room-glow { display: none; }
.ln-house:not(.mode-year) .ln-room-tree .ln-room-hit { pointer-events: none; }
.mode-year .ln-tree-foliage circle { fill: #8a5a2a; transition: fill 1.2s ease; }
.ln-room-tree.complete .ln-tree-foliage circle { fill: #3f7d4e; }

/* day lap: stars off, brighter world */
.mode-day .ln-stars { display: none; }
.mode-year .ln-stars { display: none; }

body.ln-mode-day {
    background: linear-gradient(180deg, #4a86b8 0%, #7db4e0 55%, #a8d4ee 100%);
}

body.ln-mode-year {
    background: linear-gradient(180deg, #3c4a7a 0%, #7a6a9e 55%, #d8926a 100%);
}

.ln-room.complete .ln-room-glow { opacity: 0.75; }

.ln-room.active .ln-room-glow { animation: ln-pulse 2.4s ease-in-out infinite; }
.ln-room.active:hover .ln-room-glow { animation: none; opacity: 0.45; }

.ln-room.active .ln-room-hit,
.ln-room.complete .ln-room-hit { cursor: pointer; }

@keyframes ln-pulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.28; }
}

.ln-stars circle { animation: ln-twinkle 4s ease-in-out infinite; }
.ln-stars circle:nth-child(3n) { animation-delay: 1.3s; }
.ln-stars circle:nth-child(3n + 1) { animation-delay: 2.6s; }

@keyframes ln-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.ln-room-label {
    position: absolute;
    transform: translate(-50%, -100%);
    background: #ffd98a;
    color: #2a1f07;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 18px rgba(255, 217, 138, 0.25);
}

/* ---------- task view ---------- */

/* display rules below override the hidden attribute unless restated */
.ln-task-view[hidden],
.ln-task-done[hidden],
.ln-result[hidden] {
    display: none;
}

.ln-task-view {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 22, 0.88);
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 20;
}

.ln-task-view.open { opacity: 1; }

.ln-task-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 26px;
    flex: 0 0 auto;
}

.ln-task-title { font-size: 16px; font-weight: 600; }

.ln-back {
    background: none;
    border: 1px solid #39406b;
    color: #b7bedf;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.ln-back:hover { background: #1a2145; color: #fff; }

.ln-task-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0 26px 26px;
}

.ln-coming-soon {
    margin: 12vh auto 0;
    text-align: center;
    font-size: 22px;
    color: #9aa3c7;
}

.ln-task-done {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 22, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.ln-task-done-card {
    background: #161d3d;
    border: 1px solid #2c3663;
    border-radius: 16px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ln-task-done-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* ---------- game layout ---------- */

.ln-game {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 1320px;
    margin: 0 auto;
    height: 100%;
}

/* instruction spans both columns, larger */
.ln-brief {
    font-size: 19px;
    line-height: 1.45;
    color: #e6e9f2;
    margin: 2px 4px 0;
}

.ln-game-body {
    display: flex;
    flex-wrap: wrap; /* narrow screens: the side column drops below, the canvas never collapses */
    gap: 22px;
    flex: 1 1 auto;
    align-items: flex-start;
    min-height: 0;
}

.ln-game-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 420px;
}

.ln-game-side {
    flex: 0 0 680px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ln-scene-holder {
    height: 425px;
    background: #0d1129;
    border: 1px solid #262e56;
    border-radius: 14px;
    overflow: hidden;
}

/* room fills the panel (680x425 matches the 640x400 viewBox aspect) */
.ln-scene { display: block; width: 100%; height: 100%; }

.ln-result { margin-top: 14px; }

.ln-result-line {
    font-size: 15px;
    padding: 4px 2px;
}

.ln-result-line.pass::before { content: '\2714\00a0\00a0'; color: #7ce38b; }
.ln-result-line.fail::before { content: '\2716\00a0\00a0'; color: #ff8080; }
.ln-result-line.success { color: #ffd98a; font-weight: 600; }
.ln-result-line.info { color: #9aa3c7; }

.ln-area-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9aa3c7;
    padding-left: 2px;
}

.ln-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ln-run {
    align-self: flex-start;
    background: #14a3a8;
    border: none;
    color: #04252a;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 44px;
    border-radius: 10px;
    cursor: pointer;
}

.ln-run:hover:not(:disabled) { background: #19bfc5; }
.ln-run:disabled { opacity: 0.45; cursor: default; }

.ln-stop {
    align-self: flex-start;
    background: #c0392b;
    border: none;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 44px;
    border-radius: 10px;
    cursor: pointer;
}

.ln-stop:hover:not(:disabled) { background: #d94436; }
.ln-stop:disabled { opacity: 0.45; cursor: default; }

.ln-done-back {
    background: #14a3a8;
    border: none;
    color: #04252a;
    font-size: 15px;
    font-weight: 700;
    padding: 11px 32px;
    border-radius: 10px;
    cursor: pointer;
}

.ln-done-back:hover { background: #19bfc5; }

/* ---------- program canvas (free placement) ---------- */

.ln-canvas {
    position: relative;
    height: 425px;
    border-radius: 14px;
    background-color: #0e1329;
    background-image: radial-gradient(circle, #222c52 1.2px, transparent 1.2px);
    background-size: 22px 22px;
    border: 1px solid #262e56;
    overflow: hidden;
}

.ln-canvas.ln-drop-active { border-color: #14a3a8; }

.ln-canvas.ln-canvas-empty::before {
    content: 'Drag blocks here, then wire them from Start to Stop.';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #5a648c;
    font-size: 14px;
    text-align: center;
    width: 80%;
    pointer-events: none;
}

/* Blocks palette (side rail) */
.ln-tray {
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: #10152f;
    border: 1px solid #262e56;
}

.ln-tray:empty {
    border: 2px dashed #39406b;
    background: transparent;
}

.ln-tray.ln-drop-target { border-color: #e06666; }

.ln-piece {
    position: relative;
    padding: 11px 18px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #f2f4fb;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

/* placed blocks are positioned freely on the canvas */
.ln-canvas > .ln-piece { position: absolute; margin: 0; }

.ln-piece.ln-dragging { z-index: 60; opacity: 0.92; cursor: grabbing; }

.ln-piece-start,
.ln-piece-stop,
.ln-piece-return {
    background: #1d6a41;
    border: 2px solid #3fb46b;
    border-radius: 999px;
}

/* process = rectangle */
.ln-piece-process {
    background: #7c5514;
    border: 2px solid #e8a33d;
    border-radius: 2px;
}

/* input/output = parallelogram (drawn on a layer so ports stay unclipped) */
.ln-piece-output {
    background: none;
    border: none;
    padding-left: 26px;
    padding-right: 26px;
}

.ln-piece-output::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #96690f;
    clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%);
}

/* decision = diamond; Y leaves the bottom vertex, N leaves the side vertex */
.ln-piece-decision {
    background: none;
    border: none;
    padding: 18px 34px;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* diamond drawn on a layer so clip-path cannot clip the Y/N ports */
.ln-piece-decision::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #2e5da8;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.ln-piece-label { position: relative; z-index: 1; }

.ln-piece-wait {
    background: #4b4470;
    border: 2px solid #8b7fc0;
    border-radius: 8px;
}

/* counter blocks = process rectangles, teal family so they read as one kind */
.ln-piece-set-counter,
.ln-piece-add-counter {
    background: #185e63;
    border: 2px solid #2fb0b6;
    border-radius: 2px;
}

/* read (input) and display (output of a variable) = I/O parallelograms */
.ln-piece-read,
.ln-piece-display {
    background: none;
    border: none;
    padding-left: 26px;
    padding-right: 26px;
}

.ln-piece-read::before,
.ln-piece-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #96690f;
    clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%);
}

/* for-each loop header = diamond in the counter-teal family */
.ln-piece-foreach {
    background: none;
    border: none;
    padding: 18px 34px;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ln-piece-foreach::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #185e63;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

/* locked (prewired) pieces: fixed in place */
.ln-piece.ln-locked { cursor: default; }
.ln-piece.ln-locked .ln-piece-label { opacity: 0.92; }

/* the Trace Table (Pearson 1.2.4) - the watch window */
.ln-trace {
    max-height: 220px;
    overflow: auto;
    background: #10152f;
    border: 1px solid #262e56;
    border-radius: 12px;
    padding: 10px 12px;
}

.ln-trace table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.ln-trace th {
    text-align: left;
    color: #9aa3c7;
    font-weight: 600;
    padding: 3px 10px 5px 2px;
    border-bottom: 1px solid #262e56;
}

.ln-trace td { padding: 3px 10px 3px 2px; color: #e6e9f2; }
.ln-trace .ln-trace-block { color: #8b93b8; }
.ln-trace .ln-trace-changed { color: #ffd98a; font-weight: 700; }

/* subroutine call = rectangle with double side bars */
.ln-piece-call {
    background: #5b2f7d;
    border: 2px solid #a86ad0;
    border-left: 6px double #a86ad0;
    border-right: 6px double #a86ad0;
    border-radius: 2px;
}

.ln-fixed { pointer-events: none; }

.ln-routine-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px;
    border: 1px dashed #39406b;
    border-radius: 10px;
}

.ln-routine-body .ln-piece { position: relative; cursor: default; }

/* student-built sub-flowchart: a smaller canvas in the side rail */
.ln-routine-canvas.ln-canvas { height: 320px; }

.ln-test-caption {
    display: inline-block;
    align-self: flex-start;
    background: rgba(255, 217, 138, 0.14);
    color: #ffd98a;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    margin: 0 0 10px 2px;
}

/* ---------- connections ---------- */

.ln-links {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.ln-link-line { stroke: #8b93b8; stroke-width: 2.5; fill: none; }
.ln-link-head { fill: #8b93b8; }

.ln-link-y .ln-link-line { stroke: #3fb46b; }
.ln-link-y .ln-link-head { fill: #3fb46b; }
.ln-link-n .ln-link-line { stroke: #e06666; }
.ln-link-n .ln-link-head { fill: #e06666; }

.ln-link-hit {
    stroke: transparent;
    stroke-width: 16;
    pointer-events: stroke;
    cursor: pointer;
    fill: none;
}

/* Yes/No letter beside the decision exit, flowchart convention */
.ln-link-label {
    font-size: 11px;
    font-weight: 700;
    fill: #9aa3c7;
}

.ln-link-y .ln-link-label { fill: #3fb46b; }
.ln-link-n .ln-link-label { fill: #e06666; }

.ln-link:hover .ln-link-line { stroke: #ff8080; }
.ln-link:hover .ln-link-head { fill: #ff8080; }

.ln-link-ghost {
    stroke: #ffd98a;
    stroke-width: 2.5;
    stroke-dasharray: 6 5;
    fill: none;
}

.ln-port {
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #10152f;
    border: 2px solid #8b93b8;
    cursor: crosshair;
    z-index: 2;
    font-size: 9px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    color: #dfe4f5;
}

/* decision exits: Y from the bottom vertex, N from the side vertex */
.ln-port-y { left: 50%; border-color: #3fb46b; }

.ln-port-n {
    left: auto;
    right: -8px;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    border-color: #e06666;
}

.ln-port:hover,
.ln-port.armed {
    border-color: #ffd98a;
    background: #3a3355;
    box-shadow: 0 0 10px rgba(255, 217, 138, 0.6);
}

.ln-tray .ln-port { display: none; }

.ln-piece.ln-connect-target {
    outline: 2px dashed #ffd98a;
    outline-offset: 3px;
}

.ln-canvas.ln-disabled .ln-link-hit { pointer-events: none; }

.ln-piece.ln-running {
    box-shadow: 0 0 0 3px #ffd98a, 0 0 22px rgba(255, 217, 138, 0.55);
}

.ln-drag-ghost {
    position: fixed;
    z-index: 999;
    pointer-events: none;
    opacity: 0.9;
    transform: scale(1.04);
}

.ln-drag-origin { opacity: 0.3; }

.ln-disabled .ln-piece { pointer-events: none; cursor: default; }

/* ---------- living room scene states ---------- */

.lr-lamp-glow,
.lr-ambient,
.lr-tv-picture,
.lr-tv-halo {
    opacity: 0;
    transition: opacity 0.7s ease;
}

.lr-lamp-shade { transition: fill 0.7s ease; }

.ln-scene.on-lamp .lr-lamp-glow { opacity: 1; }
.ln-scene.on-lamp .lr-ambient { opacity: 0.13; }
.ln-scene.on-lamp .lr-lamp-shade { fill: #ffd98a; }

.ln-scene.on-tv .lr-tv-picture { opacity: 1; }
.ln-scene.on-tv .lr-tv-halo { opacity: 0.8; }

/* ---------- kitchen scene states ---------- */

.k-warn-glow, .k-buzz, .k-fridge-inside, .k-ambient {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.k-warn-dome { transition: fill 0.4s ease; }

.k-door {
    transform-box: fill-box;
    transform-origin: left center;
    transition: transform 0.5s ease;
}

.ln-scene.in-door_open .k-door { transform: translateX(-96px) scaleX(0.22); }
.ln-scene.in-door_open .k-fridge-inside { opacity: 0.9; }

.ln-scene.on-warning_light .k-warn-glow { opacity: 1; }
.ln-scene.on-warning_light .k-warn-dome { fill: #ff5a5a; }
.ln-scene.on-warning_light .k-ambient { opacity: 0.07; }

.ln-scene.on-buzzer .k-buzz { opacity: 1; animation: ln-buzz 0.5s ease-in-out infinite; }

@keyframes ln-buzz {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* ---------- bathroom scene states (fast: it flashes) ---------- */

.b-mirror-glow { opacity: 0; transition: opacity 0.12s ease; }
.b-strip, .b-mirror { transition: fill 0.12s ease; }

.ln-scene.on-mirror_light .b-mirror-glow { opacity: 0.9; }
.ln-scene.on-mirror_light .b-strip { fill: #ffe9b0; }
.ln-scene.on-mirror_light .b-mirror { fill: #2c3d6e; }

/* ---------- bedroom scene states ---------- */

.bd-night { opacity: 0; transition: opacity 0.7s ease; }
.ln-scene.in-dark .bd-night { opacity: 1; }

.bd-person { opacity: 0; transition: opacity 0.4s ease; }
.ln-scene.in-motion .bd-person { opacity: 1; animation: ln-sway 1.2s ease-in-out infinite; }

@keyframes ln-sway {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-7px); }
}

.bd-glow, .bd-ambient { opacity: 0; transition: opacity 0.5s ease; }
.bd-shade { transition: fill 0.5s ease; }

.ln-scene.on-night_light .bd-glow { opacity: 1; }
.ln-scene.on-night_light .bd-shade { fill: #ffd98a; }
.ln-scene.on-night_light .bd-ambient { opacity: 0.1; }

/* ---------- study scene states (quick: it reacts live) ---------- */

.st-person { opacity: 0; transition: opacity 0.3s ease; }
.ln-scene.in-at_desk .st-person { opacity: 1; }

.st-glow, .st-cone, .st-ambient { opacity: 0; transition: opacity 0.3s ease; }
.st-head { transition: fill 0.3s ease; }

.ln-scene.on-desk_lamp .st-glow { opacity: 1; }
.ln-scene.on-desk_lamp .st-cone { opacity: 0.5; }
.ln-scene.on-desk_lamp .st-head { fill: #ffd98a; }
.ln-scene.on-desk_lamp .st-ambient { opacity: 0.07; }

/* ---------- whole-house scene states ---------- */

.h-night { opacity: 1; transition: opacity 1.6s ease; }
.ln-scene.in-morning .h-night { opacity: 0; }

.h-porch-glow, .h-alarm-glow, .h-ambient { opacity: 0; transition: opacity 0.15s ease; }
.h-porch-lamp { transition: fill 0.15s ease; }
.h-alarm-dome { transition: fill 0.15s ease; }

.ln-scene.on-porch_light .h-porch-glow { opacity: 1; }
.ln-scene.on-porch_light .h-porch-lamp { fill: #ffd98a; }

.ln-scene.on-alarm .h-alarm-glow { opacity: 1; animation: ln-buzz 0.5s ease-in-out infinite; }
.ln-scene.on-alarm .h-alarm-dome { fill: #ff5a5a; }
.ln-scene.on-alarm .h-ambient { opacity: 0.07; }

.h-person { opacity: 0; transition: opacity 0.4s ease; }
.ln-scene.in-motion .h-person { opacity: 1; animation: ln-sway 1.2s ease-in-out infinite; }

/* ---------- garage scene states ---------- */

.g-door { transition: transform 1.4s ease-in-out; }
.ln-scene.on-garage_door .g-door { transform: translateY(-200px); }

.g-lampglow, .g-ambient { opacity: 0; transition: opacity 0.12s ease; }
.g-lamp { transition: fill 0.12s ease; }

.ln-scene.on-outside_light .g-lampglow { opacity: 1; }
.ln-scene.on-outside_light .g-lamp { fill: #ffd98a; }
.ln-scene.on-outside_light .g-ambient { opacity: 0.06; }

/* ---------- Pycto Code (Parsons) ---------- */

.ln-levels {
    max-width: 560px;
    margin: 30px auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ln-level-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #10152f;
    border: 1px solid #262e56;
    border-radius: 12px;
    color: #e6e9f2;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.ln-level-card.locked { opacity: 0.4; cursor: default; }
.ln-level-card.active { border-color: #ffd98a; box-shadow: 0 0 14px rgba(255, 217, 138, 0.15); }
.ln-level-card.complete { border-color: #3fb46b; }
.ln-level-card:not(.locked):hover { background: #161d3d; }

.ln-level-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #262e56;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.ln-level-name { flex: 1 1 auto; }
.ln-level-tick { color: #7ce38b; }

/* Parsons line list */
.ln-plist {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 14px;
    background: #0e1329;
    border: 1px solid #262e56;
}

.ln-plist-indent {
    background-image: repeating-linear-gradient(90deg, #1a2142 0 1px, transparent 1px 28px);
    background-origin: content-box;
}

.ln-pline {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 14.5px;
    color: #e6e9f2;
    background: #1a2142;
    border: 1px solid #333c66;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    width: fit-content;
    min-width: 60%;
    transition: margin-left 0.12s ease;
}

.ln-pline.ln-pline-wrong { border-color: #e06666; }

/* while dragging, the origin becomes the drop slot: it sits at the exact
   position AND indent the line will land in when released */
.ln-pline.ln-drag-origin {
    opacity: 1;
    border: 1.5px dashed #14a3a8;
    background: rgba(20, 163, 168, 0.12);
}
.ln-pline.ln-drag-origin > code { visibility: hidden; }
.ln-disabled .ln-pline { pointer-events: none; cursor: default; }

/* fixed Python prompt + output console */
.ln-codeview {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 14px;
    color: #d9deef;
    background: #0e1329;
    border: 1px solid #262e56;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 0;
    overflow-x: auto;
}

.ln-console {
    min-height: 90px;
    max-height: 220px;
    overflow: auto;
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 13.5px;
    color: #b8e6c9;
    background: #0a0e20;
    border: 1px solid #262e56;
    border-radius: 12px;
    padding: 10px 14px;
}

.ln-console .ln-console-head { color: #9aa3c7; margin-top: 4px; }
.ln-console .ln-console-err { color: #ff9090; }

/* read-only reference flowchart beside the Python */
.ln-ref-canvas.ln-canvas { height: 430px; }
.ln-ref-canvas.ln-disabled .ln-piece { opacity: 1; }

/* flowchart direction: the code prompt is narrow, the canvas is the workspace */
.ln-game-side.ln-side-code { flex: 0 0 400px; }

/* ---------- misc ---------- */

@media (prefers-reduced-motion: reduce) {
    .ln-house-wrap, .ln-task-view { transition: none; }
    .ln-room.active .ln-room-glow { animation: none; opacity: 0.3; }
    .ln-stars circle { animation: none; }
}

@media (max-width: 980px) {
    .ln-game { grid-template-columns: 1fr; }
}
