@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');

:root {
    font-family: "Mulish", "Noto Sans", sans-serif;
    font-size: 16px;

    --purple: #9747FF;
    --purple-bg: #9747ff1a;
}
body {
    /*background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);*/
    background: white;
    color: black;

    margin: 0;
    padding: 16px 0;
    height: 100vh;
}
#root {
    display: flex;
    flex-direction: column;

    height: 100%;
    max-width: 1000px;
    margin-inline: auto;

    > * {
        padding-left: 16px;
        padding-right: 16px;
    }

    > table {
        margin-left: 16px;
        margin-right: 16px;
    }
}
a {
    /*color: var(--tg-theme-link-color);*/
}
.right {
    align-self: end;
}
h1 {
    font-size: 24px;
    font-weight: 400;
    padding-top: 64px;
}
* {
    /* border: dotted black 1pt; */
}
p {
    margin: 0;

    +p {
        margin-top: .5em;
    }
}
.remark {
    opacity: 30%;
}

.counter {
    margin: 32px 0;

    h1~& {
        margin-top: 0;
    }

    .counter__big {
        font-size: 64px;
        line-height: 100%;
    }

    > *:not(.ranking) {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        width: 100%;

        gap: 8px;

        :last-child {
            text-align: end;
        }

        .reverse & {
            flex-direction: row-reverse;

            :last-child {
                text-align: start;
            }

            :first-child {
                text-align: end;
            }
        }
    }

    > .ranking {

    }
}

dialog {
    z-index: 100000;
    /* position: relative;
    top: 0; */
    width: auto;
    /* margin: 0; */
    /* margin-top: 32px; */
    border: none;
    margin: 16px;
    overscroll-behavior: contain;
}

dialog::backdrop {
    background-color: rgba(0,0,0,0.6);
}

body:has(dialog[open]) {
  overflow: hidden;
}

.ranking__heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    h1 {
        padding-top: revert;
    }
}

button {
    border: none;
    background: var(--purple-bg);
    border-radius: 4px;
    padding: 16px;

    &:hover {
        background: var(--purple);
        color: white;
    }
}

.message {
    margin: 4px 16px;
    background: var(--purple-bg);
    border-left: var(--purple) 2px solid;
    padding: 12px;

    text-align: justify;

    > .message__sender {
        &::before {
            content: "От:";
            opacity: 30%;
            margin-right: 8px;
        }
    }

    > .message__recipient {
        &::before {
            content: "Кому:";
            opacity: 30%;
            margin-right: 8px;
        }
    }

    > .message__text {
        img {
            width: 100%;
            /*margin-top: 1em;*/
            /*margin-bottom: 1em;*/
        }
    }

    > .message__text:not(:first-child) {
        margin-top: 1em;
    }
}

.tgmsg {
    margin: 4px 16px;
    background: var(--purple-bg);
    border-left: var(--purple) 2px solid;
    padding: 12px;
    /* contain: layout; */

    > .tgmsg__sender {
        display: flex;
        align-items: baseline;
        gap: 8px;

        > .tgmsg__nickname {
            opacity: 30%;
        }

        > .tgmsg__role {
            box-sizing: content-box;
            /* justify-self: end; */
            margin-left: auto;
            padding: 0 8px;
            color: rgba(0,0,255);
            font-weight: 500;
            background: rgba(0,0,255,0.2);
            border: rgba(0,0,255) 2px solid;
            border-radius: 1lh;
        }
    }

    > .tgmsg__text:not(:first-child) {
        margin-top: 1em;
    }

    > .tgmsg__text:not(:last-child) {
        margin-bottom: 4px;
        text-align: justify;
    }

    > .tgmsg__footer {
        display: flex;
        flex-wrap: wrap;

        align-items: end;

        gap: 4px;

        > .tgmsg__date {
            text-align: right;
            margin-left: auto;
            /* position: absolute;
            right: 4px;
            bottom: 4px; */

            /* font-size: 14px; */

            a {
                opacity: 30%;
                transition: all;
                transition-duration: 150ms;
                transition-timing-function: ease-out;

                text-decoration: none;

                &:hover {
                    opacity: 100%;
                }
            }

            > :not(:first-child) {
                margin-left: 4px;
            }
        }
    }
}

.reaction__container {
    display: inline-block;
    background: var(--purple-bg);
    border: var(--purple) 2px solid;
    border-radius: 8px;
    padding: 2px 4px;

    color: var(--purple);
}

.reaction {
    display: inline-block;
    width: 16px;
    height: 16px;
    font-family: "Noto Color Emoji", sans-serif;
    font-size: 12px;
    vertical-align: middle;

    &.reaction-big {
        font-size: 54px;

        width: 64px;
        height: 64px;
    }
}

.reactionList {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;

    justify-content: center;

    gap: 16px;

    > * {
        display: flex;
        flex-direction: column;

        align-items: center;

        gap: 8px;
    }
}

.night {
    color: white;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%), #1F3341;
    padding-bottom: 16px;
}

.day {
    color: black;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 100%), #BDE3FF;
    padding-bottom: 16px;
}

table {
    border-collapse: separate;
    border-spacing: 0 4px;
    /*table-layout: fixed;*/
    width: 100%;

    margin-bottom: 1em;

    tr {
        background: var(--purple-bg);

        &:hover {
            background: rgb(from var(--purple-bg) r g b / 20%);
        }

        td {
            padding: 4px;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;

            width: 0px;

            &:first-child {
                border-left: var(--purple) 2px solid;
                padding-left: 8px;
            }

            &:nth-child(2) {
                width: auto;
                max-width: 0px;
            }

            &:last-child {
                padding-right: 8px;
            }
        }
    }
}

.selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.user {
    display: flex;
    gap: 16px;
    padding: 8px;

    background: var(--purple-bg);

    border-left: var(--purple) 2px solid;

    align-items: center;

    > .user__avatar {
        text-align: center;
        align-content: center;
        height: 42px;
        width: 42px;
        background: #9747FF;
        color: white;
        font-weight: 700;
        font-size: 20px;
        border-radius: 100%;
    }

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

    .user__nickname {
        opacity: 30%;
    }

    &:hover {
        background: rgb(from var(--purple-bg) r g b / 20%);
    }
}

.tabbed {
    margin-block: 16px;
    padding-inline: 0!important;

    > .tabbed__contents > * {
        padding-left: 16px;
        padding-right: 16px;
    }

    > .tabbed__control {
        position: sticky;
        top: 0;
        padding: 16px;
        background: white;
        /*box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);*/
        z-index: 9999;
    }
}

select {
  width: 100%;
  padding: 8px 12px;
  font-size: inherit;
  font-family: inherit;
  border: none;
  border-bottom: var(--purple) 2px solid;
  background: var(--purple-bg);

  &:focus-visible {
    outline: none;
  }
}

.logo {
  width: 64px;
  height: 64px;
  -webkit-mask-image: var(--logo);
  mask-image: var(--logo);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.loader {
    color: rgba(0, 0, 0, 0.2);

    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    flex-grow: 1;

    > .logo {
        background: rgba(0,0,0,0.2);
    }
}

.shimmer {
  position: relative;
  overflow: hidden;
}
.shimmer::after {
  content: '';
  z-index: 100;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    -45deg,
    transparent 30%,
    rgba(255,255,255,0.6) 50%,
    transparent 70%
  );
  background-size: 500% 100%;
  background-position-x: 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  to {
    background-position-x: 0%;
  }
}

:root {
    --logo: url("/assets/logo.svg");
}