/* ==========================================================================
   GUIZZAN — cube world portfolio
   ink / paper / signal · Unbounded + Onest + JetBrains Mono
   ========================================================================== */

:root {
    --ink: #0a0a09;
    --ink-2: #11110f;
    --ink-3: #191916;
    --paper: #efeae0;
    --paper-2: #b9b3a6;
    --faint: #6b665b;
    --line: rgba(239, 234, 224, 0.13);
    --line-2: rgba(239, 234, 224, 0.28);
    --signal: #ff4f1f;
    --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
    --body: 'Onest', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --gutter: clamp(16px, 4.2vw, 72px);
    --ease: cubic-bezier(0.19, 1, 0.22, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    background: var(--ink);
}

html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

body {
    background: var(--ink);
    color: var(--paper);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.55;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--signal);
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    text-align: inherit;
}

img,
video {
    display: block;
    max-width: 100%;
}

ul {
    list-style: none;
}

.mono {
    font-family: var(--mono);
    font-weight: 400;
    letter-spacing: 0.02em;
}

:focus-visible {
    outline: 1px solid var(--signal);
    outline-offset: 4px;
}

/* ---------- Canvas + grain ---------- */

#world {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    display: block;
}

.grain {
    position: fixed;
    inset: -50%;
    z-index: 50;
    pointer-events: none;
    opacity: 0.07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 0.6s steps(3) infinite;
}

@keyframes grain {
    33% {
        transform: translate(-3%, 2%);
    }

    66% {
        transform: translate(2%, -3%);
    }
}

/* ---------- Loader ---------- */

.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--ink);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--gutter);
    clip-path: inset(0 0 0 0);
}

.loader.done {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 1.1s var(--ease);
}

.loader-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.loader-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--paper-2);
    padding-bottom: 2vw;
}

.loader-pct {
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(4rem, 17vw, 16rem);
    line-height: 0.8;
    letter-spacing: -0.05em;
}

.loader-pct b {
    font-weight: inherit;
}

.loader-bar {
    margin-top: 3vw;
    height: 2px;
    background: var(--line);
}

.loader-bar i {
    display: block;
    height: 100%;
    background: var(--signal);
    transform-origin: left;
    transform: scaleX(0);
}

/* ---------- HUD ---------- */

.hud {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
}

.hud a,
.hud button {
    pointer-events: auto;
}

.corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 0 solid var(--line-2);
}

.corner.tl {
    top: 12px;
    left: 12px;
    border-top-width: 1px;
    border-left-width: 1px;
}

.corner.tr {
    top: 12px;
    right: 12px;
    border-top-width: 1px;
    border-right-width: 1px;
}

.corner.bl {
    bottom: 12px;
    left: 12px;
    border-bottom-width: 1px;
    border-left-width: 1px;
}

.corner.br {
    bottom: 12px;
    right: 12px;
    border-bottom-width: 1px;
    border-right-width: 1px;
}

.hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 22px 34px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: linear-gradient(rgba(10, 10, 9, 0.85), rgba(10, 10, 9, 0));
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    justify-self: start;
}

.wordmark-box {
    width: 10px;
    height: 10px;
    background: var(--signal);
    animation: spin-box 6s linear infinite;
}

@keyframes spin-box {
    to {
        transform: rotate(360deg);
    }
}

.hud-menu {
    display: flex;
    gap: 6px;
}

.hud-menu a {
    display: inline-flex;
    gap: 8px;
    padding: 7px 10px;
    color: var(--paper-2);
    transition: color 0.3s;
}

.hud-menu a i {
    font-style: normal;
    color: var(--faint);
    transition: color 0.3s;
}

.hud-menu a:hover,
.hud-menu a.on {
    color: var(--paper);
}

.hud-menu a.on i {
    color: var(--signal);
}

.hud-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 22px;
}

.lang {
    display: flex;
    gap: 2px;
}

.lang a {
    padding: 4px 6px;
    color: var(--faint);
    transition: color 0.3s;
}

.lang a:hover {
    color: var(--paper-2);
}

.lang a.on {
    color: var(--paper);
    box-shadow: inset 0 -1px 0 var(--signal);
}

.sound {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    color: var(--paper-2);
}

.sound-hint {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink);
    background: var(--signal);
    padding: 5px 9px;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none !important;
    transition: opacity 0.5s, transform 0.6s var(--ease);
}

.sound-hint.show {
    opacity: 1;
    transform: none;
    pointer-events: auto !important;
    animation: hint-pulse 1.6s ease-in-out infinite;
}

@keyframes hint-pulse {
    50% {
        box-shadow: 0 0 0 6px rgba(255, 79, 31, 0.2);
    }
}

.sound-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
}

.sound-bars i {
    width: 2px;
    height: 3px;
    background: currentColor;
}

.sound[aria-pressed="true"] {
    color: var(--paper);
}

.sound[aria-pressed="true"] .sound-bars i {
    background: var(--signal);
    animation: eq 0.9s ease-in-out infinite alternate;
}

.sound-bars i:nth-child(2) {
    animation-delay: -0.3s !important;
}

.sound-bars i:nth-child(3) {
    animation-delay: -0.6s !important;
}

.sound-bars i:nth-child(4) {
    animation-delay: -0.15s !important;
}

@keyframes eq {
    from {
        height: 2px;
    }

    to {
        height: 10px;
    }
}

.hud-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 22px 34px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--paper-2);
}

.hud-stats {
    display: flex;
    gap: 20px;
}

.hud-stats b {
    font-weight: 500;
    color: var(--paper);
}

.hud-level {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.hud-level-name {
    color: var(--paper);
}

.hud-progress {
    width: 150px;
    height: 1px;
    background: var(--line-2);
}

.hud-progress i {
    display: block;
    height: 100%;
    background: var(--signal);
    transform-origin: left;
    transform: scaleX(0);
}

/* ---------- Cursor ---------- */

.cursor {
    display: none;
}

.has-cursor,
.has-cursor * {
    cursor: none !important;
}

.has-cursor .cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 120;
    pointer-events: none;
}

.cursor-dot {
    position: fixed;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: var(--signal);
}

.cursor-ring {
    position: fixed;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    background:
        linear-gradient(var(--paper), var(--paper)) top left / 8px 1px no-repeat,
        linear-gradient(var(--paper), var(--paper)) top left / 1px 8px no-repeat,
        linear-gradient(var(--paper), var(--paper)) top right / 8px 1px no-repeat,
        linear-gradient(var(--paper), var(--paper)) top right / 1px 8px no-repeat,
        linear-gradient(var(--paper), var(--paper)) bottom left / 8px 1px no-repeat,
        linear-gradient(var(--paper), var(--paper)) bottom left / 1px 8px no-repeat,
        linear-gradient(var(--paper), var(--paper)) bottom right / 8px 1px no-repeat,
        linear-gradient(var(--paper), var(--paper)) bottom right / 1px 8px no-repeat;
    transition: width 0.45s var(--ease), height 0.45s var(--ease), margin 0.45s var(--ease);
    display: grid;
    place-items: center;
}

.cursor-ring em {
    font-style: normal;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--signal);
    padding: 3px 6px;
    white-space: nowrap;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.3s, transform 0.3s var(--ease);
}

.cursor.hover .cursor-ring {
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
}

.cursor.label .cursor-ring {
    width: 110px;
    height: 110px;
    margin: -55px 0 0 -55px;
}

.cursor.label .cursor-ring em {
    opacity: 1;
    transform: scale(1);
}

.cursor.down .cursor-ring {
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
}

/* ---------- Layout basics ---------- */

main {
    position: relative;
    z-index: 2;
}

.block {
    position: relative;
    padding: 22vh var(--gutter) 14vh;
    min-height: 100vh;
}

.kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--signal);
    margin-bottom: 4vh;
}

.kicker::before {
    content: '';
    width: 7px;
    height: 7px;
    background: currentColor;
    flex: none;
}

.block-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(2.2rem, 5.6vw, 6rem);
    line-height: 0.98;
    letter-spacing: -0.035em;
    max-width: 13ch;
    margin-bottom: 8vh;
}

/* line-split reveal */
.line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.1em;
    margin-bottom: -0.1em;
}

.line>span {
    display: inline-block;
}

.js .line>span {
    transform: translateY(110%);
}

.js .reveal {
    opacity: 0;
    transform: translateY(28px);
}

.js .reveal.in,
.js .line.in>span {
    opacity: 1;
    transform: none;
    transition: transform 1.2s var(--ease), opacity 1.2s var(--ease);
}

/* ---------- START ---------- */

.start {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 560px;
}

.start-fallback {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.no-webgl .start-fallback {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    display: block;
    padding: 28vh var(--gutter) 0;
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(3rem, 12vw, 12rem);
    line-height: 0.9;
    letter-spacing: -0.05em;
    text-transform: uppercase;
}

.start-bottom {
    position: absolute;
    left: var(--gutter);
    right: var(--gutter);
    bottom: 11vh;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
}

.tag {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--signal);
    margin-bottom: 18px;
}

.start-lead {
    font-family: var(--display);
    font-weight: 300;
    font-size: clamp(1.35rem, 2.5vw, 2.4rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    max-width: 19ch;
}

.start-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 18px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--paper-2);
    text-align: right;
}

.start-meta b {
    color: var(--paper);
    font-weight: 500;
}

.start-scroll {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--paper);
}

.arrow {
    position: relative;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line-2);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.arrow i {
    width: 1px;
    height: 14px;
    background: var(--signal);
    position: relative;
    animation: arrow 1.8s var(--ease) infinite;
}

.arrow i::after {
    content: '';
    position: absolute;
    left: -3px;
    bottom: 0;
    width: 7px;
    height: 7px;
    border-right: 1px solid var(--signal);
    border-bottom: 1px solid var(--signal);
    transform: rotate(45deg);
}

@keyframes arrow {
    0% {
        transform: translateY(-26px);
    }

    50%,
    100% {
        transform: translateY(26px);
    }
}

/* ---------- PLAYER ---------- */

.player-grid {
    display: grid;
    gap: 9vh;
    max-width: min(100%, 60vw);
}

.player-grid .sheet {
    max-width: 560px;
}

.player-bio p {
    font-family: var(--display);
    font-weight: 300;
    font-size: clamp(1.3rem, 2.35vw, 2.3rem);
    line-height: 1.25;
    letter-spacing: -0.02em;
    max-width: 30ch;
}

.player-bio p+p {
    margin-top: 0.8em;
}

.sheet {
    position: relative;
    border: 1px solid var(--line-2);
    background: var(--ink);
    padding: 0 22px 8px;
}

.sheet::before,
.sheet::after {
    content: '';
    position: absolute;
    width: 9px;
    height: 9px;
    background: var(--signal);
}

.sheet::before {
    top: -5px;
    left: -5px;
}

.sheet::after {
    bottom: -5px;
    right: -5px;
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    padding: 16px 0 14px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.sheet-online {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #9fe870;
}

.sheet-online i {
    width: 6px;
    height: 6px;
    background: currentColor;
    animation: blink 1.4s steps(2) infinite;
}

.sheet-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.sheet dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--faint);
    padding-top: 3px;
    flex: none;
}

.sheet dd {
    text-align: right;
    font-size: 15px;
}

.sheet dd a {
    box-shadow: inset 0 -1px 0 var(--signal);
    word-break: break-all;
}

.sheet-langs {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.sheet-langs dt {
    margin-bottom: 10px;
}

.sheet .lang-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 14px;
    align-items: center;
    padding: 6px 0;
    text-align: left;
}

.pips {
    display: inline-flex;
    gap: 3px;
}

.pips i {
    width: 8px;
    height: 8px;
    border: 1px solid var(--line-2);
}

.pips i.on {
    background: var(--signal);
    border-color: var(--signal);
}

.lang-note {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--faint);
}

/* ---------- QUEST ---------- */

.quest-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(2rem, 4.8vw, 5.2rem);
    line-height: 1;
    letter-spacing: -0.035em;
    max-width: 15ch;
}

.quest-log {
    margin-top: 8vh;
    max-width: 620px;
    border-top: 1px solid var(--line-2);
    background: rgba(10, 10, 9, 0.6);
}

.quest-line {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.quest-line span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--faint);
    padding-top: 4px;
}

.quest-line strong {
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
}

.quest-status {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 0;
}

.quest-status span.mono {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--signal);
    flex: none;
}

.blink {
    width: 7px;
    height: 7px;
    background: currentColor;
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.quest-bar {
    flex: 1;
    height: 8px;
    border: 1px solid var(--line-2);
    overflow: hidden;
    position: relative;
}

.quest-bar i {
    position: absolute;
    top: 1px;
    bottom: 1px;
    left: 1px;
    width: 62%;
    background: repeating-linear-gradient(-45deg, var(--signal) 0 6px, transparent 6px 12px);
    background-size: 17px 100%;
    animation: stripes 0.8s linear infinite;
}

@keyframes stripes {
    to {
        background-position: 17px 0;
    }
}

/* ---------- LEVELS ---------- */

.levels {
    position: relative;
    padding: 22vh 0 14vh;
}

.levels-head {
    padding: 0 var(--gutter);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    column-gap: 32px;
}

.levels-head .kicker {
    grid-column: 1 / -1;
}

.levels-head .block-title {
    margin-bottom: 6vh;
}

.levels-hint {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--paper-2);
    margin-bottom: 7vh;
}

.levels-viewport {
    overflow: hidden;
}

.levels-track {
    display: flex;
    gap: 3vw;
    padding: 0 var(--gutter);
    width: max-content;
    will-change: transform;
}

.level {
    position: relative;
    flex: none;
    width: clamp(300px, 58vw, 960px);
    display: flex;
    flex-direction: column;
    background: var(--ink-2);
    border: 1px solid var(--line);
    transition: border-color 0.5s;
}

.level:hover,
.level:focus-visible {
    border-color: var(--signal);
}

.level-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.level-media video,
.level-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.9) contrast(1.1) brightness(0.75);
    transform: scale(1.04);
    transition: filter 0.8s var(--ease), transform 1.2s var(--ease);
}

.level:hover .level-media video,
.level:hover .level-media img,
.level.playing .level-media video {
    filter: none;
    transform: scale(1);
}

.level-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
    pointer-events: none;
    opacity: 0.6;
}

.level-num {
    position: absolute;
    left: 18px;
    top: 10px;
    z-index: 2;
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(3rem, 7vw, 7rem);
    line-height: 1;
    letter-spacing: -0.05em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(239, 234, 224, 0.75);
    transition: color 0.5s, -webkit-text-stroke-color 0.5s;
}

.level:hover .level-num {
    color: var(--signal);
    -webkit-text-stroke-color: var(--signal);
}

.level-play {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 2;
    padding: 8px 12px;
    background: var(--paper);
    color: var(--ink);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    transform: translateY(10px);
    opacity: 0;
    transition: opacity 0.4s, transform 0.5s var(--ease);
}

.level:hover .level-play,
.level:focus-visible .level-play {
    opacity: 1;
    transform: none;
}

.level-code {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 70% 30%, rgba(255, 79, 31, 0.18), transparent 50%),
        var(--ink-3);
}

.level-code pre {
    font-family: var(--mono);
    font-size: clamp(10px, 1.1vw, 15px);
    line-height: 1.7;
    color: var(--paper-2);
    white-space: pre;
}

.level-code .c {
    color: var(--faint);
}

.level-code .k {
    color: var(--signal);
}

.level-code .t {
    color: var(--paper);
}

.level-code .s {
    color: #9fe870;
}

.level-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 32px;
    padding: 24px 24px 22px;
    flex: 1;
}

.level-info h3 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(1.3rem, 2.2vw, 2.1rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.level-info p {
    color: var(--paper-2);
    font-size: 15px;
    grid-row: span 2;
}

.level-foot {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: flex-end;
}

.level-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.level-tags li {
    font-size: 11px;
    padding: 3px 8px;
    border: 1px solid var(--line-2);
    color: var(--paper-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.level-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.level-links a {
    color: var(--paper);
    box-shadow: inset 0 -1px 0 var(--line-2);
    transition: box-shadow 0.3s, color 0.3s;
}

.level-links a:hover {
    color: var(--signal);
    box-shadow: inset 0 -1px 0 var(--signal);
}

.level-end {
    width: clamp(240px, 26vw, 420px);
    justify-content: center;
    align-items: center;
    gap: 18px;
    background: transparent;
    border-style: dashed;
    border-color: var(--line-2);
    min-height: 300px;
}

.level-end-plus {
    font-family: var(--display);
    font-weight: 300;
    font-size: 6rem;
    line-height: 1;
    color: var(--signal);
    transition: transform 0.8s var(--ease);
}

.level-end:hover .level-end-plus {
    transform: rotate(90deg);
}

.level-end-text {
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

@media (min-width: 821px) {
    .levels {
        padding-top: 12vh;
        min-height: 100vh;
    }

    .levels-head .block-title {
        max-width: none;
        font-size: clamp(2rem, 4.4vw, 4.6rem);
        margin-bottom: 5vh;
    }

    .levels-hint {
        margin-bottom: 5vh;
    }

    /* keep a full card (media + info) inside the pinned viewport */
    .level {
        width: clamp(300px, min(54vw, calc((100vh - 500px) * 1.75)), 960px);
    }

    .level-end {
        width: clamp(220px, 22vw, 360px);
    }
}

/* ---------- INVENTORY ---------- */

.inventory .block-title,
.inv-group {
    max-width: min(100%, 980px);
}

.inv-group+.inv-group {
    margin-top: 7vh;
}

.inv-cat {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--paper-2);
    margin-bottom: 14px;
}

.inv-cat span {
    color: var(--faint);
}

.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    padding: 1px 0 0 1px;
}

.slot {
    position: relative;
    aspect-ratio: 1;
    padding: 12px;
    background: var(--ink);
    border: 1px solid var(--line-2);
    margin: -1px 0 0 -1px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: background 0.35s, color 0.35s;
    outline-offset: -2px;
}

.slot-n,
.slot-lvl {
    position: absolute;
    top: 10px;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--faint);
    transition: color 0.35s;
}

.slot-n {
    left: 12px;
}

.slot-lvl {
    right: 12px;
    text-transform: uppercase;
}

.slot-sym {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(2.2rem, 3.6vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: auto;
    margin-top: 26px;
}

.slot-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    margin-bottom: auto;
    margin-top: 28px;
}

.slot-name {
    font-size: 13px;
    margin-bottom: 8px;
}

.slot-bar {
    height: 2px;
    background: var(--line);
}

.slot-bar i {
    display: block;
    height: 100%;
    background: var(--paper-2);
}

.tier-s .slot-sym,
.tier-s .slot-lvl {
    color: var(--signal);
}

.tier-s .slot-bar i {
    background: var(--signal);
}

.tier-b .slot-sym {
    color: var(--paper-2);
}

.slot:hover,
.slot:focus-visible {
    background: var(--paper);
    color: var(--ink);
    z-index: 3;
}

.slot:hover .slot-sym,
.slot:focus-visible .slot-sym,
.slot:hover .slot-n,
.slot:hover .slot-lvl,
.slot:focus-visible .slot-n,
.slot:focus-visible .slot-lvl {
    color: var(--ink);
}

.slot:hover .slot-bar i {
    background: var(--signal);
}

.slot-tip {
    position: absolute;
    left: -1px;
    right: -1px;
    top: 100%;
    padding: 10px 12px;
    background: var(--signal);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.35s var(--ease);
}

.slot:hover .slot-tip,
.slot:focus-visible .slot-tip {
    opacity: 1;
    transform: none;
}

/* ---------- CO-OP ---------- */

.coop {
    min-height: auto;
    padding-bottom: 18vh;
}

.coop-title {
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(3rem, 11vw, 12rem);
    line-height: 0.88;
    letter-spacing: -0.055em;
}

.coop-text {
    margin-top: 5vh;
    max-width: 44ch;
    font-size: clamp(1.05rem, 1.5vw, 1.3rem);
    color: var(--paper-2);
}

.coop-mail {
    margin-top: 7vh;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 16px 36px;
}

.mail-copy {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.4rem, 4.4vw, 4rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    word-break: break-all;
    position: relative;
    background: linear-gradient(var(--signal), var(--signal)) 0 100% / 0 3px no-repeat;
    transition: background-size 0.7s var(--ease);
    padding-bottom: 4px;
}

.mail-copy:hover {
    background-size: 100% 3px;
}

.mail-copy.done span {
    color: var(--signal);
}

.mail-go {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--paper-2);
    transition: color 0.3s;
}

.mail-go:hover {
    color: var(--signal);
}

.coop-list {
    margin-top: 10vh;
    border-top: 1px solid var(--line-2);
}

.coop-list li {
    border-bottom: 1px solid var(--line-2);
}

.coop-list a,
.coop-list button {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 40px;
    align-items: center;
    gap: 24px;
    width: 100%;
    padding: 22px 0;
    overflow: hidden;
    isolation: isolate;
    transition: color 0.4s, padding 0.6s var(--ease);
}

.coop-list a::before,
.coop-list button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--signal);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.55s var(--ease);
    z-index: -1;
}

.coop-list a:hover,
.coop-list button:hover {
    color: var(--ink);
    padding-left: 18px;
    padding-right: 18px;
}

.coop-list a:hover::before,
.coop-list button:hover::before {
    transform: scaleY(1);
}

.coop-list span {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.3rem, 2.8vw, 2.6rem);
    letter-spacing: -0.03em;
}

.coop-list em {
    font-style: normal;
    font-size: 12px;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 38vw;
}

.coop-list b {
    font-weight: 400;
    font-size: 1.4rem;
    text-align: right;
}

/* ---------- CREDITS ---------- */

.credits {
    position: relative;
    padding: 16vh var(--gutter) 100px;
    text-align: center;
}

.credits-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--signal);
    margin-bottom: 6vh;
}

.credits-roll div {
    margin-bottom: 4vh;
}

.credits-roll dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--faint);
    margin-bottom: 6px;
}

.credits-roll dd {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: -0.02em;
}

.credits-thanks {
    margin-top: 10vh;
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(2rem, 6vw, 5.5rem);
    letter-spacing: -0.05em;
    line-height: 1;
}

.credits-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16vh;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--faint);
}

.credits-bottom a:hover {
    color: var(--signal);
}

/* ---------- Cutscene ---------- */

/* while a video is open, use the normal system cursor so the controls are easy to reach */
.cutscene-open .cursor {
    display: none !important;
}

.has-cursor.cutscene-open,
.has-cursor.cutscene-open * {
    cursor: auto !important;
}

.has-cursor.cutscene-open .cutscene-close {
    cursor: pointer !important;
}

.cutscene {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(10, 10, 9, 0.96);
    display: flex;
    flex-direction: column;
    padding: 20px var(--gutter) var(--gutter);
    gap: 16px;
}

.cutscene[hidden] {
    display: none;
}

.cutscene-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.cutscene-title {
    color: var(--signal);
}

.cutscene-close {
    padding: 8px 12px;
    border: 1px solid var(--line-2);
    transition: background 0.3s, color 0.3s;
}

.cutscene-close:hover {
    background: var(--paper);
    color: var(--ink);
}

.cutscene video {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #000;
    object-fit: contain;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .hud-menu {
        display: none;
    }

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

@media (max-width: 820px) {
    .hud-top {
        padding: 16px 18px;
    }

    .hud-bottom {
        padding: 16px 18px;
    }

    .hud-bottom,
    .corner,
    .sound-label {
        display: none;
    }

    .hud-top {
        padding-bottom: 28px;
    }

    .start-bottom {
        flex-direction: column;
        align-items: flex-start;
        bottom: 9vh;
    }

    .start-meta {
        align-items: flex-start;
        text-align: left;
    }

    .block {
        padding-top: 16vh;
    }

    .player-grid {
        max-width: none;
    }

    .levels-head {
        grid-template-columns: 1fr;
    }

    .levels-track {
        flex-direction: column;
        width: auto;
        gap: 22px;
    }

    .level,
    .level-end {
        width: 100%;
    }

    .level-info {
        grid-template-columns: 1fr;
    }

    .level-info p {
        grid-row: auto;
    }

    .level-media video,
    .level-media img {
        filter: none;
    }

    .quest-line {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .inv-grid {
        grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    }

    .coop-list a,
    .coop-list button {
        grid-template-columns: minmax(0, 1fr) 30px;
    }

    .coop-list em {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .js .reveal,
    .js .line>span {
        opacity: 1;
        transform: none;
    }
}
