@font-face { font-family: "Munro"; src: url('/static/munro.ttf'); }

:root { color-scheme: dark; }
* { box-sizing: border-box; }

body {
    color: #c6ae89;
    background-color: #140834;
    font-family: Munro, monospace;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100vh;
    height: 100dvh;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px;
}

a { color: #3490dc; text-decoration: none; }

header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; }
header a { display: flex; align-items: center; gap: 6px; }
#me { color: #ffbe00; }

.holobox {
    background-color: #000;
    border: 2px solid #135;
}

/* A flat CRT. The effects lie on top and don't scroll with what is shown. */
.crt {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #0b1626, #03060b 75%);
    box-shadow: inset 0 0 24px #0af3, 0 0 12px #0af2;
    /* phosphor glow, and colors that don't quite line up */
    text-shadow: 0 0 5px color-mix(in srgb, currentColor 45%, transparent), 0.5px 0 #f032, -0.5px 0 #0cf2;
    color: #e6d3b3; /* brighter, because the effects take some light away */
}
/* scanlines, the red, green and blue stripes of the mask, and darker corners */
.crt::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg, #0004 0 1px, #0000 1px 3px),
        repeating-linear-gradient(90deg, #f001 0 1px, #0f01 1px 2px, #00f2 2px 3px),
        radial-gradient(ellipse at center, #0000 60%, #0007 120%);
    animation: crt-hum 5s infinite ease-in-out;
}
@keyframes crt-hum { 50% { opacity: 0.85; } }
@media (prefers-reduced-motion: reduce) {
    .crt::before { animation: none; }
}
/* the plain scan lines from before, see settings.js */
[data-effect=legacy] .crt {
    background: 0 0 / 6px 6px linear-gradient(0deg, #000 25%, #002 50%, #032 50%, #000 75%);
    box-shadow: none;
    text-shadow: none;
    color: inherit;
}
[data-effect=none] .crt { background: #000; box-shadow: none; text-shadow: none; color: inherit; }
[data-effect=legacy] .crt::before, [data-effect=none] .crt::before { display: none; }

.tabs { display: flex; flex: none; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
    flex: none;
    color: #887a66;
    font: inherit;
    padding: 7px 12px;
    background-color: #000;
    border: 2px solid #135;
    cursor: pointer;
}
/* inside, because the scrolling row would cut it off */
.tabs button:focus-visible { outline-offset: -4px; }
.tabs[hidden] { display: none; }
.tabs button[aria-selected=true] { color: inherit; border-color: #0af; }
.tabs button.unread { color: #ffbe00; border-color: #ffbe00; }

#invites { display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow-y: auto; }
#invites:empty { margin-top: -8px; }
#invites > div, #room-bar { display: flex; align-items: center; gap: 8px; }
#room-bar { padding: 4px 4px 4px 10px; }
#invites > div { padding: 6px 10px; border-color: #ffbe00; }
#invites > div > span, #room-people { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#invites button, #room-bar button { flex: none; color: inherit; font: inherit; padding: 6px 10px; cursor: pointer; }
#room-bar[hidden] { display: none; }
#room-people { max-height: 4.5em; overflow-y: auto; }

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.panel[hidden] { display: none; }
#admin-settings { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
#admin-settings[hidden] { display: none; }
#admin-settings form button, #admin button { color: inherit; font: inherit; padding: 8px 10px; cursor: pointer; }
#admin h1 { font-size: 20px; font-weight: normal; }
#admin form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
#admin label { display: flex; flex-direction: column; gap: 4px; width: 100%; }
#admin input { color: inherit; font: inherit; padding: 8px 10px; }
#admin [role=alert] { color: #ffbe00; margin: 0; }

.page { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.page h2 { margin: 0; font-size: 18px; font-weight: normal; }
.page p { margin: 0; color: #ac9b82; }
.page h2:not(:first-child) { margin-top: 8px; }
#renew { align-self: flex-start; color: inherit; font: inherit; padding: 8px 10px; cursor: pointer; }
#renew:disabled { opacity: 0.5; cursor: default; }
#effect { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; }
#effect legend { float: left; padding: 0; margin-right: 4px; }
#effect input { position: absolute; opacity: 0; }
#effect span { display: block; padding: 6px 12px; color: #ac9b82; background-color: #000; border: 2px solid #135; cursor: pointer; }
#effect input:checked + span { color: inherit; border-color: #0af; }
#effect input:focus-visible + span { outline: 2px solid #0af; outline-offset: 1px; }
.people { margin: 0; padding: 0; list-style: none; }
.people li { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.people button { color: inherit; font: inherit; padding: 8px 10px; cursor: pointer; }

.menu {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 4px;
    min-width: 140px;
    max-width: 260px;
}
#invite-list, #shape-list, #color-list { max-height: 50vh; overflow-y: auto; }
.menu .name, .menu .title, .menu p { margin: 0; padding: 4px 8px; }
.menu button {
    width: 100%;
    padding: 10px 8px;
    color: inherit;
    font: inherit;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
}
.menu button:hover { background-color: #135; }

/* the two share the height, see presence.js */
#presence { flex: 50 1 0; min-height: 110px; contain: strict; }
/* the chat matters more when there is little room, like with a keyboard open */
@media (max-height: 480px) {
    /* pings are still needed, so their row stays */
    body:not(.map-full) #presence { flex: none !important; min-height: 0; height: 48px; }
    body:not(.map-full) :is(.dot, .wave) { display: none; }
}
/* only the map, within the space the app has */
.map-full #tabs, .map-full #room-tabs, .map-full #room-bar, .map-full #chat-screen, .map-full #composer { display: none; }
.dot { position: absolute; width: 3px; height: 3px; margin: -1px; background-color: var(--color); box-shadow: 0 0 5px var(--color); pointer-events: none; }
.dot.mine { outline: 1px solid #fff; outline-offset: 2px; }
.wave { position: absolute; translate: -50% -50%; pointer-events: none; overflow: visible; max-width: none; }
.wave path, #ping-shape path, #shape-list path { fill: none; stroke: var(--color, #0af); stroke-width: 2px; vector-effect: non-scaling-stroke; }
#presence-bar { position: absolute; left: 6px; right: 8px; bottom: 6px; z-index: 1; display: flex; align-items: flex-end; gap: 6px; }
#presence-notes { margin-left: auto; color: #ac9b82; text-align: right; }
#presence-notes span { display: block; }
#presence-notes [hidden] { display: none; }
#presence-unread { color: #ffbe00; }
#presence-bar button {
    height: 32px;
    padding: 0 10px;
    color: #ac9b82;
    font: inherit;
    background-color: #000;
    border: 2px solid #135;
    cursor: pointer;
}
#presence-bar [hidden] { display: none; }
#presence-bar #map-exit { color: #ffbe00; border-color: #ffbe00; }
#presence-bar #ping { position: relative; min-width: 70px; overflow: hidden; }
#presence-bar #ping:disabled { cursor: default; }
#presence-bar #ping:enabled { color: #ffbe00; border-color: #ffbe00; }
#ping-charge { position: absolute; inset: 0; background-color: #1b4a75; transform: scaleX(0); transform-origin: left; }
#ping:enabled #ping-charge { background-color: #420; }
#ping-label { position: relative; }
#ping-shape svg, #shape-list svg { display: block; width: 18px; height: 18px; overflow: visible; }
.swatch { display: block; width: 14px; height: 14px; background-color: var(--color); box-shadow: 0 0 5px var(--color); }
.menu [aria-pressed=true] { color: #fff; background-color: #135; }
#shape-list button, #color-list button { display: flex; align-items: center; gap: 10px; }

#chat-screen { flex: 50 1 0; min-height: 60px; display: flex; flex-direction: column; }
#messages { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px; }
#messages div { display: flow-root; overflow-wrap: anywhere; margin-bottom: 2px; }
#messages div[hidden] { display: none; }
#messages time { color: #ac9b82; margin-right: 8px; }
.name { color: #0af; }
#messages .name { margin-right: 8px; }
button.name { padding: 0; font: inherit; background: none; border: 0; cursor: pointer; user-select: text; }
button.name:hover { text-decoration: underline; }
#messages .mine .name { color: #ffbe00; }

#messages .content { white-space: pre-wrap; }
#messages .delete { float: right; color: #887a66; font: inherit; padding: 0 6px; background: none; border: 0; cursor: pointer; }
#messages .delete:hover { color: #f55; }
#messages .info, #messages .info .name { color: #ac9b82; }

#composer { position: relative; display: flex; align-items: flex-end; gap: 8px; }
#composer textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 140px; resize: none; }
#composer textarea, #composer button { color: inherit; font: inherit; padding: 8px 10px; }
#composer button { cursor: pointer; }
#counter { position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 1; padding: 2px 8px; color: #ac9b82; }
#counter[hidden] { display: none; }
#composer .over { border-color: #f55; }
#counter.over { color: #f55; border-color: #f55; }
#composer > button { min-width: 44px; height: 40px; }
#charges { display: flex; flex-direction: column; justify-content: space-between; width: 12px; height: 40px; }
#charges[hidden] { display: none; }
#charges span { width: 12px; height: 12px; border: 2px solid #135; background-color: #000; }
#charges .filled { border-color: #ffbe00; background-color: #ffbe00; box-shadow: 0 0 5px #ffbe0066; }
#newline svg { display: block; margin: 0 auto; }
#composer button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid #0af; outline-offset: 1px; }

#suggestions {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(8, 40px);
    max-width: 100%;
    padding: 4px;
}
#suggestions[hidden] { display: none; }
#suggestions button { padding: 6px 0; border: 0; background: none; font-size: 20px; }
#suggestions button:hover { background-color: #135; }

#emoji-picker {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 8px;
    width: min(340px, 100vw - 16px);
}
#emoji-picker:popover-open { display: flex; flex-direction: column; gap: 4px; }
#emoji-search { color: inherit; font: inherit; padding: 6px 8px; }
#emoji-list { flex: 1; min-height: 0; overflow-y: auto; }
#emoji-list:has(+ #emoji-none:not([hidden])) { display: none; }
#emoji-none { margin: 8px; color: #ac9b82; }
#emoji-picker [hidden] { display: none; }
#emoji-picker h2 { margin: 6px 0 2px; font-size: 14px; font-weight: normal; color: #ac9b82; }
#emoji-list section div { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
#emoji-picker button { padding: 5px 0; border: 0; background: none; font-size: 20px; }
#emoji-picker button:hover { background-color: #135; }

/* Mouse and keyboard get emoji and Shift+Enter. Touch keyboards bring their own
   emoji but can't do Shift+Enter, so they get a line break button. */
#newline { display: none; }
@media not ((hover: hover) and (pointer: fine)) {
    #newline { display: block; }
    #emoji, #emoji-picker { display: none; }
}

/* Only speaks up about problems. Stays in the page while empty so screen readers
   announce it; the negative margin cancels the column gap. */
#status { color: #ffbe00; }
#status:empty { margin-top: -8px; }

/* Roomy windows: a phone-shaped column with space around it. */
@media (min-width: 600px) and (min-height: 600px) {
    body {
        max-width: 480px;
        height: min(100vh - 96px, 900px);
        margin: max(48px, (100vh - 900px) / 2) auto;
    }
}
