:root {
    --tight-gap: 0.42rem;
}

.page-container {
    padding: 0.35rem;
}

#game-container {
    margin-bottom: 0.35rem;
    max-width: 1120px;
}

.game-header {
    padding: 0.55rem 0.7rem;
}

.game-header h1 {
    font-size: 1.18rem;
}

.header-controls {
    gap: var(--tight-gap);
}

.btn-header,
.level-indicator-clickable {
    border-radius: 14px;
    font-size: 0.78rem;
    min-height: 36px;
    padding: 0.32rem 0.55rem;
}

.header-stats span {
    font-size: 0.7rem;
    padding: 0.28rem 0.46rem;
}

.home-screen {
    gap: 0.55rem;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
    padding: 0.6rem;
}

.home-hero,
.home-progress-card,
.home-stat {
    padding: 0.65rem;
}

.home-hero {
    grid-row: span 2;
}

.home-logo {
    font-size: 2.8rem;
}

.home-hero h2 {
    font-size: 1.55rem;
}

.home-copy {
    font-size: 0.9rem;
}

.home-system-line {
    font-size: 0.68rem;
    margin-top: 0.45rem;
    padding: 0.38rem 0.5rem;
}

.home-progress-track {
    height: 11px;
    margin: 0.55rem 0 0.35rem;
}

.home-stat span {
    font-size: 1.28rem;
}

.home-actions {
    gap: var(--tight-gap);
    grid-column: 1 / -1;
}

.game-main {
    align-items: start;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: minmax(280px, max-content) minmax(340px, 430px);
    justify-content: center;
    padding: 0.55rem;
}

.game-world {
    align-self: start;
    flex: initial;
    gap: 0.35rem;
    justify-items: center;
    max-width: 100%;
    padding: 0.45rem;
    width: fit-content;
}

.world-hud {
    gap: 0.3rem;
}

.world-hud span,
.world-terminal {
    font-size: 0.68rem;
    min-height: 28px;
    padding: 0.26rem 0.45rem;
}

.control-panel {
    align-self: start;
    gap: 0.45rem;
    max-width: 430px;
    padding: 0.55rem;
    width: 100%;
}

.control-panel h2 {
    display: none;
}

.mission-panel {
    padding: 0.48rem 0.55rem;
}

.mission-kicker {
    font-size: 0.64rem;
}

.mission-panel h3 {
    font-size: 0.88rem;
    margin: 0.12rem 0;
}

.mission-concept {
    font-size: 0.64rem;
    margin-bottom: 0.25rem;
    padding: 0.12rem 0.42rem;
}

.mission-panel p {
    font-size: 0.74rem;
    margin-bottom: 0.28rem;
}

.mission-objectives {
    display: grid;
    gap: 0.12rem 0.35rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-objectives li {
    font-size: 0.63rem;
}

.code-editor-wrapper {
    background: #263445;
    border: 2px solid #3e536c;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
    padding: 0.35rem;
}

.code-titlebar {
    align-items: center;
    color: #d6f5ed;
    display: grid;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.74rem;
    gap: 0.45rem;
    grid-template-columns: auto 1fr auto;
    padding: 0.18rem 0.2rem 0.45rem;
}

.code-titlebar strong {
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-dots {
    display: flex;
    gap: 0.24rem;
}

.code-dots span {
    border-radius: 50%;
    display: block;
    height: 9px;
    width: 9px;
}

.code-dots span:nth-child(1) { background: #e94e77; }
.code-dots span:nth-child(2) { background: #f5a623; }
.code-dots span:nth-child(3) { background: #50e3c2; }

#code-editor {
    background: #101a26;
    border: 1px solid #4a90e2;
    color: #e9f6ff;
    font-size: 0.88rem;
    height: 205px;
    line-height: 1.42;
    min-height: 205px;
    resize: vertical;
}

#code-editor::placeholder {
    color: #86a9cc;
    opacity: 1;
}

.error-feedback {
    background: transparent;
    color: #ff8dab;
    font-size: 0.75rem;
    margin-top: 0.3rem;
    min-height: 0;
}

.console-feedback {
    margin-top: 0.35rem;
    max-height: 58px;
    padding: 0.38rem;
}

.snippet-buttons {
    gap: 0.35rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.action-buttons {
    gap: 0.35rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.btn {
    font-size: 0.78rem;
    min-height: 36px;
    padding: 0.44rem 0.38rem;
}

.ad-container-bottom {
    margin-top: 0.25rem;
    padding: 0.3rem;
}

.ad-iframe-bottom {
    height: 64px;
}

.site-footer {
    font-size: 0.76rem;
    margin-top: 0.25rem;
}

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

    .home-hero {
        grid-row: auto;
    }

    .game-main {
        grid-template-columns: 1fr;
    }

    .game-world {
        justify-self: center;
    }

    .control-panel {
        justify-self: center;
        max-width: 620px;
    }
}

@media (max-width: 720px) {
    .page-container {
        padding: 0.2rem;
    }

    #game-container {
        border-radius: 8px;
    }

    .game-header {
        gap: 0.35rem;
        padding: 0.45rem;
    }

    .game-header h1 {
        font-size: 0.98rem;
        text-align: center;
        width: 100%;
    }

    .header-controls {
        align-items: stretch;
        display: grid;
        gap: 0.28rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .header-stats {
        display: grid;
        gap: 0.25rem;
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        justify-content: stretch;
        width: 100%;
    }

    .header-stats span,
    .btn-header,
    .level-indicator-clickable {
        font-size: 0.62rem;
        min-height: 31px;
        overflow: hidden;
        padding: 0.22rem 0.24rem;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 100%;
    }

    .home-screen {
        gap: 0.4rem;
        padding: 0.38rem;
    }

    .home-hero {
        gap: 0.45rem;
        grid-template-columns: auto 1fr;
        padding: 0.5rem;
        text-align: left;
    }

    .home-logo {
        font-size: 2rem;
    }

    .home-kicker,
    .home-label {
        font-size: 0.6rem;
    }

    .home-hero h2 {
        font-size: 1.04rem;
    }

    .home-copy,
    .home-progress-copy {
        font-size: 0.74rem;
        line-height: 1.25;
    }

    .home-system-line {
        font-size: 0.58rem;
        padding: 0.32rem 0.38rem;
    }

    .home-progress-card {
        padding: 0.48rem;
    }

    .home-progress-top {
        gap: 0.3rem;
        grid-template-columns: 1fr 1fr;
    }

    .home-progress-top strong {
        font-size: 0.78rem;
    }

    .home-stat-grid {
        gap: 0.3rem;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-stat {
        padding: 0.38rem 0.2rem;
    }

    .home-stat span {
        font-size: 1rem;
    }

    .home-stat strong {
        font-size: 0.65rem;
    }

    .home-actions {
        gap: 0.3rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #home-resume-btn {
        grid-column: 1 / -1;
    }

    .game-main {
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .game-world {
        gap: 0.28rem;
        padding: 0.3rem;
        width: 100%;
    }

    .world-hud {
        gap: 0.24rem;
    }

    .world-hud span,
    .world-terminal {
        font-size: 0.64rem;
        min-height: 24px;
        padding: 0.22rem 0.3rem;
    }

    .control-panel {
        gap: 0.35rem;
        max-width: none;
        padding: 0.35rem;
    }

    .mission-panel {
        padding: 0.38rem;
    }

    .mission-panel h3 {
        font-size: 0.76rem;
    }

    .mission-panel p {
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .mission-objectives li {
        font-size: 0.66rem;
    }

    .mission-objectives {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mission-objectives li:nth-child(n+3) {
        display: none;
    }

    .code-editor-wrapper {
        padding: 0.28rem;
    }

    .code-titlebar {
        font-size: 0.62rem;
        padding-bottom: 0.32rem;
    }

    #code-editor {
        font-size: 0.78rem;
        height: 160px;
        min-height: 140px;
        padding: 0.42rem;
        -webkit-overflow-scrolling: touch;
    }

    .snippet-buttons {
        gap: 0.28rem;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .action-buttons {
        gap: 0.28rem;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .btn {
        font-size: 0.66rem;
        min-height: 32px;
        padding: 0.32rem 0.24rem;
    }

    .ad-container-bottom {
        display: none;
    }
}

@media (max-width: 390px) {
    .header-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .home-actions,
    .snippet-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Full-screen density pass */
html,
body {
    min-height: 100%;
}

body {
    min-height: 100dvh;
}

.page-container {
    gap: 0.32rem;
    justify-content: stretch;
    min-height: 100dvh;
    padding: clamp(0.2rem, 0.7vw, 0.55rem);
    width: 100%;
}

#game-container {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin-bottom: 0;
    max-width: min(1380px, calc(100vw - clamp(0.4rem, 1.4vw, 1.1rem)));
    min-height: 0;
}

#game-container.is-home,
#game-container:has(#home-screen:not(.hidden)) {
    flex: 0 0 auto;
}

#game-container.is-playing {
    flex: 1 1 auto;
}

.game-header {
    flex: 0 0 auto;
}

.home-screen,
.game-main {
    flex: 1 1 auto;
    min-height: 0;
}

.home-screen {
    align-content: stretch;
    grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto;
}

#game-container.is-home .home-screen,
#game-container:has(#home-screen:not(.hidden)) .home-screen {
    align-content: start;
    flex: 0 0 auto;
    grid-template-rows: auto;
}

.home-hero {
    min-height: 0;
}

.home-actions {
    align-items: stretch;
}

.home-certificate-note {
    background: #fff7dc;
    border: 2px solid #f5c25f;
    border-radius: 8px;
    color: #76551c;
    font-size: 0.78rem;
    font-weight: 800;
    grid-column: 1 / -1;
    line-height: 1.35;
    margin: 0;
    padding: 0.48rem 0.6rem;
    text-align: center;
}

.home-certificate-note.hidden {
    display: none;
}

.home-actions .btn.is-locked {
    background: #dbe3ee;
    border: 2px dashed #aab8c9;
    color: #5b6675;
}

.home-actions .btn.is-locked:hover {
    background: #e7edf5;
}

.home-actions .btn.is-attention {
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.28);
}

.game-main {
    align-items: stretch;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 430px);
    justify-content: stretch;
}

.game-world {
    align-self: stretch;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: hidden;
    place-items: center;
    width: 100%;
}

#grid-container {
    align-self: center;
    justify-self: center;
    max-height: 100%;
    max-width: 100%;
}

.control-panel {
    align-self: stretch;
    max-width: none;
    min-height: 0;
}

.code-editor-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#code-editor {
    flex: 1 1 auto;
    height: clamp(170px, 28dvh, 280px);
    min-height: 150px;
}

.modal-overlay {
    padding: clamp(0.35rem, 1.5vw, 1rem);
}

.modal-content {
    max-height: calc(100dvh - clamp(0.7rem, 3vw, 2rem));
    padding: clamp(0.8rem, 1.5vw, 1.2rem);
    width: min(96vw, 760px);
}

.level-select-modal,
.reward-center-modal {
    max-width: 980px;
    padding: clamp(0.8rem, 1.5vw, 1.2rem);
    width: min(96vw, 980px);
}

.welcome-modal,
.hint-modal,
.share-modal,
.game-complete-modal {
    padding: clamp(0.8rem, 1.6vw, 1.25rem);
}

.reward-grid {
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.reward-card {
    min-height: 0;
    padding: 0.65rem;
}

.reward-card p {
    min-height: 0;
}

.level-select-description {
    margin-bottom: 0.7rem;
    padding: 0.65rem;
}

.level-progress-summary {
    margin: 0.75rem 0;
    padding: 0.65rem;
}

.level-grid {
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    margin: 0.8rem 0;
}

.level-item {
    border-radius: 8px;
    min-height: 92px;
    padding: 0.58rem 0.35rem;
}

.game-complete-header h2 {
    font-size: 1.55rem;
    margin-bottom: 0.45rem;
}

.trophy-animation {
    font-size: 3rem;
    margin: 0.4rem 0;
}

.completion-message,
.game-complete-stats,
.game-complete-actions {
    margin: 0.75rem 0;
}

.ad-container-bottom {
    flex: 0 0 auto;
    margin-top: 0.32rem;
    max-width: min(1380px, calc(100vw - clamp(0.4rem, 1.4vw, 1.1rem)));
}

@media (max-width: 900px) {
    #game-container {
        max-width: 100%;
    }

    .home-screen {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .game-main {
        align-items: start;
        grid-template-columns: 1fr;
    }

    /* On single-column mobile the game world must NOT stretch — let the grid
       determine its own height so there is no empty space above/below it. */
    .game-world {
        align-self: auto;
        grid-template-rows: auto auto auto;
        min-height: 0;
        padding: 0.5rem 0.5rem 0.4rem;
    }

    #grid-container {
        margin: 0 auto;
    }

    .control-panel {
        height: auto;
    }

    #code-editor {
        height: clamp(140px, 24dvh, 210px);
        min-height: 130px;
    }
}

@media (min-width: 761px) and (max-width: 900px) {
    .game-header {
        align-items: center;
        flex-direction: row;
        gap: 0.45rem;
    }

    .game-header h1 {
        font-size: 1.05rem;
        text-align: left;
        width: auto;
    }

    .header-controls {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        width: auto;
    }

    .header-stats {
        display: flex;
        width: auto;
    }

    .btn-header,
    .level-indicator-clickable {
        width: auto;
    }

    .game-main {
        align-items: stretch;
        grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    }

    /* Restore the side-by-side stretch behaviour for tablet landscape */
    .game-world {
        align-self: stretch;
        grid-template-rows: auto minmax(0, 1fr) auto;
        min-height: 0;
    }

    .control-panel {
        justify-self: stretch;
        max-width: none;
    }

    #code-editor {
        height: clamp(160px, 24dvh, 230px);
    }
}

@media (max-width: 560px) {
    .page-container {
        padding: 0;
    }

    #game-container {
        border-radius: 0;
        width: 100%;
    }

    .game-header {
        border-radius: 0;
        padding: 0.42rem;
    }

    .header-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .header-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .header-stats span,
    .btn-header,
    .level-indicator-clickable {
        font-size: 0.62rem;
        min-height: 30px;
        min-width: 0;
        overflow: hidden;
        padding: 0.2rem 0.24rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .home-screen {
        gap: 0.35rem;
        padding: 0.34rem;
    }

    .home-hero {
        gap: 0.45rem;
        grid-template-columns: auto 1fr;
        padding: 0.48rem;
        text-align: left;
    }

    .home-logo {
        font-size: 1.9rem;
    }

    .home-hero h2 {
        font-size: 1.02rem;
    }

    .home-copy,
    .home-progress-copy {
        font-size: 0.72rem;
        line-height: 1.25;
    }

    .home-system-line {
        font-size: 0.56rem;
        padding: 0.32rem 0.38rem;
    }

    .home-progress-top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #home-resume-btn {
        grid-column: 1 / -1;
    }

    .home-certificate-note {
        font-size: 0.64rem;
        padding: 0.35rem;
    }

    .game-main {
        gap: 0.32rem;
        padding: 0.3rem;
    }

    .game-world {
        overflow-x: auto;
        padding: 0.3rem 0.28rem 0.24rem;
    }

    .world-hud {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .world-hud span,
    .world-terminal {
        font-size: 0.62rem;
        min-height: 24px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .control-panel {
        gap: 0.32rem;
        padding: 0.34rem;
    }

    .mission-objectives {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .snippet-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .action-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .btn {
        font-size: 0.68rem;
        min-height: 34px;
        padding: 0.34rem 0.24rem;
    }

    .commands-cheatsheet {
        padding: 0.35rem 0.4rem 0.42rem;
    }

    .commands-cheatsheet-title {
        font-size: 0.68rem;
        margin-bottom: 0.28rem;
    }

    .commands-grid {
        gap: 0.16rem 0.35rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cmd code {
        font-size: 0.6rem;
    }

    .cmd span {
        font-size: 0.56rem;
    }

    #hint-text {
        font-size: 0.85rem;
        padding: 0.5rem 0.6rem;
    }

    #hint-tips-list li {
        font-size: 0.78rem;
        padding: 0.3rem 0.45rem;
    }

    .hint-path-text {
        font-size: 0.82rem;
        padding: 0.5rem 0.6rem;
    }

    .hint-section-label {
        font-size: 0.62rem;
    }

    .modal-overlay {
        align-items: flex-start;
        padding: 0.25rem;
    }

    .modal-content {
        max-height: calc(100dvh - 0.5rem);
        padding: 0.65rem;
        width: 100%;
    }

    .level-grid {
        gap: 0.35rem;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .level-item {
        min-height: 74px;
        padding: 0.4rem 0.2rem;
    }

    .reward-tabs {
        gap: 0.35rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reward-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reward-card h3 {
        font-size: 0.76rem;
    }

    .reward-card p {
        font-size: 0.64rem;
    }

    .level-complete-actions,
    .game-complete-actions,
    .level-select-actions,
    .hint-actions {
        gap: 0.35rem;
    }
}

@media (max-width: 360px) {
    .header-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .home-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .home-actions,
    .snippet-buttons,
    .action-buttons,
    .reward-grid,
    .level-grid {
        grid-template-columns: 1fr;
    }

    .home-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ─── Mission concept card: hidden until populated ──────────────── */
.mission-concept-card.hidden {
    display: none;
}

/* ─── Command cheatsheet ─────────────────────────────────────────── */
.commands-cheatsheet {
    background: #f0f6ff;
    border: 1px solid #b8d4f5;
    border-left: 4px solid #4a90e2;
    border-radius: 8px;
    padding: 0.42rem 0.55rem 0.5rem;
}

.commands-cheatsheet[open] .commands-toggle-hint {
    display: none;
}

.commands-cheatsheet-title {
    align-items: center;
    color: #1e4080;
    cursor: pointer;
    display: flex;
    font-family: var(--font-secondary, 'Nunito', sans-serif);
    font-size: 0.72rem;
    font-weight: 900;
    gap: 0.4rem;
    letter-spacing: 0.03em;
    list-style: none;
    margin: 0 0 0.32rem;
    text-transform: uppercase;
    user-select: none;
}

.commands-cheatsheet-title::-webkit-details-marker { display: none; }

.commands-toggle-hint {
    color: #7aaad9;
    font-size: 0.62rem;
    font-weight: 600;
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
}

.commands-grid {
    display: grid;
    gap: 0.2rem 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cmd {
    align-items: baseline;
    display: flex;
    gap: 0.3rem;
    min-width: 0;
}

.cmd code {
    background: #daeafe;
    border-radius: 3px;
    color: #1e4080;
    flex: 0 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    padding: 0.04rem 0.26rem;
    white-space: nowrap;
}

.cmd span {
    color: #4a6080;
    font-size: 0.6rem;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.commands-semicolon-note {
    border-top: 1px solid #c5daf5;
    color: #3a6096;
    font-size: 0.62rem;
    line-height: 1.4;
    margin: 0.32rem 0 0;
    padding-top: 0.28rem;
}

.commands-semicolon-note code {
    background: #daeafe;
    border-radius: 3px;
    color: #1e4080;
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    padding: 0.02rem 0.22rem;
}

/* ─── Hint modal: new structured layout ─────────────────────────── */
.hint-concept-section,
.hint-tips-section,
.hint-path-section {
    margin-bottom: 0.65rem;
}

.hint-section-label {
    color: #4a90e2;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    margin-bottom: 0.28rem;
    text-transform: uppercase;
}

#hint-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #1a2e45;
    background: #eef6ff;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border-left: 4px solid #50e3c2;
    margin: 0;
}

#hint-tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

#hint-tips-list li {
    align-items: flex-start;
    background: #f8fffe;
    border: 1px solid #c8f0e7;
    border-radius: 6px;
    display: flex;
    font-size: 0.85rem;
    gap: 0.45rem;
    line-height: 1.4;
    padding: 0.38rem 0.55rem;
}

.hint-tip-num {
    background: #50e3c2;
    border-radius: 50%;
    color: #0d4535;
    flex: 0 0 1.3rem;
    font-size: 0.68rem;
    font-weight: 900;
    height: 1.3rem;
    line-height: 1.3rem;
    text-align: center;
    width: 1.3rem;
}

.hint-path-text {
    background: #fff8e6;
    border: 1px solid #f5c25f;
    border-left: 4px solid #f5a623;
    border-radius: 8px;
    color: #3a2800;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    padding: 0.6rem 0.75rem;
}

.hint-path-locked {
    color: #5b6675;
    font-size: 0.85rem;
    font-style: italic;
    margin: 0;
    padding: 0.35rem 0;
}

.hint-path-locked strong {
    color: #f5a623;
    font-style: normal;
}

/* ─── Educational feedback additions ────────────────────────────── */

/* Always-visible concept hint card in the mission panel */
.mission-concept-card {
    background: #edfff9;
    border: 1px solid #50e3c2;
    border-left: 4px solid #50e3c2;
    border-radius: 8px;
    color: #17624f;
    font-size: 0.78rem;
    line-height: 1.45;
    margin-top: 0.45rem;
    padding: 0.42rem 0.6rem;
}

.mission-concept-label {
    font-weight: 900;
    margin-right: 0.25rem;
}

/* Rich error display: main message + teaching line */
.error-main {
    display: block;
    color: #ff8dab;
    font-weight: 700;
    line-height: 1.35;
}

.error-teach {
    display: block;
    color: #f5a623;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 0.2rem;
}

/* Tips panel: auto-shown after repeated failures */
.tip-feedback {
    background: #fffbf0;
    border: 1px solid #f5c25f;
    border-left: 4px solid #f5a623;
    border-radius: 8px;
    font-size: 0.76rem;
    line-height: 1.45;
    margin-top: 0.35rem;
    padding: 0.42rem 0.6rem;
}

.tip-feedback.hidden {
    display: none;
}

.tip-item {
    color: #6b4300;
    display: block;
    line-height: 1.4;
}

.tip-nudge {
    color: #3a7bc8;
    display: block;
    font-weight: 800;
    margin-top: 0.3rem;
}

/* Responsive tweaks for small screens */
@media (max-width: 560px) {
    .mission-concept-card {
        font-size: 0.7rem;
        padding: 0.35rem 0.45rem;
    }

    .error-teach {
        font-size: 0.66rem;
    }

    .tip-feedback {
        font-size: 0.68rem;
        padding: 0.35rem 0.45rem;
    }
}

@media (max-width: 360px) {
    .mission-concept-card {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
    }

    .tip-feedback {
        font-size: 0.63rem;
    }

    .commands-grid {
        grid-template-columns: 1fr;
    }

    .hint-section-label {
        font-size: 0.6rem;
    }
}
