#hanzisudoku {
    --hanzisudoku-blue: var(--hd-primary, #2e4a43);
    --hanzisudoku-blue-dark: var(--hd-primary-hover, #1f342f);
    --hanzisudoku-grid: var(--hd-text, #222a2d);
    --hanzisudoku-muted: var(--hd-muted, #5d686c);
    --hanzisudoku-surface: var(--hd-canvas, #f6f7f3);
}

#hanzisudoku .hanzisudoku_input textarea {
    box-sizing: border-box;
    float: none;
    margin-top: 7px;
    min-height: 90px;
    resize: vertical;
    width: 100%;
}

#hanzisudoku .hanzisudoku_input_footer {
    align-items: flex-start;
    color: var(--hd-muted, #5d686c);
    display: flex;
    font-size: 11px;
    gap: 8px;
    justify-content: space-between;
    line-height: 1.35;
    margin-top: 7px;
}

#hanzisudoku .hanzisudoku_character_count {
    flex: 0 0 auto;
    white-space: nowrap;
}

#hanzisudoku .hanzisudoku_invalid {
    background: rgba(217, 83, 79, 0.05);
    box-shadow: inset 3px 0 0 #b73535;
}

#hanzisudoku .hanzisudoku_invalid textarea,
#hanzisudoku .hanzisudoku_invalid .ss-main,
#hanzisudoku .hanzisudoku_invalid select {
    border-color: #b73535;
}

#hanzisudoku .hanzisudoku_selection_summary {
    color: var(--hd-muted, #5d686c);
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 8px;
    min-height: 17px;
    padding-left: 9px;
}

#hanzisudoku .hanzisudoku_controls .btnBlock > a,
#hanzisudoku .hanzisudoku_controls .btnBlock > .btn_no_pro {
    width: 49%;
}

#hanzisudoku .hanzisudoku_controls .btn_no_pro .btn {
    width: 100%;
}

#hanzisudoku .hanzisudoku_sample_pdf {
    color: var(--hanzisudoku-blue-dark);
    display: block;
    font-size: 13px;
    margin-top: 7px;
    text-align: center;
    text-decoration: underline;
}

#hanzisudoku #result_block.hanzisudoku_welcome {
    background-image: url('/modules/chinesekids/views/img/chinesetools/tonetrainer/tonetrainer_bg.jpg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    margin-bottom: 0;
    min-height: 620px;
    overflow: hidden;
    position: relative;
}

#hanzisudoku #result_block.hanzisudoku_welcome .chinesetools-title {
    bottom: 0;
    height: 100%;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 1;
}

#hanzisudoku #result_block.hanzisudoku_welcome .chinesetools-title h1 {
    margin: 0 0 15px;
}

#hanzisudoku #result_block.hanzisudoku_welcome .chinesetools-title_text {
    margin: 0;
}

#hanzisudoku .chinesetools-title h1 {
    text-shadow: 0 5px 11px rgba(31, 52, 47, .28);
}

#onlinegame_hanzisudoku,
#hanzisudoku_result {
    align-items: center;
    background:
        radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.96), transparent 31%),
        linear-gradient(145deg, var(--hd-canvas, #f6f7f3) 0%, var(--hd-primary-soft, #e7eeea) 53%, var(--hd-accent-soft, #fff3c4) 100%);
    display: flex;
    flex-direction: column;
    min-height: 620px;
    overflow: hidden;
    padding: 22px;
    position: relative;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#onlinegame_hanzisudoku .hanzisudoku_game_title {
    color: var(--hanzisudoku-blue-dark);
    font-size: 27px;
    font-weight: 700;
    margin: 0 0 12px;
    text-align: center;
}

#onlinegame_hanzisudoku .hanzisudoku_game_status {
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(46, 74, 67, 0.18);
    border-radius: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 30px;
    justify-content: center;
    margin-bottom: 7px;
    max-width: 660px;
    padding: 8px 16px;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_status_item {
    color: var(--hd-muted, #5d686c);
    font-size: 13px;
    white-space: nowrap;
}

#onlinegame_hanzisudoku .hanzisudoku_status_item strong {
    color: var(--hanzisudoku-blue-dark);
}

#onlinegame_hanzisudoku .hanzisudoku_game_symbols {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(46, 74, 67, 0.14);
    border-radius: 7px;
    box-sizing: border-box;
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 11px;
    max-width: 660px;
    padding: 6px 12px;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_game_symbols_label {
    color: var(--hd-muted, #5d686c);
    flex: 0 0 auto;
    font-size: 12px;
}

#onlinegame_hanzisudoku .hanzisudoku_game_symbols_list {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

#onlinegame_hanzisudoku .hanzisudoku_game_symbol {
    align-items: center;
    background: var(--hd-primary-soft, #e7eeea);
    border-radius: 5px;
    color: var(--hd-text, #222a2d);
    display: inline-flex;
    font-size: 24px;
    height: 31px;
    justify-content: center;
    line-height: 1;
    min-width: 31px;
    padding: 0 3px;
}

#onlinegame_hanzisudoku .hanzisudoku_board_scroll {
    display: flex;
    justify-content: center;
    max-width: 100%;
    overflow: visible;
    padding: 3px 3px 10px;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_board_shell {
    flex: 0 0 auto;
    max-width: 560px;
    position: relative;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_board {
    display: grid;
    margin: 0 auto;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_board_9 {
    min-width: 0;
}

#onlinegame_hanzisudoku .hanzisudoku_cell {
    align-items: center;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.95);
    border: 0;
    border-bottom: 1px solid rgba(34, 42, 45, 0.55);
    border-radius: 0;
    border-right: 1px solid rgba(34, 42, 45, 0.55);
    box-sizing: border-box;
    color: var(--hd-text, #222a2d);
    display: flex;
    font-size: clamp(25px, 5.2vw, 43px);
    font-weight: 400;
    justify-content: center;
    line-height: 1;
    margin: 0;
    min-width: 0;
    padding: 0;
    position: relative;
}

#onlinegame_hanzisudoku .hanzisudoku_board_6 .hanzisudoku_cell {
    font-size: clamp(23px, 4.5vw, 38px);
}

#onlinegame_hanzisudoku .hanzisudoku_board_9 .hanzisudoku_cell {
    font-size: 30px;
}

#onlinegame_hanzisudoku .hanzisudoku_cell_editable {
    color: var(--hanzisudoku-blue-dark);
    cursor: pointer;
    transition:
        background-color 150ms ease,
        box-shadow 150ms ease,
        color 150ms ease;
}

#onlinegame_hanzisudoku .hanzisudoku_cell_editable:hover,
#onlinegame_hanzisudoku .hanzisudoku_cell_editable:focus,
#onlinegame_hanzisudoku .hanzisudoku_cell_active {
    background: var(--hd-primary-soft, #e7eeea);
    box-shadow: inset 0 0 0 2px var(--hanzisudoku-blue);
    outline: none;
    z-index: 2;
}

#onlinegame_hanzisudoku .hanzisudoku_cell_given {
    background: var(--hd-surface-muted, #eff2ef);
    /*font-weight: 600;*/
}

#onlinegame_hanzisudoku .hanzisudoku_cell_block_right {
    border-right: 3px solid var(--hanzisudoku-grid);
}

#onlinegame_hanzisudoku .hanzisudoku_cell_block_bottom {
    border-bottom: 3px solid var(--hanzisudoku-grid);
}

#onlinegame_hanzisudoku .hanzisudoku_cell_outer_top {
    border-top: 3px solid var(--hanzisudoku-grid);
}

#onlinegame_hanzisudoku .hanzisudoku_cell_outer_left {
    border-left: 3px solid var(--hanzisudoku-grid);
}

#onlinegame_hanzisudoku .hanzisudoku_cell_outer_right {
    border-right: 3px solid var(--hanzisudoku-grid);
}

#onlinegame_hanzisudoku .hanzisudoku_cell_outer_bottom {
    border-bottom: 3px solid var(--hanzisudoku-grid);
}

#onlinegame_hanzisudoku .hanzisudoku_cell_wrong {
    animation: hanzisudoku-cell-error 420ms ease;
    background: #fff0ef;
    color: #c9433f;
}

#onlinegame_hanzisudoku .hanzisudoku_cell_correct {
    background: #eaf6ef;
    color: #2f7d4c;
}

#onlinegame_hanzisudoku .hanzisudoku_cell_revealed {
    background: #fff6df;
    color: #8a642d;
}

#onlinegame_hanzisudoku .hanzisudoku_board_locked .hanzisudoku_cell_editable {
    cursor: default;
    opacity: 1;
}

#onlinegame_hanzisudoku .hanzisudoku_picker {
    animation: hanzisudoku-picker-in 140ms ease-out;
    background: #ffffff;
    border: 1px solid rgba(46, 74, 67, 0.3);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(31, 52, 47, 0.22);
    box-sizing: border-box;
    max-width: 245px;
    overscroll-behavior: contain;
    padding: 8px;
    position: fixed;
    width: max-content;
    z-index: 1060;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_options {
    display: grid;
    gap: 5px;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_option {
    align-items: center;
    background: var(--hd-surface-muted, #eff2ef);
    border: 1px solid var(--hd-border, #d7ddda);
    border-radius: 7px;
    color: var(--hd-text, #222a2d);
    cursor: pointer;
    display: flex;
    font-size: 25px;
    height: 43px;
    justify-content: center;
    min-width: 43px;
    padding: 0;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_option:hover,
#onlinegame_hanzisudoku .hanzisudoku_picker_option:focus,
#onlinegame_hanzisudoku .hanzisudoku_picker_option_active {
    background: var(--hd-primary-soft, #e7eeea);
    border-color: var(--hanzisudoku-blue);
    color: var(--hanzisudoku-blue-dark);
    outline: none;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_actions {
    border-top: 1px solid var(--hd-border, #d7ddda);
    display: flex;
    margin-top: 7px;
    padding-top: 5px;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_action {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--hd-muted, #5d686c);
    cursor: pointer;
    display: flex;
    flex: 1 1 50%;
    font-size: 17px;
    height: 32px;
    justify-content: center;
    padding: 0;
    position: relative;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_action + .hanzisudoku_picker_action {
    border-left: 1px solid var(--hd-border, #d7ddda);
}

#onlinegame_hanzisudoku .hanzisudoku_picker_action:hover,
#onlinegame_hanzisudoku .hanzisudoku_picker_action:focus {
    background: var(--hd-primary-soft, #e7eeea);
    color: var(--hanzisudoku-blue-dark);
    outline: none;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_clear:hover,
#onlinegame_hanzisudoku .hanzisudoku_picker_clear:focus {
    color: #c9433f;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_action:disabled {
    background: transparent;
    color: #b7c1c9;
    cursor: default;
}

#onlinegame_hanzisudoku .hanzisudoku_hint_count {
    align-items: center;
    background: var(--hanzisudoku-blue);
    border: 2px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    font-size: 9px;
    font-weight: 700;
    height: 16px;
    justify-content: center;
    line-height: 1;
    margin-left: -3px;
    margin-top: -13px;
    width: 16px;
}

#onlinegame_hanzisudoku .hanzisudoku_picker_action:disabled .hanzisudoku_hint_count {
    background: #aeb9c2;
}

#onlinegame_hanzisudoku .hanzisudoku_feedback {
    color: var(--hd-muted, #5d686c);
    font-size: 13px;
    min-height: 20px;
    padding-top: 7px;
    text-align: center;
}

#onlinegame_hanzisudoku .hanzisudoku_feedback_notice {
    color: #a36a19;
}

#onlinegame_hanzisudoku .hanzisudoku_game_actions {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_game_buttons {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 500px;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_game_buttons .btn {
    border-radius: 9px;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 600;
    min-height: 42px;
    padding: 9px 8px;
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease,
        color 150ms ease;
    white-space: nowrap;
    width: 100%;
}

#onlinegame_hanzisudoku .hanzisudoku_game_buttons .btn-primary {
    box-shadow: 0 5px 13px rgba(46, 74, 67, 0.24);
}

#onlinegame_hanzisudoku .hanzisudoku_action_secondary {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(46, 74, 67, 0.45);
    color: var(--hanzisudoku-blue-dark);
}

#onlinegame_hanzisudoku .hanzisudoku_action_secondary:hover,
#onlinegame_hanzisudoku .hanzisudoku_action_secondary:focus {
    background: var(--hd-primary-soft, #e7eeea);
    border-color: var(--hanzisudoku-blue);
    color: var(--hanzisudoku-blue-dark);
    outline: none;
}

#onlinegame_hanzisudoku .hanzisudoku_game_buttons .btn:disabled,
#onlinegame_hanzisudoku .hanzisudoku_game_buttons .btn.disabled {
    box-shadow: none;
    cursor: default;
    opacity: 0.48;
}

#onlinegame_hanzisudoku .hanzisudoku_game_settings,
#hanzisudoku_result .hanzisudoku_game_settings {
    color: var(--hanzisudoku-blue-dark);
    display: none;
    flex-basis: 100%;
    font-size: 13px;
    text-align: center;
}

#hanzisudoku_result {
    justify-content: center;
}

#hanzisudoku_result h1 {
    color: var(--hanzisudoku-blue-dark);
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 18px;
    text-align: center;
}

#hanzisudoku_result .hanzisudoku_result_summary {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(46, 74, 67, 0.2);
    border-radius: 7px;
    margin-bottom: 20px;
    max-width: 680px;
    padding: 16px 22px;
    text-align: center;
    width: 100%;
}

#hanzisudoku_result .hanzisudoku_result_symbols {
    color: var(--hanzisudoku-blue-dark);
    font-size: 34px;
    line-height: 1.4;
    word-spacing: 9px;
}

#hanzisudoku_result .hanzisudoku_result_stats {
    border-top: 1px solid rgba(46, 74, 67, 0.13);
    color: var(--hd-muted, #5d686c);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    justify-content: center;
    margin-top: 11px;
    padding-top: 10px;
}

#hanzisudoku_result .hanzisudoku_result_stats strong {
    color: var(--hanzisudoku-blue-dark);
}

#hanzisudoku_result .chinesetools-screen_buttons {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes hanzisudoku-cell-error {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

@keyframes hanzisudoku-picker-in {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 769px) {
    #hanzisudoku .output_block_p {
        min-height: auto;
        padding: 0;
    }

    #hanzisudoku #result_block.hanzisudoku_welcome {
        min-height: 520px;
    }

    #onlinegame_hanzisudoku,
    #hanzisudoku_result {
        min-height: 560px;
        padding: 16px 7px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_title {
        font-size: 23px;
        margin-bottom: 8px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_status {
        gap: 5px 14px;
        margin-bottom: 6px;
        padding: 7px 6px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_status_item {
        font-size: 11px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_symbols {
        display: block;
        margin-bottom: 7px;
        padding: 5px 4px;
        text-align: center;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_symbols_label {
        display: block;
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 3px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_symbols_list {
        gap: 3px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_symbol {
        font-size: 21px;
        height: 27px;
        min-width: 25px;
        padding: 0 2px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_board_shell {
        max-width: 520px;
        width: 100%;
    }

    #onlinegame_hanzisudoku .hanzisudoku_board_9 {
        min-width: 0;
    }

    #onlinegame_hanzisudoku .hanzisudoku_cell {
        font-size: clamp(24px, 10vw, 40px);
    }

    #onlinegame_hanzisudoku .hanzisudoku_board_6 .hanzisudoku_cell {
        font-size: clamp(22px, 7vw, 34px);
    }

    #onlinegame_hanzisudoku .hanzisudoku_board_9 .hanzisudoku_cell {
        font-size: clamp(17px, 5.8vw, 29px);
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_buttons {
        gap: 6px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_buttons .btn {
        font-size: 12px;
        min-height: 40px;
        padding: 8px 3px;
    }

    #onlinegame_hanzisudoku .hanzisudoku_game_settings,
    #hanzisudoku_result .hanzisudoku_game_settings {
        display: inline-block;
    }

    #hanzisudoku_result h1 {
        font-size: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #onlinegame_hanzisudoku .hanzisudoku_cell {
        animation-duration: 0.01ms;
        transition-duration: 0.01ms;
    }

    #onlinegame_hanzisudoku .hanzisudoku_picker {
        animation-duration: 0.01ms;
    }
}
