@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #E8E5D8 0%, #F5F3ED 50%, #E8E5D8 100%);
    min-height: 100vh;
    font-family: -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}

#container {
    max-width: 800px;
    margin: 40px auto;
    padding: 50px 45px;
}

h1 { 
    margin: 0 0 10px 0; 
    text-align: center;
    font-size: 28px;
    font-weight: 400;
    color: #2C2C2C;
    letter-spacing: 0.5px;
}

article { 
    font-size: 14px; 
    color: #6B6B6B;
    line-height: 1.8;
    text-align: center;
    padding: 15px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.control-section {
    text-align: center;
    margin-bottom: 40px;
}

/* 像素风格按钮 */
.pick-button {
    padding: 14px 32px;
    font-size: 12px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background-color: #FF6B6B;
    color: #000;
    border: 4px solid #000;
    cursor: pointer;
    box-shadow: 
        4px 4px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.1s;
    border-radius: 0;
    width: 160px;
    text-align: center;
}

.pick-button:hover {
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.pick-button:active {
    transform: translate(4px, 4px);
    box-shadow: 
        0px 0px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.result-section {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-section.hidden {
    display: none;
}

.color-display-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

.color-preview {
    width: 150px;
    min-width: 150px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.5);
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                      linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                      linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #FFFFFF;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    aspect-ratio: 1;
}

.status-bar {
    margin-top: 15px;
    padding: 8px 16px;
    font-size: 14px;
    color: #5A5A5A;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-bar:not(.hidden) {
    opacity: 1;
}

.status-bar.hidden {
    display: none;
}

.color-info {
    flex: 1;
    min-width: 200px;
}

.color-value {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
}

.color-value label {
    color: #5A5A5A;
    font-weight: 500;
    min-width: 60px;
    margin-right: 12px;
}

.color-value span {
    color: #2C2C2C;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    padding: 4px 12px;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 3px;
}

/* 像素风格复制按钮 */
.copy-button {
    margin-top: 8px;
    padding: 10px 20px;
    font-size: 11px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background-color: #4ECDC4;
    color: #000;
    border: 4px solid #000;
    cursor: pointer;
    box-shadow: 
        4px 4px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.1s;
    border-radius: 0;
    width: 140px;
    display: inline-block;
    text-align: center;
}

.copy-button:hover:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.copy-button:active:not(:disabled) {
    transform: translate(4px, 4px);
    box-shadow: 
        0px 0px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.copy-button:disabled {
    background-color: #C8C5BA;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: 
        4px 4px 0 #000,
        inset -2px -2px 0 rgba(255, 255, 255, 0.3),
        inset 2px 2px 0 rgba(0, 0, 0, 0.2);
}

/* 全屏覆盖层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    cursor: crosshair;
}

.overlay.hidden {
    display: none;
}

/* 放大镜 */
.magnifier {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5),
                inset 0 0 0 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    pointer-events: none;
    transform: translate(-50%, -50%);
    background-color: #FFFFFF;
}

.magnifier-content {
    position: relative;
    width: 100%;
    height: 100%;
}

#magnifierCanvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.magnifier-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 2px;
    background-color: #000000;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8),
                0 0 0 2px rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    z-index: 10;
}

.magnifier-crosshair::before,
.magnifier-crosshair::after {
    content: '';
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
}

.magnifier-crosshair::before {
    top: 50%;
    left: -20px;
    width: 40px;
    height: 1px;
    transform: translateY(-50%);
}

.magnifier-crosshair::after {
    left: 50%;
    top: -20px;
    width: 1px;
    height: 40px;
    transform: translateX(-50%);
}

.magnifier-info {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #FFFFFF;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 8px;
}

.magnifier-color-preview {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    flex-shrink: 0;
}

.magnifier-color-value {
    font-weight: 600;
}

.hint-text {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 10001;
    font-family: -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}

footer {
    margin-top: 40px;
    padding: 20px 0;
}

footer a {
    opacity: 0.6;
    transition: opacity 0.2s;
}

footer a:hover {
    opacity: 0.8;
}

footer img {
    filter: grayscale(100%);
    transition: filter 0.2s;
}

footer a:hover img {
    filter: grayscale(0%);
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    #container {
        padding: 30px 25px;
    }
    
    .color-display-row {
        flex-direction: column;
    }
    
    .color-preview {
        width: 100%;
        aspect-ratio: 1;
    }
    
    .color-info {
        width: 100%;
    }
}
