body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #f0f0f0;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}
.container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
body.dark-mode .container {
    background-color: #2d2d2d;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.dark-mode-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    user-select: none;
}
body.dark-mode .dark-mode-toggle {
    color: #ccc;
}
.dark-mode-switch {
    position: relative;
    width: 40px;
    height: 20px;
}
.dark-mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.dark-mode-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 20px;
}
.dark-mode-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.dark-mode-switch input:checked + .dark-mode-slider {
    background-color: #4CAF50;
}
.dark-mode-switch input:checked + .dark-mode-slider:before {
    transform: translateX(20px);
}
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
    }
}
@media screen and (max-width: 480px) {
    body {
        padding: 5px;
    }
    .container {
        padding: 10px;
    }
}
input[type="text"], select, button {
    margin: 5px;
    padding: 8px 12px;
    background-color: white;
    color: black;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    height: 36px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode input[type="text"], body.dark-mode select, body.dark-mode button {
    background-color: #3d3d3d;
    color: #e0e0e0;
    border: 1px solid #555;
}
input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #C11007;
    box-shadow: 0 0 0 2px rgba(193, 16, 7, 0.1);
}
body.dark-mode input[type="text"]:focus, body.dark-mode select:focus {
    border-color: #C11007;
    box-shadow: 0 0 0 2px rgba(193, 16, 7, 0.2);
}
button:disabled {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}
#display {
    background-color: #FFFBEB;
    color: #C11007;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    overflow-x: auto;
    max-width: 100%;
    width: fit-content;
    box-sizing: border-box;
    line-height: 20px;
    font-size: 0;
    white-space: nowrap;
    position: relative;
}
#display::-webkit-scrollbar {
    height: 8px;
}
#display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
#display::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}
#display::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
#display.inverted {
    background-color: #C11007;
    color: #FFFBEB;
}
@media screen and (max-width: 768px) {
    #display {
        padding: 8px;
    }
}
@media screen and (max-width: 480px) {
    #display {
        padding: 5px;
    }
}
.led-dot {
    width: 12px;
    height: 12px;
    display: inline-block;
    background-color: #FFFBEB;
    border: 1px solid #C11007;
    box-sizing: border-box;
    margin: 2px;
}
.led-dot.on {
    background-color: #C11007;
    border: 1px solid #C11007;
}
.led-dot.inverted {
    background-color: #C11007;
    border: 1px solid #FFFBEB;
}
.led-dot.on.inverted {
    background-color: #FFFBEB;
    border: 1px solid #FFFBEB;
}
.led-dot[data-label] {
    position: relative;
    font-size: 8px;
    line-height: 12px;
    text-align: center;
    color: #999;
    z-index: 1;
}
.led-dot[data-label]::before {
    content: attr(data-label);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    color: #999;
    font-weight: bold;
}
.led-dot.on[data-label]::before {
    color: #fff;
}
.led-dot.inverted[data-label]::before {
    color: rgba(255, 255, 255, 0.7);
}
.led-dot.inverted.on[data-label]::before {
    color: #000;
}
.debug-info {
    margin-top: 10px;
    padding: 5px;
    background-color: #e0e0e0;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .debug-info {
    background-color: #4d4d4d;
    color: #e0e0e0;
}
.debug-info .debug-number {
    color: #C11007;
    font-weight: bold;
}
body.dark-mode .debug-info .debug-number {
    color: #ff6b6b;
}
.footer {
    transition: color 0.3s ease;
}
body.dark-mode .footer {
    color: #999;
}
.footer-link {
    transition: color 0.3s ease;
}
body.dark-mode .footer-link {
    color: #66aaff;
}
.hint-text {
    transition: color 0.3s ease;
}
body.dark-mode .hint-text {
    color: #999;
}
.pwa-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    max-width: 300px;
    z-index: 1000;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .pwa-popup {
    background-color: #2d2d2d;
    border-color: #555;
    color: #e0e0e0;
}
.pwa-popup.show {
    opacity: 1;
    transform: translateY(0);
}
.pwa-popup h3 {
    margin-top: 0;
    margin-bottom: 10px;
}
.pwa-popup .close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
}
.pwa-popup .close-btn:hover {
    color: #333;
}
body.dark-mode .pwa-popup .close-btn:hover {
    color: #fff;
}
.pwa-popup .dont-show-again {
    margin-top: 10px;
}
.pwa-popup .dont-show-again label {
    font-size: 12px;
    display: flex;
    align-items: center;
}
.pwa-popup .dont-show-again input {
    margin-right: 5px;
}
.led-row {
    display: block;
    height: 16px;
    line-height: 16px;
}
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}
.qr-code-popup {
    position: fixed;
    z-index: 2000;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding: 20px;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 500px;
}
body.dark-mode .qr-code-popup {
    background-color: #2d2d2d;
}
.qr-code-popup.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
.qr-code-popup .qr-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.qr-code-popup .qr-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}
body.dark-mode .qr-code-popup .qr-title {
    color: #e0e0e0;
}
.qr-code-popup #wechat-qr,
.qr-code-popup #alipay-qr {
    width: 200px;
    height: 200px;
    background-color: white;
    padding: 10px;
    border-radius: 5px;
}
body.dark-mode .qr-code-popup #wechat-qr,
body.dark-mode .qr-code-popup #alipay-qr {
    background-color: white;
}
.qr-code-popup .qr-text {
    text-align: center;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}
body.dark-mode .qr-code-popup .qr-text {
    color: #e0e0e0;
}
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    position: relative;
    margin: 0;
    margin-right: 8px;
    vertical-align: middle;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
input[type="checkbox"]:hover {
    border-color: #C11007;
    background-color: #fff5f5;
}
input[type="checkbox"]:checked {
    background-color: #C11007;
    border-color: #C11007;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6l3 3 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}
body.dark-mode input[type="checkbox"] {
    background-color: #3d3d3d;
    border-color: #666;
}
body.dark-mode input[type="checkbox"]:hover {
    border-color: #C11007;
    background-color: #4d2d2d;
}
body.dark-mode input[type="checkbox"]:checked {
    background-color: #C11007;
    border-color: #C11007;
}
label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #333;
    transition: color 0.3s ease;
}
body.dark-mode label {
    color: #e0e0e0;
}
label:hover {
    color: #C11007;
}
body.dark-mode label:hover {
    color: #ff6b6b;
}
.char-offset-controls {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .char-offset-controls {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}
.char-offset-global-section {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .char-offset-global-section {
    background-color: #3d3d3d;
    border-color: #555;
}
.char-offset-section-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
    transition: color 0.3s ease;
}
body.dark-mode .char-offset-section-title {
    color: #e0e0e0;
}
#char-offset-controls input[type="number"] {
    padding: 8px 12px;
    background-color: white;
    color: black;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    height: 36px;
    box-sizing: border-box;
    width: 80px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
#char-offset-controls input[type="number"]:focus {
    outline: none;
    border-color: #C11007;
    box-shadow: 0 0 0 2px rgba(193, 16, 7, 0.1);
}
body.dark-mode #char-offset-controls input[type="number"] {
    background-color: #3d3d3d;
    color: #e0e0e0;
    border-color: #555;
}
body.dark-mode #char-offset-controls input[type="number"]:focus {
    border-color: #C11007;
    box-shadow: 0 0 0 2px rgba(193, 16, 7, 0.2);
}
.char-offset-label {
    font-size: 14px;
    color: #333;
    transition: color 0.3s ease;
}
body.dark-mode .char-offset-label {
    color: #e0e0e0;
}
.char-offset-button {
    padding: 8px 16px;
    background-color: #C11007;
    color: #FFFBEB;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    height: 36px;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}
.char-offset-button:hover {
    background-color: #a00d06;
}
.char-offset-char-card {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .char-offset-char-card {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}
.char-offset-char-label {
    color: #333;
    transition: color 0.3s ease;
}
body.dark-mode .char-offset-char-label {
    color: #e0e0e0;
}
.char-offset-char-label label {
    transition: color 0.3s ease;
}
body.dark-mode .char-offset-char-label label {
    color: #e0e0e0;
}


