.ai-game-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 12%, rgba(45, 212, 191, 0.18), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(245, 158, 11, 0.16), transparent 28%),
        linear-gradient(135deg, #0f172a, #111827 48%, #1f2937);
    color: #f8fafc;
}

.ai-game-page .site-header {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(148, 163, 184, 0.22);
}

.ai-game-page .brand,
.ai-game-page .site-nav a {
    color: #f8fafc;
}

.ai-game-page .site-nav a:hover,
.ai-game-page .site-nav a:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

.ai-shell {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 3.5rem 0 5rem;
}

.ai-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.25rem;
}

.ai-hero h1 {
    color: #ffffff;
}

.ai-hero p:not(.eyebrow) {
    max-width: 780px;
    color: #dbeafe;
    font-size: 1.08rem;
}

.classic-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 900;
    text-decoration: none;
}

.ai-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1rem;
    align-items: stretch;
}

.ai-panel,
.game-surface {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.84);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
}

.game-surface {
    min-height: 560px;
    padding: 1rem;
}

.ai-panel {
    display: grid;
    gap: 1rem;
    align-content: start;
    padding: 1rem;
}

.ai-panel h2,
.game-surface h2 {
    color: #ffffff;
    font-size: 1.45rem;
}

.ai-panel p,
.game-surface p {
    color: #cbd5e1;
}

.ai-readout {
    min-height: 104px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: #dbeafe;
    font-weight: 800;
}

.ai-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.ai-stat-grid div {
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.ai-stat-grid span {
    display: block;
    color: #93c5fd;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.ai-stat-grid strong {
    color: #ffffff;
    font-size: 1.45rem;
}

.ai-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.ai-button-row .button {
    flex: 1;
}

.ai-game-page .panel-button {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.ai-game-page .panel-button:hover,
.ai-game-page .panel-button:focus-visible {
    background: rgba(255, 255, 255, 0.18);
}

.ai-form {
    display: grid;
    gap: 0.85rem;
}

.ai-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.ai-form label {
    display: grid;
    gap: 0.4rem;
    color: #f8fafc;
    font-weight: 900;
}

.ai-form input,
.ai-form select,
.ai-form textarea {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(248, 250, 252, 0.96);
    color: #0f172a;
}

.ai-output {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.ai-output h2 {
    margin-bottom: 0.7rem;
}

.gridmind-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: 0.75rem;
    max-width: 560px;
    margin: 2rem auto 1rem;
}

.gridmind-cell {
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(45, 212, 191, 0.1), rgba(37, 99, 235, 0.12)),
        rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: clamp(2.4rem, 10vw, 5.6rem);
    font-weight: 900;
    cursor: pointer;
}

.gridmind-cell:hover,
.gridmind-cell:focus-visible {
    background: rgba(37, 99, 235, 0.32);
}

.gridmind-cell.ai-move {
    box-shadow: inset 0 0 0 4px rgba(245, 158, 11, 0.75);
}

.score-strip {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: #dbeafe;
    font-weight: 900;
}

.pong-canvas,
.rift-canvas {
    width: 100%;
    display: block;
    border-radius: 8px;
    background: #020617;
}

.pong-canvas {
    aspect-ratio: 16 / 9;
    max-height: 620px;
}

.rift-canvas {
    min-height: 560px;
    height: min(68vh, 720px);
}

.word-bank {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.story-text {
    white-space: pre-wrap;
    color: #e5edf7;
}

.rift-hud {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.rift-hud div {
    padding: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.rift-hud span {
    display: block;
    color: #93c5fd;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.rift-hud strong {
    color: #ffffff;
}

.lifestack-page {
    min-height: 100vh;
    overflow-x: hidden;
    background: #07130f;
}

.lifestack-page .site-header {
    background: rgba(5, 13, 18, 0.9);
}

.lifestack-fullscreen {
    min-height: calc(100vh - 72px);
}

.lifestack-game-screen {
    --pad: clamp(0.75rem, 1.7vw, 1.2rem);
    --side-width: min(360px, 27vw);
    --npc-width: min(500px, calc(100vw - var(--side-width) - 3.5rem));
    --dock-height: 10.75rem;
    position: relative;
    isolation: isolate;
    min-height: calc(100vh - 72px);
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 20%, rgba(45, 212, 191, 0.18), transparent 28%),
        radial-gradient(circle at 78% 18%, rgba(251, 191, 36, 0.18), transparent 26%),
        radial-gradient(circle at 52% 92%, rgba(248, 113, 113, 0.16), transparent 30%),
        linear-gradient(135deg, #080b14, #0b242f 50%, #102015);
}

.lifestack-game-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(3, 7, 18, 0.64), transparent 32%, transparent 68%, rgba(3, 7, 18, 0.7)),
        linear-gradient(0deg, rgba(3, 7, 18, 0.58), transparent 34%, rgba(3, 7, 18, 0.36));
}

.lifestack-scene {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: block;
    background: #08111d;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.lifestack-scene.is-panning {
    cursor: grabbing;
}

.lifestack-overlay-top,
.lifestack-scene-caption,
.lifestack-event,
.lifestack-run-controls,
.lifestack-npc,
.lifestack-side-overlay,
.lifestack-action-dock {
    position: absolute;
    z-index: 2;
}

.lifestack-title-chip,
.lifestack-topline div,
.lifestack-resources div,
.lifestack-scene-caption,
.lifestack-event,
.lifestack-npc,
.lifestack-side-overlay,
.lifestack-action-dock,
.lifestack-tutorial-panel {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.7);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.lifestack-overlay-top {
    top: var(--pad);
    left: var(--pad);
    right: var(--pad);
    display: grid;
    grid-template-columns: minmax(190px, 250px) minmax(360px, 680px) auto;
    gap: 0.75rem;
    align-items: start;
    pointer-events: none;
}

.lifestack-overlay-top > * {
    pointer-events: auto;
}

.lifestack-title-chip {
    min-height: 70px;
    padding: 0.7rem 0.85rem;
    background:
        linear-gradient(145deg, rgba(45, 212, 191, 0.18), rgba(251, 191, 36, 0.08)),
        rgba(8, 13, 24, 0.72);
}

.lifestack-title-chip h1 {
    color: #fff7ed;
    font-size: clamp(1.45rem, 2.2vw, 2.1rem);
    line-height: 1;
}

.lifestack-topline,
.lifestack-resources {
    display: grid;
    gap: 0.55rem;
}

.lifestack-topline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.lifestack-topline div,
.lifestack-resources div {
    min-width: 0;
    padding: 0.62rem 0.7rem;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
        rgba(8, 13, 24, 0.64);
}

.lifestack-topline span,
.lifestack-resources span {
    display: block;
    color: #a7f3d0;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.lifestack-topline strong,
.lifestack-resources strong {
    color: #ffffff;
    font-size: 1.2rem;
}

.lifestack-tutorial-open {
    min-width: 112px;
    min-height: 46px;
    justify-self: end;
}

.lifestack-overlay-tools {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 0.55rem;
    justify-content: end;
    align-items: start;
}

.lifestack-view-menu {
    position: relative;
    min-width: 96px;
}

.lifestack-view-menu summary {
    min-height: 46px;
    display: grid;
    place-items: center;
    padding: 0.72rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}

.lifestack-view-menu summary::-webkit-details-marker {
    display: none;
}

.lifestack-view-menu[open] summary {
    border-color: rgba(45, 212, 191, 0.5);
    background: rgba(45, 212, 191, 0.14);
}

.lifestack-view-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 210px;
    display: grid;
    gap: 0.65rem;
    padding: 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.92);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px);
}

.lifestack-view-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.lifestack-view-options label {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.46rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #dbeafe;
    font-size: 0.75rem;
    font-weight: 900;
}

.lifestack-view-options input {
    accent-color: #14b8a6;
}

.lifestack-view-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.lifestack-view-actions button {
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 900;
    cursor: pointer;
}

.lifestack-view-actions button:hover,
.lifestack-view-actions button:focus-visible {
    border-color: rgba(45, 212, 191, 0.58);
    background: rgba(45, 212, 191, 0.14);
}

.lifestack-scene-caption {
    top: calc(var(--pad) + 9.3rem);
    left: calc(var(--pad) + var(--npc-width) + 0.75rem);
    right: calc(var(--side-width) + var(--pad) + 1rem);
    display: grid;
    gap: 0.22rem;
    min-width: 0;
    padding: 0.78rem 0.85rem;
    background: rgba(8, 13, 24, 0.72);
}

.lifestack-scene-caption h2 {
    color: #fff7ed;
    font-size: 1.12rem;
    line-height: 1.12;
}

.lifestack-scene-caption p:not(.eyebrow) {
    color: #dbeafe;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
}

.lifestack-event {
    top: calc(var(--pad) + 17rem);
    left: calc(var(--pad) + var(--npc-width) + 0.75rem);
    right: calc(var(--side-width) + var(--pad) + 1rem);
    min-height: 46px;
    padding: 0.72rem 0.85rem;
    border-color: rgba(56, 189, 248, 0.28);
    background:
        linear-gradient(145deg, rgba(56, 189, 248, 0.14), rgba(45, 212, 191, 0.08)),
        rgba(8, 13, 24, 0.74);
    color: #dbeafe;
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.35;
}

.lifestack-run-controls {
    top: calc(var(--pad) + 5.4rem);
    right: var(--pad);
    width: var(--side-width);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.lifestack-run-controls .button {
    min-height: 48px;
}

.lifestack-npc {
    top: calc(var(--pad) + 9.3rem);
    left: var(--pad);
    display: grid;
    gap: 0.65rem;
    width: var(--npc-width);
    max-height: min(40vh, 360px);
    overflow: auto;
    padding: 0.85rem;
    border-color: rgba(94, 234, 212, 0.3);
    background:
        linear-gradient(145deg, rgba(251, 191, 36, 0.16), rgba(20, 184, 166, 0.12)),
        rgba(8, 13, 24, 0.72);
}

.lifestack-npc-main {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
}

.lifestack-npc-avatar {
    width: 54px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.85), transparent 12%),
        linear-gradient(145deg, #f97316, #14b8a6 48%, #2563eb);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.lifestack-npc h2,
.lifestack-side-overlay h2 {
    color: #ffffff;
    font-size: 1.08rem;
    line-height: 1.15;
}

.lifestack-npc p {
    color: #cbd5e1;
}

.lifestack-npc-line {
    padding: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.54);
    color: #e0f2fe;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.35;
}

.lifestack-npc-replies {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.lifestack-npc-reply {
    min-height: 84px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 0.38rem;
    align-content: start;
    padding: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #e5edf7;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.lifestack-npc-reply.is-recommended {
    border-color: rgba(251, 191, 36, 0.82);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.34), 0 14px 32px rgba(251, 191, 36, 0.12);
}

.lifestack-reply-glyph {
    grid-row: span 2;
    width: 30px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fde68a;
}

.lifestack-reply-glyph svg {
    width: 21px;
    height: 21px;
}

.lifestack-npc-reply:hover,
.lifestack-npc-reply:focus-visible {
    border-color: rgba(251, 191, 36, 0.72);
    background: rgba(251, 191, 36, 0.14);
}

.lifestack-npc-reply:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.lifestack-npc-reply strong {
    color: #ffffff;
    font-size: 0.78rem;
    line-height: 1.2;
}

.lifestack-npc-reply span {
    color: #fde68a;
    font-size: 0.66rem;
    font-weight: 900;
    text-transform: uppercase;
}

.lifestack-npc-response {
    padding: 0.65rem;
    border: 1px solid rgba(251, 191, 36, 0.26);
    border-radius: 8px;
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
    font-size: 0.86rem;
    font-weight: 900;
    line-height: 1.35;
}

.lifestack-side-overlay {
    top: calc(var(--pad) + 9.15rem);
    right: var(--pad);
    bottom: calc(var(--pad) + var(--dock-height) + 0.75rem);
    display: grid;
    gap: 0.75rem;
    align-content: start;
    width: var(--side-width);
    overflow: auto;
    padding: 0.85rem;
    background: rgba(8, 13, 24, 0.72);
}

.lifestack-action-dock {
    left: var(--pad);
    right: var(--pad);
    bottom: var(--pad);
    display: grid;
    grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
    min-height: var(--dock-height);
    padding: 0.75rem;
    background: rgba(8, 13, 24, 0.76);
}

.lifestack-action-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(112px, 1fr));
    gap: 0.62rem;
}

.lifestack-action {
    min-height: 130px;
    display: grid;
    grid-template-rows: 38px auto auto minmax(2.25em, auto) auto auto;
    gap: 0.32rem;
    align-content: stretch;
    width: 100%;
    padding: 0.58rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background:
        radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--action-color) 34%, transparent), transparent 44%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)),
        rgba(255, 255, 255, 0.07);
    color: #e5edf7;
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.lifestack-action.is-recommended {
    border-color: color-mix(in srgb, var(--action-color) 74%, #ffffff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action-color) 42%, transparent), 0 18px 40px rgba(0, 0, 0, 0.24);
}

.lifestack-action.is-spent {
    opacity: 0.45;
}

.lifestack-action.is-too-expensive {
    filter: grayscale(0.4);
}

.lifestack-action:hover,
.lifestack-action:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(45, 212, 191, 0.72);
    background:
        radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--action-color) 48%, transparent), transparent 44%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07)),
        rgba(255, 255, 255, 0.1);
}

.lifestack-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.lifestack-action-type,
.lifestack-costs,
.lifestack-gains,
.lifestack-risk {
    font-size: 0.64rem;
    font-weight: 900;
    text-transform: uppercase;
}

.lifestack-action-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    justify-self: center;
    border: 1px solid color-mix(in srgb, var(--action-color) 46%, rgba(255, 255, 255, 0.18));
    border-radius: 8px;
    background: color-mix(in srgb, var(--action-color) 18%, rgba(15, 23, 42, 0.82));
    color: var(--action-color);
}

.lifestack-action-icon svg {
    width: 25px;
    height: 25px;
}

.lifestack-choice-badge {
    justify-self: center;
    min-width: 48px;
    padding: 0.18rem 0.4rem;
    border: 1px solid color-mix(in srgb, var(--action-color) 42%, rgba(255, 255, 255, 0.18));
    border-radius: 999px;
    background: color-mix(in srgb, var(--action-color) 16%, rgba(15, 23, 42, 0.78));
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 900;
    text-transform: uppercase;
}

.lifestack-action-type {
    color: var(--action-color);
}

.lifestack-action strong {
    color: #ffffff;
    font-size: 0.78rem;
    line-height: 1.15;
}

.lifestack-costs {
    color: #bfdbfe;
}

.lifestack-gains {
    min-height: 2em;
    color: #fde68a;
}

.lifestack-action-loading {
    place-items: center;
    text-align: center;
    color: #bfdbfe;
    font-weight: 900;
    cursor: default;
}

.lifestack-stats {
    display: grid;
    gap: 0.55rem;
}

.stat-row {
    display: grid;
    gap: 0.28rem;
}

.stat-row > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: #dbeafe;
    font-size: 0.76rem;
    font-weight: 900;
}

.stat-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.stat-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #38bdf8);
    transition: width 180ms ease;
}

.stress-row .stat-fill {
    background: linear-gradient(90deg, #fbbf24, #ef4444);
}

.lifestack-log-details {
    display: grid;
    gap: 0.55rem;
}

.lifestack-log-details summary {
    color: #dbeafe;
    font-size: 0.86rem;
    font-weight: 900;
    cursor: pointer;
}

.lifestack-log {
    max-height: 170px;
    display: grid;
    gap: 0.5rem;
    overflow: auto;
    padding-top: 0.55rem;
}

.lifestack-log div {
    display: grid;
    gap: 0.2rem;
    padding: 0.58rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.lifestack-log strong {
    color: #ffffff;
    font-size: 0.78rem;
}

.lifestack-log span {
    color: #cbd5e1;
    font-size: 0.78rem;
    line-height: 1.35;
}

.lifestack-achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.lifestack-achievements span {
    padding: 0.35rem 0.48rem;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
    font-size: 0.7rem;
    font-weight: 900;
}

.lifestack-tutorial {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: grid;
    place-items: center;
    padding: 1rem;
    background:
        radial-gradient(circle at 50% 36%, rgba(45, 212, 191, 0.28), transparent 24%),
        rgba(3, 7, 18, 0.68);
    backdrop-filter: blur(8px);
}

.lifestack-tutorial-panel {
    width: min(440px, 94vw);
    display: grid;
    gap: 0.78rem;
    padding: 1rem;
    background:
        linear-gradient(145deg, rgba(20, 184, 166, 0.22), rgba(251, 191, 36, 0.1)),
        rgba(8, 13, 24, 0.9);
}

.lifestack-tutorial-art {
    position: relative;
    min-height: 132px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(34, 197, 94, 0.13)),
        rgba(15, 23, 42, 0.72);
}

.lifestack-tutorial-art::before {
    content: "";
    position: absolute;
    inset: 50% 12% auto;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #38bdf8, #fbbf24, #22c55e);
    transform: translateY(-50%) rotate(-8deg);
}

.lifestack-tutorial-art span {
    position: absolute;
    width: 46px;
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.8);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.lifestack-tutorial-art span:nth-child(1) {
    left: 16%;
    top: 22%;
}

.lifestack-tutorial-art span:nth-child(2) {
    left: 44%;
    top: 46%;
    border-color: rgba(251, 191, 36, 0.9);
}

.lifestack-tutorial-art span:nth-child(3) {
    right: 15%;
    top: 18%;
    border-color: rgba(45, 212, 191, 0.9);
}

.lifestack-tutorial h2 {
    color: #ffffff;
    font-size: 1.35rem;
}

.lifestack-tutorial p:not(.eyebrow) {
    color: #dbeafe;
    font-weight: 800;
    line-height: 1.5;
}

@media (max-width: 1180px) {
    .lifestack-game-screen {
        --side-width: min(320px, 27vw);
        --npc-width: min(420px, calc(100vw - var(--side-width) - 3.5rem));
    }

    .lifestack-overlay-top {
        grid-template-columns: minmax(170px, 220px) minmax(320px, 1fr) auto;
    }

    .lifestack-action-grid {
        grid-template-columns: repeat(3, minmax(112px, 1fr));
    }

    .lifestack-action {
        min-height: 112px;
    }
}

@media (max-width: 900px) {
    .ai-hero,
    .ai-stage {
        grid-template-columns: 1fr;
    }

    .game-surface {
        min-height: auto;
    }

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

    .lifestack-fullscreen,
    .lifestack-game-screen {
        min-height: auto;
    }

    .lifestack-game-screen {
        display: grid;
        gap: 0.75rem;
        overflow: visible;
        padding: 0.75rem;
    }

    .lifestack-game-screen::before {
        position: fixed;
    }

    .lifestack-scene {
        position: relative;
        min-height: 52vh;
        height: 52vh;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 8px;
    }

    .lifestack-overlay-top,
    .lifestack-scene-caption,
    .lifestack-event,
    .lifestack-run-controls,
    .lifestack-npc,
    .lifestack-side-overlay,
    .lifestack-action-dock {
        position: relative;
        inset: auto;
        width: auto;
        max-width: none;
        z-index: 2;
    }

    .lifestack-overlay-top {
        grid-template-columns: 1fr auto;
    }

    .lifestack-topline {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .lifestack-npc,
    .lifestack-side-overlay {
        max-height: none;
    }

    .lifestack-action-dock {
        grid-template-columns: 1fr;
        min-height: 0;
    }

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

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

@media (max-width: 620px) {
    .ai-shell {
        width: min(94vw, 1180px);
        padding-top: 2.5rem;
    }

    .ai-form-grid,
    .word-bank,
    .rift-hud {
        grid-template-columns: 1fr;
    }

    .gridmind-board {
        grid-template-columns: repeat(3, minmax(72px, 1fr));
        gap: 0.5rem;
    }

    .lifestack-game-screen {
        padding: 0.55rem;
    }

    .lifestack-overlay-top,
    .lifestack-topline,
    .lifestack-run-controls,
    .lifestack-resources,
    .lifestack-npc-replies,
    .lifestack-action-grid {
        grid-template-columns: 1fr;
    }

    .lifestack-overlay-tools {
        grid-template-columns: 1fr;
    }

    .lifestack-view-menu,
    .lifestack-tutorial-open {
        width: 100%;
    }

    .lifestack-view-popover {
        right: auto;
        left: 0;
        width: min(280px, calc(100vw - 1.1rem));
    }

    .lifestack-scene {
        min-height: 48vh;
        height: 48vh;
    }

    .lifestack-title-chip,
    .lifestack-topline div,
    .lifestack-resources div,
    .lifestack-scene-caption,
    .lifestack-event,
    .lifestack-npc,
    .lifestack-side-overlay,
    .lifestack-action-dock {
        padding: 0.68rem;
    }

    .lifestack-npc-main {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .lifestack-npc-avatar {
        width: 48px;
    }

    .lifestack-action {
        min-height: 0;
    }
}
