/* Mac keyboard styling to exactly match the reference image with perfect alignment */

/* Dark theme support for Mac keyboard */
[data-theme="dark"] {
    --primary-color: #bb86fc;
    --secondary-color: #a370f7;
    --highlight-color: #ff79c6;
    --background-color: #1a1a2e;
    --text-color: #e1e1e1;
    --card-bg-color: #252541;
    --shadow-color: rgba(187, 134, 252, 0.2);
    --header-bg: linear-gradient(135deg, #483d8b, #6a4c93);
    --footer-bg: #2c2c44;
    --footer-text: #e1e1e1;
}

/* Dark theme keyboard container */
[data-theme="dark"] .mac-keyboard-container {
    background: #2a2a2a;
    border-color: #1a1a1a;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Dark theme keys */
[data-theme="dark"] .mac-key {
    background: #1a1a1a;
    color: #e1e1e1;
    border-color: #0a0a0a;
    box-shadow:
        0 1px 0 #2a2a2a,
        0 1px 2px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .mac-key:hover {
    background: #2a2a2a;
    border-color: #bb86fc;
}

[data-theme="dark"] .mac-key:active,
[data-theme="dark"] .mac-key.pressed {
    background: #0a0a0a;
    border-color: #ff79c6;
}

[data-theme="dark"] .mac-key.active {
    background: linear-gradient(145deg, #4a4a6a, #2a2a4a);
    border-color: #bb86fc;
    box-shadow: 
        0 0 15px rgba(187, 134, 252, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Dark theme function keys */
[data-theme="dark"] .mac-fn {
    background: #1a1a1a;
    color: #b0b0b0;
}

[data-theme="dark"] .mac-fn i,
[data-theme="dark"] .play-pause-icon {
    color: #b0b0b0;
}

[data-theme="dark"] .mac-fn .fn-label {
    color: #808080;
}

.mac-keyboard-container {
    background: #c0c0c0;
    border-radius: 12px;
    padding: 16px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
    position: relative;
    border: 2px solid #a8a8a8;
    width: 932px; /* 900 (keyboard) + 16*2 padding */
    margin-left: auto;
    margin-right: auto;
}

.mac-keyboard {
    position: relative;
    width: 900px; /* sum of each row including gaps */
    margin: 0 auto;
}

.mac-row {
    display: flex;
    margin-bottom: 4px;
    gap: 4px;
    width: 100%;
}

.mac-key {
    width: 56px;
    height: 56px;
    background: #3a3a3a;
    color: #ffffff;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 400;
    text-transform: lowercase;
    box-shadow:
        0 1px 0 #4a4a4a,
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mac-key:hover {
    background: #4a4a4a;
    transform: translateY(1px);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid #8e6dba;
    transition: all 0.15s ease-in-out;
}

.mac-key:active,
.mac-key.pressed {
    transform: translateY(2px);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.4);
    background: #2a2a2a;
    border: 1px solid #a78bda;
}

.mac-key.active {
    background: linear-gradient(145deg, #6a6a8a, #4a4a6a);
    border: 1px solid #8e6dba;
    box-shadow: 
        0 0 15px rgba(142, 109, 186, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #ffffff;
    position: relative;
    z-index: 2;
}

/* Key character styling */
.mac-key .main {
    font-size: 12px;
    display: block;
    margin-bottom: 2px;
    color: #aaaaaa;
}

.mac-key .sub {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    display: block;
}

.mac-key .modifier {
    font-size: 16px;
    margin-right: 4px;
    font-weight: 600;
    color: #ffffff;
}

/* Special key widths - calculated for perfect alignment */
.mac-esc {
    width: 88px;
    text-transform: lowercase;
    font-size: 12px;
}

.mac-fn {
    width: 56px;
    text-transform: uppercase;
    font-size: 9px;
    line-height: 1;
    flex-direction: column;
    padding: 6px 4px;
    justify-content: center;
    background: #3a3a3a;
    color: #cccccc;
    position: relative;
}

.mac-fn i {
    font-size: 14px;
    margin-bottom: 6px; /* 增大图标与F标签的间距 */
    opacity: 0.9;
    color: #cccccc;
}

.mac-fn .fn-label {
    font-size: 8px;
    opacity: 0.7;
    color: #aaaaaa;
    margin-top: 2px; /* 提供额外的视觉间距 */
}

/* 移除功能键右上角蓝点 */
.mac-fn::after {
    content: none;
    display: none;
}

/* Play-pause icon for F8 - Apple keyboard style */
.play-pause-icon {
    font-size: 14px;
    line-height: 1;
    letter-spacing: -1px;
    color: #cccccc;
    display: block;
    margin-bottom: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

.mac-power {
    width: 88px;
    background: #2a2a2a;
    border: 1px solid #1a1a1a;
}

.mac-power i {
    font-size: 16px;
    opacity: 0.8;
}

.mac-backspace {
    width: 120px;
    text-transform: lowercase;
    font-size: 12px;
    justify-content: flex-end;
    padding-right: 12px;
}

.mac-tab {
    width: 88px;
    justify-content: flex-start;
    padding-left: 12px;
    font-size: 12px;
}

.mac-backslash {
    width: 88px;
}

.mac-caps {
    width: 118px;
    justify-content: flex-start;
    padding-left: 12px;
    font-size: 11px;
}

.mac-caps i {
    margin-right: 4px;
    font-size: 10px;
    opacity: 0.8;
}

.mac-return {
    width: 118px;
    justify-content: flex-end;
    padding-right: 12px;
    font-size: 12px;
}

.mac-shift-left {
    width: 148px;
    justify-content: flex-start;
    padding-left: 12px;
    font-size: 12px;
}

.mac-shift-right {
    width: 148px;
    justify-content: flex-end;
    padding-right: 12px;
    font-size: 12px;
}

.mac-fn-globe {
    width: 56px;
    font-size: 10px;
    text-align: center;
}

.mac-fn-globe i {
    font-size: 12px;
    margin-right: 3px;
}

.mac-ctrl,
.mac-option,
.mac-command {
    width: 88px;
    font-size: 10px;
    text-align: center;
}

.mac-space {
    width: 276px;
    height: 56px;
    background: #3a3a3a;
    border: 1px solid #2a2a2a;
}

/* Bottom row layout */
.mac-bottom-row {
    display: flex;
    justify-content: flex-start;
    position: relative;
    align-items: flex-end;
}

/* Arrow keys positioned at the end of bottom row */
.mac-arrows-container {
    /* 参与行宽计算，确保右侧与其它行对齐 */
    margin-left: 0;
    width: 100px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mac-arrow-row {
    display: flex;
    gap: 2px;
}

.mac-arrow-row:first-child {
    justify-content: center;
}

.mac-arrow {
    width: 32px !important;
    height: 32px !important;
    font-size: 10px;
    background: #3a3a3a !important;
    border: 1px solid #2a2a2a !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Enhanced visual effects */
.mac-key.highlighted {
    background: linear-gradient(145deg, #6a6a8a, #4a4a6a);
    color: #ffffff;
    box-shadow:
        0 0 20px rgba(106, 106, 138, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Adjust function row spacing */
.mac-row:first-child {
    margin-bottom: 8px;
}

/* Ensure L key is uppercase */
.mac-key[data-key="L"] {
    text-transform: uppercase;
}

/* F8 play icon styling - now uses Font Awesome */

/* Key information styling - enhanced version */
.key-info-container {
    background: linear-gradient(135deg, #f8f5ff, #f0f0f5);
    border-radius: 20px;
    padding: 25px;
    width: 932px; /* 与键盘容器宽度保持一致 */
    margin: 0 auto 40px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(142, 109, 186, 0.1);
    transition: all 0.3s ease;
    box-sizing: border-box; /* 确保内边距包含在总宽度内 */
}

/* Dark theme Key Information area */
[data-theme="dark"] .key-info-container {
    background: linear-gradient(135deg, #252541, #2a2a4a);
    border-color: rgba(187, 134, 252, 0.2);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(187, 134, 252, 0.1);
}

[data-theme="dark"] .key-info-content {
    background: rgba(35, 35, 55, 0.7);
    border: 1px solid rgba(187, 134, 252, 0.15);
}

[data-theme="dark"] .key-title {
    color: #bb86fc;
    border-bottom-color: #ff79c6;
}

[data-theme="dark"] .key-description {
    color: rgba(225, 225, 225, 0.9);
}

[data-theme="dark"] .key-usage h3,
[data-theme="dark"] .key-shortcut h4 {
    color: #bb86fc;
}

[data-theme="dark"] .key-usage h3 i,
[data-theme="dark"] .key-shortcut h4 i {
    color: #ff79c6;
}

[data-theme="dark"] .key-usage-list li,
[data-theme="dark"] .shortcut-list li {
    color: rgba(225, 225, 225, 0.85);
}

[data-theme="dark"] .key-usage-list li::before {
    color: #ff79c6;
}

[data-theme="dark"] .shortcut-list li::before {
    color: #bb86fc;
}

[data-theme="dark"] .shortcut-combo {
    background: rgba(187, 134, 252, 0.15);
    border-color: rgba(187, 134, 252, 0.3);
    color: #e1e1e1;
}

[data-theme="dark"] .key-note {
    background: rgba(187, 134, 252, 0.1);
    border-left-color: #bb86fc;
    color: rgba(225, 225, 225, 0.9);
}

[data-theme="dark"] .key-note i {
    color: #ff79c6;
}

[data-theme="dark"] .welcome-message {
    background: rgba(187, 134, 252, 0.1);
    border-color: rgba(187, 134, 252, 0.3);
    color: #bb86fc;
}

[data-theme="dark"] .welcome-message i {
    color: #ff79c6;
}

[data-theme="dark"] .key-info-content h2 {
    color: #bb86fc;
    border-bottom-color: rgba(187, 134, 252, 0.3);
}

[data-theme="dark"] .key-info-content h2 i {
    color: #ff79c6;
}

[data-theme="dark"] .key-section {
    background: rgba(45, 45, 65, 0.3);
    border-color: rgba(187, 134, 252, 0.1);
}

[data-theme="dark"] .key-additional {
    color: rgba(225, 225, 225, 0.8);
    border-top-color: rgba(187, 134, 252, 0.3);
}

.key-info-container:hover {
    box-shadow: 
        0 15px 35px rgba(142, 109, 186, 0.15),
        0 3px 10px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.key-info-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.key-info-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #8e6dba, #a78bda, #ff7eb6);
}

.key-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(142, 109, 186, 0.2);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
}

.key-title::before {
    content: "⌨️";
    margin-right: 10px;
    font-size: 24px;
}

.key-description {
    font-size: 17px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 20px;
    padding: 0 5px;
}

.key-section {
    margin-bottom: 25px;
    background: #f9f7fc;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(142, 109, 186, 0.1);
}

.key-usage h3, 
.key-shortcut h4 {
    font-size: 20px;
    font-weight: 600;
    color: #4a4a6a;
    margin: 0 0 15px;
    display: flex;
    align-items: center;
}

.key-usage h3 i, 
.key-shortcut h4 i {
    margin-right: 10px;
    color: #8e6dba;
    font-size: 18px;
}

.key-usage-list, 
.shortcut-list {
    list-style-type: none;
    padding-left: 5px;
    margin-bottom: 5px;
}

.key-usage-list li, 
.shortcut-list li {
    position: relative;
    padding: 6px 0 6px 25px;
    line-height: 1.5;
    font-size: 16px;
    color: #555;
    transition: all 0.2s ease;
}

.key-usage-list li:hover, 
.shortcut-list li:hover {
    color: #333;
    transform: translateX(3px);
}

.key-usage-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #8e6dba;
    font-weight: bold;
}

.shortcut-list li:before {
    content: "⌨";
    position: absolute;
    left: 0;
    color: #8e6dba;
}

.shortcut-combo {
    background: linear-gradient(135deg, #f0e6ff, #e6e6ff);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    font-weight: 600;
    color: #6a4c93;
    margin-right: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(142, 109, 186, 0.2);
    display: inline-block;
}

.key-note {
    background: #fff8e1;
    border-left: 5px solid #ffca28;
    padding: 15px 20px;
    margin-top: 20px;
    font-size: 16px;
    color: #5d4037;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.key-note i {
    color: #ff9800;
    margin-right: 8px;
}

.key-additional {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed rgba(142, 109, 186, 0.3);
    font-size: 15px;
    color: #666;
    font-style: italic;
}

.welcome-message {
    text-align: center;
    color: #6a4c93;
    font-size: 22px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f9f4ff, #f0e6ff);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(142, 109, 186, 0.1);
    border: 1px solid rgba(142, 109, 186, 0.1);
}

.welcome-message i {
    margin-right: 10px;
    animation: pulse 1.5s infinite;
    color: #8e6dba;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.key-history {
    font-size: 14px;
    color: #666;
    margin-top: 15px;
    padding-top: 10px;
}

.key-example {
    margin-top: 15px;
    background: #f0f7ff;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #4a89dc;
    font-size: 15px;
    color: #444;
}

.key-example code {
    background: rgba(255,255,255,0.7);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    color: #333;
}

/* 新增样式 */
.related-key {
    display: inline-block;
    background: linear-gradient(135deg, #f0e6ff, #e6e6ff);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    font-weight: 600;
    color: #6a4c93;
    margin: 0 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(142, 109, 186, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.related-key:hover {
    background: linear-gradient(135deg, #e6d9ff, #d9d9ff);
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.key-special-chars h4 {
    color: #8e6dba;
}

.key-tips h4 {
    color: #ff7eb6;
}

.key-related h4 {
    color: #4a89dc;
}

.key-history h4 {
    color: #ff9800;
}

/* 增强动画效果 */
@keyframes highlight-key {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(142, 109, 186, 0); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(142, 109, 186, 0.5); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(142, 109, 186, 0); }
}

.mac-key.highlight-animation {
    animation: highlight-key 1s ease-in-out;
}

/* 改进的键盘信息区域滚动效果 */
.key-info-container {
    scroll-behavior: smooth;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(142, 109, 186, 0.5) rgba(240, 230, 255, 0.5);
}

.key-info-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.key-info-container::-webkit-scrollbar-track {
    background: rgba(240, 230, 255, 0.5);
    border-radius: 10px;
}

.key-info-container::-webkit-scrollbar-thumb {
    background-color: rgba(142, 109, 186, 0.5);
    border-radius: 10px;
    border: 2px solid rgba(240, 230, 255, 0.5);
}

/* Dual-character keys: vertically stack both characters in center */
.mac-key:has(.main) {
    justify-content: center;
    align-items: center;
    padding: 0;
    flex-direction: column;
}

/* Responsive behavior */
@media (max-width: 1060px) {
    .mac-keyboard-container {
        overflow-x: auto;
        padding: 12px;
    }

    .mac-keyboard {
        width: 900px;
        min-width: 900px;
    }
    
    .key-info-container {
        width: 932px; /* 保持与键盘容器宽度一致 */
        overflow-x: auto; /* 在小屏幕上允许水平滚动 */
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .mac-keyboard-container {
        padding: 10px;
        border-radius: 12px;
        margin: 0 10px 20px;
        width: auto;
        max-width: none;
    }

    .mac-keyboard {
        width: 800px;
        min-width: 800px;
    }
    
    .key-info-container {
        width: 800px; /* 与平板视图下的键盘宽度匹配 */
        padding: 15px;
        margin: 0 auto 30px;
        border-radius: 15px;
    }

    .mac-key {
        width: 46px;
        height: 46px;
        font-size: 11px;
    }

    .mac-esc {
        width: 69px;
    }

    .mac-power {
        width: 69px;
    }

    .mac-backspace {
        width: 92px;
    }

    .mac-tab {
        width: 69px;
    }

    .mac-backslash {
        width: 69px;
    }

    .mac-caps {
        width: 94px;
    }

    .mac-return {
        width: 94px;
    }

    .mac-shift-left,
    .mac-shift-right {
        width: 119px;
    }

    .mac-ctrl,
    .mac-option,
    .mac-command {
        width: 69px;
    }

    .mac-fn-globe {
        width: 46px;
    }

    .mac-space {
        width: 229px;
    }

    .mac-arrow {
        width: 30px !important;
        height: 30px !important;
    }

    /* keep right edge aligned on tablet width */
    .mac-arrows-container {
        margin-left: 0;
        width: 94px;
    }

    /* F8 play-pause icon for tablet */
    .mac-fn .play-pause-icon {
        font-size: 11px;
        margin-bottom: 4px;
        letter-spacing: -0.5px;
    }
}

@media (max-width: 480px) {
    .mac-keyboard-container {
        padding: 8px;
        border-radius: 10px;
    }

    .mac-keyboard {
        width: 700px;
        min-width: 700px;
    }
    
    .key-info-container {
        width: 700px; /* 与移动视图下的键盘宽度匹配 */
        padding: 12px;
        margin: 0 auto 25px;
        border-radius: 12px;
    }
    
    .key-info-content {
        padding: 15px;
    }
    
    .key-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .key-title {
        font-size: 22px;
        padding-bottom: 8px;
    }
    
    .key-description {
        font-size: 15px;
    }

    .mac-key {
        width: 40px;
        height: 40px;
        font-size: 10px;
    }

    .mac-esc {
        width: 60px;
    }

    .mac-power {
        width: 60px;
    }

    .mac-backspace {
        width: 80px;
    }

    .mac-tab {
        width: 60px;
    }

    .mac-backslash {
        width: 60px;
    }

    .mac-caps {
        width: 82px;
        font-size: 10px;
    }

    .mac-return {
        width: 82px;
        font-size: 10px;
    }

    .mac-shift-left,
    .mac-shift-right {
        width: 104px;
    }

    .mac-ctrl,
    .mac-option,
    .mac-command {
        width: 60px;
    }

    .mac-fn-globe {
        width: 40px;
    }

    .mac-space {
        width: 202px;
    }

    .mac-arrow {
        width: 26px !important;
        height: 26px !important;
        font-size: 10px;
    }

    /* keep right edge aligned on mobile width */
    .mac-arrows-container {
        margin-left: 0;
        width: 82px;
    }

    .mac-fn {
        font-size: 7px;
    }

    .mac-fn i {
        font-size: 10px;
    }

    /* F8 play-pause icon for mobile */
    .mac-fn .play-pause-icon {
        font-size: 8px;
        margin-bottom: 3px;
        letter-spacing: -0.3px;
    }
}

/* Rotation hint for mobile portrait - similar to Windows keyboard */
.rotation-hint {
    display: none;
}

/* Mobile Portrait - Show rotation hint */
@media (max-width: 768px) and (orientation: portrait) {
    /* Ensure body allows full content display */
    body {
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100vh;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .mac-keyboard-container {
        position: relative;
        min-height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #2c3e50, #34495e);
    }

    .mac-keyboard {
        display: none;
    }

    .rotation-hint {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        color: white;
        padding: 30px 20px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 15px;
        backdrop-filter: blur(10px);
        border: 2px dashed rgba(255, 255, 255, 0.3);
    }

    /* Dark theme rotation hint */
    [data-theme="dark"] .rotation-hint {
        background: rgba(187, 134, 252, 0.2);
        border-color: rgba(187, 134, 252, 0.4);
        color: #e1e1e1;
    }

    [data-theme="dark"] .rotation-hint i {
        color: #ff79c6;
    }

    .rotation-hint i {
        font-size: 4rem;
        margin-bottom: 20px;
        color: #ff7eb6;
        animation: rotate 2s ease-in-out infinite;
    }

    .rotation-hint h3 {
        font-size: 1.5rem;
        margin-bottom: 15px;
        color: white;
    }

    .rotation-hint p {
        font-size: 1.1rem;
        line-height: 1.6;
        opacity: 0.9;
        margin-bottom: 10px;
    }

    @keyframes rotate {
        0%, 100% { transform: rotate(0deg); }
        25% { transform: rotate(-90deg); }
        75% { transform: rotate(-90deg); }
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    .key-info-content h2 {
        font-size: 1.3rem;
    }

    .welcome-message {
        font-size: 1rem !important;
    }

    /* Optimize Key Information area for mobile portrait */
    .key-info-container {
        width: 100%;
        max-width: 100%;
        padding: 15px 10px;
        margin: 20px 0 60px 0; /* Add bottom margin to prevent footer overlap */
        border-radius: 12px;
        box-sizing: border-box;
        background: linear-gradient(135deg, #f8f5ff, #f0f0f5);
        box-shadow: 0 8px 25px rgba(142, 109, 186, 0.15);
        position: relative;
        z-index: 1;
        /* Remove height restriction to allow full content display */
        min-height: 200px;
    }

    /* Dark theme mobile portrait Key Information */
    [data-theme="dark"] .key-info-container {
        background: linear-gradient(135deg, #252541, #2a2a4a);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
        border-color: rgba(187, 134, 252, 0.2);
    }

    .key-info-content {
        padding: 20px 15px;
        box-sizing: border-box;
    }

    .key-info-content h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
        text-align: center;
    }

    .welcome-message {
        font-size: 1.1rem !important;
        padding: 20px 15px;
        text-align: center;
        line-height: 1.5;
        margin-bottom: 15px;
        /* Ensure full visibility */
        min-height: auto;
        overflow: visible;
    }

    /* Optimize key sections for portrait */
    .key-section {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 10px;
    }

    .key-title {
        font-size: 1.6rem;
        margin-bottom: 12px;
        text-align: center;
        padding-bottom: 8px;
    }

    .key-description {
        font-size: 1rem;
        line-height: 1.6;
        text-align: center;
        margin-bottom: 20px;
    }

    .key-usage h3,
    .key-shortcut h4 {
        font-size: 1.2rem;
        margin: 15px 0 12px;
        text-align: center;
    }

    .key-usage-list,
    .shortcut-list {
        padding-left: 0;
        text-align: left;
    }

    .key-usage-list li,
    .shortcut-list li {
        font-size: 0.95rem;
        margin-bottom: 10px;
        padding-left: 20px;
        line-height: 1.5;
    }

    .shortcut-combo {
        font-size: 0.9rem;
        padding: 4px 8px;
        margin-right: 8px;
        display: inline-block;
        margin-bottom: 4px;
    }

    .key-note {
        padding: 12px 15px;
        margin-top: 15px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .key-additional {
        font-size: 0.85rem;
        margin-top: 15px;
        padding-top: 12px;
        text-align: center;
    }

    /* Enhanced visual hierarchy for portrait */
    .key-usage h3 i,
    .key-shortcut h4 i {
        color: #ff7eb6;
        margin-right: 8px;
    }

    .key-usage-list li::before {
        content: "✨";
        position: absolute;
        left: 0;
        color: #ff7eb6;
    }

    .shortcut-list li::before {
        content: "⌨";
        position: absolute;
        left: 0;
        color: #8e6dba;
    }

    /* Improve touch targets for mobile */
    .shortcut-combo {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }

    /* Add subtle animations */
    .key-section {
        transition: all 0.3s ease;
    }

    .key-section:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(142, 109, 186, 0.2);
    }
}

/* Small-phone portrait - Enhanced Key Information optimization */
@media (max-width: 480px) and (orientation: portrait) {
    /* Ensure body allows full content display on small screens */
    body {
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100vh;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 8px;
        box-sizing: border-box;
    }

    .rotation-hint {
        padding: 25px 15px;
    }

    .rotation-hint i {
        font-size: 3.5rem;
        margin-bottom: 15px;
    }

    .rotation-hint h3 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    .rotation-hint p {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    /* Ultra-compact Key Information area */
    .key-info-container {
        padding: 12px 8px;
        margin: 15px 0 50px 0; /* Add bottom margin for small screens */
        border-radius: 10px;
        background: linear-gradient(135deg, #f8f5ff, #f0f0f5);
        box-shadow: 0 6px 20px rgba(142, 109, 186, 0.12);
        position: relative;
        z-index: 1;
        /* Remove height restriction for small screens too */
        min-height: 150px;
    }

    /* Dark theme small screen Key Information */
    [data-theme="dark"] .key-info-container {
        background: linear-gradient(135deg, #252541, #2a2a4a);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        border-color: rgba(187, 134, 252, 0.2);
    }

    .key-info-content {
        padding: 15px 10px;
    }

    .key-info-content h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .welcome-message {
        font-size: 1rem !important;
        padding: 15px 10px;
        line-height: 1.4;
        margin-bottom: 12px;
        /* Ensure full visibility on small screens */
        min-height: auto;
        overflow: visible;
    }

    .key-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .key-title {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .key-description {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 15px;
    }

    .key-usage h3,
    .key-shortcut h4 {
        font-size: 1.1rem;
        margin: 12px 0 10px;
    }

    .key-usage-list li,
    .shortcut-list li {
        font-size: 0.85rem;
        margin-bottom: 8px;
        padding-left: 18px;
    }

    .shortcut-combo {
        font-size: 0.8rem;
        padding: 3px 6px;
        margin-right: 6px;
    }

    .key-note {
        padding: 10px 12px;
        font-size: 0.8rem;
        margin-top: 12px;
    }

    .key-additional {
        font-size: 0.8rem;
        margin-top: 12px;
        padding-top: 10px;
    }

    /* Enhanced visual hierarchy for small portrait */
    .key-usage h3 i,
    .key-shortcut h4 i {
        color: #ff7eb6;
        margin-right: 6px;
        font-size: 1rem;
    }

    .key-usage-list li::before {
        content: "✨";
        position: absolute;
        left: 0;
        color: #ff7eb6;
        font-size: 0.8rem;
    }

    .shortcut-list li::before {
        content: "⌨";
        position: absolute;
        left: 0;
        color: #8e6dba;
        font-size: 0.8rem;
    }

    /* Compact touch targets */
    .shortcut-combo {
        min-height: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }

    /* Subtle animations for small screens */
    .key-section {
        transition: all 0.2s ease;
    }

    .key-section:active {
        transform: scale(0.98);
    }

    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 0.9rem;
    }
}

/* Mobile Landscape - Hide navigation and header, optimize layout */
@media (max-width: 768px) and (orientation: landscape) {
    /* Hide navigation bar and header in landscape mode */
    .navbar,
    header {
        display: none !important;
    }

    body {
        font-size: 12px;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }

    .container {
        padding: 0 8px;
        max-width: 100%;
    }

    /* Full-width keyboard container */
    .mac-keyboard-container {
        width: 100vw;
        max-width: 100vw;
        padding: 8px;
        margin: 8px 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        background: #c0c0c0;
    }

    /* Dark theme landscape keyboard container */
    [data-theme="dark"] .mac-keyboard-container {
        background: #2a2a2a;
    }

    .mac-keyboard {
        /* Scale the keyboard to fit viewport width */
        transform-origin: top left;
        transform: scale(calc((100vw - 16px) / 932px));
        width: 900px;
        min-width: 900px;
        margin: 0;
    }



    /* Full-width info container */
    .key-info-container {
        width: 100vw;
        max-width: 100vw;
        padding: 10px 8px;
        margin: 6px 0 12px;
        border-radius: 0;
        box-sizing: border-box;
    }

    .key-info-content {
        padding: 15px;
        box-sizing: border-box;
    }

    .key-info-content h2 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .welcome-message {
        font-size: 0.85rem !important;
        padding: 12px 8px;
        line-height: 1.3;
    }

    /* Optimize key sections for landscape */
    .key-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .key-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .key-description {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .key-usage-list li,
    .shortcut-list li {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    /* Compact footer */
    .footer {
        padding: 6px 0;
        margin-top: 12px;
        font-size: 0.7rem;
    }

    /* Avoid extra horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* F8 play-pause icon for landscape */
    .mac-fn .play-pause-icon {
        font-size: 14px;
        letter-spacing: -1px;
    }
}

/* Small-phone landscape - Maximum compactness */
@media (max-width: 480px) and (orientation: landscape) {
    /* Hide navigation bar and header */
    .navbar,
    header {
        display: none !important;
    }

    body {
        font-size: 11px;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }

    .container {
        padding: 0 4px;
        max-width: 100%;
    }

    /* Maximum compact keyboard container */
    .mac-keyboard-container {
        width: 100vw;
        max-width: 100vw;
        padding: 4px;
        margin: 4px 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        background: #c0c0c0;
    }

    /* Dark theme small landscape keyboard container */
    [data-theme="dark"] .mac-keyboard-container {
        background: #2a2a2a;
    }

    .mac-keyboard {
        /* Scale for small screens */
        transform-origin: top left;
        transform: scale(calc((100vw - 8px) / 932px));
        width: 900px;
        min-width: 900px;
        margin: 0;
    }



    /* Maximum compact info section */
    .key-info-container {
        width: 100vw;
        max-width: 100vw;
        padding: 8px 4px;
        margin: 4px 0;
        border-radius: 0;
        box-sizing: border-box;
    }

    .key-info-content {
        padding: 10px;
        box-sizing: border-box;
    }

    .key-info-content h2 {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }

    .welcome-message {
        font-size: 0.75rem !important;
        padding: 8px 6px;
        line-height: 1.2;
    }

    /* Ultra-compact key sections */
    .key-section {
        padding: 8px;
        margin-bottom: 10px;
    }

    .key-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .key-description {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .key-usage-list li,
    .shortcut-list li {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .shortcut-combo {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Maximum compact footer */
    .footer {
        padding: 4px 0;
        margin-top: 8px;
        font-size: 0.6rem;
    }

    /* F8 play-pause icon for small landscape */
    .mac-fn .play-pause-icon {
        font-size: 12px;
        letter-spacing: -0.8px;
    }
}