html {
    background-color: #f0f8ff; /* AliceBlue */
    height: 100%; /* Ensure html covers full height for background */
}
body {
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative; /* For stacking context */
    z-index: 0;       /* Ensures body content is above the ::before pseudo-element */
}
body::before {
    content: "";
    position: fixed; /* Cover the viewport and stay fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('img/background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.1; /* 10% opacity for the background image */
    z-index: -1; /* Place it behind the body's content */
}
h1 {
    color: #ff6347; /* Tomato red */
    font-size: 3em;
    text-shadow: 2px 2px 4px #aaa;
    margin: 0;
}
h2 {
    color: #4682b4; /* SteelBlue */
    font-size: 1.8em;
    margin-top: 30px;
    margin-bottom: 10px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    padding: 0 30px;
    box-sizing: border-box;
}
.header h1 {
    margin: 0;
    text-align: left;
}
.top-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 0;
}

.button-container {
    display: flex;
    gap: 10px;
}

.settings-button {
    cursor: pointer;
    width: 48px;
    height: 48px;
    fill: #888;
    transition: fill 0.3s ease;
}

.settings-button:hover {
    fill: #ff6347;
}

#board {
    margin: 0;
    position: relative;
    width: 480px;
    height: 485px;
    border: 5px solid #8b4513;
    border-radius: 15px;
    background-color: #f5f5dc;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    overflow: hidden; /* 防止图块超出边界 */
}
/* Styling for board triangles */
#board svg polygon { 
    stroke: #a2b18e; /* A muted green for triangle borders */
    stroke-width: 1;
    transition: opacity 0.2s ease;
}
/* Empty board cells */
#board svg polygon[fill="#f0f0f0"] { 
    fill: #f5f5f5; /* Slightly off-white */
}

/* Hover effect for placed pieces on board */
#board svg polygon:not([fill="#f0f0f0"]):not([fill="#f5f5f5"]) {
    cursor: pointer;
}

#board svg polygon:not([fill="#f0f0f0"]):not([fill="#f5f5f5"]):hover {
    opacity: 0.7;
    stroke-width: 2;
    stroke: #ff6347;
}

#pieces { display: none; }
.side-controls { display: none; }

.canvas-container {
    min-width: 400px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#canvas {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    min-height: 400px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}
.main-layout {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: calc(100vh - 120px);
    padding: 0 24px;
    box-sizing: border-box;
}

/* 游戏板网格吸附效果 */
#board .snap-grid {
    position: absolute;
    pointer-events: none;
    border: 1px dashed rgba(0,0,0,0.1);
}

/* 响应式布局 */
@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 200px);
    }

    .canvas-container {
        min-height: 400px;
        height: 60vh;
    }

    .side-controls {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-layout {
        padding: 0 10px;
        gap: 15px;
    }
    
    .canvas-container,
    .side-controls {
        padding: 15px;
    }
    
    h1 {
        font-size: 2.5em;
    }
    
    .top-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .button-container {
        flex-direction: column;
        width: 100%;
    }
    
    .button-container button {
        width: 100%;
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2em;
    }
    
    .canvas-container {
        min-height: 300px;
        height: 50vh;
    }
    
    button {
        padding: 10px 20px;
        font-size: 1em;
    }
}

.controls {
    margin: 30px 20px;
    text-align: center;
}
button {
    background-color: #ff9966; /* Orangey-pink */
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 25px; /* Pill-shaped buttons */
    cursor: pointer;
    margin: 5px 10px;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    font-weight: bold;
}
button:hover:not(:disabled) {
    background-color: #ff7744;
    transform: translateY(-2px);
}
button:active:not(:disabled) {
    transform: translateY(1px);
}
button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    box-shadow: none;
}

#message {
    text-align: center;
    height: 20px;
    margin: 10px 0;
    color: #333;
}
#message.solving {
    color: #2196F3;
}
#message.error {
    color: #f44336;
}
#message.paused {
    color: #ff9800;
}

/* Styling for the selected piece in the 'Available Pieces' list */
/* JS handles outline, this can be for additional effects if desired */
.piece svg.selected {
     box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.6), 0 0 8px rgba(255,0,0,0.4); /* Red glow */
     /* outline: none; /* If you want to fully replace the JS outline */
} 

/* Styles for images within the instructions modal */
#instructions-text-area img {
    max-width: 60%;      /* Max width is 60% of the container */
    height: auto;        /* Maintain aspect ratio */
    display: block;      /* Allows margin auto to work for centering */
    margin-left: auto;
    margin-right: auto;
    margin-top: 10px;    /* Some space above the image */
    margin-bottom: 10px; /* Some space below the image */
    border-radius: 8px;  /* Optional: rounded corners for images */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Optional: subtle shadow */
} 

#board-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#pieces-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#pieces-layer * {
    pointer-events: auto;
}

/* 确保SVG内容完整显示 */
svg {
    overflow: visible;
} 