* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at center, #ddc784, #c4a85c);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center
}

#lobby-view {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    background: linear-gradient(135deg, #f5f7fa, #e4e8ec)
}

#game-view {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center
}

.connection-status {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    font-size: 12px;
    padding: 6px 12px;
    background: #0000004d;
    border-radius: 4px;
    color: #fff
}

.hide-table-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 700;
    background: #00000080;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 2px 8px #0000004d
}

.hide-table-btn:hover {
    background: #000000b3;
    border-color: #fff9;
    transform: translateY(-1px)
}

.settings-toggle-btn-wrapper {
    position: relative;
    width: 0;
    flex: 0 0 auto;
    align-self: stretch
}

.settings-toggle-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    width: 20px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #0000001a;
    border: none;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    transition: all .2s
}

.settings-toggle-btn:hover {
    background: #0009
}

.player-names-text {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    font-size: 14px;
    color: #fff
}

.connection-status .status-label {
    color: #ffffffb3
}

.connection-status .status-text {
    font-weight: 700
}

.connection-status.connected .status-text {
    color: #4caf50
}

.connection-status.disconnected .status-text {
    color: #f44336
}

.game-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 1400px;
    padding: 20px;
    box-sizing: border-box
}

#gameContainer {
    flex: 0 0 auto
}

.settings-panel {
    flex: 0 0 auto;
    width: calc(min(90vw, calc((100vh - 100px) * 10 / 11))*.45);
    height: calc(min(90vw, calc((100vh - 100px) * 10 / 11))*1.1);
    background: gray;
    border-radius: 0;
    border: 1px solid #000;
    border-left: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px;
    overflow: hidden
}

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

.player-names-section {
    flex: 0 0 auto;
    background: #ffffff26;
    border-radius: 5px;
    padding: 10px 8px
}

.player-names-vs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    gap: 8px
}

.player-name-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0
}

.player-name-left,
.player-name-right {
    padding: 5px 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%
}

.waiting-placeholder {
    color: #bebebe
}

.player-tag {
    position: absolute;
    top: -5px;
    font-size: 10px;
    padding: 1px 5px;
    background: #2196f3;
    color: #fff;
    border-radius: 3px;
    font-weight: 400;
    line-height: 1.2
}

.player-name-wrapper:first-child .player-tag {
    left: 0
}

.player-name-wrapper:last-child .player-tag {
    right: 0
}

.vs-text {
    color: gold;
    font-weight: 700
}

.settings-divider {
    display: none
}

.move-records-section {
    flex: 0 0 auto;
    height: 200px;
    overflow: hidden;
    background: #0003;
    border-radius: 5px;
    padding: 8px;
    margin: 10px 0;
    display: flex;
    flex-direction: column
}

.section-title {
    font-size: 14px;
    color: #fffc;
    margin-bottom: 8px
}

.move-records-list {
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
    line-height: 1.6
}

.empty-records {
    color: #fff6;
    font-style: italic
}

.move-record-round {
    border-radius: 3px;
    padding: 2px 4px
}

.move-record-round:nth-child(odd) {
    background: #ffffff0f
}

.move-record-round:nth-child(2n) {
    background: transparent
}

.move-record-item {
    display: flex;
    align-items: baseline;
    color: #ffffffe6
}

.record-number {
    flex: 0 0 24px;
    color: #ffffff80;
    text-align: left
}

.record-move {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline
}

.record-capture {
    color: #ffc864e6;
    font-size: 12px;
    margin-left: 4px;
    white-space: nowrap
}

.chat-section {
    flex: 0 0 auto;
    height: 200px;
    overflow: hidden;
    margin: 10px 0
}

.chat-box-settings {
    display: flex;
    flex-direction: column;
    height: 100%
}

.chat-box-settings .chat-messages {
    flex: 1;
    overflow-y: auto;
    background: #0003;
    border-radius: 5px;
    padding: 8px;
    margin-bottom: 4px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.chat-message-wrapper {
    display: flex;
    width: 100%
}

.chat-message-wrapper.own {
    justify-content: flex-end
}

.chat-message-wrapper.opponent {
    justify-content: flex-start
}

.chat-message-bubble {
    max-width: 90%;
    padding: 8px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    line-height: 1.4
}

.chat-message-wrapper.own .chat-message-bubble {
    background: #95ec69;
    color: #000;
    border-bottom-right-radius: 2px
}

.chat-message-wrapper.opponent .chat-message-bubble {
    background: #fff;
    color: #000;
    border-bottom-left-radius: 2px
}

.chat-box-settings .chat-input-container {
    display: flex;
    gap: 2px;
    border-top: none;
    padding: 4px 0;
    width: 100%;
    box-sizing: border-box
}

.chat-box-settings .chat-input {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 5px;
    background: #ffffff1a;
    color: #fff;
    font-size: 12px;
    outline: none
}

.chat-box-settings .chat-input:focus {
    outline: none;
    border: 1px solid rgba(255, 255, 255, .4)
}

.chat-box-settings .chat-send {
    padding: 6px 12px;
    border: 1px solid #808080;
    border-radius: 5px;
    background: #d2d2d2;
    color: #000;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none
}

.game-actions-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px
}

.game-actions-section .control-btn {
    padding: 6px 20px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #808080;
    border-radius: 6px;
    background: #d2d2d2;
    color: #000;
    cursor: pointer;
    transition: all .2s;
    box-shadow: none
}

.game-actions-section .control-btn:hover {
    background: #ffed4a;
    box-shadow: none
}

.game-actions-section .control-btn.danger {
    background: #f44336;
    color: #fff;
    border: 1px solid #808080
}

.game-actions-section .control-btn.danger:hover {
    background: #ff6659;
    box-shadow: none
}

.game-actions-section .control-btn:disabled {
    opacity: .5;
    cursor: not-allowed
}

.game-actions-section .control-btn:disabled:hover {
    background: #d2d2d2
}

.controls-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.controls-section .control-btn {
    width: 100%;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #808080;
    border-radius: 6px;
    background: #fff;
    color: #000;
    cursor: pointer;
    transition: all .2s;
    box-shadow: none
}

.controls-section .control-btn:hover {
    background: #f0f0f0;
    box-shadow: none
}

.controls-section .control-btn.can-start {
    background: #ff9800;
    color: #fff;
    animation: pulse 1.5s infinite
}

@keyframes pulse {
    0% {
        opacity: 1
    }

    50% {
        opacity: .7
    }

    to {
        opacity: 1
    }
}

.game-header,
.game-controls,
.chat-box {
    display: none
}

.lobby-container {
    width: 1000px;
    min-width: 600px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    margin: 0 auto;
    color: #333
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px #00000014
}

.lobby-header h1 {
    font-size: 32px;
    color: #c41e3a;
    font-family: SimSun, 宋体, serif
}

.beta-tag {
    font-size: 14px;
    color: #888;
    margin-left: 8px;
    vertical-align: middle
}

.back-to-game-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 700;
    background: #00000080;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 2px 8px #0000004d
}

.back-to-game-btn:hover {
    background: #000000b3;
    border-color: #fff9;
    transform: translateY(-1px)
}

.create-table-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: #fff;
    box-shadow: 0 4px 12px #4caf504d;
    transition: all .2s;
    cursor: pointer
}

.create-table-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px #0006
}

.lobby-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px
}

.tables-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px #00000014;
    min-height: 550px
}

.tables-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
    border-bottom: 2px solid rgba(196, 30, 58, .15);
    padding-bottom: 10px
}

.tables-list {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.table-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all .2s
}

.table-item:hover {
    background: #e9ecef
}

.table-item.playing {
    opacity: .6
}

.table-info {
    flex: 1
}

.table-id {
    font-size: 16px;
    font-weight: 700;
    color: #c41e3a;
    margin-bottom: 4px
}

.table-host {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px
}

.table-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%
}

.status-dot.waiting {
    background: #4caf50;
    box-shadow: 0 0 8px #4caf50
}

.status-dot.playing {
    background: #ff9800
}

.table-players {
    margin: 0 15px
}

.player-count-badge {
    background: transparent;
    border: 1px solid #999;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #333
}

.join-btn {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #2196f3, #1565c0);
    color: #fff;
    cursor: pointer;
    transition: all .2s
}

.join-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px #2196f366
}

.full-badge {
    padding: 8px 15px;
    font-size: 12px;
    color: #999;
    background: #e9ecef;
    border-radius: 6px
}

.empty-tables {
    text-align: center;
    padding: 40px;
    color: #999
}

.empty-tables .empty-hint {
    font-size: 13px;
    margin-top: 10px;
    color: #bbb
}

.loading-tables {
    text-align: center;
    padding: 40px;
    color: #999
}

.players-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px #00000014;
    min-height: 550px
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(196, 30, 58, .15);
    padding-bottom: 10px
}

.players-header h2 {
    color: #333;
    font-size: 20px;
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px
}

.player-count {
    color: #888;
    font-size: 14px
}

.change-nickname-btn {
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 400;
    border: 1px solid rgba(196, 30, 58, .4);
    border-radius: 4px;
    background: transparent;
    color: #c41e3acc;
    cursor: pointer;
    transition: all .2s;
    margin-left: 10px
}

.change-nickname-btn:hover {
    background: #c41e3a1a;
    border-color: #c41e3acc;
    color: #c41e3a
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all .2s
}

.player-item:hover {
    background: #e9ecef
}

.player-item.self {
    background: #4caf5026;
    border: 1px solid rgba(76, 175, 80, .4)
}

.player-avatar {
    font-size: 20px
}

.player-name {
    font-size: 14px;
    color: #333
}

.empty-players {
    text-align: center;
    padding: 20px;
    color: #999
}

.lobby-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 13px;
    color: #666;
    box-shadow: 0 2px 12px #00000014
}

.footer-links {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px
}

.footer-copyright {
    text-align: center;
    font-size: 12px;
    color: #999
}

.lobby-footer a {
    color: #666;
    text-decoration: none;
    transition: color .2s
}

.lobby-footer a:hover {
    color: #c41e3a;
    text-decoration: underline
}

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

.room-info-card {
    background: #fff;
    padding: 40px 60px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 20px #00000014
}

.room-info-card h2 {
    color: #c41e3a;
    margin-bottom: 30px;
    font-size: 24px
}

.room-details {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef
}

.detail-row:last-child {
    border-bottom: none
}

.detail-label {
    color: #666
}

.detail-value {
    color: #333;
    font-weight: 700
}

.detail-value.room-id {
    color: #c41e3a;
    font-size: 18px;
    letter-spacing: 2px
}

.waiting-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px
}

.start-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: #fff;
    cursor: pointer;
    transition: all .2s
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #4caf5066
}

.start-btn:disabled {
    background: #e9ecef;
    color: #bbb;
    cursor: not-allowed
}

.cancel-btn,
.leave-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #f44336, #c62828);
    color: #fff;
    cursor: pointer;
    transition: all .2s
}

.cancel-btn:hover,
.leave-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #f4433666
}

.waiting-hint {
    color: #999;
    font-size: 14px
}

.disconnect-message,
.connect-error {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(244, 67, 54, .3);
    box-shadow: 0 2px 12px #00000014
}

.disconnect-message p,
.connect-error p {
    font-size: 18px;
    color: #f44336;
    margin-bottom: 10px
}

.error-hint {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px
}

.reconnect-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, gold, #fa0);
    color: #000;
    cursor: pointer;
    transition: all .2s
}

.reconnect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #ffd70066
}

.lobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 20px
}

.lobby h1 {
    font-size: 48px;
    color: #c41e3a;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, .1);
    margin-bottom: 30px
}

.lobby-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center
}

.lobby-btn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, gold, #fa0);
    color: #000;
    box-shadow: 0 4px 12px #0000001f;
    transition: all .2s
}

.lobby-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px #0006
}

.lobby-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none
}

.room-input {
    padding: 12px 20px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8f9fa;
    color: #333;
    text-align: center;
    text-transform: uppercase
}

.room-input::placeholder {
    color: #aaa
}

.room-info {
    background: #fff;
    padding: 20px 40px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 12px #00000014
}

.room-info h2 {
    color: #c41e3a;
    margin-bottom: 10px
}

.room-info .room-id {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    letter-spacing: 5px;
    margin: 15px 0
}

.waiting-text {
    color: #999;
    font-size: 14px;
    margin-top: 10px
}

.scene-container {
    width: 100%;
    height: calc(100vh - 40px);
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none
}

.board-wrapper {
    position: relative;
    width: min(90vw, calc((100vh - 100px) * 10 / 11));
    height: calc(min(90vw, calc((100vh - 100px) * 10 / 11))*1.1);
    transform-style: preserve-3d;
    transition: transform .1s ease;
    z-index: 1;
    --board-width: min(90vw, calc((100vh - 100px) * 10 / 11));
    --board-height: calc(var(--board-width) * 11 / 10)
}

.board-wrapper.black-side {
    transform: rotate(180deg)
}

.board-background {
    position: absolute;
    width: min(90vw, calc((100vh - 100px) * 10 / 11));
    height: calc(min(90vw, calc((100vh - 100px) * 10 / 11))*1.1);
    background: #e8cfa0;
    background-image: url(../bd.svg);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0
}

.grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: 100%;
    height: 100%;
    gap: 0;
    background: transparent;
    padding: calc(var(--board-height) * 25 / 550) calc(var(--board-width) * 25 / 500);
    transform-style: preserve-3d;
    z-index: 1
}

.tile {
    width: 100%;
    height: 100%;
    position: relative;
    transition: background-color .2s;
    transform-style: preserve-3d;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center
}

.tile.normal,
.tile.river,
.tile.palace-red,
.tile.palace-black {
    background: transparent
}

.tile:hover {
    background: #d4b89680
}

.piece {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 2.5vw, 18px);
    font-family: SimSun, 宋体, serif;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, .3);
    box-shadow: 0 4px 8px #0000004d, inset 0 2px 4px #ffffff4d, 0 0 0 2px #0003;
    z-index: 10;
    -webkit-user-select: none;
    user-select: none;
    position: relative
}

.piece.red {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #d32f2f);
    color: #ffeb3b;
    border: 2px solid #b71c1c
}

.piece.red:before {
    content: "";
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    border: 1px solid #ffeb3b
}

.piece.black {
    background: radial-gradient(circle at 30% 30%, #616161, #212121);
    color: #ffeb3b;
    border: 2px solid #000
}

.piece.black:before {
    content: "";
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    border: 1px solid #ffeb3b
}

.tile.selected {
    box-shadow: inset 0 0 0 3px #4caf50
}

.tile.last-move {
    box-shadow: inset 0 0 0 3px #2196f3
}

.tile.valid-move:after {
    content: "";
    position: absolute;
    width: 30%;
    height: 30%;
    background: #4caf50;
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 10px #4caf50
}

.game-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000
}

.control-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    background: gold;
    color: #000;
    box-shadow: 0 5px 15px #0000004d;
    transition: all .2s
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px #0006
}

.control-btn.danger {
    background: #f44336;
    color: #fff
}

.chat-box {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 280px;
    background: #000c;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .2);
    z-index: 1000
}

.chat-messages {
    height: 120px;
    overflow-y: auto;
    padding: 10px;
    font-size: 12px
}

.chat-message {
    margin-bottom: 5px;
    padding: 4px 8px;
    border-radius: 5px;
    background: #ffffff1a
}

.chat-message.own {
    background: #ff44444d
}

.chat-message.opponent {
    background: #6464644d
}

.chat-input-container {
    display: flex;
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, .2)
}

.chat-input {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 5px;
    background: #ffffff1a;
    color: #fff;
    font-size: 12px
}

.chat-input::placeholder {
    color: #ffffff80
}

.chat-send {
    padding: 6px 12px;
    margin-left: 8px;
    border: none;
    border-radius: 5px;
    background: gold;
    color: #000;
    font-size: 12px;
    font-weight: 700
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00000080;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000
}

.modal {
    background: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
    box-shadow: 0 10px 40px #00000026;
    width: 320px;
    height: 220px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center
}

.modal h2 {
    font-size: 24px;
    color: #c41e3a;
    margin-bottom: 12px
}

.modal p {
    font-size: 14px;
    color: #333;
    margin-bottom: 16px
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center
}

.draw-request-modal h3 {
    font-size: 20px;
    color: #c41e3a;
    margin-bottom: 10px
}

.draw-request-modal p {
    font-size: 14px;
    color: #333;
    margin-bottom: 16px
}

.waiting-modal {
    padding: 16px 24px
}

.waiting-modal p {
    font-size: 14px;
    color: #333;
    margin-bottom: 16px
}

.hidden {
    display: none !important
}

.nickname-modal {
    background: #fff;
    padding: 40px 50px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
    box-shadow: 0 10px 40px #00000026;
    min-width: 380px
}

.nickname-modal h2 {
    font-size: 28px;
    color: #c41e3a;
    margin-bottom: 10px
}

.nickname-modal .modal-hint {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px
}

.nickname-input {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8f9fa;
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    transition: all .2s
}

.nickname-input:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 10px #c41e3a26
}

.nickname-input::placeholder {
    color: #aaa
}

.nickname-modal .modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center
}

.btn-primary {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: #fff;
    cursor: pointer;
    transition: all .2s
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #4caf5066
}

.btn-secondary {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: #e9ecef;
    color: #333;
    cursor: pointer;
    transition: all .2s
}

.btn-secondary:hover {
    background: #dee2e6;
    transform: translateY(-2px)
}

::-webkit-scrollbar {
    width: 6px;
    background-color: transparent
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
    background-color: transparent
}

::-webkit-scrollbar-thumb {
    background-color: #a7a7a7;
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background-color: #cfcfcf
}