:root {
    --background: #000;
    --desktop-ink: #fff;
    --window: rgba(212, 212, 212, 0.9);
}

:root.light {
    --background: #fff;
    --desktop-ink: #111;
    --window: rgba(171, 171, 171, 0.75);
}

html {
    background-color: var(--background);
    height: 100%;
}

body {
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100svh;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    align-items: center;
    line-height: 1.6;
    font-size: 18px;
    color: #222;
    font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", serif;
}

#screen > .window {
    background: var(--window);
    box-sizing: border-box;
    position: relative;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    max-width: 636px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.window-body {
    -webkit-user-select: text;
    user-select: text;
    overflow-y: auto;
    margin: 0;
    padding: 20px;
}

#tamanotchi img, #buttons img {
    image-rendering: pixelated;
}

#buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

#buttons img {
    flex: none;
}

#screen > .window.placed {
    position: fixed;
    margin: 0;
    max-width: none;
    max-height: none;
}

#screen > .window > .title-bar {
    background: linear-gradient(90deg, #a32c56, #e9658b);
    touch-action: none;
}

#screen > .window.minimized .window-body {
    display: none;
}

#screen > .window[hidden] {
    display: none;
}

#screen {
    display: contents;
}

#dock {
    position: fixed;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
}

#dock > * {
    box-sizing: border-box;
    width: 64px;
    height: 64px;
    background: url("nextstep-tile.png");
    display: flex;
    align-items: center;
    justify-content: center;
}

#dock > *[hidden] {
    display: none;
}

#dock img {
    width: auto;
    height: 48px;
}

#dock #kyle-app {
    border: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    padding: 0;
}

#dock #kyle-app img {
    width: 60px;
    height: 60px;
}

#icons {
    display: grid;
    grid-template-columns: repeat(4, 72px);
    position: fixed;
    top: 16px;
    left: 12px;
    gap: 4px;
    padding: 4px;
}

#icons .icon:not(.app):not(#credits-icon) {
    display: none;
}

#credits-window h2 {
    margin-top: 0;
}

#screen > #catclock-window:not([hidden]) {
    position: fixed;
    top: 96px;
    left: 12px;
    width: auto;
    height: auto;
}

.icon {
    background: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    padding: 2px;
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--desktop-ink);
    text-shadow: none;
}

.icon.dropped {
    position: fixed;
}

#icons .icon:active {
    box-shadow: none;
    text-shadow: none;
}

#icons .icon:focus {
    outline: none;
}

.icon:focus-visible .icon-label {
    outline: 1px dotted var(--desktop-ink);
}

.icon-image {
    position: relative;
    line-height: 0;
}

.icon-image img {
    width: auto;
    height: 32px;
    image-rendering: pixelated;
}

.icon.selected .icon-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #000080;
    opacity: 0.5;
}

.icon-label {
    padding: 0 1px;
    line-height: 1.2;
}

.icon.selected .icon-label {
    background: #000080;
    color: #fff;
    outline: 1px dotted #fff;
}

.resizer {
    display: none;
    position: absolute;
}
.resizer-n, .resizer-s {
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
}
.resizer-e, .resizer-w {
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
}
.resizer-n { top: -3px; }
.resizer-s { bottom: -3px; }
.resizer-e { right: -3px; }
.resizer-w { left: -3px; }
.resizer-ne, .resizer-nw, .resizer-se, .resizer-sw {
    width: 12px;
    height: 12px;
    z-index: 1;
}
.resizer-ne, .resizer-nw { top: -3px; }
.resizer-se, .resizer-sw { bottom: -3px; }
.resizer-ne, .resizer-se { right: -3px; }
.resizer-nw, .resizer-sw { left: -3px; }
.resizer-nw, .resizer-se { cursor: nwse-resize; }
.resizer-ne, .resizer-sw { cursor: nesw-resize; }

h1 {
    font-size: 2em;
    line-height: 1.2;
}
h2 {
    font-size: 1.5em;
    line-height: 1.2;
}

a {
    color: #e9658b;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.favicon {
    height: 1em;
    padding-right: 0.3em;
    transform: translateY(0.1em);
}

#header {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25em;
    align-items: center;
}

#me {
    width: 96px;
    height: 96px;
}

#header h1 {
    margin: 0;
}

#header p {
    margin: 0.2em 0 0;
}
#header .field-border {
    line-height: 0;
}

footer {
    text-align: center;
}

#footer-break {
    display: none;
}

footer > a:hover {
    filter: brightness(1.5);
}

#toggle {
    display: none;
    font-size: 24px;
    color: inherit;
    text-shadow: none;
}

#applemusic {
    max-width: 480px;
    border: 4px solid #e9658b;
    border-radius: 10px;
    box-sizing: border-box;
}

@media (min-width: 656px) {
    #tamanotchi img {
        transform: scaleX(-1);
    }

    #dock #toggle {
        display: flex;
        border: none;
        box-shadow: none;
        min-width: 0;
        min-height: 0;
        padding: 0;
        font-size: 32px;
    }

    #screen {
        display: block;
        position: relative;
        width: 100%;
        height: 100%;
    }

    #screen > .window {
        position: absolute;
        height: auto;
        max-height: 100%;
    }

    #screen > #catclock-window:not([hidden]) {
        display: flex;
        top: 24px;
        left: 32px;
        width: auto;
    }

    #catclock-window .window-body {
        padding: 0;
    }

    #catclock {
        display: block;
    }

    #icons {
        left: auto;
        right: 80px;
        grid-template-columns: repeat(3, 72px);
    }

    #icons .icon:not(.app):not(#credits-icon) {
        display: flex;
    }


    #testimonials-window:not([hidden]),
    #friends-window:not([hidden]),
    #credits-window:not([hidden]) {
        display: flex;
        width: 420px;
    }

    #testimonials-window h2,
    #friends-window h2 {
        margin-top: 0;
    }

    #friends-window {
        left: 300px;
        top: 140px;
    }

    #testimonials-window {
        left: 360px;
        top: 200px;
    }

    #credits-window {
        left: 420px;
        top: 260px;
    }

    #screen > #kfarwell-window {
        left: 92px;
        top: 92px;
        max-height: 75vh;
        width: 636px;
        max-width: calc(100vw - 64px);
        z-index: 2;
    }

    #webamp-host {
        z-index: 1;
    }

    #buttons {
        box-sizing: border-box;
        width: 100%;
        padding: 4px;
        max-height: 25vh;
        overflow-y: auto;
        align-content: flex-end;
    }

    #screen > #kfarwell-window.placed {
        max-height: none;
    }

    #screen > .window .resizer {
        display: block;
    }
}

@media (min-width: 1320px) {
    #screen > #kfarwell-window {
        left: 220px;
        top: 24px;
    }
}

[data-phx-session],
[data-phx-teleported-src] {
    display: contents;
}

#chat-window .window-body {
    overflow: hidden;
    padding: 6px;
    display: flex;
    flex: 1;
    min-height: 0;
}

.chat {
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
    min-height: 0;
    font-family: "SerenityOS Emoji", "Pixelated MS Sans Serif", Arial;
    font-size: 11px;
    line-height: 1.5;
    -webkit-font-smoothing: none;
}

.chat button,
.chat input,
.chat label,
.chat menu {
    font-family: inherit;
    font-size: inherit;
}

.chat-body {
    display: flex;
    flex: 1;
    gap: 4px;
    min-height: 0;
}

.chat-contacts {
    width: 116px;
    flex: none;
    margin: 0;
    overflow-y: auto;
}

.chat-contacts summary {
    font-weight: bold;
    list-style: none;
}

.chat-contacts summary::marker,
.chat-contacts summary::-webkit-details-marker {
    content: "";
    display: none;
}

.chat-contact {
    text-decoration: none;
    color: inherit;
}

.chat-contact:hover {
    text-decoration: underline;
}

.chat-contact.host {
    color: #e9658b;
    font-weight: bold;
}

.chat-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.chat-main menu[role="tablist"] {
    margin: 0 0 -2px 0;
    flex-wrap: wrap;
}

.chat-typing {
    position: sticky;
    bottom: 0;
    margin: 0;
    padding-top: 1px;
    background: #fff;
    color: grey;
    overflow: hidden;
    white-space: nowrap;
}

.chat-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    padding: 4px;
}

.chat-context-menu {
    position: absolute;
    z-index: 20;
    background: silver;
    padding: 2px;
    box-shadow: inset -1px -1px grey, inset 1px 1px #fff,
        inset -2px -2px #0a0a0a, inset 2px 2px #dfdfdf;
}

.chat-context-menu button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    box-shadow: none;
    text-align: left;
    padding: 2px 16px 2px 8px;
    min-height: 0;
    color: #222;
    text-shadow: none;
    cursor: pointer;
}

.chat-context-menu button:hover {
    background: #000080;
    color: #fff;
}

.chat-empty {
    color: grey;
    margin: 0;
}

.chat-nickname {
    margin: 0;
    align-items: center;
}

.chat-nickname form {
    flex: 1;
    display: flex;
}

.chat-nickname input {
    flex: 1;
    min-width: 0;
}

.chat-log {
    -webkit-user-select: text;
    user-select: text;
    background: #fff;
    box-shadow: inset -1px -1px #fff, inset 1px 1px grey,
        inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 3px 5px;
    line-height: 1.25;
}

.chat-message {
    margin: 0;
}

.chat-author {
    font-weight: bold;
}

.chat-author::after {
    content: ": ";
    font-weight: normal;
}

.chat-message.theirs .chat-author {
    color: #000080;
}

.chat-text {
    word-break: break-word;
}

.chat-text .chat-line {
    display: inline;
}

.chat-text h1,
.chat-text h2,
.chat-text h3 {
    display: block;
    margin: 2px 0;
    font-size: 15px;
}

.chat-text h2 {
    font-size: 13px;
}

.chat-text h3 {
    font-size: 12px;
}

.chat-text blockquote {
    display: block;
    margin: 1px 0 1px 2px;
    padding-left: 5px;
    border-left: 3px solid #808080;
}

.chat-text pre {
    display: block;
    margin: 2px 0;
    padding: 3px 5px;
    white-space: pre-wrap;
    box-shadow: inset -1px -1px #fff, inset 1px 1px grey;
    background: #efefef;
}

.chat-text code {
    padding: 0 2px;
    background: #efefef;
    font-family: monospace;
}

.chat-text a {
    color: #0000c0;
    text-decoration: underline;
}

.chat-text ul {
    margin: 1px 0;
    padding-left: 18px;
}

.chat-spoiler {
    background: #0a0a0a;
    color: transparent;
    cursor: pointer;
}

.chat-spoiler.revealed {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    cursor: auto;
}

.chat-message img {
    display: block;
    max-width: 100%;
    max-height: 160px;
    margin: 2px 0;
    image-rendering: auto;
}

.chat-presence.online {
    color: #008000;
}

.chat-presence.idle,
.chat-presence.away {
    color: #b8860b;
}

.chat-presence.dnd {
    color: #a00;
}

.chat-presence.offline,
.chat-presence.unknown {
    color: grey;
}

.chat-compose {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.chat-tool {
    min-width: 0;
    min-height: 0;
    height: 18px;
    padding: 0 6px;
    color: #222;
    text-shadow: none;
}

label.chat-tool {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: silver;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff,
        inset -2px -2px grey, inset 2px 2px #dfdfdf;
    line-height: normal;
    cursor: pointer;
}

label.chat-tool:active:not(.disabled) {
    box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a,
        inset -2px -2px #dfdfdf, inset 2px 2px grey;
}

label.chat-tool.disabled {
    pointer-events: none;
    color: grey;
    text-shadow: 1px 1px 0 #fff;
}

label.chat-tool.disabled span {
    opacity: 0.4;
}

.chat-tool.wide {
    padding: 0 8px;
}

.chat-block {
    display: block;
    width: 11px;
    height: 9px;
    background: #222;
}

.chat-tool.h1 {
    font-size: 12px;
}

.chat-tool.h2 {
    font-size: 11px;
}

.chat-tool.h3 {
    font-size: 10px;
}

.chat-tool.right {
    margin-left: auto;
}

.chat-form {
    display: flex;
    gap: 4px;
}

.chat-form textarea {
    flex: 1;
    min-width: 0;
    resize: none;
    font-family: inherit;
    font-size: inherit;
}

.chat-form button {
    min-width: 58px;
}

.chat-file {
    display: none;
}

.chat-upload {
    display: contents;
}

#chat-emoji,
#chat-gif {
    display: contents;
}

.chat-picker[hidden] {
    display: none;
}

.chat-picker {
    position: absolute;
    display: flex;
    flex-direction: column;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    z-index: 20;
    background: silver;
    padding: 4px;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff,
        inset -2px -2px grey, inset 2px 2px #dfdfdf;
}

.chat-picker-grid {
    background: #fff;
    box-shadow: inset -1px -1px #fff, inset 1px 1px grey,
        inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px;
}

.chat-picker-search {
    display: flex;
    margin-bottom: 4px;
}

.chat-picker-search input {
    flex: 1;
    min-width: 0;
}

.chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 30px);
    justify-content: space-between;
    overflow-x: hidden;
}

.chat .chat-emoji {
    border: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    background-color: transparent;
    background-image: url("emoji.png");
    background-repeat: no-repeat;
    background-size: 1320px 1200px;
    image-rendering: pixelated;
    cursor: pointer;
}

.chat .chat-emoji:hover {
    background-color: #000080;
}

.chat-gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 2px;
}

.chat-gif {
    background: none;
    border: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
    padding: 0;
    cursor: pointer;
    line-height: 0;
}

.chat-gif img {
    width: 100%;
    height: 56px;
    object-fit: cover;
}

.chat-gif:hover img,
.chat-gif:focus img {
    outline: 2px solid #000080;
    outline-offset: -2px;
}

.chat-gif-search {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.chat-gif-search input {
    flex: 1;
    min-width: 0;
}

.chat-picker-note {
    margin: 4px 0 0;
    color: grey;
}

.chat-status {
    margin: 0;
    color: #a00;
}

.chat-sending {
    margin: 0;
    color: grey;
}

.chat .status-bar {
    margin: 0;
}

.chat-connection {
    flex: 0 0 96px;
}

#music {
    display: none;
}

#screen > #chat-window {
    isolation: isolate;
}

#screen > #chat-window:not([hidden]) {
    position: fixed;
    inset: 0;
    height: auto;
    max-width: none;
    z-index: 10;
}

@media (min-width: 656px) {
    #screen > #chat-window:not([hidden]) {
        display: flex;
        position: absolute;
        inset: auto;
        z-index: auto;
        right: 76px;
        top: 156px;
        width: 520px;
        height: 380px;
    }
}

* {
    cursor: url("cursor.png"), auto;
}
