/* html {
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
    filter: grayscale(100%);
    filter: gray;
    filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
} */

@font-face {
    font-family: 'DS-Digital';
    src: url('./fonts/DS-DIGI.TTF') format('truetype');
}

@font-face {
    font-family: 'Press Start 2P';
    src: url('./fonts/PressStart2P-Regular.ttf') format('truetype');
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffffff, #abeafd, #83c7ff);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: white;
    overflow-x: hidden;
}

.header {
    text-align: center;
    margin: 20px 0 30px;
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 1s ease-out;
}

h1 {
    font-size: 3.2rem;
    margin-bottom: 10px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to right, #ffffff, #ffd700);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.4rem;
    opacity: 0.9;
    margin: 10px 0 20px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
}

#outer-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 1200px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

#chat-panel {
    /*width: 40%;*/
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    overflow: hidden;
    /* min-height: 550px; */
    min-width: 280px;
    display: flex;
    flex-direction: column;
    /* height: 100%; 根据父容器调整高度 */
}


.toolbar {
    display: flex;
    justify-content: space-between;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
    gap: 15px;
    min-height: 76.5px;
    flex-shrink: 0; /* 防止压缩 */
}

#gaseu {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    gap: 0px;
    height: 76.5px;
    line-height: 76.5px;
    padding-top: 0;
    padding-bottom: 0;
}

.tool-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.tool {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 1rem;
    /*min-width: 100px;*/
    justify-content: center;
    backdrop-filter: blur(5px);
}

.tool-group button:hover,
.tool:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:active,
.tool:active {
    transform: translateY(1px);
}

.brush-size {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 10px;
}

.size-display {
    width: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
}

#father-canvas {
    position: relative;
    width: 100%;
    height: auto;
    background: #e4e4e4;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#canvas {
    display: block;
    max-width: 100%;
    height: auto;
    background: #ffffff;
    border-radius: 5px;
}

#canvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.stats {
    display: flex;
    justify-content: space-between;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 1.1rem;
    flex-wrap: wrap;
    gap: 20px;
}

.user-count-label,
.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

#status-indicator {
    background: rgb(240, 149, 115);
    animation: pulse 1.5s infinite alternate;
}

.tool.active {
    background: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.5);
}

footer {
    color: #777;
    margin: 20px 0;
    text-align: center;
    font-size: 1rem;
    opacity: 0.8;
    width: 100%;
    padding: 15px;
}

.chalk-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.03"><rect width="100" height="100" fill="white"/></svg>');
    background-size: 100px 100px;
    mix-blend-mode: overlay;
    z-index: 10;
}

.floating-items {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.floating-item {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(-100vh) rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.4rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .toolbar {
        flex-direction: column;
        align-items: center;
    }

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

    .instructions {
        padding: 15px;
    }

    #outer-container {
        flex-direction: column;
    }
}

@media (min-width: 768px) {
    #chat-panel {
        max-width: 280px;
    }
}



.clock-container {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 500px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 20px auto;
}

.clock {
    background: #111;
    color: #00ffcc;
    font-family: 'DS-Digital', monospace;
    font-size: 2em;
    padding: 5px 10px;
    border-radius: 5px;
}

.grille {
    position: absolute;
    width: 90%;
    height: 60%;
    left: 5%;
    top: 20%;
    background: repeating-linear-gradient(90deg, #ddd, #ddd 10px, transparent 10px, transparent 20px);
    z-index: 0;
}

.clock {
    z-index: 1;
}

.podium-wrapper {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    perspective: 1000px;
    /* 添加透视 */
    z-index: 999;
    transition: all 0.5s ease
}

.podium {
    width: 600px;
    height: 150px;
    transform: rotateX(30deg);
    /* 俯视视角 */
    background: linear-gradient(45deg, rgb(229, 224, 185), rgb(207, 196, 176));
    border-radius: 8px 8px 2px 2px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
}

.teacher-avatar {
    width: 120px;
    height: 120px;
    transition: transform 0.3s ease;
}

.teacher-avatar:hover {
    transform: scale(1.1) rotate(5deg);
}

/* 聊天输入框容器 */
.chat-input-container {
    flex-shrink: 0; /* 防止压缩 */
    height: 178px;
    width: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* 透明输入框通用样式 */
.chat-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 1.1rem;
    background: transparent;
    border: none;
    color: white;
    transition: all 0.3s ease;
    outline: none;
    display: block;
}

.chat-input:hover,
.chat-input:active {
    background: rgba(0, 0, 0, 0.05);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* 昵称输入框 */
/* .nickname-input {
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
/* } */ 

.emoji-container {
    display: flex;
    flex-direction: row;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 消息输入框 */
.message-container {
    position: relative;
}

.message-input {
    padding-right: 70px;
    min-height: 120px;
    resize: none;
}

/* 发送按钮 */
.send-btn {
    position: absolute;
    right: 15px;
    bottom: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ff88, #2df6fd);
    border: none;
    color: #1a2a6c;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

#chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: scroll;
    width: 100%;
    min-height: 200px;
}

.chatmsg {
    margin: 5px;
    font-size: 17px;
}

#color-palette {
    display: flex;
    gap: 7px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.color-swatch,
#color-shower {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    outline: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

input[type="color"] {
    appearance: none;
    /* 移除默认样式 */
    -webkit-appearance: none;
    /* Safari/Chrome */
    border: none;
    padding: 0;
    width: 24px;
    height: 24px;
    cursor: pointer;
    border-radius: 6px;
    background: none;

    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* --- 表情功能新增样式 --- */

/* 让消息输入容器支持相对定位，以便安放表情面板 */
.message-container {
    position: relative;
}

/* 表情切换按钮 */
.emoji-toggle-btn {
    width: 50px;
    border: none;
    background: transparent;
    font-size: 22px;
    padding: 0 5px;
    cursor: pointer;
    color: #555;
    transition: transform 0.2s;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.emoji-toggle-btn:hover {
    transform: scale(1.2);
}

/* 表情面板 */
.emoji-panel {
    position: relative;
    left: 0;
    bottom: 0;
    right: 0;
    height: 200px;
    max-height: 200px;
    overflow-y: scroll;
    background-color: #222;
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    z-index: 1000;
}

/* 用于控制面板显示/隐藏的类 */
.emoji-panel.hidden {
    display: none;
}

/* 面板中的单个表情 */
.emoji-panel .emoji-item {
    width: 40px;
    height: 40px;
    padding: 4px;
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.2s;
}

.emoji-panel .emoji-item:hover {
    background-color: #444;
}

/* 聊天消息中渲染出来的表情图片 */
.chat-emoji {
    width: 28px;  /* 调整为您认为合适的大小 */
    height: 28px;
    vertical-align: middle; /* 关键：让表情和文字垂直对齐 */
    margin: 0 2px;
}

/* ========= */
/* GAME PART */
/* GAME PART */
/* GAME PART */
/* GAME PART */
/* GAME PART */
/* GAME PART */
/* ========= */

#gomoku-hint {
    cursor: pointer;
}

.game-container {
    /* z-index: 2;
    position: fixed; */
    font-family: 'Press Start 2P', cursive; /* Pixel font for overall text */
    background-color: #3a3f4b; /* Slightly lighter dark gray */
    border-radius: 20px; /* Slightly less rounded for pixel feel */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4); /* Deeper shadow */
    padding: 1.5rem; /* Reduced padding for compact look */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem; /* Reduced gap */
    /* width: 100%; */
    width: 500px; /* Max width for larger screens, slightly smaller */
    height: 680px;
}
#gomokuBoard {
    touch-action: manipulation; /* Prevent default touch actions like double-tap zoom */
    image-rendering: pixelated; /* Ensure pixelated rendering for canvas content */
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}
.controls {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 0.75rem; /* Smaller gap for buttons */
    justify-content: center;
    width: 100%;
}
.control-button {
    font-family: 'Press Start 2P', cursive; /* Pixel font for buttons */
    padding: 0.75rem 1.25rem; /* Adjusted padding */
    border-radius: 0.5rem; /* Sharper button corners */
    font-weight: 700;
    transition: all 0.1s ease-in-out; /* Faster transition */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Flat shadow */
    cursor: pointer;
    flex-grow: 1; /* Allow buttons to grow */
    min-width: 80px; /* Smaller minimum width for icons */
    font-size: 1.5rem; /* Larger font size for icons */
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.2); /* Pixelated text shadow */
}
.control-button:hover {
    transform: translateY(-1px); /* Subtle hover effect */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.control-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.control-button.primary {
    background-color: #61dafb; /* Bright blue */
    color: #282c34;
}
.control-button.primary:hover {
    background-color: #4dcffb;
}
.control-button.secondary {
    background-color: #ff6b6b; /* Bright red */
    color: #282c34;
}
.control-button.secondary:hover {
    background-color: #ff4d4d;
}
#returnButton {
    background-color: #86df89;
    color: #282c34;
}
#returnButton:hover {
    background-color: #71cc74;
}
.status-message {
    font-size: 1rem; /* Adjusted font size */
    font-weight: 700;
    color: #eeeeee; /* Light text color */
    text-align: center;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}
h1 {
    font-size: 2rem; /* Adjusted title size */
    color: #eeeeee;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.3);
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    .game-container {
        width: 460px;
    }
}