/* The Legend of Myra - level archive
 * Colours: gold = the game's CLRFNT font (brick screen palette), blue = BGROUND night forest. */
:root {
    --gold: #ffbe00;
    --gold-light: #ffdb71;
    --gold-dark: #d38e00;
    --gold-deep: #8a5a00;
    --navy: #070a2e;
    --navy-mid: #141a5c;
    --ink: #e4e7ff;
}

/* ---------- page ---------- */
html, body { margin: 0; padding: 0; }
body {
    background: #02031a url("Background.webp") center center / cover no-repeat fixed;
    color: var(--ink);
    font: 15px/1.5 Verdana, Geneva, Tahoma, sans-serif;
}
.page-header {
    background: linear-gradient(to bottom, rgba(10, 12, 52, 0.95), rgba(4, 6, 30, 0.9));
    padding: 22px 16px 16px;
    text-align: center;
    border-bottom: 3px solid var(--gold-dark);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.page-header h1 {
    margin: 0;
    font-size: 38px;
    letter-spacing: 2px;
    color: var(--gold);   /* fallback */
    background: linear-gradient(to bottom, var(--gold-light) 0%, var(--gold) 45%, var(--gold-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 0 #000);
}
.page-header .sub { margin: 6px 0 0; color: var(--gold-light); opacity: 0.85; }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
.intro {
    margin: 8px 0 16px;
    padding: 10px 14px;
    background: rgba(4, 6, 30, 0.72);
    border: 1px solid var(--gold-deep);
}
.intro p { margin: 0 0 8px; }
.intro ul { margin: 0; padding-left: 22px; }
.intro li { margin: 2px 0; }
/* inline game tiles (16x16, black made transparent) */
img.icon {
    width: 16px; height: 16px;
    vertical-align: -3px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.page-footer { text-align: center; color: #aab; font-size: 12px; padding: 16px; text-shadow: 0 1px 2px #000; }

/* ---------- level table ---------- */
table.levels {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--gold-deep);
    background: rgba(6, 9, 40, 0.82);
}
table.levels th, table.levels td {
    border: 1px solid var(--gold-deep);
    padding: 4px 8px;
    text-align: left;
    vertical-align: top;
}
table.levels th { background: var(--navy-mid); color: var(--gold); font-weight: bold; }
table.levels tbody tr:nth-child(even) { background: rgba(24, 30, 92, 0.55); }
table.levels tbody tr.lvl-row { cursor: pointer; }
table.levels tbody tr.lvl-row:hover,
table.levels tbody tr.lvl-row:focus { background: rgba(255, 190, 0, 0.2); color: #fff; outline: none; }
table.levels tbody tr.lvl-row:hover .c-d { color: var(--gold-light); }
table.levels th.c-n, table.levels th.c-g, table.levels th.c-num,
table.levels td.c-n, table.levels td.c-g, table.levels td.c-num { width: 1%; white-space: nowrap; text-align: center; }

/* ---------- lightbox ---------- */
/* while the viewer is open the page can't scroll, but the scroll bar stays so nothing shifts */
html.lb-open { overflow-y: scroll; }
body.lb-open { position: fixed; left: 0; right: 0; }
.lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.75);
    user-select: none;
}
.lb-main {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.lb-row { display: flex; align-items: center; }

/* frame from the game's MAP textures (20x20, drawn 3x = 60x60 with no smoothing). The map image fills the
 * frame's inner black area; the frame pieces sit behind it. At 3x the inner area starts 9 px from the left and
 * 15 px from the top; the right pieces start 12 px before the inner right edge, the bottom pieces 42 px before
 * the inner bottom edge. */
.lb-box {
    position: relative;
    padding: 15px 48px 18px 9px;
    /* the frame is wider on the right (ornaments) and lower edge: these margins make the box symmetric,
       so the level image itself is centred (48 px around it horizontally, 18 px vertically) */
    margin: 3px 0 0 39px;
}
.lb-fr {
    position: absolute;
    z-index: 0;
    background-size: 60px 60px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.lb-fr-tl { left: 0;  top: 0;  width: 60px; height: 60px; background-image: url("MAP_000.webp"); }
.lb-fr-t  { left: 60px; right: 60px; top: 0; height: 60px; background-image: url("MAP_001.webp"); background-repeat: repeat-x; }
.lb-fr-tr { right: 0; top: 0;  width: 60px; height: 60px; background-image: url("MAP_002.webp"); }
.lb-fr-l  { left: 0;  top: 57px; bottom: 60px; width: 60px; background-image: url("MAP_003.webp"); background-repeat: repeat-y; }
.lb-fr-r  { right: 0; top: 60px; bottom: 60px; width: 60px; background-image: url("MAP_004.webp"); background-repeat: repeat-y; }
.lb-fr-bl { left: 0;  bottom: 0; width: 60px; height: 60px; background-image: url("MAP_005.webp"); }
.lb-fr-b  { left: 60px; right: 60px; bottom: 0; height: 60px; background-image: url("MAP_006.webp"); background-repeat: repeat-x; }
.lb-fr-br { right: 0; bottom: 0; width: 60px; height: 60px; background-image: url("MAP_007.webp"); }

.lb-stage { position: relative; z-index: 1; background: #000; }   /* not clipped: circles at the map edge may overlap the frame */
.lb-stage img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.lb-layers img { visibility: hidden; }
.lb-layers img.on { visibility: visible; }
.lb-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lb-svg .hs { pointer-events: all; fill: #fff; fill-opacity: 0; cursor: default; }
.lb-svg .hs-lever.hot { stroke: #fff; stroke-width: 1.5; stroke-opacity: 0.9; }
.lb-svg .tp-arrow { pointer-events: none; }
.lb-svg .egg-icon { pointer-events: none; image-rendering: pixelated; image-rendering: crisp-edges; }
.lb-spinner {
    position: absolute;
    left: 50%; top: 50%;
    width: 36px; height: 36px;
    margin: -18px 0 0 -18px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ddd;
    border-radius: 50%;
    animation: lb-spin 0.8s linear infinite;
    display: none;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* navigation arrows (ARROW3) and close button (CLRFNT "X"), drawn 3x without smoothing */
.lb-nav, .lb-close {
    border: 0;
    padding: 0;
    cursor: pointer;
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transition: filter 0.15s;
}
.lb-nav:hover, .lb-close:hover, .lb-nav:focus-visible, .lb-close:focus-visible { filter: brightness(1.35); outline: none; }
.lb-nav {
    /* 48x48 arrow (3x) inside a bigger hit area: +25% left and right, +100% above and below */
    flex: 0 0 72px;
    width: 72px;
    height: 144px;
    background-size: 48px 48px;
}
/* 50 px between each arrow and the level image (the button's 12 px side padding is included) */
.lb-prev { margin-right: -10px; }
.lb-next { margin-left: -10px; }
.lb-prev { background-image: url("nav_prev.webp"); }
.lb-next { background-image: url("nav_next.webp"); }
.lb-nav[disabled] { visibility: hidden; }
.lb-close {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 2;
    width: 40px; height: 40px;
    background-image: url("close.webp");
}
.lb-caption {
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 0 16px;
    text-align: center;
    color: #bbb;
    font-size: 16px;
}
/* black box behind the caption text, only as wide as the text */
.lb-caption .lb-label {
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    padding: 6px 14px;
    background: #000;
    text-align: center;
    line-height: 1.5;
}
.lb-caption .lb-desc, .lb-caption .lb-meta div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lb-caption .lb-meta { font-size: 14px; margin-top: 2px; }
.lb-caption .lb-meta b { color: #ddd; }
.lb-caption .lb-name { color: #ddd; font-weight: bold; margin-right: 8px; }
