:root {
    --primary-0: #81b180;
    --primary-1: #97ca96;
    --primary-2: #c6eec5;
    --primary-3: #d5e9d5;
    --border: #445e43;

    --details-box-closed: linear-gradient(0deg, #81b180, #97ca96);

    --brand-foreground: #445e43;
    --box-foreground: #000;
    --box-radius: 4px;

    --foreground: #445e43;
    --foreground-hover: #628a61;

    --alert-red: #ff4242;
    --alert-red-border: #892424;

    --button-foreground: #000;
    --button-border: #303030;
    --button-background: linear-gradient(0deg, #ddd, #eee);
    --button-background-hover: linear-gradient(180deg, #ddd, #eee);
}

* {
    padding: 0;
    margin: 0;

    font-family: Arial, Helvetica, sans-serif;
}

body {
    background: var(--primary-3);
    color: var(--box-foreground);
    width: 100%;
    min-height: 100vh;
}

main {
    padding: 8px;
}

header {
    background: linear-gradient(0deg, var(--primary-1), var(--primary-2));
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    padding: 2px 8px;
}

body>header {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

body>header>section {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: end;
}

body>header>.links {
    flex-grow: 1;
}

body>header>section>.brand {
    text-decoration: none;
    color: var(--brand-foreground);
    display: flex;
    flex-direction: row;
    align-items: end;
}

a {
    color: var(--foreground);
    text-decoration: none;
}

a:hover {
    color: var(--foreground-hover);
    text-decoration: underline;
}

.box,
box {
    background: var(--primary-1);
    color: var(--box-foreground);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 4px;
    display: block;
}

.box:has(.content):has(.tab),
box:has(box-tab) {
    background: unset;
    border: unset;
    padding: unset;
    border-radius: unset;
}

box:has(box-tab)>* {
    display: block;
}

.box>.tab,
box>box-tab {
    display: inline-block;
    background: var(--primary-1);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-bottom: unset;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    margin-bottom: -1px;
}

.box>.content,
box>box-content {
    background: var(--primary-1);
    border: 1px solid var(--border);
    padding: 8px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 4px;
}

.box>.content:has(.box),
box>box-content:has(box) {
    background: var(--primary-0);
}

.box:has(.box)>.tab,
box:has(box)>box-tab {
    margin-bottom: unset;
}

a>.box:hover,
a>box:hover {
    background: var(--primary-2);
}

details.box>summary.tab {
    cursor: pointer;
}

details.box:not([open])>summary.tab {
    background: var(--details-box-closed);
    border-radius: var(--box-radius);
    border-bottom: 1px solid var(--border);
}

.sound-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

.sound-item,
.emote-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.sound-item>.timestamp {
    font-size: 12px;
}

a:has(.emote-item) {
    text-decoration: none;
    color: unset;
}

.emote-item {
    width: 92px;
    height: 92px;
    position: relative;
}

.emote-item>.code,
.emote-item>.author {
    max-width: 6em;
    min-height: 1em;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.emote-item>.author {
    font-size: 12px;
}

.emote-item>.icon {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.emote-item>.icon>img {
    max-width: 64px;
    max-height: 64px;
}

.emote-item[emote-selected] {
    background: var(--foreground-hover);
}

.emote-item[emote-selected]::after {
    content: ' ';
    position: absolute;
    background: url('/static/img/icons/selected.png');
    background-size: 100% 100%;
    width: 32px;
    height: 32px;
    top: 0;
    right: 0;
}

/** SOUND BLOCKS */
.sound-block {
    display: flex;
    flex-direction: row;
}

.sound-block>.icon {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.sound-block>.icon>img {
    height: 64px;
    border-radius: 4px;
}

.sound-block>.icon::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: inline-block;
    background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, var(--primary-1) 100%);
}

.sound-block>.description {
    display: flex;
    flex-direction: column;
    align-items: end;
}

.sound-block .emotes {
    display: flex;
    flex-direction: row;
    position: relative;
    gap: 4px;
}

.sound-block .emotes::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: inline-block;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, var(--primary-1) 100%);
}

/** SOUND PLAYBACK */
.sound-playback {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 8px;
}

/** CHAT PREVIEW */
.chat-messages {
    height: 123px;
    background: #303030;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

.chat-message {
    background: linear-gradient(180deg, #505050, #454545);
    padding: 4px 2px;
    border-bottom: 1px solid #353535;
    display: flex;
    flex-direction: row;
    align-items: end;
    gap: 8px;
}

.chat-message:nth-child(1) {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.chat-message:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.chat-message:nth-child(even) {
    background: linear-gradient(0deg, #404040, #353535);
}

.alert.red {
    background: var(--alert-red);
    border-color: var(--alert-red-border);
}

/** BUTTON */
button,
.button {
    font-size: 12px;
    color: var(--button-foreground);
    border: 1px solid var(--button-border);
    border-radius: 2px;
    background: var(--button-background);
    padding: 1px 2px;
}

button:hover,
.button:hover {
    background: var(--button-background-hover);
    color: var(--button-foreground);
    text-decoration: none;
    cursor: pointer;
}

.button.twitch {
    background: #bca9ff;
}

.button.twitch:hover {
    background: #a389ff;
}

/** SHORTCUTS */
.row {
    display: flex;
    flex-direction: row;
}

.column {
    display: flex;
    flex-direction: column;
}

.grow {
    flex-grow: 1;
}

.wrap {
    flex-wrap: wrap;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}

.hint {
    font-size: 10px;
}

.red {
    color: red;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-0: #353535;
        --primary-1: #303030;
        --primary-2: #303030;
        --primary-3: #202020;
        --border: #181818;

        --details-box-closed: linear-gradient(0deg, #484848, #787878);

        --box-foreground: #e3ead5;
        --box-radius: 4px;

        --brand-foreground: #9ce79c;
        --foreground: #9ce79c;
        --foreground-hover: #478447;

        --alert-red: #ff4242;
        --alert-red-border: #892424;

        --button-foreground: #000;
        --button-border: #303030;
        --button-background: linear-gradient(0deg, #ddd, #eee);
        --button-background-hover: linear-gradient(180deg, #ddd, #eee);
    }
}