:root {
            --panel: rgba(65, 42, 28, 0.94);
            --green: #37b24d;
            --red: #d94841;
            --blue: #4c8bf5;
            --purple: #8b5cf6;
            --gray: #8f8f8f;
            --yellow: #f6c35d;
            --forbid-bg: rgba(255, 200, 100, 0.15);
            --forbid-border: #f0b34b;
        }

        * {
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        html, body {
            margin: 0;
            padding: 0;
            min-height: 100%;
            font-family: Arial, Helvetica, sans-serif;
            background: linear-gradient(180deg, #e8d3a4, #f8edd3);
            color: #222;
        }

        #bootScreen {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 42px;
            font-weight: 900;
            color: #5e3419;
        }

        #appScreen {
            display: none;
        }

        #appTopBar {
            position: sticky;
            top: 0;
            z-index: 10;
            background: rgba(83, 43, 20, 0.96);
            color: #fff;
            border-bottom: 1px solid rgba(255,255,255,0.08);
            backdrop-filter: blur(6px);
        }

        .topInner {
            width: min(1200px, 96vw);
            margin: 0 auto;
            padding: 12px 0;
            display: flex;
            gap: 12px;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
        }

        .badgeGroup {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .badge {
            background: rgba(255,255,255,0.12);
            padding: 10px 14px;
            border-radius: 12px;
            font-weight: 800;
        }

        button, a.topLink {
            border: none;
            cursor: pointer;
            border-radius: 12px;
            padding: 12px 16px;
            font-size: 15px;
            font-weight: 900;
            color: #fff;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.1s ease;
        }

        button:active {
            transform: scale(0.96);
        }

        .btn-green { background: linear-gradient(180deg, #3acb54, #2ca544); }
        .btn-blue { background: linear-gradient(180deg, #62a4ff, #387cf0); }
        .btn-red { background: linear-gradient(180deg, #ec5c5c, #cf3e3e); }
        .btn-purple { background: linear-gradient(180deg, #a67cff, #7c4dff); }
        .btn-gray { background: linear-gradient(180deg, #8f8f8f, #6f6f6f); }
        .btn-yellow { background: linear-gradient(180deg, #f6c35d, #dfa132); }

        #appContent {
            width: min(1200px, 96vw);
            margin: 20px auto 40px;
            display: grid;
            grid-template-columns: 360px 1fr;
            gap: 18px;
        }

        .panel {
            background: var(--panel);
            color: #fff;
            border-radius: 18px;
            padding: 16px;
            box-shadow: 0 12px 28px rgba(0,0,0,0.14);
        }

        .panel h2 {
            margin: 0 0 12px;
        }

        .roomCreateRow {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 12px;
        }

        .createRow {
            display: flex;
            gap: 10px;
        }

        .createRow input {
            flex: 1;
            border: none;
            outline: none;
            border-radius: 10px;
            padding: 12px;
            font-size: 14px;
        }

        /* 禁手面板美化 */
        .forbidPanel {
            background: var(--forbid-bg);
            border-radius: 14px;
            padding: 14px;
            margin-top: 8px;
            border: 1px solid var(--forbid-border);
            transition: all 0.2s ease;
        }

        .forbidTitle {
            font-size: 14px;
            font-weight: 800;
            margin-bottom: 12px;
            color: #ffe4ad;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        /* 自定义复选框样式 */
        .forbidCheckboxGroup {
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
            margin-bottom: 10px;
        }

        .custom-checkbox {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            padding: 6px 12px;
            background: rgba(255,255,255,0.08);
            border-radius: 20px;
            transition: all 0.2s ease;
        }

        .custom-checkbox:hover {
            background: rgba(255,255,255,0.18);
        }

        .custom-checkbox input {
            display: none;
        }

        .checkmark {
            width: 18px;
            height: 18px;
            border-radius: 4px;
            background: rgba(255,255,255,0.2);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s ease;
        }

        .custom-checkbox input:checked + .checkmark {
            background: #f6c35d;
        }

        .custom-checkbox input:checked + .checkmark::after {
            content: "✓";
            color: #5e3419;
            font-size: 13px;
            font-weight: bold;
        }

        .custom-checkbox.disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .custom-checkbox.disabled:hover {
            background: rgba(255,255,255,0.08);
        }

        .ruleNote {
            font-size: 11px;
            opacity: 0.7;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px dashed rgba(255,255,255,0.2);
        }

        .ruleNote strong {
            color: #f6c35d;
        }

        #roomList {
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: 520px;
            overflow: auto;
            padding-right: 4px;
        }

        .roomItem {
            background: rgba(255,255,255,0.1);
            border-radius: 14px;
            padding: 12px;
            transition: background 0.15s ease;
        }

        .roomItem:hover {
            background: rgba(255,255,255,0.15);
        }

        .roomItemTitle {
            font-size: 16px;
            font-weight: 900;
            margin-bottom: 8px;
        }

        .forbidBadge {
            display: inline-block;
            background: #f6c35d;
            color: #5e3419;
            font-size: 10px;
            padding: 2px 8px;
            border-radius: 12px;
            margin-left: 8px;
            vertical-align: middle;
        }

        .roomMeta {
            font-size: 13px;
            line-height: 1.5;
            opacity: 0.95;
            margin-bottom: 10px;
        }

        #gameArea {
            min-height: 720px;
            position: relative;
        }

        #lobbyEmpty {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 660px;
            text-align: center;
            color: rgba(255,255,255,0.88);
            font-size: 22px;
            font-weight: 800;
            background: rgba(255,255,255,0.06);
            border-radius: 16px;
        }

        #roomArea {
            display: none;
        }

        #roomHeader {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 12px;
        }

        #roomStatusLine {
            font-size: 15px;
            font-weight: 800;
            color: #ffe7ae;
        }

        #boardWrap {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 8px 0 16px;
            position: relative;
        }

        #gomokuCanvas {
            width: min(78vw, 620px);
            height: auto;
            max-width: 620px;
            aspect-ratio: 1 / 1;
            background: linear-gradient(180deg, #ddb56f, #c78c4e);
            border-radius: 16px;
            box-shadow: inset 0 0 0 3px rgba(110,63,24,0.45), 0 12px 22px rgba(0,0,0,0.18);
            touch-action: none;
        }

        #centerBanner {
            position: absolute;
            padding: 14px 28px;
            border-radius: 18px;
            font-size: clamp(28px, 4vw, 52px);
            font-weight: 900;
            color: #fff6d8;
            background: linear-gradient(180deg, rgba(100,40,180,0.95), rgba(74,22,138,0.95));
            border: 2px solid rgba(255,232,160,0.85);
            box-shadow: 0 14px 40px rgba(0,0,0,0.28);
            opacity: 0;
            transform: scale(0.7);
            transition: all 0.25s ease;
            pointer-events: none;
        }

        #centerBanner.show {
            opacity: 1;
            transform: scale(1);
        }

        /* 禁手警告横幅 */
        #forbidWarning {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: linear-gradient(135deg, #ff6b6b, #ee5a24);
            color: white;
            padding: 14px 24px;
            border-radius: 40px;
            font-weight: 800;
            font-size: 16px;
            z-index: 1000;
            box-shadow: 0 8px 25px rgba(0,0,0,0.3);
            transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            pointer-events: none;
            white-space: nowrap;
            max-width: 90vw;
            white-space: normal;
            text-align: center;
        }

        #forbidWarning.show {
            transform: translateX(-50%) translateY(0);
        }

        #gameInfo {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-top: 10px;
        }

        .infoBlock {
            background: rgba(255,255,255,0.1);
            border-radius: 14px;
            padding: 12px;
        }

        .infoBlock strong {
            display: block;
            margin-bottom: 8px;
            color: #ffe4ad;
        }

        #movesList {
            max-height: 220px;
            overflow: auto;
            font-size: 14px;
            line-height: 1.6;
            white-space: pre-wrap;
        }

        #roomActions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 14px;
        }

        #gameMessage {
            min-height: 24px;
            margin-top: 10px;
            font-weight: 800;
            color: #fff1b6;
        }

        .smallText {
            font-size: 13px;
            opacity: 0.9;
        }

        @media (max-width: 980px) {
            #appContent {
                grid-template-columns: 1fr;
            }

            #gameArea {
                min-height: auto;
            }

            #lobbyEmpty {
                min-height: 220px;
            }

            #gameInfo {
                grid-template-columns: 1fr;
            }

#forbidWarning {
                font-size: 13px;
                padding: 10px 18px;
                white-space: normal;
            }
        }