        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            user-select: none;
            /* 防止連點選取文字 */
        }

        body {
            font-family: 'Comic Sans MS', 'Arial', 'Microsoft JhengHei', sans-serif;
            background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .container {
            background: white;
            border-radius: 30px;
            padding: 30px;
            box-shadow: 0 10px 40px rgba(252, 182, 159, 0.4);
            max-width: 580px;
            width: 100%;
            border: 4px solid #ffb6c1;
        }

        h1 {
            text-align: center;
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 20px;
            font-size: 2.5em;
            text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.3);
            font-weight: bold;
        }

        .controls {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 20px;
            justify-content: center;
        }

        button {
            padding: 8px 16px;
            font-size: 16px;
            border: 3px solid;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s;
            font-weight: bold;
            color: white;
            height: 40px;
            font-family: 'Comic Sans MS', 'Microsoft JhengHei', sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* 按鈕樣式 */
        .btn-new {
            background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
            border-color: #a8edea;
            color: #5a5a5a;
        }

        .btn-new:hover {
            transform: translateY(-3px) scale(1.05);
            box-shadow: 0 5px 15px rgba(168, 237, 234, 0.4);
        }

        .btn-check {
            background: linear-gradient(135deg, #81FBB8 0%, #28C76F 100%);
            border-color: #28C76F;
        }

        .btn-check:hover {
            transform: translateY(-3px) scale(1.05);
            box-shadow: 0 5px 15px rgba(40, 199, 111, 0.4);
        }

        .btn-hint {
            background: linear-gradient(135deg, #FFD26F 0%, #FF9E2C 100%);
            border-color: #FF9E2C;
        }

        .btn-hint:hover {
            transform: translateY(-3px) scale(1.05);
            box-shadow: 0 5px 15px rgba(255, 158, 44, 0.4);
        }

        .btn-clear {
            background: linear-gradient(135deg, #FF6B9D 0%, #C94277 100%);
            border-color: #FF6B9D;
        }

        .btn-clear:hover {
            transform: translateY(-3px) scale(1.05);
            box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
        }

        /* 模式切換按鈕 (從 testa.html 引入) */
        .mode-toggle {
            display: flex;
            gap: 10px;
            justify-content: center;
            margin-bottom: 10px;
        }

        .mode-toggle button {
            padding: 8px 20px;
            font-size: 14px;
            background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
            border-color: #e0c3fc;
            color: #5a5a5a;
            border-radius: 20px;
            border: 3px solid #e0c3fc;
        }

        .mode-toggle button.active {
            background: linear-gradient(135deg, #c77dff 0%, #9d4edd 100%);
            border-color: #c77dff;
            color: white;
            transform: scale(1.05);
        }

        .mode-toggle button:hover {
            transform: scale(1.05);
        }

        .difficulty {
            display: flex;
            gap: 10px;
            justify-content: center;
            margin-bottom: 15px;
        }

        .difficulty button {
            background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
            border-color: #e0c3fc;
            font-size: 14px;
            padding: 8px 16px;
            color: #5a5a5a;
        }

        .difficulty button.active {
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
            border-color: #ff9a9e;
            color: white;
            transform: scale(1.1);
        }

        .game-area {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
            margin-bottom: 20px;
        }

        .game-area-horizontal {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .sudoku-wrapper {
            display: flex;
            flex-direction: column;
            gap: 0;
            width: 100%;
            max-width: 450px;
        }

        .number-selector {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            padding: 0 3px;
            gap: 2px;
        }

        .number-selector button {
            flex: 1;
            height: 48px;
            padding: 0;
            font-size: 20px;
            font-weight: bold;
            background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
            color: #5a5a5a;
            border: 3px solid #ffb6c1;
            transition: all 0.2s;
            border-radius: 12px;
            margin: 0 2px;
        }

        .number-selector button:hover {
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
            color: white;
            transform: scale(1.1);
            z-index: 10;
        }

        .number-selector button.active {
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
            color: white;
            border-color: #ff9a9e;
            transform: scale(1.15);
            box-shadow: 0 0 10px rgba(255, 154, 158, 0.6);
            z-index: 10;
        }

        .number-selector button.clear-btn {
            background: linear-gradient(135deg, #FF6B9D 0%, #C94277 100%);
            color: white;
            border-color: #FF6B9D;
            font-size: 22px;
        }

        .sudoku-grid {
            display: inline-block;
            border: 4px solid #ff9a9e;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 8px 20px rgba(255, 154, 158, 0.3);
            background: #ff9a9e;
            /* Grid gap color */
        }

        .sudoku-row {
            display: flex;
        }

        .sudoku-cell {
            width: 48px;
            height: 48px;
            border: 1px solid #ffd6e3;
            background: white;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 26px;
            font-weight: bold;
            color: #ff6b9d;
            cursor: pointer;
            transition: background 0.2s;
            position: relative;
        }

        /* 格子線條粗細增加區分度 */
        .sudoku-cell:nth-child(3n) {
            border-right: 2px solid #ff9a9e;
        }

        .sudoku-row:nth-child(3n) .sudoku-cell {
            border-bottom: 2px solid #ff9a9e;
        }

        .sudoku-cell:last-child {
            border-right: none;
        }

        .sudoku-row:last-child .sudoku-cell {
            border-bottom: none;
        }

        .sudoku-cell:hover:not(.fixed) {
            background: #fff0f5;
        }

        .sudoku-cell.fixed {
            background: #fdf2e9;
            color: #5a5a5a;
        }

        .sudoku-cell.selected {
            background: #e0c3fc !important;
        }

        .sudoku-cell.highlight {
            background: #f3e5f5;
        }

        .sudoku-cell.error {
            background: #ffccd5;
            color: #d32f2f;
            animation: shake 0.4s;
        }

        /* 筆記樣式 */
        .note-grid {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(3, 1fr);
            pointer-events: none;
        }

        .note-num {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 10px;
            color: #888;
            font-weight: normal;
        }

        .message {
            text-align: center;
            margin-top: 15px;
            font-size: 18px;
            font-weight: bold;
            min-height: 27px;
            color: #555;
        }

        .message.success {
            color: #28C76F;
        }

        .message.error {
            color: #ff6b9d;
        }

        @keyframes shake {

            0%,
            100% {
                transform: translateX(0);
            }

            25% {
                transform: translateX(-4px);
            }

            75% {
                transform: translateX(4px);
            }
        }

        @media (max-width: 500px) {
            .sudoku-cell {
                width: 38px;
                height: 38px;
                font-size: 20px;
            }

            .note-num {
                font-size: 8px;
            }

            .number-selector button {
                height: 40px;
                font-size: 18px;
            }

            h1 {
                font-size: 2em;
            }

            .container {
                padding: 15px;
            }
        }
