* { box-sizing: border-box; }
:root { color-scheme: dark; }
body { margin: 0; background: #000; color: #fff; font: 13px/1.5 Tahoma, Verdana, sans-serif; }
a { color: #c0ff8b; text-decoration: underline; cursor: pointer; }
a:hover { color: #ff9cf5; }
button { font: 12px Tahoma, sans-serif; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 2px dotted #e1ff00; outline-offset: 5px; }
.background-video { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.scanlines { position: fixed; inset: 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 3px, #0003 3px 4px); opacity: .4; z-index: 10; }
header { position: absolute; inset: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; padding: 25px 32px; gap: 20px; }
.site-name { color: #baff87; font: 29px 'Courier New', monospace; letter-spacing: -1px; text-shadow: 2px 2px #000, -1px -1px #000; text-decoration: none; }
.top-links { display: flex; gap: 20px; padding-top: 6px; }
.top-links a { background: #000b; padding: 2px 6px; }
main { min-height: 100svh; position: relative; }
header { z-index: 2; }
.coordinates { position: absolute; top: 19%; left: 32px; color: #b8ff87; font: 10px/1.7 'Courier New', monospace; text-shadow: 1px 1px black; }
.cat-label { position: absolute; top: 23%; right: 7%; display: flex; flex-direction: column; align-items: center; transform: rotate(6deg); }
.cat-label img { width: clamp(65px, 9vw, 115px); border: 1px solid #8aab65; }
.cat-label span { font: 11px 'Courier New', monospace; padding: 1px 6px; color: #000; background: #b8ff87; }
.lore-note { position: absolute; left: 5%; bottom: 21%; width: min(400px, 45%); transform: rotate(-1.5deg); }
.lore-note p { margin: 0 0 12px; background: #e2e4ceeF; color: #090d02; font: 14px/1.5 'Courier New', monospace; padding: 12px 15px; box-shadow: 4px 5px #0008; }
.lore-note p span { background: #f99a31; padding: 0 2px; }
.lore-note > div { display: flex; align-items: center; gap: 16px; }
.lore-note a { background: #000b; padding: 0 5px; font-size: 11px; }
.lore-note button, footer button { color: #000; background: #c0c0c0; border: 2px outset #eee; padding: 3px 8px; }
.media-entry { position: absolute; bottom: 25%; right: 10%; background: #000b; border: 1px dotted #adff7b; color: #b9ff8c; padding: 12px 18px; display: flex; gap: 13px; align-items: center; text-align: left; transform: rotate(2deg); }
.media-entry:hover { background: #111e08; color: white; }
.play-symbol { font: 34px 'Courier New', monospace; }
.media-entry small { font: 10px 'Courier New', monospace; color: #b6c5ad; }
.floating-link { position: absolute; left: 48%; top: 28%; transform: rotate(-8deg); font: italic 17px 'Times New Roman', serif; text-shadow: 2px 2px black; }
.floating-link a { color: #e7ff43; }
footer { position: fixed; bottom: 0; width: 100%; padding: 10px 15px; display: flex; justify-content: space-between; align-items: end; gap: 15px; z-index: 3; }
footer > div { display: flex; flex-wrap: wrap; gap: 5px; }
footer > span { background: #000a; padding: 2px 5px; font-size: 9px; color: #aaa; }
#tear { position: fixed; top: 39%; height: 9px; width: 100%; pointer-events: none; z-index: 11; opacity: 0; background: #aaffbb30; }
body.glitching #tear { opacity: 1; box-shadow: 0 63px #f0f2, 0 -100px #fff2; }
body.glitching .background-video { transform: translateX(4px); filter: hue-rotate(15deg); }
#error-layer { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
.error-window { position: absolute; width: 235px; background: silver; color: black; border: 2px outset #eee; padding: 2px; font: 11px Tahoma, sans-serif; box-shadow: 3px 3px #0008; pointer-events: auto; }
.error-title, .window-title { background: linear-gradient(90deg, #000080, #1084d0); color: #fff; padding: 2px 4px; display: flex; justify-content: space-between; align-items: center; font: 11px Tahoma, sans-serif; }
.error-title button, .close-window { background: silver; color: black; border: 2px outset #eee; padding: 0 4px; font-size: 12px; line-height: 15px; }
.error-body { padding: 13px 8px; display: flex; align-items: center; gap: 12px; }
.error-icon { border-radius: 50%; width: 23px; height: 23px; text-align: center; flex-shrink: 0; background: #b00000; color: white; font: 21px Arial, sans-serif; }
.error-ok { display: block; margin: 0 auto 9px; min-width: 65px; background: silver; color: black; border: 2px outset #eee; }
dialog { padding: 3px; border: 2px outset #ddd; background: #bcbcbc; color: #000; max-width: calc(100vw - 24px); max-height: calc(100svh - 24px); box-shadow: 8px 8px #0008; }
dialog::backdrop { background: #000b; }
#gallery { width: 860px; }
.window-title { margin-bottom: 3px; }
.media-stage { background: #000; height: min(65svh, 610px); display: flex; align-items: center; justify-content: center; }
.media-stage video, .media-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
[hidden] { display: none !important; }
.gallery-controls { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 8px 0 2px; font: 12px 'Courier New', monospace; }
.gallery-controls button { background: silver; color: #000; border: 2px outset white; min-width: 60px; padding: 2px 10px; font-size: 20px; }
.keyboard-hint { text-align: center; margin: 3px 0 5px; font: 10px 'Courier New', monospace; color: #333; }
#lore-dialog { width: 560px; }
#lore-dialog img { display: block; max-width: 100%; max-height: calc(100svh - 110px); margin: auto; object-fit: contain; }
.source-link { display: block; text-align: center; padding: 5px; color: #000080; font-size: 11px; }
@media (max-width: 650px) {
    header { padding: 18px 15px; }
    .site-name { font-size: 23px; }
    .top-links { gap: 7px; flex-direction: column; padding: 0; font-size: 11px; }
    .coordinates { left: 16px; top: 17%; }
    .cat-label { top: 20%; right: 8%; }
    .floating-link { top: 42%; left: 15%; font-size: 15px; }
    .lore-note { left: 5%; bottom: 24%; width: 90%; }
    .lore-note p { font-size: 12px; padding: 9px 12px; }
    .media-entry { right: 7%; bottom: 10%; padding: 4px 12px; }
    footer { align-items: start; padding: 7px; }
    footer > span { max-width: 120px; font-size: 8px; }
    footer button { font-size: 10px; padding: 3px; }
    .media-stage { height: 57svh; }
}
@media (prefers-reduced-motion: reduce) {
    #tear { display: none; }
    body.glitching .background-video { transform: none; filter: none; }
}

main {
    min-height: 100svh;
    max-width: 1500px;
    margin: auto;
    padding: 105px 4% 85px;
    display: flex;
    flex-wrap: wrap;
    gap: 25px 5%;
    align-items: flex-start;
    justify-content: space-between;
}
.cat-label { display: none; }
.lore-note { position: static; width: min(580px, 100%); margin: 0; transform: rotate(-1deg); }
.lore-note p { font-size: 14px; }
.floating-link { position: static; margin: 28px 15px 0 auto; transform: rotate(-5deg); }
#gallery, #lore-panel { background: silver; color: black; border: 2px outset #eee; padding: 3px; box-shadow: 5px 5px #0008; }
#gallery { width: 59%; margin-top: 30px; transform: rotate(.6deg); }
#lore-panel { width: 34%; margin: 0 0 30px; transform: rotate(-1deg); }
#lore-panel img { display: block; width: 100%; height: auto; }
.media-stage { height: auto; aspect-ratio: 4 / 3; }
.media-stage video, .media-stage img { min-height: 0; }
footer { background: #0009; }
@media (max-width: 750px) {
    main { padding: 105px 5% 110px; gap: 20px; }
    .lore-note { width: 100%; }
    .floating-link { margin: 0 5px 15px auto; }
    #gallery { width: 100%; margin: 0; }
    #lore-panel { width: 88%; margin: 12px auto 0; }
    .media-stage { height: auto; }
}

.cat-label {
    display: flex;
    position: static;
    flex: 0 0 175px;
    margin: 0 8px 5px 0;
    transform: rotate(-4deg);
    align-self: center;
}
.cat-label img { width: 175px; max-width: 100%; border: 1px solid #8aab65; box-shadow: 4px 4px #0008; }
.lore-note { flex: 1 1 330px; max-width: 580px; align-self: center; }
.floating-link { flex: 0 0 100%; margin: -5px 0 10px; text-align: center; transform: rotate(-3deg); }
@media (max-width: 750px) {
    .cat-label { flex-basis: 125px; margin: 0 auto 12px; }
    .cat-label img { width: 125px; }
    .lore-note { flex-basis: 100%; }
    .floating-link { margin: 0 0 10px; }
}
