/* Constants */

:root {
    --icon-size: 24px;
    --primary-color: #4285f4;
    --paired-device-color: #00a69c;
    --public-room-color: #db8500;
    --accent-color: var(--primary-color);
    --peer-width: 120px;
    color-scheme: light dark;
}

/* Layout */

html,
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    width: 100vw;
    overflow-x: hidden;
    overscroll-behavior: none;
    overflow-y: hidden;
    /* Only allow selection on message and pair key */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    transition: color 300ms;
}

body {
    height: 100%;
    /* mobile viewport bug fix */
    min-height: -moz-available;          /* WebKit-based browsers will ignore this. */
    min-height: -webkit-fill-available;  /* Mozilla-based browsers will ignore this. */
    min-height: fill-available;
}

html {
    height: 100%;
    min-height: -moz-available;          /* WebKit-based browsers will ignore this. */
    min-height: -webkit-fill-available;  /* Mozilla-based browsers will ignore this. */
    min-height: fill-available;
}

.fw {
    width: 100%;
}

.row-reverse {
    display: flex;
    flex-direction: row-reverse;
}

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

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

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

.center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.grow {
    flex-grow: 1;
}

.full {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.pointer {
    cursor: pointer;
}

header {
    position: absolute;
    align-items: baseline;
    padding: 8px 16px;
    box-sizing: border-box;
    width: 100vw;
    z-index: 2;
    top: 0;
    right: 0;
}

header > *:not(:first-child) {
    margin-left: 8px;
}

header > div {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    touch-action: manipulation;
}

header > div .icon-button {
    height: 40px;
    transition: all 300ms;
}

header > div > div {
    display: flex;
    flex-direction: column;
}

header > div:not(:hover) .icon-button:not(.selected) {
    height: 0;
    opacity: 0;
}

#theme-wrapper:hover::before {
    border-radius: 20px;
    background: currentColor;
    opacity: 0.1;
    transition: opacity 300ms;
    content: '';
    position: absolute;
    width: 40px;
    top: 0;
    bottom: 0;
    margin-top: 8px;
    margin-bottom: 8px;
}

header > div:hover .icon-button.selected::before {
    opacity: 0.1;
}

@media (pointer: coarse) {
    header > div:hover .icon-button.selected:hover::before {
        opacity: 0.2;
    }

    header > div .icon-button:not(.selected) {
        height: 0;
        opacity: 0;
        pointer-events: none;
    }

    header > div > div {
        flex-direction: column-reverse;
    }
}

[hidden] {
    display: none !important;
}


/* Typography */

body {
    font-family: -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 {
    font-size: 34px;
    font-weight: 400;
    letter-spacing: -.01em;
    line-height: 40px;
    margin: 8px 0 0;
}

h2 {
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -.012em;
    line-height: 32px;
    color: var(--primary-color);}

h3 {
    font-size: 20px;
    font-weight: 500;
    margin: 16px 0;
    color: var(--primary-color);
}

.font-subheading {
    font-size: 14px;
    font-weight: 400;
    line-height: 18px;
    word-break: normal;
}

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

.font-body1,
body {
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
}

.font-body2 {
    font-size: 12px;
    line-height: 18px;
}

a,
.icon-button {
    text-decoration: none;
    color: currentColor;
    cursor: pointer;
}

input {
    cursor: pointer;
}

input[type="checkbox"] {
    min-width: 13px;
}

x-noscript {
    background: var(--primary-color);
    color: white;
    z-index: 2;
}


/* Icons */

.icon {
    width: var(--icon-size);
    height: var(--icon-size);
    fill: currentColor;
}



/* Shadows */

[shadow="1"] {
    box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),
        0 1px 8px 0 rgba(0, 0, 0, 0.12),
        0 3px 3px -2px rgba(0, 0, 0, 0.4);
}

[shadow="2"] {
    box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14),
        0 1px 10px 0 rgba(0, 0, 0, 0.12),
        0 2px 4px -1px rgba(0, 0, 0, 0.4);
}




/* Animations */

@keyframes fade-in {
    0% {
        opacity: 0;
    }
}

#center {
    position: relative;
    display: flex;
    margin-top: 56px;
    flex-direction: column-reverse;
    flex-grow: 1;
    justify-content: space-around;
    align-items: center;
    overflow-x: hidden;
    overflow-y: scroll;
    overscroll-behavior-x: none;
}


/* Peers List */

#x-peers-filler {
    display: flex;
    flex-grow: 1;
}

x-peers {
    position: relative;
    display: flex;
    flex-flow: row wrap;
    flex-grow: 1;
    align-items: start !important;
    justify-content: center;

    z-index: 2;
    transition: --bg-color 0.5s ease;
    overflow-y: scroll;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    scrollbar-width: none;

    --peers-per-row: 6; /* default if browser does not support :has selector */
    --x-peers-width: min(100vw, calc(var(--peers-per-row) * (var(--peer-width) + 25px) - 16px));
    width: var(--x-peers-width);
    margin-right: 20px;
    margin-left: 20px;
}

x-peers.overflowing {
    background: /* Shadow covers */ linear-gradient(rgb(var(--bg-color)) 30%, rgba(var(--bg-color), 0)),
    linear-gradient(rgba(var(--bg-color), 0), rgb(var(--bg-color)) 70%) 0 100%,
        /* Shadows */ radial-gradient(farthest-side at 50% 0, rgba(var(--text-color), .2), rgba(var(--text-color), 0)),
    radial-gradient(farthest-side at 50% 100%, rgba(var(--text-color), .2), rgba(var(--text-color), 0)) 0 100%;

    background-repeat: no-repeat;
    background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;

    /* Opera doesn't support this in the shorthand */
    background-attachment: local, local, scroll, scroll;
}

x-peers:has(> x-peer) {
    --peers-per-row: 10;
}

@media screen and (min-height: 505px) and (max-height: 649px) and (max-width: 426px),
screen and (min-height: 486px) and (max-height: 631px) and (min-width: 426px) {
    x-peers:has(> x-peer) {
        --peers-per-row: 3;
    }

    x-peers:has(> x-peer:nth-of-type(7)) {
        --peers-per-row: 4;
    }

    x-peers:has(> x-peer:nth-of-type(10)) {
        --peers-per-row: 5;
    }

    x-peers:has(> x-peer:nth-of-type(13)) {
        --peers-per-row: 6;
    }

    x-peers:has(> x-peer:nth-of-type(16)) {
        --peers-per-row: 7;
    }

    x-peers:has(> x-peer:nth-of-type(19)) {
        --peers-per-row: 8;
    }

    x-peers:has(> x-peer:nth-of-type(22)) {
        --peers-per-row: 9;
    }

    x-peers:has(> x-peer:nth-of-type(25)) {
        --peers-per-row: 10;
    }
}

@media screen and (min-height: 649px) and (max-width: 425px),
screen and (min-height: 631px) and (min-width: 426px) {
    x-peers:has(> x-peer) {
        --peers-per-row: 3;
    }

    x-peers:has(> x-peer:nth-of-type(10)) {
        --peers-per-row: 4;
    }

    x-peers:has(> x-peer:nth-of-type(13)) {
        --peers-per-row: 5;
    }

    x-peers:has(> x-peer:nth-of-type(16)) {
        --peers-per-row: 6;
    }

    x-peers:has(> x-peer:nth-of-type(19)) {
        --peers-per-row: 7;
    }

    x-peers:has(> x-peer:nth-of-type(22)) {
        --peers-per-row: 8;
    }

    x-peers:has(> x-peer:nth-of-type(25)) {
        --peers-per-row: 9;
    }

    x-peers:has(> x-peer:nth-of-type(28)) {
        --peers-per-row: 10;
    }
}

::-webkit-scrollbar {
    display: none;
}

/* Empty Peers List */

x-no-peers {
    display: flex;
    flex-direction: column;
    padding: 8px;
    height: 137px;
    text-align: center;
    animation: fade-in 600ms;
    animation-fill-mode: backwards;
    /* prevent flickering on load */
    animation-iteration-count: 0;
}

x-no-peers h2,
x-no-peers a {
    color: var(--primary-color);
    margin-bottom: 5px;
}

x-peers:not(:empty)+x-no-peers {
    display: none;
}

x-no-peers::before {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -.012em;
    line-height: 32px;
}

x-no-peers[drop-bg]::before {
    content: attr(data-drop-bg);
}

x-no-peers[drop-bg] * {
    display: none;
}



/* Peer */

x-peer {
    padding: 8px;
    align-content: start;
    flex-wrap: wrap;
}

x-peer label {
    width: var(--peer-width);
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    position: relative;
}

input[type="file"] {
    visibility: hidden;
    position: absolute;
}

x-peer x-icon {
    --icon-size: 40px;
    margin-bottom: 4px;
    transition: transform 150ms;
    will-change: transform;
    display: flex;
    flex-direction: column;
}

x-peer .icon-wrapper {
    width: var(--icon-size);
    padding: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
}

x-peer.type-secret .icon-wrapper {
    background: var(--paired-device-color);
}

x-peer:not(.type-ip):not(.type-secret).type-public-id .icon-wrapper {
    background: var(--public-room-color);
}

x-peer x-icon > .highlight-wrapper {
    align-self: center;
    align-items: center;
    margin: 7px auto 0;
    height: 6px;
}

x-peer x-icon > .highlight-wrapper > .highlight {
    width: 15px;
    height: 6px;
    border-radius: 4px;
    margin-left: 1px;
    margin-right: 1px;
    display: none;
}

x-peer.type-ip x-icon > .highlight-wrapper > .highlight.highlight-room-ip {
    background-color: var(--primary-color);
    display: inline;
}

x-peer.type-secret x-icon > .highlight-wrapper > .highlight.highlight-room-secret {
    background-color: var(--paired-device-color);
    display: inline;
}

x-peer.type-public-id x-icon > .highlight-wrapper > .highlight.highlight-room-public-id {
    background-color: var(--public-room-color);
    display: inline;
}

x-peer:not([status]):hover x-icon,
x-peer:not([status]):focus x-icon {
    transform: scale(1.05);
}

x-peer[status] x-icon {
    box-shadow: none;
    opacity: 0.8;
    transform: scale(1);
}

.device-descriptor {
    width: 100%;
    text-align: center;
}

.device-descriptor > div {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.status,
.device-name,
.connection-hash {
    opacity: 0.7;
}

.device-name {
    font-size: 14px;
    white-space: nowrap;
}

.connection-hash {
    font-size: 12px;
    white-space: nowrap;
}

x-peer:not([status]) .status,
x-peer[status] .device-name {
    display: none;
}

x-peer[status] {
    pointer-events: none;
}

x-peer x-icon {
    animation: pop 600ms ease-out 1;
}

@keyframes pop {
    0% {
        transform: scale(0.7);
    }

    40% {
        transform: scale(1.2);
    }
}

x-peer[drop] x-icon {
    transform: scale(1.1);
}



/* Footer */

footer {
    position: relative;
    z-index: 2;
    align-items: center;
    text-align: center;
    cursor: default;
    margin: auto 5px 5px;
}

footer .logo {
    --icon-size: 80px;
    margin-bottom: 8px;
    color: var(--primary-color);
    margin-top: -10px;
    animation: ease-in;
}

.discovery-wrapper {
    font-size: 12px;
    margin: 10px auto auto;
    border: 3px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2px;
    background-color: rgb(var(--bg-color));
    transition: background-color 0.5s ease;
    min-height: 24px;
}

/*You can be discovered wrapper*/
.discovery-wrapper > div:first-of-type {
    padding-left: 4px;
    padding-right: 4px;
}


.discovery-wrapper .badge {
    word-break: keep-all;
    margin: 2px;
}

.badge {
    border-radius: 0.3rem/0.3rem;
    padding-right: 0.3rem;
    padding-left: 0.3em;
    background-color: var(--badge-color);
    color: white;
    transition: background-color 0.5s ease;
    white-space: nowrap;
}

.badge-room-ip {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.badge-room-secret {
    background-color: var(--paired-device-color);
    border-color: var(--paired-device-color);
}

.badge-room-public-id {
    background-color: var(--public-room-color);
    border-color: var(--public-room-color);
}

#display-name {
    position: relative;
    display: inline-block;
    text-align: left;
    border: none;
    outline: none;
    max-width: 15em;
    text-overflow: ellipsis;
    cursor: text;
    margin-bottom: -6px;
    padding-bottom: 0.1rem;
    border-radius: 1.3rem/30%;
    border-right: solid 1rem transparent;
    border-left: solid 1rem transparent;
    background-clip: padding-box;
    overflow: hidden;
    z-index: 1;
}

#edit-pen {
    width: 1rem;
    height: 1rem;
    margin-bottom: -2px;
    position: relative;
}

html:not([dir="rtl"]) {
    #display-name,
    #edit-pen {
        margin-left: -1rem;
    }
}

html[dir="rtl"] {
    #display-name,
    #edit-pen {
        margin-right: -1rem;
    }
    #edit-pen {
        transform: rotateY(180deg);
    }
}

/* Dialog */

x-dialog x-background {
    background: rgba(0, 0, 0, 0.61);
    z-index: 10;
    transition: opacity 300ms;
    will-change: opacity;
    padding: 15px;
    overflow: overlay;
}

x-dialog x-paper {
    z-index: 3;
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    box-sizing: border-box;
    transition: transform 300ms;
    will-change: transform;
}

x-paper > .row:first-of-type {
    background-color: var(--accent-color);
    border-bottom: solid 4px var(--border-color);
    margin-bottom: 10px;
}

x-paper > .row:first-of-type h2 {
    color: white;
}

#pair-device-dialog,
#edit-paired-devices-dialog {
    --accent-color: var(--paired-device-color);
}

#public-room-dialog {
    --accent-color: var(--public-room-color);
}

#pair-device-dialog x-paper,
#public-room-dialog x-paper {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: max(50%, 350px);
    margin-top: -328.5px;
    width: calc(100vw - 20px);
}

#pair-device-dialog ::-moz-selection,
#pair-device-dialog ::selection {
    color: black;
    background: var(--paired-device-color);
}

#public-room-dialog ::-moz-selection,
#public-room-dialog ::selection {
    color: black;
    background: var(--public-room-color);
}

x-dialog:not([show]) {
    pointer-events: none;
}

x-dialog:not([show]) x-paper {
    transform: scale(0.1);
}

x-dialog:not([show]) x-background {
    opacity: 0;
}


x-dialog a {
    color: var(--primary-color);
}

/* Pair Devices Dialog & Public Room Dialog */

.input-key-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.input-key-container > input {
    width: 45px;
    height: 45px;
    font-size: 30px;
    padding: 0;
    text-align: center;
    text-transform: uppercase;
    display: -webkit-box !important;
    display: -webkit-flex !important;
    display: -moz-flex !important;
    display: -ms-flexbox !important;
    display: flex !important;
    -webkit-justify-content: center;
    -ms-justify-content: center;
    justify-content: center;
}

.input-key-container > input {
    margin: 0 3px;
}

.input-key-container.six-chars > input:nth-of-type(4) {
    margin-left: 5%;
}

.key {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    display: inline-block;
    font-size: 50px;
    letter-spacing: min(calc((100vw - 80px - 99px) / 100 * 7), 20px);
    text-indent: calc(0.5 * (11px + min(calc((100vw - 80px - 99px) / 100 * 6), 28px)));
    margin: 25px 0;
}

.key-qr-code {
    margin: 16px;
}

.key-instructions {
    flex-direction: column;
}

x-dialog h2 {
    margin-top: 5px;
    margin-bottom: 0;
}

x-dialog hr {
    height: 3px;
    border: none;
    width: 100%;
    background-color: var(--border-color);
}

.hr-note {
    margin-top: 10px;
    margin-bottom: 20px;
}

.hr-note hr {
    margin-bottom: -2px;
}

.hr-note > div {
    height: 0;
    transform: translateY(-10px);
}


.hr-note > div > span {
    padding: 3px 10px;
    border-radius: 10px;
    color: rgb(var(--text-color));
    background-color: rgb(var(--bg-color));
    border: var(--border-color) solid 3px;
    text-transform: uppercase;
}

#pair-device-dialog x-background {
    padding: 16px!important;
}

/* Edit Paired Devices Dialog */
.paired-devices-wrapper:empty:before {
    content: attr(data-empty);
}

.paired-devices-wrapper:empty {
    padding: 10px;
}

.paired-devices-wrapper {
    border-top: solid 4px var(--paired-device-color);
    border-bottom: solid 4px var(--paired-device-color);
    max-height: 65vh;
    overflow: scroll;
    background: /* Shadow covers */ linear-gradient(rgb(var(--bg-color)) 30%, rgba(var(--bg-color), 0)),
    linear-gradient(rgba(var(--bg-color), 0), rgb(var(--bg-color)) 70%) 0 100%,
        /* Shadows */ radial-gradient(farthest-side at 50% 0, rgba(var(--text-color), .3), rgba(var(--text-color), 0)),
    radial-gradient(farthest-side at 50% 100%, rgba(var(--text-color), .3), rgba(var(--text-color), 0)) 0 100%;

    background-repeat: no-repeat;
    background-size: 100% 80px, 100% 80px, 100% 24px, 100% 24px;

    /* Opera doesn't support this in the shorthand */
    background-attachment: local, local, scroll, scroll;
}

.paired-device {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
}

.paired-device:not(:last-child) {
    border-bottom: solid 4px var(--paired-device-color);
}

.paired-device > .display-name,
.paired-device > .device-name {
    width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    text-align: center;
    align-self: center;
    border-bottom: solid 2px rgba(128, 128, 128, 0.5);
    opacity: 1;
}
.paired-device span {
    width: 100%;
}

.paired-device > .button-wrapper {
    display: flex;
    height: 36px;
    justify-content: space-between;
    flex-direction: row;
    align-items: center;
    width: 100%;
}

.paired-device > .button-wrapper > label,
.paired-device > .button-wrapper > button {
    display: flex;
    align-items: center;
    text-align: center;
    white-space: nowrap;
    justify-content: center;
    width: 50%;
    padding-left: 6px;
    padding-right: 6px;
    height: 36px;
}

.paired-device > .button-wrapper > :not(:last-child) {
    border-right: solid 1px rgba(128, 128, 128, 0.5);
}

.paired-device > .button-wrapper > :not(:first-child) {
    border-left: solid 1px rgba(128, 128, 128, 0.5);
}

.paired-device * {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Receive Dialog */

x-paper > .row {
    padding: 10px;
}

/* button row*/
x-paper > .button-row {
    border-top: solid 3px var(--border-color);
    height: 50px;
    margin-top: 10px;
}

x-paper > .button-row > .button {
    height: 100%;
    width: 100%;
}

html:not([dir="rtl"]) {
    & x-paper > .button-row > .button:not(:first-child) {
        border-right: solid 1.5px var(--border-color);
    }

    & x-paper > .button-row > .button:not(:last-child) {
        border-left: solid 1.5px var(--border-color);
    }
}

html[dir="rtl"] {
    & x-paper > .button-row > .button:not(:first-child) {
        border-left: solid 1.5px var(--border-color);
    }

    & x-paper > .button-row > .button:not(:last-child) {
        border-right: solid 1.5px var(--border-color);
    }
}

.language-buttons > button > span {
    margin: 0 0.3em;
}

.file-description {
    max-width: 100%;
}

.file-description span {
    display: inline;
    word-break: normal;
}

.file-name {
    font-style: italic;
    max-width: 100%;
    margin-top: 5px;
}

.file-stem {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1px;
}

/* Send Text Dialog */
x-dialog .dialog-subheader {
    padding-top: 16px;
    padding-bottom: 16px;
}

#send-text-dialog .display-name-wrapper {
    padding-bottom: 0;
}

#send-text-dialog .textarea {
    min-height: 200px;
    width: 100%;
}

/* Receive Text Dialog */

#receive-text-dialog #text {
    width: 100%;
    word-break: break-all;
    max-height: calc(100vh - 393px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    white-space: pre-wrap;
}

#receive-text-dialog #text a {
    cursor: pointer;
}

#receive-text-dialog #text a:hover {
    text-decoration: underline;
}

#receive-text-dialog h3 {
    /* Select the received text when double-clicking the dialog */
    user-select: none;
    pointer-events: none;
}

.row-separator {
    border-bottom: solid 2.5px var(--border-color);
    margin: auto -24px;
}

#base64-paste-btn,
#base64-paste-dialog .textarea {
    width: 100%;
    height: 40vh;
    border: solid 12px #438cff;
    border-radius: 8px;
}

#base64-paste-dialog .textarea {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#base64-paste-dialog .textarea::before {
    font-size: 15px;
    letter-spacing: 0.12em;
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    white-space: pre-wrap;
}


/* Button */

.button {
    padding: 2px 16px 0;
    box-sizing: border-box;
    min-height: 36px;
    font-size: 14px;
    line-height: 24px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    background: inherit;
    color: var(--accent-color);
    overflow: hidden;
}

.button[disabled] {
    color: #5B5B66;
    cursor: not-allowed;
}


.button,
.icon-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    touch-action: manipulation;
    border: none;
    outline: none;
}

.button:before,
.icon-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 300ms;
}

.button:not([disabled]):hover:before,
.icon-button:hover:before {
    opacity: 0.1;
}

.button[selected],
.icon-button[selected] {
    opacity: 0.1;
}

#cancel-paste-mode {
    z-index: 2;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    width: 100vw;
    height: 56px;
    background-color: var(--primary-color);
    color: rgb(238, 238, 238);
}

.button:focus:before,
.icon-button:focus:before {
    opacity: 0.2;
}



button::-moz-focus-inner {
    border: 0;
}


/* Icon Button */
.icon-button {
    width: 40px;
    height: 40px;
}

.icon-button:before {
    border-radius: 50%;
}

/* Text Input */
.textarea {
    box-sizing: border-box;
    border: none;
    outline: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #f1f3f4;
    display: block;
    overflow: auto;
    resize: none;
    line-height: 16px;
    max-height: calc(100vh - 254px);
    white-space: pre;
}


/* Info Animation */

#about {
    color: white;
    z-index: 11;
    overflow: hidden;
    pointer-events: none;
    text-align: center;
}

#about header {
    z-index: 1;
}

#about:not(:target) header.fade-in {
    transition-delay: 400ms;
}

#about:target header.fade-in {
    transition-delay: 100ms;
}

#about .fade-in {
    transition: opacity 300ms ease 300ms;
    will-change: opacity;
    pointer-events: all;
}

#about:not(:target) .fade-in {
    opacity: 0 !important;
    pointer-events: none;
    transition-delay: 0s;
}

#about .logo {
    --icon-size: 96px;
}

#about .title-wrapper {
    display: flex;
    align-items: baseline;
}

#about .title-wrapper > div {
    margin-left: 0.5em;
}

#about x-background {
    position: absolute;
    --size: max(max(230vw, 230vh), calc(150vh + 150vw));
    --size-half: calc(var(--size)/2);
    top: calc(28px - var(--size-half));
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--primary-color);
    transform: scale(0);
    z-index: -1;
}

html:not([dir="rtl"]) {
    #about x-background {
        right: calc(36px - var(--size-half));
    }
}

html[dir="rtl"] {
    #about x-background {
        left: calc(36px - var(--size-half));
    }
}


/* Hack such that initial scale(0) isn't animated */
#about x-background {
    will-change: transform;
    transition: transform 800ms cubic-bezier(0.77, 0, 0.175, 1);
}

#about:target x-background {
    transform: scale(1);
}

#about .row a {
    margin: 8px 8px -16px;
}

#about section {
    flex-grow: 1;
}

canvas.circles {
    width: 100vw;
    position: absolute;
    z-index: -10;
    top: 0;
    left: 0;
}

/* Loading Indicator */

.progress {
    width: 80px;
    height: 80px;
    position: absolute;
    top: -8px;
    clip: rect(0px, 80px, 80px, 40px);
    --progress: rotate(0deg);
    transition: transform 200ms;
}

.circle {
    width: 72px;
    height: 72px;
    border: 4px solid var(--primary-color);
    border-radius: 40px;
    position: absolute;
    clip: rect(0px, 40px, 80px, 0px);
    will-change: transform;
    transform: var(--progress);
}

.over50 {
    clip: rect(auto, auto, auto, auto);
}

.over50 .circle.right {
    transform: rotate(180deg);
}


/* Generic placeholder */
[placeholder]:empty:before {
    content: attr(placeholder);
}

/* Toast */

.toast-container {
    padding: 0 8px 24px;
    overflow: hidden;
    pointer-events: none;
}

x-toast {
    position: absolute;
    min-height: 48px;
    top: 50px;
    width: 100%;
    max-width: 344px;
    background-color: rgb(var(--text-color));
    color: rgb(var(--bg-color));
    align-items: center;
    box-sizing: border-box;
    padding: 8px 24px;
    z-index: 20;
    transition: opacity 200ms, transform 300ms ease-out;
    cursor: default;
    line-height: 24px;
    border-radius: 8px;
    pointer-events: all;
}

x-toast:not([show]):not(:hover) {
    opacity: 0;
    transform: translateY(-100px);
}


/* Instructions */

x-instructions {
    position: relative;
    opacity: 0.5;
    text-align: center;
    margin-left: 10px;
    margin-right: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
}

x-instructions:not([drop-peer]):not([drop-bg]):before {
    content: attr(mobile);
}

x-instructions[drop-peer]:before {
    content: attr(data-drop-peer);
}

x-instructions[drop-bg]:not([drop-peer]):before {
    content: attr(data-drop-bg);
}

x-instructions p {
    display: none;
}

x-peers:empty~x-instructions {
    opacity: 0 !important;
}

@media (hover: none) and (pointer: coarse) {
    x-peer {
        transform: scale(0.95);
        padding: 4px;
    }
}

/* Prevent Cumulative Layout Shift */

body > header,
canvas,
#center,
x-no-peers,
x-peers,
x-instructions,
footer > .icon.logo,
.discovery-wrapper,
.known-as-wrapper {
    transition: opacity 0.5s ease 0.1s;
    opacity: 0; /* will be set to 1 after initial translation is loaded */
}

/* Responsive Styles */

@media screen and (min-height: 800px) {
    footer {
        margin-bottom: 16px;
    }
}

@media (hover: hover) and (pointer: fine) {
    x-instructions:not([drop-peer]):not([drop-bg]):before {
        content: attr(desktop);
    }
}

/*
    Color Themes
*/

/* Default colors */
body {
    --text-color: 51,51,51;
    --bg-color: 250,250,250; /*rgb code*/
    --bg-color-test: 18,18,18;
    --bg-color-secondary: #e4e4e4;
    --border-color: rgb(169, 169, 169);
    --badge-color: #a5a5a5;
}

/* Dark theme colors */
body.dark-theme {
    --text-color: 238,238,238;
    --bg-color: 18,18,18; /*rgb code*/
    --bg-color-secondary: #333;
    --border-color: rgb(238,238,238);
    --badge-color: #717171;
}

/* Colored Elements */
body {
    color: rgb(var(--text-color));
    background-color: rgb(var(--bg-color));
    transition: background-color 0.5s ease;
}

x-dialog x-paper {
    background-color: rgb(var(--bg-color));
}

.textarea {
    color: rgb(var(--text-color)) !important;
    background-color: var(--bg-color-secondary) !important;
}

.textarea * {
    margin: 0 !important;
    padding: 0 !important;
    color: unset !important;
    background: unset !important;
    border: unset !important;
    opacity: unset !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-style: unset !important;
    font-weight: unset !important;
}

/* Image/Video/Audio Preview */
.file-preview {
    margin-bottom: 15px;
}

.file-preview:empty {
    display: none;
}

.file-preview > img,
.file-preview > audio,
.file-preview > video {
    max-width: 100%;
    max-height: 40vh;
    margin: auto;
    display: block;
}

/* Styles for users who prefer dark mode at the OS level */
@media (prefers-color-scheme: dark) {

    /* defaults to dark theme */
    body {
        --text-color: 238,238,238;
        --bg-color: 18,18,18; /*rgb code*/
        --bg-color-secondary: #333;
        --border-color: rgb(238,238,238);
        --badge-color: #717171;
    }

    /* Override dark mode with light mode styles if the user decides to swap */
    body.light-theme {
        --text-color: 51,51,51;
        --bg-color: 250,250,250; /*rgb code*/
        --bg-color-secondary: #e4e4e4;
        --border-color: rgb(169, 169, 169);
        --badge-color: #a5a5a5;
   }
}


/*
    Edge specific styles
*/
@supports (-ms-ime-align: auto) {

    html,
    body {
        overflow: hidden;
    }
}

/*
    iOS specific styles
*/
@supports (-webkit-overflow-scrolling: touch) {
    html {
        min-height: -webkit-fill-available;
    }
}

/* webkit scrollbar style*/

::-webkit-scrollbar{
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb{
    background: #bfbfbf;
    border-radius: 4px;
}

::-moz-selection,
::selection {
    color: black;
    background: var(--primary-color);
}
