/* Sonic PHP: a Green Hill sky, a checkered ground, rings and yellow buttons. Mobile first. */
:root {
    /* the site is dark already: browsers that darken pages by themselves (Mi, WebViews) leave it as it is */
    color-scheme: dark;
    --sky-top: #1440c8;
    --sky: #2a7ff0;
    --sky-low: #7cc8ff;
    --yellow: #ffd400;
    --yellow-dark: #e09a00;
    --ink: #10183a;
    --white: #ffffff;
    --ground: #b85c00;
    --ground-dark: #7a3c00;
    --grass: #2eb82e;
    --panel: rgba(8, 20, 70, .9);
    --red: #ff5a5a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--white);
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky) 45%, var(--sky-low) 100%) fixed;
}

a { color: var(--yellow); }

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    font-weight: 800;
    text-decoration: none;
    letter-spacing: .02em;
}

.ring {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 5px solid var(--yellow);
    box-shadow: inset 0 0 0 1px var(--yellow-dark), 0 0 0 1px var(--yellow-dark);
    animation: spin 1.2s linear infinite;
}

@keyframes spin { 50% { transform: scaleX(.25); } }

.account { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.account a { color: var(--white); }
.who { font-weight: 800; color: var(--yellow); }
.pill { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .18); text-decoration: none; }

main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 8px 16px 40px; }

.flash {
    margin: 0 auto 16px;
    max-width: 560px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(46, 184, 46, .9);
    font-weight: 600;
}

.hero { text-align: center; padding: 32px 0 24px; }

h1 {
    margin: 0;
    font-size: clamp(44px, 12vw, 88px);
    line-height: 1;
    font-weight: 900;
    font-style: italic;
    letter-spacing: -.02em;
    text-shadow: 0 4px 0 var(--ink), 0 8px 24px rgba(0, 0, 0, .35);
}

.tagline { margin: 12px auto 0; max-width: 520px; font-size: 18px; opacity: .95; }

.play {
    display: inline-block;
    margin: 28px 0 8px;
    padding: 20px 64px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff27a 0%, var(--yellow) 45%, var(--yellow-dark) 100%);
    box-shadow: 0 6px 0 #9a5a00, 0 12px 28px rgba(0, 0, 0, .35);
    color: var(--ink);
    font: 900 clamp(30px, 8vw, 44px)/1 system-ui, sans-serif;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: .06em;
    cursor: pointer;
    transition: transform .08s, box-shadow .08s;
    -webkit-tap-highlight-color: transparent;
}

.play:hover { transform: translateY(-2px); }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #9a5a00, 0 6px 14px rgba(0, 0, 0, .3); }
.play:focus-visible { outline: 4px solid var(--white); outline-offset: 4px; }
.play.small { margin: 16px 0 0; padding: 14px 32px; font-size: 20px; border-radius: 14px; }

.as { margin: 12px 0 0; }

.online {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--panel);
    font-size: 14px;
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: #3cff6a; box-shadow: 0 0 8px #3cff6a; }

.cards { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 16px; }

.card, .howto, .panel {
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.card h2, .howto h2 { margin: 0 0 6px; font-size: 20px; color: var(--yellow); }
.card p { margin: 0; }

.howto { margin-top: 14px; }
.howto ul { margin: 0; padding-left: 20px; }

kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 6px;
    border-radius: 6px;
    background: var(--white);
    color: var(--ink);
    font: 700 13px/1.6 ui-monospace, monospace;
    text-align: center;
    box-shadow: 0 2px 0 #9aa;
}

.panel { max-width: 440px; margin: 24px auto 0; }
.panel h1 { font-size: clamp(36px, 9vw, 48px); }

.form { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.form label { font-weight: 700; }
.form input[type=text], .form input[type=password], .form input[type=email] {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 18px;   /* >= 16px: no zoom on iOS */
    color: var(--ink);
    background: var(--white);
}
.form input:focus { outline: none; border-color: var(--yellow); }
.form input[name$="[username]"], .form #username { text-transform: uppercase; letter-spacing: .08em; }
.form > div, .form > div > div { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.form .help-text, .form small { font-size: 13px; opacity: .85; }
.form ul { margin: 0; padding: 0; list-style: none; color: var(--red); font-weight: 700; }
.form button { align-self: stretch; }

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.error { color: var(--red); font-weight: 700; }
.alt { margin: 16px 0 0; text-align: center; }

.construction { max-width: 560px; text-align: center; }
.construction .soon { text-align: left; }
.sign {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: repeating-linear-gradient(45deg, var(--yellow) 0 12px, var(--ink) 12px 24px);
    transform: rotate(45deg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.ground {
    padding: 28px 16px calc(18px + env(safe-area-inset-bottom));
    text-align: center;
    font-size: 14px;
    background:
        linear-gradient(180deg, var(--grass) 0 10px, transparent 10px),
        repeating-conic-gradient(var(--ground) 0 25%, var(--ground-dark) 0 50%) 0 10px / 32px 32px;
}
.ground p { margin: 4px 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.ground a { color: var(--white); }
.ground .small { font-size: 12px; opacity: .9; }

@media (min-width: 720px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
    .hero { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    .ring { animation: none; }
    .play { transition: none; }
}

.online[hidden] { display: none; }
.online + .online { margin-left: 8px; }

/* the Sonic of the visitors (js/sonics.js): behind the page, on the grass of the footer (in front of it) or
   along the bottom of the screen */
canvas.sonics {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: pixelated;
    z-index: 0;
}
.top, main { position: relative; z-index: 1; }

/* header: language, links */
.account { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
.langs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.langs a { padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; text-decoration: none; }
.langs a[aria-current] { background: var(--yellow); color: var(--ink); }

/* counters: players in the game, visitors, members */
.counts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 0; }
.counts .online { margin: 0; }
.counts .online + .online { margin-left: 0; }
.dot.member { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }

/* lobby */
.hero.compact { padding: 16px 0 8px; }
.hero.compact h1 { font-size: clamp(36px, 9vw, 56px); }
.panel.wide { max-width: none; margin: 16px 0 0; }
.panel h2 { margin: 0 0 10px; font-size: 20px; color: var(--yellow); }
.muted { opacity: .8; }
.duo { display: grid; gap: 14px; grid-template-columns: 1fr; }
.duo .panel { max-width: none; margin: 16px 0 0; }
.choice { display: flex; flex-wrap: wrap; gap: 6px 16px; flex-direction: row !important; }
.choice label { font-weight: 600; }
.form select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 17px;
    color: var(--ink);
    background: var(--white);
}
.form input#code { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; }

.rooms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "code info go" "code who go";
    align-items: center;
    gap: 2px 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .1);
}
.room-code { grid-area: code; font: 900 24px/1 ui-monospace, monospace; letter-spacing: .08em; color: var(--yellow); text-decoration: none; }
.room-info { grid-area: info; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 700; }
.room-who { grid-area: who; font-size: 14px; overflow-wrap: anywhere; }
.room-row .pill-button { grid-area: go; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--grass); color: var(--white); }
.badge.busy, .badge.private { background: #d7263d; }

.pill-button {
    /* the text (and an icon) centred, the same height for a link and a button */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    color: var(--white);
    font: 700 15px/1 system-ui, sans-serif;
    white-space: nowrap;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color .15s, transform .1s;
}
.pill-button:active { transform: translateY(1px); }
.pill-button:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.ico { flex: none; width: 16px; height: 16px; }
.pill-button.icon-only { width: 36px; padding: 0; }
.pill-button.icon-only .ico { width: 18px; height: 18px; }
/* a play button that also stops (sound-engine.js: .on while it plays) */
.sd-play .ico-stop, .sd-play.on .ico-play { display: none; }
.sd-play.on .ico-stop { display: block; }
.pill-button:hover { background: rgba(255, 255, 255, .3); }
.pill-button:disabled { opacity: .5; cursor: default; }

/* room */
.room-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.room-head h1 { font-size: clamp(32px, 8vw, 48px); }
.room .status { margin: 6px 0 0; font-weight: 700; }
.room-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 14px; }
.people { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.people li { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-weight: 800; letter-spacing: .04em; }
.people small { font-weight: 600; opacity: .8; letter-spacing: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.actions .play.small { margin: 0; }
.play[aria-disabled="true"] { opacity: .5; pointer-events: none; }
#settings { margin: 0 0 8px; }
.chat { display: flex; flex-direction: column; min-width: 0; }
.chat-log {
    list-style: none;
    margin: 0;
    padding: 10px 12px;
    height: 260px;
    overflow-y: auto;
    border-radius: 12px;
    background: #0a1440;
    font: 600 14px/1.5 ui-monospace, monospace;
    overflow-wrap: anywhere;
}
.chat-log b { color: var(--yellow); }
.chat-log .note { opacity: .75; font-style: italic; }
.say { display: flex; gap: 8px; margin-top: 8px; }
.say input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 16px;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--white);
}

/* statistics */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0 0 18px; }
.stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1); }
.stats dt { font-size: 13px; opacity: .85; }
.stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 900; }
.stats dd small { font-size: 12px; font-weight: 600; opacity: .8; }
.stats .big dd { color: var(--yellow); }
.ranking { margin: 0; padding-left: 24px; }
.ranking li { padding: 4px 0; }
.ranking li span { margin-left: 10px; }
.ranking li.me b { color: var(--yellow); }

@media (min-width: 720px) {
    .duo { grid-template-columns: 1fr 1fr; }
    .room-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
    .room-row { grid-template-columns: auto 1fr; grid-template-areas: "code info" "who who" "go go"; }
    .room-row .pill-button { justify-self: start; }
}

/* members */
.members { margin: 12px 0 0; padding-left: 40px; columns: 2 260px; column-gap: 24px; }
.members li { padding: 3px 0; break-inside: avoid; }
.members li b { letter-spacing: .04em; margin-right: 8px; }
.members li span { margin-right: 8px; font-size: 14px; }
.members li.me b { color: var(--yellow); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

/* history of the games */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.tabs .on { background: var(--yellow); color: #0a1440; }
.replays { list-style: none; margin: 0; padding: 0; }
.replays > li { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr auto; gap: 8px 16px; align-items: center; padding: 10px 0; border-top: 1px solid #ffffff22; }
.replay-what { display: flex; flex-direction: column; }
.replay-result { margin: 0; padding-left: 22px; font-size: 14px; }
.replay-result li.me b { color: var(--yellow); }
@media (max-width: 640px) { .replays > li { grid-template-columns: 1fr; } }

/* header: the players in the game right now */
.ingame { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--panel); font-weight: 800; font-size: 14px; }

/* the menu of the header (details / summary) */
.top { position: relative; z-index: 5; }
.top .ingame { margin-left: auto; }
.menu { position: relative; }
.menu summary {
    display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 12px; border-radius: 999px;
    background: rgba(255, 255, 255, .16); cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:focus-visible { outline: 3px solid var(--yellow); }
.burger { display: inline-flex; flex-direction: column; gap: 4px; width: 20px; }
.burger i { display: block; height: 3px; border-radius: 2px; background: var(--white); transition: transform .15s, opacity .15s; }
.menu[open] .burger i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu[open] .burger i:nth-child(2) { opacity: 0; }
.menu[open] .burger i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; min-width: 220px; max-width: calc(100vw - 32px);
    display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 14px;
    background: #0b1a5c; box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.menu-panel a { padding: 9px 12px; border-radius: 10px; color: var(--white); text-decoration: none; font-weight: 700; }
.menu-panel a:hover, .menu-panel a:focus-visible { background: rgba(255, 255, 255, .12); }
.menu-panel a[aria-current="page"] { color: var(--yellow); }
.menu-panel .pill { background: var(--yellow); color: var(--ink); text-align: center; margin-top: 4px; }
.menu-panel hr { width: 100%; border: 0; border-top: 1px solid rgba(255, 255, 255, .15); margin: 4px 0; }
.menu-panel .langs { display: flex; justify-content: center; margin-top: 6px; padding: 3px; }
.menu-panel .langs a { flex: 1; text-align: center; padding: 5px 8px; font-size: 13px; }

.brand { white-space: nowrap; }

/* ---- editors (level, tiles): public/js/level-view.js, editor-level.js, editor-tiles.js */
main.wide { max-width: 1280px; }
main.full { max-width: none; padding: 0 12px 24px; }
.pc-only { display: none; }
/* a phone or a tablet: the editors want a mouse and a keyboard */
@media (pointer: coarse) and (max-width: 1100px), (max-width: 760px) {
    .pc-only { display: block; padding: 10px 14px; border-radius: 10px; background: rgba(255, 212, 0, .16); border: 2px solid var(--yellow); font-weight: 700; }
    .pc-hide { display: none !important; }
}
.flash.error { color: var(--white); background: rgba(255, 90, 90, .35); padding: 8px 12px; border-radius: 8px; }
.badge.off { background: #5a6488; }
.small { font-size: 14px; }
.pill-button.danger { background: rgba(255, 90, 90, .35); }
.pill-button.danger:hover { background: #d7263d; }
.pill-button:disabled { opacity: .5; cursor: not-allowed; }

.ed-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ed-card { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.ed-thumb { display: flex; align-items: center; justify-content: center; height: 110px; border-radius: 8px; background: #0a1440; overflow: hidden; }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.ed-card.tiles .ed-thumb img { object-position: top left; }
.ed-card.sprites .ed-thumb img { object-fit: none; object-position: 0 0; transform: scale(2); transform-origin: 0 0; }
.ed-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ed-card-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-card-text .badge { align-self: flex-start; }
/* the buttons of a card: one row, the same width each, the trash (red, square) at the end */
.ed-card-go { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 4px; }
.ed-card-go form { display: contents; }
.ed-card-go > .pill-button, .ed-card-go > form > .pill-button { flex: 1 1 0; min-width: 0; padding: 0 10px; }
.ed-card-go .pill-button.icon-only { flex: 0 0 38px; padding: 0; }
/* the main action of a card (play, listen) takes the room left */
.ed-card-go .pill-button.play-pill.icon-only { flex: 1 1 38px; }
.lv-fav .ico { color: rgba(255, 255, 255, .55); }
.lv-fav.on .ico { color: #ff4d6d; }
.lv-numbers { display: flex; flex-wrap: wrap; gap: 4px 12px; color: rgba(255, 255, 255, .75); }
.lv-numbers > span { display: inline-flex; align-items: center; gap: 4px; }
.lv-numbers .ico { width: 13px; height: 13px; }
.lv-numbers .ico-star { color: #ffd400; }
.lv-numbers .ico-heart { color: #ff4d6d; }
.ed-card-go .ed-card-trash .pill-button { margin-left: auto; background: #c81e36; color: var(--white); }
.ed-card-go .ed-card-trash .pill-button:hover { background: #ee2f4a; }
.ed-only-empty { display: flex; flex-direction: column; gap: 6px; }

.lv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; margin-bottom: 10px; }
.lv-head h1 { margin: 0; font-size: clamp(26px, 6vw, 40px); overflow-wrap: anywhere; }
.lv-head p { margin: 4px 0 0; }
.lv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lv-actions form { margin: 0; }
.lv-box { position: relative; overflow: auto; border-radius: 10px; background: #05091f; overscroll-behavior: contain; }
.lv-box.view { height: min(70vh, 560px); cursor: grab; touch-action: pan-x pan-y; }
.lv-canvas { position: sticky; top: 0; left: 0; display: block; z-index: 1; pointer-events: none; }
.lv-sizer { position: absolute; top: 0; left: 0; }
.ts-view { overflow: auto; border-radius: 10px; background: #0a1440; }
.ts-view img { display: block; width: 1024px; max-width: none; image-rendering: pixelated; }

.editor { display: flex; flex-direction: column; gap: 8px; height: calc(100vh - 84px); min-height: 520px; }
.ed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel); }
.ed-bar input[type=text] { width: 220px; padding: 6px 10px; border: 0; border-radius: 8px; font: 700 16px system-ui, sans-serif; }
.ed-bar label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; }
.ed-bar .play.small { margin: 0; padding: 8px 18px; font-size: 16px; border-radius: 10px; }
.ed-sep { flex: 1; }
.ed-zoom { min-width: 48px; text-align: center; font-size: 14px; }
.ed-status { font-size: 14px; font-weight: 700; }
.ed-status[data-kind=ok] { color: #7dff9a; }
.ed-status[data-kind=warn] { color: var(--yellow); }
.ed-status[data-kind=error] { color: var(--red); }
.ed-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 312px; gap: 8px; }
.ed-main .lv-box { height: 100%; }
.lv-box[data-tool] { cursor: crosshair; }
.lv-box[data-tool=select] { cursor: default; }
.lv-box[data-over="1"] { cursor: move; }
.ed-clone, .ed-selection { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: rgba(63, 208, 255, .1); }
.ed-selection { background: rgba(255, 212, 0, .1); }
.lv-box[data-pan] { cursor: grab; }
.ed-side { overflow: auto; padding: 10px 12px; border-radius: 12px; background: var(--panel); }
.ed-side h3, .editor h3 { margin: 10px 0 6px; font-size: 15px; color: var(--yellow); display: inline; }
.editor h3 { display: block; }
.ed-side summary { cursor: pointer; margin: 10px 0 4px; }
.ed-side summary h3 { display: inline; }
.ed-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ed-tools button, .ed-object { padding: 6px 8px; border: 2px solid transparent; border-radius: 8px; background: rgba(255, 255, 255, .1); color: var(--white); font: 600 13px system-ui, sans-serif; text-align: left; cursor: pointer; }
.ed-tools button.on, .ed-object.on { border-color: var(--yellow); background: rgba(255, 212, 0, .18); }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.ed-row select, .ed-row input[type=number], .editor select { padding: 4px 6px; border-radius: 6px; border: 0; font-size: 14px; }
.ed-row input[type=number] { width: 64px; }
.ed-palette-box { max-height: 320px; overflow: auto; border-radius: 6px; }
.ed-palette { display: block; cursor: pointer; image-rendering: pixelated; }
.ed-objects { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow: auto; }
.ed-object { display: flex; align-items: center; gap: 8px; }
.ed-object span { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; border-radius: 5px; font: 800 11px system-ui, sans-serif; }
.ed-object-icon { width: 30px; height: 28px; flex: none; image-rendering: pixelated; }
.ed-help { padding-left: 18px; }
.ed-pos { min-height: 1.5em; }

.te-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 540px) auto minmax(260px, 1fr); gap: 8px; }
.te-main > div { overflow: auto; padding: 10px 12px; border-radius: 12px; background: var(--panel); }
.te-sheet, .te-other { display: block; width: 100%; max-width: 512px; cursor: pointer; image-rendering: pixelated; border-radius: 6px; }
.te-list label { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.te-pixels { display: block; width: 448px; height: 448px; cursor: crosshair; touch-action: none; border-radius: 6px; }
.te-draw .ed-tools { grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
.te-swatches { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; max-width: 320px; }
.te-swatch { aspect-ratio: 1; border: 2px solid transparent; border-radius: 3px; padding: 0; cursor: pointer; }
.te-swatch.on { border-color: var(--white); }
.te-preview { display: block; width: 192px; height: 192px; image-rendering: pixelated; border-radius: 6px; }
.te-anim { display: block; width: 128px; height: 64px; image-rendering: pixelated; border-radius: 6px; }
.te-shapes { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; max-width: 320px; margin-bottom: 12px; }
.te-shape { padding: 0; border: 2px solid transparent; border-radius: 4px; background: none; cursor: pointer; line-height: 0; }
.te-shape canvas { width: 100%; image-rendering: pixelated; }
.te-shape.on { border-color: var(--yellow); }
.te-props label { display: flex; align-items: center; gap: 6px; }
@media (max-width: 1250px) { .te-main { grid-template-columns: 1fr 1fr; } .te-props { grid-column: 1 / -1; } }

.lv-actions .play.small, .lv-play { margin: 0; padding: 8px 20px; font-size: 17px; border-radius: 10px; }
.pill-button.play-pill { background: var(--yellow); color: var(--ink); }
.pill-button.play-pill:hover { background: #ffe14d; }
.ed-bar select { padding: 4px 6px; border-radius: 6px; border: 0; font-size: 14px; }

/* sprite editor */
.sp-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-tabs button { padding: 6px 12px; border: 2px solid transparent; border-radius: 8px; background: var(--panel); color: var(--white); font: 600 14px system-ui, sans-serif; cursor: pointer; }
.sp-tabs button.on { border-color: var(--yellow); }
.sp-tabs button.own::after { content: ' •'; color: var(--yellow); }
.sp-box { overflow: auto; border-radius: 12px; background: #05091f; }
.sp-canvas { display: block; cursor: crosshair; touch-action: none; image-rendering: pixelated;
    background: repeating-conic-gradient(#2a3157 0% 25%, #1c2244 0% 50%) 0 0 / 16px 16px; }
.sp-view img { width: auto; max-width: none; background: repeating-conic-gradient(#2a3157 0% 25%, #1c2244 0% 50%) 0 0 / 16px 16px; }
.sp-swatches { grid-template-columns: repeat(12, 1fr); }
.ed-side label.small:has(input[type=file]) { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }

/* sound editor */
.mu-box { position: relative; overflow: auto; border-radius: 12px; background: #0a1028; user-select: none; }
.mu-roll { position: sticky; top: 0; left: 0; display: block; z-index: 1; pointer-events: none; }
.mu-sizer { position: absolute; top: 0; left: 0; }
.mu-voices { display: flex; flex-direction: column; gap: 6px; }
.mu-voice { display: flex; align-items: center; gap: 8px; }
.mu-voice button { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; border: 2px solid transparent; font-size: 14px; }
.mu-voice.on button { border-color: var(--yellow); }
.mu-voice i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.mu-voice input { width: 90px; }
.ed-bar input[type=number] { width: 64px; padding: 4px 6px; border: 0; border-radius: 6px; font-size: 14px; }
.sfx-main { flex: 1; min-height: 0; overflow: auto; }
.sfx-panel { max-width: 760px; margin: 0; }
.sfx-presets { flex-wrap: wrap; }
.sfx-wave { display: block; width: 100%; max-width: 720px; height: 120px; margin: 10px 0; border-radius: 8px; }
.sfx-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.sfx-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.sfx-fields output { color: var(--yellow); font-weight: 700; }
.ed-card.sound .ed-card-text b { font-size: 16px; }
/* the level's sound effects: one per line, the game's sound on the left, the editor's on the right */
.ed-sfx label.small { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; }
.ed-sfx label.small select { flex: 0 1 60%; min-width: 0; }

/* creations: credits, history, profiles, editors open by several players (editor-live.js) */
.author { font-weight: 700; }
.credits h3 { margin: 14px 0 6px; }
.cr-members, .cr-forks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.cr-members li { display: flex; align-items: center; gap: 6px; }
.cr-members form, .cr-add { display: inline-flex; gap: 6px; margin: 8px 0 0; }
.cr-add input { max-width: 160px; }
.cr-history { list-style: none; margin: 0; padding: 0; }
.cr-history > li { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.cr-history > li.current { border-left: 3px solid var(--yellow); padding-left: 8px; }
.cr-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cr-line time { font-variant-numeric: tabular-nums; opacity: .75; }
.cr-history ul { margin: 4px 0 0; padding-left: 18px; }
.ed-live { margin: 6px 0; padding: 8px 12px; border-radius: 8px; background: rgba(255, 212, 0, .16); border: 1px solid var(--yellow); }
.ed-live-line { display: flex; justify-content: space-between; gap: 12px; margin: 2px 0 6px; min-height: 1.2em; }
.trashed { border: 2px dashed var(--yellow); }
.trashed form { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-trash { margin-top: 14px; }
.cr-trash-list { list-style: none; margin: 0 0 16px; padding: 0; }
.cr-trash-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.cr-trash-list form { display: flex; gap: 6px; flex-wrap: wrap; }

/* the AI page and the API keys */
.ai-doc h3 { margin: 18px 0 6px; font-size: 16px; }
.ai-doc pre, .ai-new pre { overflow-x: auto; padding: 10px 12px; border-radius: 8px; background: rgba(0, 0, 0, .35); font-size: 13px; line-height: 1.45; white-space: pre; }
.ai-doc code, .ai-new code, .cr-trash-list code { padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .3); font-size: .92em; overflow-wrap: anywhere; }
.ai-doc li { margin: 4px 0; }
.ai-tools { margin: 0; }
.ai-tools dt { margin-top: 8px; }
.ai-tools dd { margin: 2px 0 0 16px; font-size: 14px; opacity: .85; }
.ai-new { margin: 12px 0 18px; padding: 12px 14px; border: 2px solid var(--yellow); border-radius: 10px; }
.ai-key code { font-size: 15px; user-select: all; }
.ai-form { max-width: 440px; }
.ai-form select { padding: 8px 10px; border: 0; border-radius: 8px; font-size: 15px; }
.danger-text { color: #ff7a7a; }

/* the page of the public API */
.dev-docs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dev-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dev-table th, .dev-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, .12); text-align: left; vertical-align: top; }
.dev-table td:first-child { white-space: nowrap; }
@media (max-width: 600px) { .dev-table td:first-child { white-space: normal; } }

/* the catalogue of the levels (/niveaux): search, orders */
.lv-search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 12px; }
.lv-search input[type="search"] { flex: 1 1 220px; max-width: 420px; padding: 9px 14px; border: 2px solid rgba(255, 255, 255, .2);
    border-radius: 999px; background: rgba(0, 0, 0, .25); color: var(--white); font: 600 15px system-ui, sans-serif; }
.lv-search input[type="search"]:focus { outline: none; border-color: var(--yellow); }
.lv-search input[type="search"]::placeholder { color: rgba(255, 255, 255, .5); }
.lv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.lv-tabs a { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: inherit; text-decoration: none; font-weight: 700; font-size: 14px; }
.lv-tabs a:hover { background: rgba(255, 255, 255, .16); }
.lv-tabs a[aria-current="page"] { background: var(--yellow, #ffd400); color: #10194d; }
/* the stars of a level page */
.lv-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; }
.lv-rate form { display: inline-flex; align-items: center; gap: 2px; }
.lv-star { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: rgba(255, 255, 255, .3); cursor: pointer; }
.lv-star .ico { width: 26px; height: 26px; }
.lv-star.on { color: #ffd400; }
.lv-rate form:hover .lv-star { color: #ffd400; }
.lv-rate form .lv-star:hover ~ .lv-star { color: rgba(255, 255, 255, .3); }
.lv-star:focus-visible { outline: 2px solid #fff; }

/* a group of cards inside a section (the musics, the sound effects) */
.ed-sub { margin: 14px 0 8px; font-size: 16px; }
.ed-sub:first-of-type { margin-top: 4px; }

/* the best times of a level */
.lv-records { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 560px; }
.lv-records li { display: grid; grid-template-columns: 28px 1fr auto auto auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .06); }
.lv-records li.me { background: rgba(255, 212, 0, .16); }
.lv-records li:first-child .lv-rank { color: var(--yellow); }
.lv-rank { font-weight: 800; text-align: right; }
.lv-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-time { font-variant-numeric: tabular-nums; }
