:root {
    --bg: #20222e;
    --paper: #f2f0e5;
    --ink: #212123;
    --muted: #868188;
    --text2: #55525e;
    --lime: #c2d368;
    --cyan: #68c2d3;
    --bar-dark: #2a2a3a;
    --task: #3a3858;
    --font: "Rubik", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --display: "Jost", "Rubik", sans-serif;
}

* { box-sizing: border-box; }

html.ru .en, html.en .ru { display: none !important; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    background: var(--bg) url(img/circuit.jpg) center / cover fixed;
    font: 16px/1.4 var(--font);
    color: var(--ink);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(32, 34, 46, .66);
    z-index: -1;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
code { font: 13px var(--mono); background: #e3e0d5; padding: 1px 5px; border-radius: 3px; }

.ic { width: 18px; height: 18px; flex: none; }

#desk { position: relative; width: 100%; padding-bottom: 56px; }

#stage {
    position: relative;
    width: 1440px;
    height: 1620px;
    transform-origin: 0 0;
}

.icon, .win, .sticky, .wallpaper {
    position: absolute;
    left: var(--x);
    top: var(--y);
}

.icon {
    width: 112px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 0 4px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    z-index: 1;
    border-radius: 10px;
}

.icon .tile {
    position: relative;
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    background: var(--c);
    border: 2px solid var(--ink);
    border-radius: 14px;
    box-shadow: 0 5px 0 var(--ink);
    color: var(--ink);
    transition: transform .12s, box-shadow .12s;
}

.icon .tile .ic { width: 30px; height: 30px; }
.icon .tile .link { position: absolute; right: -8px; bottom: -8px; width: 22px; height: 22px; padding: 3px; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; }

.icon .caption {
    font-weight: 600;
    font-size: 16px;
    color: var(--paper);
    text-align: center;
    line-height: 1.2;
    padding: 1px 6px;
    border-radius: 4px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}

.icon:hover .tile { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.icon:focus-visible { outline: 2px dashed var(--cyan); outline-offset: 4px; }
.icon.selected .caption { background: #3a6a9a; }
.tidy { transition: left .35s ease, top .35s ease; }
.icon.dragging { z-index: 999; cursor: grabbing; }
.icon.dragging .tile { transform: translateY(-4px) rotate(-4deg); box-shadow: 0 10px 0 rgba(0, 0, 0, .5); }

.win {
    width: var(--w);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 8px;
    box-shadow: 8px 10px 0 rgba(12, 12, 18, .67);
    overflow: hidden;
    z-index: 2;
}

.win[hidden] { display: none; }
.win.focus { box-shadow: 10px 13px 0 rgba(12, 12, 18, .75); }

.bar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 16px;
    background: var(--bar);
    border-bottom: 2px solid var(--ink);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.win.dragging .bar { cursor: grabbing; }
.win:not(.focus) .bar { filter: saturate(.75) brightness(.92); }

.bar h2 { font-size: 17px; font-weight: 700; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ctl { display: flex; gap: 8px; }
.ctl button {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    background: rgba(242, 240, 229, .22);
    color: rgba(242, 240, 229, .85);
}
.ctl button .ic { width: 16px; height: 16px; }
.ctl .close { background: #cf4f4f; color: #fff; }
.ctl button:hover { filter: brightness(1.2); }

.body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }

.shot { display: block; position: relative; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; background: var(--ink); }
.shot img { width: 100%; }

.logo-shot .logo { position: absolute; left: 14px; bottom: 10px; width: 46%; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .5)); }
.logo-shot .logo.vr { width: 22%; }

.row { display: flex; align-items: center; gap: 16px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text2); font-size: 15px; }
.meta { margin-top: 6px; font: 13px var(--mono); color: var(--muted); }


.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 3px 0 var(--ink);
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.big { height: 48px; padding: 0 24px; font-size: 17px; }
.btn.lime { background: var(--lime); }
.btn.red { background: #fa5c5c; color: #fff; }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: #33333a; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font: 700 12px var(--mono);
    font-style: normal;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 3px;
    background: #e3e0d5;
    color: #43436a;
}
.chip .ic { width: 13px; height: 13px; }
.chip.lime { background: var(--lime); color: var(--ink); }
.chip.dark { background: var(--ink); color: #ede19e; }

.path {
    padding: 7px 12px;
    background: #e3e0d5;
    border-radius: 4px;
    font: 13px var(--mono);
    color: #43436a;
}
.path .ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 8px; }

.games { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 -8px; }.game, .world {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 8px 10px;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: background .12s, border-color .12s;
    position: relative;
}
.game:hover, .world:hover { background: #e8e5d8; border-color: var(--ink); }
.game img, .world img { border: 2px solid var(--ink); border-radius: 5px; margin-bottom: 6px; aspect-ratio: 630 / 500; object-fit: cover; width: 100%; }
.game img.pixel { image-rendering: pixelated; }
.game b, .world b { font-size: 16px; line-height: 1.2; }
.game > span, .world > span { font-size: 13px; color: var(--text2); line-height: 1.3; }
.game .tag {
    position: absolute;
    top: 14px;
    font: 700 11px var(--mono);
    font-style: normal;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--ink);
    color: var(--paper);
    left: 14px;
}
.game .tag.jam { left: auto; right: 14px; background: #ede19e; color: var(--ink); border: 1px solid var(--ink); }

.featured { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: center; padding-bottom: 18px; border-bottom: 2px dashed #d6d2c4; }
.featured .shot { transition: transform .15s; }
.featured .shot:hover { transform: translateY(-2px) rotate(-.5deg); }
.featured .info { display: flex; flex-direction: column; gap: 8px; }
.featured h3 { font-size: 24px; font-weight: 800; line-height: 1.15; }
.featured p:not(.meta) { font-size: 16px; }
.featured .meta { margin-top: 0; }
.featured .links { margin-top: 4px; }

.foot { border-top: 2px dashed #d6d2c4; padding-top: 14px; }

.tabs { display: flex; gap: 4px; padding: 10px 22px 0; background: #e3e0d5; border-bottom: 2px solid var(--ink); }
.tab {
    padding: 7px 16px 8px;
    font-weight: 700;
    font-size: 15px;
    color: #6b6876;
    border: 2px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    margin-bottom: -2px;
}
.tab.on { background: var(--paper); border-color: var(--ink); color: var(--ink); }
.tab:hover:not(.on) { color: var(--ink); }
.pane { display: flex; flex-direction: column; gap: 14px; }
.pane[hidden] { display: none; }

.worlds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: -8px; }
.world img { aspect-ratio: 4 / 3; }
.mods .world img { aspect-ratio: 4 / 3; }

.hello { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border: 2px solid var(--ink); border-radius: 50%; background: #2c3140; }
.hello h3 { font-size: 22px; font-weight: 700; }
#about p { font-size: 16.5px; }
#about .btn { height: 36px; padding: 0 11px; font-size: 14px; }
#about .btn .ic { width: 16px; height: 16px; }
.discord { color: #5865f2; }
.discord span, .discord { font-family: var(--font); }

.sticky {
    width: 212px;
    padding: 18px;
    background: #ede19e;
    border: 2px solid var(--ink);
    box-shadow: 5px 6px 0 rgba(12, 12, 18, .67);
    transform: rotate(-2.5deg);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.sticky::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 50%;
    width: 70px;
    height: 22px;
    margin-left: -35px;
    background: rgba(242, 240, 229, .65);
    border: 1px solid rgba(33, 33, 35, .25);
    transform: rotate(3deg);
}
.sticky h3 { font-size: 20px; font-weight: 800; }
.sticky p { font-size: 14px; color: #3a3858; }
.sticky.wiggle { animation: wiggle .6s; }
.brand-btn {
    display: grid;
    place-items: center;
    height: 44px;
    background: #fffbe8;
    border: 2px solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 3px 0 var(--ink);
    transition: transform .08s, box-shadow .08s;
}
.brand-btn img { height: 20px; width: auto; }
.brand-btn:first-of-type img { height: 26px; }
.brand-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); background: #fff; }

.wallpaper { pointer-events: none; z-index: 0; }
.wallpaper h1 { font: 800 96px/1.1 var(--display); color: var(--paper); letter-spacing: -1px; }
.wallpaper p { font: 22px var(--mono); color: var(--cyan); margin-top: 4px; }

#taskbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: var(--bar-dark);
    border-top: 2px solid var(--ink);
    z-index: 5000;
    color: var(--paper);
}

#start {
    height: 37px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--lime);
    color: var(--ink);
    font: 700 16px var(--mono);
    border: 2px solid var(--ink);
    flex: none;
}
#start .prompt { font-weight: 400; }
#start[aria-expanded="true"] { background: #d7e68a; }

#tasks { display: flex; gap: 8px; flex: 1; min-width: 0; overflow: hidden; }
.task {
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--task);
    font-size: 14px;
    white-space: nowrap;
    flex: none;
    border-bottom: 3px solid transparent;
}
.task:hover { background: #48466c; }
.task.focus { background: #514f7c; border-bottom-color: var(--cyan); }
.task.min { opacity: .6; }

.tray { display: flex; align-items: center; gap: 4px; flex: none; }
.tray a, .tray button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--paper); }
.tray a:hover, .tray button:hover { background: #3a3858; }
.tray .ic { width: 19px; height: 19px; }
html.crt #crt-toggle { color: var(--lime); }

.lang { display: flex; padding: 3px; background: var(--ink); border-radius: 6px; flex: none; }
.lang button { padding: 5px 9px; border-radius: 4px; font: 700 13px var(--mono); color: var(--muted); }
html.ru .lang [data-lang="ru"], html.en .lang [data-lang="en"] { background: var(--cyan); color: var(--ink); }

#clock { font: 15px var(--mono); flex: none; min-width: 46px; text-align: right; }

#startmenu {
    position: fixed;
    left: 12px;
    bottom: 64px;
    width: 280px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 8px;
    box-shadow: 8px 10px 0 rgba(12, 12, 18, .67);
    z-index: 5001;
    padding: 8px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
#startmenu[hidden] { display: none; }
#startmenu .who { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; }
#startmenu .who img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); background: #2c3140; }
#startmenu .who b { display: block; font-size: 18px; }
#startmenu .who span { font-size: 13px; color: var(--text2); }
#startmenu hr { border: 0; border-top: 2px dashed #d6d2c4; margin: 6px 4px; }
#startmenu .list { display: flex; flex-direction: column; }
#startmenu .list a, #startmenu .list button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 15px;
    text-align: left;
    width: 100%;
}
#startmenu .list a:hover, #startmenu .list button:hover { background: #e3e0d5; }
#startmenu .dot { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); background: var(--c); flex: none; }
#startmenu .state { margin-left: auto; font: 700 11px var(--mono); font-style: normal; padding: 2px 6px; border-radius: 3px; background: #e3e0d5; }
html.crt #startmenu .state { background: var(--lime); }
#startmenu .state::after { content: "OFF"; }
html.crt #startmenu .state::after { content: "ON"; }

#toast {
    position: fixed;
    left: 50%;
    bottom: 72px;
    transform: translate(-50%, 20px);
    padding: 10px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 6px;
    font: 14px var(--mono);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 5002;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#crt, #boot { display: none; }
html.crt #crt {
    display: block;
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    animation: flicker 4s infinite;
}
#crt .lines {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, .17) 0, rgba(0, 0, 0, .17) 1px, transparent 1px, transparent 3px),
        repeating-linear-gradient(90deg, rgba(255, 0, 40, .035) 0, rgba(255, 0, 40, .035) 1px, rgba(0, 255, 120, .025) 1px, rgba(0, 255, 120, .025) 2px, rgba(0, 90, 255, .035) 2px, rgba(0, 90, 255, .035) 3px);
}
#crt .roll {
    position: absolute;
    left: 0;
    right: 0;
    height: 25vh;
    top: -25vh;
    background: linear-gradient(transparent, rgba(255, 255, 255, .045), transparent);
    animation: roll 8s linear infinite;
}
#crt .bezel {
    position: absolute;
    inset: 0;
    border-radius: 28px / 36px;
    box-shadow: 0 0 0 60px #07080b, inset 0 0 110px rgba(0, 0, 0, .55), inset 0 0 18px rgba(0, 0, 0, .6);
    background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .3) 100%);
}
html.crt .wallpaper h1 { text-shadow: 3px 0 rgba(255, 40, 90, .35), -3px 0 rgba(60, 200, 255, .35); }
html.crt .bar h2, html.crt .icon .caption, html.crt #taskbar { text-shadow: 1px 0 rgba(255, 40, 90, .25), -1px 0 rgba(60, 200, 255, .25); }

html.crt.booting #boot {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9500;
    pointer-events: none;
}
#boot::before, #boot::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    background: #000;
    animation: shutter .55s .25s cubic-bezier(.7, 0, .3, 1) forwards;
}
#boot::before { top: 0; border-bottom: 1px solid #fff; box-shadow: 0 2px 12px #cfe8ff; }
#boot::after { bottom: 0; --dir: 1; }
#boot::before { --dir: -1; }

@keyframes shutter {
    to { transform: translateY(calc(var(--dir) * 101%)); }
}
@keyframes roll {
    to { transform: translateY(150vh); }
}
@keyframes flicker {
    0%, 100% { opacity: 1; }
    48% { opacity: 1; }
    50% { opacity: .82; }
    52% { opacity: 1; }
}
@keyframes wiggle {
    0%, 100% { transform: rotate(-2.5deg); }
    25% { transform: rotate(3deg) scale(1.05); }
    50% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(1deg); }
}

@media (prefers-reduced-motion: reduce) {
    #crt, #crt .roll { animation: none; }
    #crt .roll { display: none; }
    html.crt.booting #boot { display: none; }
    .sticky.wiggle { animation: none; }
}

@media (max-width: 899px) {
    #desk { padding: 16px 16px 76px; }
    #stage {
        width: auto;
        height: auto !important;
        transform: none !important;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 22px 4px;
    }
    .win, .sticky, .wallpaper, .icon { min-width: 0; }
    .icon, .win, .sticky, .wallpaper { position: relative; left: auto; top: auto; z-index: auto; }
    .win, .sticky, .wallpaper { grid-column: 1 / -1; }
    .icon { width: auto; margin-bottom: -8px; }
    #about { order: 1; }
    #games { order: 3; }
    #vr { order: 4; }
    #vrc { order: 5; }
    #ws { order: 6; }
    .icon .tile { width: 58px; height: 58px; border-radius: 12px; }
    .icon .tile .ic { width: 26px; height: 26px; }
    .icon .caption { font-size: 13px; }
    .win { width: auto; box-shadow: 5px 6px 0 rgba(12, 12, 18, .67); }
    .bar { cursor: default; }
    .body { padding: 16px; }
    .row { flex-wrap: wrap; }
    .featured { grid-template-columns: 1fr; }
    .featured .links .btn { flex: 1; justify-content: center; }
    .games { grid-template-columns: 1fr 1fr; gap: 8px; }
    .sticky { order: 2; width: auto; transform: none; cursor: default; margin: 0 6px; }
    .wallpaper { order: 8; padding: 10px 0; }
    .wallpaper h1 { font-size: 56px; }
    .wallpaper p { font-size: 15px; }
    #tasks { display: none; }
    .tray a, .tray button { width: 30px; }
    .tray a { display: none; }
    #taskbar { gap: 6px; padding: 0 8px; justify-content: space-between; }
    #start { padding: 0 10px; }
    #crt .bezel { border-radius: 16px / 20px; }
}

@media (max-width: 420px) {
    .games { grid-template-columns: 1fr 1fr; }
    .tray #heart { display: none; }
}
