/* All styles in this sheet are needed on page load */

/* Layout */

html,
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    width: 100vw;
    overflow-x: hidden;
    overscroll-behavior: none;
    overflow-y: hidden;
    transition: color 300ms;
}

body {
    height: 100%;
}

html {
    height: 100%;
}

.fw {
    width: 100%;
}

.p-1 {
    padding: 5px;
}

.p-2 {
    padding: 0px 10px;
}

.pb-0 {
    padding-bottom: 0;
}

.mx-1 {
    margin-left: 5px;
    margin-right: 5px;
}

.m-1 {
    margin: 5px;
}

.cursive {
    font-style: italic;
}

.wrap {
    display: flex;
    flex-wrap: wrap;
}

.wrap-reverse {
    display: flex;
    flex-wrap: wrap-reverse;
}

.grow {
    display: flex;
    flex-grow: 1;
}

.grow-2 {
    display: flex;
    flex-grow: 2;
}

.grow-5 {
    display: flex;
    flex-grow: 1;padding-bottom: 20px;
}

.shrink {
    display: flex;
    flex-shrink: 1;
}

.flex {
    display: flex;
}

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

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

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

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

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

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

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

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

.pointer {
    cursor: pointer;
}

header {
    position: relative;
    align-items: baseline;
    padding: 8px 12px;
    box-sizing: border-box;
    width: 100vw;
    z-index: 20;
    top: 0;
    right: 0;
    min-height: 56px;
}

header.overflow-hidden {
    overflow: hidden;
}

header:not(.overflow-expanded) {
    height: 56px;
}

header > * {
    margin-left: 4px;
    margin-right: 4px;
}

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

header > .icon-button {
    height: 40px;
}

header * {
    transition: all 300ms;
}

#theme-wrapper > div {
    display: flex;
    flex-direction: column;
}

/* expand theme buttons */
#theme-wrapper:not(:hover) .icon-button:not(.selected) {
    height: 0;
    opacity: 0;
}

#theme-wrapper:hover::before {
    border-radius: 20px;
    background: var(--primary-color);
    opacity: 0.2;
    transition: opacity 300ms;
    content: '';
    position: absolute;
    width: 40px;
    height: 120px;
    top: 0;
    margin-top: 8px;
    margin-bottom: 8px;
}

@media (hover: hover) and (pointer: fine) {
    #theme-wrapper:hover .icon-button:not(.selected):hover:before {
        opacity: 0.3;
    }

    #theme-wrapper:hover .icon-button.selected::before {
        opacity: 0.3;
    }
}

@media (hover: none) and (pointer: coarse) {
    #theme-wrapper:before {
        opacity: 0.3 !important;
        height: 40px !important;
    }

    #theme-wrapper .icon-button:before {
        opacity: 0;
    }

    #theme-wrapper .icon-button:not(.selected) {
        height: 0;
        opacity: 0;
        pointer-events: none;
    }

    #theme-wrapper > div {
        flex-direction: column-reverse;
    }
}

#expand > .icon {
    transition: transform 150ms ease-out
}

html:not([dir="rtl"]) #expand.flipped  > .icon {
    transform: rotate(-90deg);
}

html[dir="rtl"] #expand.flipped  > .icon {
    transform: rotate(90deg);
}

[hidden] {
    display: none !important;
}


/* Typography */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-variant-ligatures: common-ligatures;
    font-kerning: normal;
}

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

h2 {
    font-size: 22px;
    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;
}

.text-white {
    color: white !important;
}

.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);
}

.overflowing {
    background:
        /* Shadow covers */
            linear-gradient(rgb(var(--shadow-color-cover-rgb)) 30%, rgba(var(--shadow-color-cover-rgb), 0)),
            linear-gradient(rgba(var(--shadow-color-cover-rgb), 0), rgb(var(--shadow-color-cover-rgb)) 70%) 0 100%,
                /* Shadows */
            radial-gradient(farthest-side at 50% 0, rgba(var(--shadow-color-rgb), .2), rgba(var(--shadow-color-rgb), 0)),
            radial-gradient(farthest-side at 50% 100%, rgba(var(--shadow-color-rgb), .2), rgba(var(--shadow-color-rgb), 0))
            0 100%;
    background-repeat: no-repeat;
    background-size: 100% 60px, 100% 60px, 100% 24px, 100% 24px;
    background-attachment: local, local, scroll, scroll;
}


/* Animations */

/* Opacity for elements at keyframe 100% is set on element (default 1) */
@keyframes fade-in {
    0% {
        opacity: 0;
    }
}

#center {
    position: relative;
    display: flex;
    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  */

x-peers {
    position: relative;
    display: flex;
    flex-flow: row wrap;

    z-index: 2;
    transition: background-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);
}

/* Empty Peers List */

x-no-peers {
    display: flex;
    flex-direction: column;
    padding: 8px;
    height: 137px;
    text-align: center;
}

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

x-no-peers .logo {
    width: auto;
    height: 60px;
    margin: 0 auto 10px;
}

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;
}

/* Footer */

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

footer .logo {
    --icon-size: 80px;
    
    color: var(--primary-color);
    
}

.border {
    border: 2px solid var(--border-color);
}

.panel {
    font-size: 14px;
    padding: 2px;
    background-color: rgb(var(--bg-color));
    transition: background-color 0.5s ease;
    min-height: 24px;
}

.panel.column {
    border-radius: 16px;
}

.panel.row {
    border-radius: 12px;
}

.panel > div:first-of-type {
    padding-left: 4px;
    padding-right: 4px;
}

/* You can be discovered wrapper */
.discovery-wrapper {
    margin: 15px auto auto;
}

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

.badge {
    border-radius: 0.4rem;
    padding-right: 0.3rem;
    padding-left: 0.3em;
  
    white-space: nowrap;
}

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

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

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

.known-as-wrapper {
    font-size: 16px; /* prevents auto-zoom on edit */
}

#display-name {
    position: relative;
    display: inline-block;
    text-align: left;
    border: none;
    outline: none;
    height: 20px;
 
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    cursor: text;
 
  
    border-right: solid 1rem transparent;
    border-left: solid 1rem transparent;
    background-clip: padding-box;
    z-index: 1;    border: 1px solid #eee;
}



#display-name:focus::before {
    display: none;
}



/* Dialogs needed on page load */
x-dialog:not([show]) x-background {
    opacity: 0;
}

/* Button */

.btn {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 2px 16px 0;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 24px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    background: inherit;
    color: var(--accent-color);
    overflow: hidden;
}

.btn-small {
    font-size: 12px;
    line-height: 22px;
}

.btn[disabled] {
    color: var(--btn-disabled-color);
    cursor: not-allowed;
}


.btn,
.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;
}

.btn:before,
.icon-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;

    transition: opacity 300ms;
}

.icon-button:before {
    z-index: -1;
}

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

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

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

.btn-round {
    border-radius: 50%;
}

.btn-rounded {
    border-radius: 12px;
}

.btn-small.btn-rounded {
    border-radius: 6px;
}

.btn-grey {
    background-color: var(--bg-color-secondary);
}

.btn-dark {
    background-color: #262628;
}

.btn-primary {
    background: var(--primary-color);
    color: rgb(var(--bg-color));
}

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


/* Icon Button */
.icon-button {
    width: 45px;
    height: 45px;
    background: none !important;color: #666;
}

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


/* Info Animation */
#about {
    color: white;
    z-index: 32;
    overflow: hidden;
    pointer-events: none;
    text-align: center;
}

#about header {
    z-index: 1;
}

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

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

#about > * {
    transition: opacity 300ms ease 300ms;
    will-change: opacity;
    pointer-events: all;
}

#about:not(:target) > header,
#about:not(:target) > section {
    opacity: 0;
    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.4em;
}

#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);
    z-index: -1;
    background: var(--primary-color);
    background-image: radial-gradient(circle at calc(50% - 36px), var(--primary-color) 0%, black 80%);
    --crop-size: 0px;
    clip-path: circle(var(--crop-size));
    /* For clients < iOS 13.1 */
    -webkit-clip-path: circle(var(--crop-size));
}

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: clip-path;
    transition: clip-path 800ms cubic-bezier(0.77, 0, 0.175, 1);
}

#about:target x-background {
    --crop-size: var(--size);
}

#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;
}

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

/* Toast */

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

x-toast {    margin: 15px;
    display: flex;
    justify-content: space-between;
    position: absolute;
    min-height: 48px;
    top: 50px;
    max-width: 400px;
    background-color: rgb(var(--text-color));
    color: var(--dialog-bg-color);
    align-items: center;
    box-sizing: border-box;
    padding: 8px;
    z-index: 40;
    transition: opacity 200ms, transform 300ms ease-out;
    cursor: default;
    line-height: 24px;
    border-radius: 12px;
    pointer-events: all;
}

x-toast.top-row {
    top: 3px;
}

x-toast:not([show]) {
    opacity: 0;
    transform: translateY(calc(-100% + -55px));
}

x-toast span {
    flex-grow: 1;
    margin: auto 4px auto 10px
}

x-dialog[show] ~ div x-toast {
    background-color: var(--lt-dialog-bg-color);
    color: rgb(var(--lt-text-color));
}

/* Instructions */

x-instructions {
    display: flex;
    position: relative;
    opacity: 0.5;
    text-align: center;
    margin-right: 10px;
    margin-left: 10px;
    min-height: max(6vh, 40px);
    flex-direction: column;
    justify-content: end;
}

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-peers:empty,
x-peers:empty~x-instructions {
    display: none;
}

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

/* Prevent Cumulative Layout Shift */

.fade-in {
    animation: fade-in 600ms;
    animation-fill-mode: backwards;
}

.no-animation-on-load {
    animation-iteration-count: 0;
}

.opacity-0 {
    opacity: 0;
}

/* Responsive Styles */

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

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

/* PWA Standalone styles */
@media all and (display-mode: standalone) {
    footer {
        padding-bottom: 34px;
    }
}

/* Constants */

:root {
    --icon-size: 24px;
    --peer-width: 120px;
    color-scheme: light dark;
}

/*
    Color Themes
*/

/* Default colors */
body {
    /* Constant colors */
    --primary-color: #4285f4;
    --paired-device-color: #00a69c;
    --public-room-color: #ed9d01;
    --accent-color: var(--primary-color);
    --ws-peer-color: #ff6b6b;
    --btn-disabled-color: #5B5B66;

    /* shadows */
    --shadow-color-rgb: var(--text-color);
    --shadow-color-cover-rgb: var(--bg-color);

    /* Light theme colors */
    --lt-text-color: 51,51,51;
    --lt-dialog-bg-color: #fff;
    --lt-bg-color: 255,255,255;
    --lt-bg-color-secondary: #f2f2f2;
    --lt-border-color: #757575;
    --lt-badge-color: #757575;
    --lt-lang-hr-color: #DDD;

    --lt-shadow-color-secondary-rgb: 0,0,0;
    --lt-shadow-color-secondary-cover-rgb: 242,242,242;
    --lt-shadow-color-dialog-rgb: 0,0,0;
    --lt-shadow-color-dialog-cover-rgb: 242,242,242;

    /* Dark theme colors */
    --dt-text-color: 238,238,238;
    --dt-dialog-bg-color: #141414;
    --dt-bg-color: 0,0,0;
    --dt-bg-color-secondary: #262628;
    --dt-border-color: #757575;
    --dt-badge-color: #757575;
    --dt-lang-hr-color: #404040;

    --dt-shadow-color-secondary-rgb: 255,255,255;
    --dt-shadow-color-secondary-cover-rgb: 38,38,38;
    --dt-shadow-color-dialog-rgb: 255,255,255;
    --dt-shadow-color-dialog-cover-rgb: 38,38,38;
}

/* Light theme colors */
body {
    --text-color: var(--lt-text-color);
    --dialog-bg-color: var(--lt-dialog-bg-color);
    --bg-color: var(--lt-bg-color);
    --bg-color-secondary: var(--lt-bg-color-secondary);
    --border-color: var(--lt-border-color);
    --badge-color: var(--lt-badge-color);
    --lang-hr-color: var(--lt-lang-hr-color);

    --shadow-color-secondary-rgb: var(--lt-shadow-color-secondary-rgb);
    --shadow-color-secondary-cover-rgb: var(--lt-shadow-color-secondary-cover-rgb);
    --shadow-color-dialog-rgb: var(--lt-shadow-color-dialog-rgb);
    --shadow-color-dialog-cover-rgb: var(--lt-shadow-color-dialog-cover-rgb);
}

/* Dark theme colors */
body.dark-theme {
    --text-color: var(--dt-text-color);
    --dialog-bg-color: var(--dt-dialog-bg-color);
    --bg-color: var(--dt-bg-color);
    --bg-color-secondary: var(--dt-bg-color-secondary);
    --border-color: var(--dt-border-color);
    --badge-color: var(--dt-badge-color);
    --lang-hr-color: var(--dt-lang-hr-color);

    --shadow-color-secondary-rgb: var(--dt-shadow-color-secondary-rgb);
    --shadow-color-secondary-cover-rgb: var(--dt-shadow-color-secondary-cover-rgb);
    --shadow-color-dialog-rgb: var(--dt-shadow-color-dialog-rgb);
    --shadow-color-dialog-cover-rgb: var(--dt-shadow-color-dialog-cover-rgb);
}

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

    /* defaults to dark theme */
    body {
        --text-color: var(--dt-text-color);
        --dialog-bg-color: var(--dt-dialog-bg-color);
        --bg-color: var(--dt-bg-color);
        --bg-color-secondary: var(--dt-bg-color-secondary);
        --border-color: var(--dt-border-color);
        --badge-color: var(--dt-badge-color);
        --lang-hr-color: var(--dt-lang-hr-color);

        --shadow-color-secondary-rgb: var(--dt-shadow-color-secondary-rgb);
        --shadow-color-secondary-cover-rgb: var(--dt-shadow-color-secondary-cover-rgb);
        --shadow-color-dialog-rgb: var(--dt-shadow-color-dialog-rgb);
        --shadow-color-dialog-cover-rgb: var(--dt-shadow-color-dialog-cover-rgb);
    }


    /* Override dark mode with light mode styles if the user decides to swap */
    body.light-theme {
        --text-color: var(--lt-text-color);
        --dialog-bg-color: var(--lt-dialog-bg-color);
        --bg-color: var(--lt-bg-color);
        --bg-color-secondary: var(--lt-bg-color-secondary);
        --border-color: var(--lt-border-color);
        --badge-color: var(--lt-badge-color);
        --lang-hr-color: var(--lt-lang-hr-color);

        --shadow-color-secondary-rgb: var(--lt-shadow-color-secondary-rgb);
        --shadow-color-secondary-cover-rgb: var(--lt-shadow-color-secondary-cover-rgb);
        --shadow-color-dialog-rgb: var(--lt-shadow-color-dialog-rgb);
        --shadow-color-dialog-cover-rgb: var(--lt-shadow-color-dialog-cover-rgb);
    }
}

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

/* Gradient for wifi-tether icon */
#primaryGradient .start-color {
    stop-color: var(--primary-color);
}

@supports (stop-color: color-mix(in srgb, blue 50%, black)) {
    #primaryGradient .start-color {
        stop-color: color-mix(in srgb, var(--primary-color) 80%, white);
    }
}

#primaryGradient .stop-color {
    stop-color: var(--primary-color);
}


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

    html,
    body {
        overflow: hidden;
    }
}

/*
    Browser specific styles
*/

body {
    /* 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 {
    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;
}

/* webkit scrollbar style*/

::-webkit-scrollbar{
    width: 0;
    height: 0;
}

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

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

/* make elements with attribute contenteditable editable on older iOS devices.
See note here: https://developer.mozilla.org/en-US/docs/Web/CSS/user-select */
[contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

/* 聊天窗口样式 */
.chat-history {
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  
}

/* 强制覆盖全局样式 */
#chat-dialog .chat-message {
    margin: 12px 0 !important;
    padding: 10px 14px !important;
    border-radius: 18px !important;
    max-width: 80% !important;
    word-break: break-word !important;
    position: relative !important;
    font-size: 14px !important;
    color: #2d2d2d !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    background-color: white !important;
}

#chat-dialog .chat-message-incoming {
    background-color: #f1f1f1 !important;
    align-self: flex-start !important;
    float: left !important;
    clear: both !important;
    border-bottom-left-radius: 4px !important;
}

#chat-dialog .chat-message-outgoing {
    background-color: #dcf8c6 !important;
    align-self: flex-end !important;
    float: right !important;
    clear: both !important;
    border-bottom-right-radius: 4px !important;
}

#chat-dialog .chat-message-time {
    font-size: 12px !important;
    color: #666 !important;
    display: block !important;
    margin-bottom: 4px !important;
}

#chat-dialog .chat-message-content {
    word-break: break-word !important;
    line-height: 1.4 !important;
    font-size: 14px !important;
    color: #2d2d2d !important;
}

.chat-history::after {
    content: "";
    display: table;
    clear: both;
}

#chat-input {
    min-height: 40px !important;
    max-height: 100px !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    width: 100% !important; /* 添加宽度100%，占满剩余空间 */
    background-color: #f5f5f5 !important;
    border: 1px solid #e0e0e0 !important;
}

/* 增大聊天对话框 */
#chat-dialog x-paper {
    max-width: 500px;
    max-height: 90vh;
    width: 90%;
}

/* 聊天窗口头部样式 */
.chat-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1px 10px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
}

.chat-header .header-left,
.chat-header .close-btn {
    flex: 1 !important;
    background: none;
    display: flex !important;
    align-items: center !important;
}

.chat-header .header-center {
    flex: 8 !important;
    text-align: center !important;
}

.chat-header .header-center .display-name {
    font-size: 16px !important;
    font-weight: 500 !important;
}

.close-btn {
    padding: 6px !important;
    display: flex !important;
    justify-content: flex-end !important;
    background: none !important;
    color: #999 !important;
}

/* 聊天输入区域 */
.chat-input-container {
    display: flex !important;
    align-items: center !important;
    padding: 10px !important;
}

.file-btn-container {
    
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.file-btn {
    width: 46px !important;    padding: 0px;    margin-right: 5px;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 30% !important;
    background-color: #f5f5f5 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
}

.file-btn:hover {
    background-color: #e0e0e0 !important;
}

.file-btn .icon {
    width: 20px !important;
    height: 20px !important;
    color: #666 !important;
}

.file-btn small {
    font-size: 10px !important;
    line-height: 1 !important;
    margin-top: 2px !important;
    color: #666 !important;
    width: 100% !important;
    text-align: center !important;
}

body.dark-theme .file-btn {
    background-color: #2a2a2a !important;
}

body.dark-theme .file-btn:hover {
    background-color: #3a3a3a !important;
}

body.dark-theme .file-btn .icon {
    color: #ccc !important;
}

body.dark-theme .file-btn small {
    color: #ccc !important;
}

#chat-input {
    min-height: 40px !important;
    max-height: 100px !important;
    overflow-y: auto !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    width: 100% !important; /* 添加宽度100%，占满剩余空间 */
    background-color: #f5f5f5 !important;
    border: 1px solid #e0e0e0 !important;
}

/* 深色主题适配 */
body.dark-theme #chat-dialog .chat-message {
    color: #f1f1f1 !important;
    background-color: #262626 !important;
}

body.dark-theme #chat-dialog .chat-message-incoming {
    background-color: #303030 !important;
}

body.dark-theme #chat-dialog .chat-message-outgoing {
    background-color: #056162 !important;
}

body.dark-theme #chat-dialog .chat-message-time {
    color: #aaa !important;
}

body.dark-theme #chat-dialog .chat-message-content {
    color: #f1f1f1 !important;
}

body.dark-theme #chat-input {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #f1f1f1 !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-input-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 10px !important;
    }
    
    /* 移除发送按钮的样式 */
    
    #chat-input {
        flex: 1 !important;
    }
    
    /* 修复移动端键盘显示问题 */
    #chat-dialog x-paper {
        position: relative !important;
        top: 0 !important;
        transform: translateY(-10vh) !important;
        max-height: 80vh !important;
    }
    
    /* 确保聊天历史区域可滚动，而不是整个对话框 */
    .chat-history {
        max-height: 35vh !important;
    }
}

/* 发送按钮样式已移除 */

/* 聊天窗口中的媒体预览 */
.chat-media-preview {
    max-width: 100% !important;
    max-height: 200px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    margin: 5px 0 !important;
    display: block !important;
}

/* 视频容器样式 */
.chat-media-container {
    position: relative !important;
    display: inline-block !important;
    max-width: 100% !important;
}

/* 视频下载按钮样式 */
.chat-media-download-btn {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 32px !important;
    height: 32px !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 2 !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
}

.chat-media-download-btn:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

.chat-media-download-btn svg {
    width: 18px !important;
    height: 18px !important;
    fill: white !important;
}

body.dark-theme .chat-media-download-btn {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

body.dark-theme .chat-media-download-btn:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
}

/* 聊天中的文件链接 */
.chat-file-link {
    display: block !important;
    padding: 8px 10px !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-radius: 6px !important;
    margin: 5px 0 !important;
    text-decoration: none !important;
    color: inherit !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
}

/* 在深色主题中调整文件链接的背景颜色 */
body.dark-theme .chat-file-link {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* 媒体全屏显示样式 */
.media-fullscreen-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
}

.media-fullscreen-content {
    max-width: 90% !important;
    max-height: 90% !important;
    object-fit: contain !important;
    border-radius: 6px !important;
}

.media-fullscreen-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 40px !important;
    height: 40px !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 50% !important;
    color: white !important;
    font-size: 24px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.media-fullscreen-close:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
}

/* 添加对发送消息时间戳位置的调整 */
#chat-dialog .chat-message-outgoing .chat-message-time {
    text-align: right !important;
}

/* 视频通话样式 */
.video-call-header-in-video {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 16px !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10 !important;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent) !important;
}

/* 移除旧的视频通话头部样式 */
.video-call-header {
    display: none !important;
}

.video-call-header .header-center {
    display: none !important;
}

/* 默认的call-controls样式 */
.call-controls {
    position: absolute !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10 !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    border-radius: 25px !important;
    padding: 5px !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important; /* 加快淡入淡出速度 */
    opacity: 1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* 控制栏隐藏时添加平移效果 */
.call-controls[style*="opacity: 0"],
.call-controls.controls-hidden {
    transform: translateX(-50%) translateY(10px) !important;
    pointer-events: none !important;
    display: none !important;
}

.video-container {
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    background-color: #f0f0f0 !important;
    overflow: hidden !important;
    cursor: pointer !important; /* 始终显示指针光标 */
    margin: 0 auto !important; /* 居中显示 */
    max-width: 100% !important; /* 防止溢出屏幕 */
}

.remote-video-container {
    flex: 1 !important;
    position: relative !important;
    overflow: hidden !important;
    background-color: #111 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.remote-video-placeholder {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.remote-video-placeholder .icon {
    --icon-size: 80px !important;
    opacity: 0.5 !important;
    color: white !important;
}

.local-video-container {
    position: absolute !important;
    right: 10px !important;
    bottom: 10px !important;
    width: 120px !important; /* 初始宽度，会被JS动态调整 */
    height: 160px !important; /* 初始高度，会被JS动态调整 */
    border-radius: 8px !important;
    overflow: hidden !important;
    background-color: #333 !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    transition: width 0.3s, height 0.3s !important; /* 添加平滑过渡效果 */
    max-width: 35% !important; /* 确保不会太大 */
    max-height: 35% !important; /* 确保不会太大 */
}

#remote-video, #local-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* 默认值，会被JS根据视频比例调整 */
}

.end-call-btn {
    background-color: rgba(255, 0, 0, 0.7) !important;
    border-radius: 50% !important;
}

#toggle-video, #toggle-audio, #toggle-local-video {
    background-color: rgba(50, 50, 50, 0.5) !important;
    border-radius: 50% !important;
    margin: 0 4px !important;
}

#toggle-video-quality {
    background-color: rgba(50, 50, 50, 0.5) !important;
    border-radius: 50px !important;
    margin: 0 4px !important;
    padding: 0 10px !important;
    position: relative !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 40px !important;
    height: 40px !important;
}

#toggle-video-quality .quality-text {
    position: static !important;
    color: white !important;
    font-size: 12px !important;
    font-weight: bold !important;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8) !important;
    transform: none !important;
    padding: 0 !important;
    background-color: transparent !important;
}

@media (max-width: 768px) {
    #toggle-video-quality .quality-text {
        font-size: 10px !important;
    }
}

#video-call-dialog x-paper {
    width: auto !important;
    max-width: 90% !important;
    max-height: 90vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.video-call-display-name {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

/* 深色主题适配 */
body.dark-theme .video-container {
    background-color: #1a1a1a !important;
}

body.dark-theme .remote-video-container {
    background-color: #000 !important;
}

body.dark-theme .local-video-container {
    border-color: #333 !important;
}

/* 移动设备适配 */
@media (max-width: 768px) {
    .video-container {
        width: 100% !important;
        max-height: 80vh !important;
    }
    
    .remote-video-container {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    #remote-video {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    
    .local-video-container {
        /* 移除固定尺寸，由JS动态设置 */
        position: absolute !important;
        right: 10px !important;
        bottom: 15px !important; /* 调整位置以适应新的控制按钮位置 */
        max-width: 30% !important;
        max-height: 30% !important;
    }
    
    .call-controls {
        bottom: 15px !important;
        left: 15px !important; /* 放置在左下角 */
        transform: none !important; /* 移除居中变换 */
        padding: 5px !important; 
        border-radius: 20px !important;
        background-color: rgba(0, 0, 0, 0.7) !important; /* 移动端背景色更深 */
    }
    
    /* 移动设备下控制栏隐藏效果 */
    .call-controls[style*="opacity: 0"],
    .call-controls.controls-hidden {
        transform: translateY(10px) !important;
    }
    
    /* 移动端下缩小控制按钮 */
    .call-controls .icon-button {
        --icon-button-size: 40px !important;
        margin: 0 2px !important;
    }
    
    .call-controls .icon {
        --icon-size: 22px !important;
    }
    
    #toggle-video, #toggle-audio, #toggle-local-video {
        margin: 0 2px !important;
    }
    
    /* 改进移动端视频容器点击区域 */
    .video-container {
        cursor: pointer !important; /* 增加光标指示 */
    }
    
    #video-call-dialog x-paper {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* 高亮显示按钮悬停效果 */
.call-controls .icon-button:hover {
    background-color: rgba(70, 70, 70, 0.8) !important;
    transform: scale(1.1) !important;
}

.end-call-btn:hover {
    background-color: rgba(255, 0, 0, 0.9) !important;
    transform: scale(1.1) !important;
}

/* 聊天页面中的自动保存开关 */
.auto-download-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 10px;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 3px 6px;
    border-radius: 8px;
    width: 40px;
}

.auto-download-label {
    font-size: 11px;
    margin-top: 3px;
    white-space: nowrap;
}

/* 小型开关样式 */
.switch.small-switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 16px;
}

.switch.small-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch.small-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
}

.switch.small-switch .slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
}

.switch.small-switch input:checked + .slider {
    background-color: var(--primary-color, #4285f4);
}

.switch.small-switch input:checked + .slider:before {
    transform: translateX(14px);
}

.switch.small-switch .slider.round {
    border-radius: 16px;
}

.switch.small-switch .slider.round:before {
    border-radius: 50%;
}

/* 黑暗模式样式 */
body.dark-theme .auto-download-container {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 移动设备适配 */
@media (max-width: 600px) {
    .auto-download-container {
        margin-left: 5px;
        padding: 2px 4px;
        width: 35px;
    }
    
    .auto-download-label {
        font-size: 9px;
        margin-top: 2px;
    }
}

