@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Arial', 'Helvetica Neue', Helvetica, sans-serif;
    background-color: #fdf6e3; /* Softer, warm background - like parchment */
    color: #5d4037; /* Dark brown for text, better contrast on parchment */
    margin: 0;
    padding: 0; /* Removed body padding, will be handled by panels */
    min-height: 100vh;
    display: flex; /* For main-layout to take full height if needed */
}

.main-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d2c8aa' fill-opacity='0.15'%3E%3Cpath d='M36 0c-5.523 0-10 4.477-10 10s4.477 10 10 10c5.522 0 10-4.477 10-10S41.523 0 36 0zm0 30c-5.523 0-10 4.477-10 10s4.477 10 10 10c5.522 0 10-4.477 10-10S41.523 30 36 30zM6 0c-5.523 0-10 4.477-10 10s4.477 10 10 10c5.522 0 10-4.477 10-10S11.523 0 6 0zm0 30c-5.523 0-10 4.477-10 10s4.477 10 10 10c5.522 0 10-4.477 10-10S11.523 30 6 30z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); /* Subtle dot pattern */
}

.left-panel {
    flex: 0 0 28%; /* Left panel takes 28% of the width */
    max-width: 400px; /* Max width for very large screens, can adjust */
    background-color: #fffbf0; /* Lighter parchment for left panel */
    padding: 10px;
    border-right: 2px solid #e0e0e0; /* Separator line */
    overflow-y: auto; /* Allow left panel to scroll if content is too long */
    height: 100vh; /* Make left panel full height */
    position: sticky; /* Stick the left panel */
    top: 0;
}

.left-panel-content h1 {
    font-size: 1.8em; /* Slightly smaller for left panel */
    color: #8d6e63; /* Softer brown for titles */
    margin-bottom: 2px; /* User updated */
    font-weight: 700;
}

.left-panel-content h2 {
    font-size: 1.2em;
    color: #a1887f; /* Lighter brown */
    margin-bottom: 5px; /* User updated */
    font-weight: 600;
}

.title-divider {
    margin-bottom: 10px; /* User updated */
    border: 0;
    border-top: 1px solid #e0d8c0; /* Adjusted divider color */
}

.left-panel-content h3 { /* For "The Puzzle", "The Clues", "The Question" */
    font-size: 1.3em; /* Slightly increased H3 size for emphasis */
    color: #c79100; /* Engaging warm gold/orange for section titles */
    margin-top: 10px; /* Reduced */
    margin-bottom: 5px; /* Significantly Reduced */
    padding-bottom: 2px; /* Reduced */
    border-bottom: 1px solid #eee;
}

.left-panel-content p { /* For puzzle description and question */
    font-size: 0.9em; /* Slightly reduced general paragraph font size */
    line-height: 1.3; /* Significantly Reduced from 1.45 */
    color: #333;
    margin-bottom: 5px; /* Significantly Reduced from 8px */
}

.left-panel-content .clues-list {
    list-style-position: inside;
    padding-left: 0; /* Remove default padding */
}

.left-panel-content .clues-list li {
    font-size: 0.9em; /* Matched to p for consistency */
    line-height: 1.25; /* Significantly Reduced from 1.45 */
    margin-bottom: 2px; /* Significantly Reduced from 5px */
    padding: 2px 4px; /* Reduced padding: top/bottom 2px, left/right 4px */
    border-radius: 3px; /* Slightly reduced radius */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.left-panel-content .clues-list li.highlighted-clue {
    background-color: #ffe082; /* Softer yellow highlight */
    color: #5d4037; /* Dark brown text on highlight */
    font-weight: 700; /* Bolder when highlighted */
    transform: scale(1.02); /* Slightly increased scale effect for better feedback */
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.5); /* Slightly more pronounced glow */
    border-left: 3px solid #ffc107; /* Add a little left border accent */
}

.right-panel {
    flex: 1; /* Right panel takes the remaining space */
    padding: 20px;
    overflow-y: auto; /* Allow right panel to scroll if its content is too long */
    height: 100vh; /* Make right panel full viewport height for sticky positioning context */
}

.container { /* This container is now inside right-panel */
    background-color: #fffdf7; /* Very light cream for main content cards */
    padding: 25px;
    border-radius: 20px; /* Increased border radius for softer look */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08); /* Softer, more diffused shadow */
    width: 100%; /* Take full width of right-panel */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.puzzle-board {
    flex: 1; /* Allows info-panel to push down if needed */
    background: #fffdf7; /* Match container */
    border-radius: 15px; /* Consistent rounding */
    box-shadow: none; /* Removed shadow as parent .container has it */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.houses-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px; /* Increased gap for better separation */
    padding: 20px; /* Increased padding */
    background-color: #e0f2f7; /* Light sky blue, more playful for houses area */
    border-radius: 15px;
    position: sticky;
    top: 0; /* Stick to the top of the right-panel viewport */
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.house {
    background-color: #ffffff; /* White houses */
    border: 2px solid #b0bec5; /* Muted blue-grey border */
    border-radius: 15px; /* Softer corners */
    padding: 15px; /* Increased padding */
    text-align: center;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 15px rgba(0,0,0,0.07); /* Default subtle shadow */
}

.house:hover {
    transform: translateY(-6px) scale(1.02); /* More noticeable hover */
    box-shadow: 0 8px 20px rgba(0,0,0,0.12); /* Enhanced shadow on hover */
}

.house-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.house-number {
    font-weight: 700; /* Bolder */
    font-size: 1.2em;
    color: #455a64; /* Darker blue-grey for house numbers */
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #cfd8dc; /* Lighter dashed border */
}

.house-attribute {
    background-color: #f5f7fa; /* Very light grey, almost white */
    padding: 10px; /* Increased padding */
    border-radius: 8px; /* Softer radius */
    font-size: 0.95em; /* Slightly larger */
    color: #78909c; /* Muted text color for placeholder */
    border: 1px solid #eceff1;
    transition: all 0.5s ease, background-color 0.5s ease, color 0.5s ease; 
    opacity: 0.7;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.house-attribute.revealed {
    color: #37474f; /* Darker text when revealed */
    font-weight: 700; /* Bold when revealed */
    background-color: #e1f5fe; /* Light blue tint when revealed */
    border-color: #81d4fa; /* Blue border when revealed */
    opacity: 1;
}

.house-attribute.highlight-conclusion {
    background-color: #ffeb3b !important; /* Brighter, more cheerful yellow */
    border: 2px solid #fdd835 !important;
    color: #424242 !important; /* Dark grey for better readability on yellow */
    font-weight: 700;
    box-shadow: 0 0 12px 3px rgba(253, 216, 53, 0.6);
    z-index: 2;
    transform: scale(1.1); /* Slightly more pop */
    transition: all 0.3s cubic-bezier(.4,2,.6,1);
}

.house-attribute.possibility-highlight {
    background-color: #c5e1a5 !important; /* Light, friendly green */
    border: 2px solid #9ccc65 !important;
    color: #33691e !important; /* Dark green for text */
    font-weight: 700;
    box-shadow: 0 0 10px 2px rgba(174, 213, 129, 0.6);
    z-index: 2;
}

.bilingual-sep {
    color: #999;
    margin: 0 0.3em;
    font-weight: normal;
}

.house-attribute .bilingual-sep {
    font-size: 0.9em;
}

.house-possibilities {
    margin-top: 10px;
    min-height: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: stretch;
}

.possibility-note {
    background-color: #fff9c4; /* Softer yellow for notes */
    color: #795548; /* Brown text for notes */
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85em;
    text-align: left;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.08);
    border-left: 5px solid #ffeb3b; /* Brighter yellow accent */
    animation: popIn 0.4s ease-out; /* Slightly slower popIn */
    line-height: 1.4;
}

.possibility-note .chinese-note {
    display: block;
    font-size: 0.9em;
    color: #8d6e63; /* Softer brown for Chinese text */
    margin-top: 4px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px; /* Added margin top for separation */
}

.controls button {
    background-color: #ff9800; /* Cheerful orange */
    color: white;
    border: none;
    padding: 14px 28px; /* Slightly larger buttons */
    font-size: 1.05em;
    border-radius: 30px; /* Fully rounded ends */
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 3px 7px rgba(0,0,0,0.15);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.controls button:hover {
    background-color: #f57c00; /* Darker orange */
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.2);
}

.controls button:active {
    transform: translateY(-1px);
    background-color: #ef6c00; /* Even darker orange */
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.controls button:disabled {
    background-color: #bdbdbd; /* Grey for disabled */
    color: #757575;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.current-step-display { /* This is for the text like "1 / 20" in info-panel */
    font-size: 1em;
    color: #757575; /* Medium grey */
    background-color: #f5f5f5; /* Light grey background */
    padding: 8px 15px; /* Adjusted padding */
    border-radius: 20px; /* Rounded */
    font-weight: 600;
}

.progress { /* Styling for the progress div */
    text-align: center;
    margin-top: 15px; /* Space above progress */
    margin-bottom: 5px; /* Space below progress */
}

.info-panel {
    background-color: #fffdf7; /* Match .container */
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #f0e8d1; /* Light border to define it from container if same color */
    text-align: left;
    box-shadow: none; /* Removing as .container provides shadow */
}

.info-panel .step-title { /* Style for the p#step-title */
    font-size: 1.8em; /* Prominent step title */
    color: #00796b; /* Teal for step titles */
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #b2dfdb; /* Lighter teal for border */
}

.info-panel .current-step,
.info-panel .clues-section,
.info-panel .reasoning-section {
    margin-bottom: 25px; /* Increased margin */
    padding: 20px;
    background-color: #ffffff; /* White cards for sections within info-panel */
    border-radius: 12px; /* Softer radius for inner cards */
    border: 1px solid #e0e0e0; /* Lighter border */
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); /* Subtle shadow for inner cards */
}

/* Specific H3 styling for Clues Used and Reasoning Process headers */
.info-panel .clues-section h3,
.info-panel .reasoning-section h3 {
    font-size: 1.3em; /* Slightly larger */
    color: #d84315; /* Deep orange for section headers */
    margin-top: 0;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    font-weight: 700;
}

.info-panel .clues-section h3::before {
    content: '📜';
    margin-right: 10px;
    font-size: 1.3em; /* Larger icon */
    transform: translateY(-1px);
}

.info-panel .reasoning-section h3::before {
    content: '💡';
    margin-right: 10px;
    font-size: 1.3em; /* Larger icon */
    transform: translateY(-1px);
}

.info-panel #step-description,
.info-panel #step-clues,
.info-panel #step-reasoning {
    font-size: 1.05em; /* Slightly larger text for readability */
    line-height: 1.75;
    color: #424242; /* Darker grey for better readability */
    margin-bottom: 0; /* Remove bottom margin as parent container has it */
}

/* Styles for the reasoning table */
.reasoning-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.reasoning-table th,
.reasoning-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
    line-height: 1.4;
}

.reasoning-table th {
    background-color: #f2f2f2;
    color: #333;
    font-weight: bold;
}

.reasoning-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.reasoning-table td:nth-child(4) { 
    text-align: center;
    font-weight: bold;
}

.reasoning-table strong {
    color: #27ae60;
}

.reasoning-table .no-match td {
    color: #c0392b;
}

.fade-in {
    animation: fadeInAnimation 0.7s ease-in-out;
}

@keyframes fadeInAnimation {
    from { opacity: 0.3; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 1200px) { /* Adjust breakpoint for when left panel might get too squeezed */
    .left-panel {
        flex: 0 0 30%; /* Slightly more space for left panel on medium-large screens */
    }
}

@media (max-width: 900px) {
    .main-layout {
        flex-direction: column; /* Stack panels vertically on smaller screens */
    }
    .left-panel {
        flex: 0 0 auto; 
        width: 100%;
        max-width: none;
        height: auto; 
        position: static; 
        border-right: none;
        border-bottom: 2px solid #e0e0e0; 
        margin-bottom: 0; /* Remove margin, padding of right-panel will create space */
        overflow-y: visible; 
    }
    .right-panel {
        width: 100%;
        padding: 15px; 
        overflow-y: auto; /* Right panel is the main scroller in mobile view */
        height: auto; /* Allow it to take content height */
    }
    .container {
        padding: 15px;
    }
    .houses-container {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        top: 0; /* Sticky to top of right panel, which is now the main scroll viewport */
        position: sticky; /* Ensure sticky is re-asserted or still active */
    }
    .info-panel .step-title {
        font-size: 1.4em;
    }
    .controls button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}

@media (max-width: 600px) {
    .right-panel {
        padding: 10px;
    }
    .container {
        padding: 10px;
    }
    .houses-container {
        gap: 10px;
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); /* Further adjust for very small */
    }
    .house-attribute {
        font-size: 0.8em;
        padding: 6px;
        min-height: 25px;
    }
    .possibility-note {
        font-size: 0.75em;
        padding: 6px;
    }
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .info-panel #step-description,
    .info-panel #step-clues,
    .info-panel #step-reasoning {
        font-size: 0.9em;
    }
    .info-panel .clues-section h3,
    .info-panel .reasoning-section h3 {
        font-size: 1.1em;
    }
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #b0b0b0; /* Slightly darker scrollbar thumb */
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #909090;
}

/* Styles for Interstitial Page */
.interstitial-content {
    background-color: #e0f7fa; /* Light cyan background */
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #80deea; /* Cyan border */
    margin-bottom: 20px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.interstitial-content .interstitial-title {
    font-size: 1.5em;
    color: #006064; /* Dark cyan for title */
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #4dd0e1; /* Lighter cyan */
    font-weight: 700;
}

.interstitial-content .interstitial-text-en,
.interstitial-content .interstitial-text-zh {
    font-size: 1.05em;
    line-height: 1.7;
    color: #004d40; /* Dark teal for text */
}

.interstitial-content .interstitial-text-zh {
    margin-top: 12px;
    /* font-style: italic; (Removing italic for better readability with Nunito) */
    color: #00796b; /* Teal for Chinese text */
}

.interstitial-content .interstitial-divider {
    margin-top: 18px;
    margin-bottom: 12px;
    border: 0;
    border-top: 1px dashed #4dd0e1; /* Lighter cyan dashed */
}

/* Styles for Strategy Guide Page */
#strategy-guide-container {
    background-color: #fffefa; /* Very light, warm cream */
    padding: 35px; /* Increased padding */
    border-radius: 20px; /* Softer, larger radius */
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1); /* More pronounced shadow */
    color: #5d4037; /* Dark brown text */
    text-align: left;
    margin: 20px; 
}

#strategy-guide-container h2 { /* Main title (English) */
    font-size: 2.2em;
    color: #bf360c; /* Deep, earthy orange for main title */
    margin-bottom: 8px;
    text-align: center;
    font-weight: 700;
}
#strategy-guide-container h3 { /* Sub-title (Chinese) and Section titles */
    font-size: 1.6em;
    color: #e65100; /* Bright, engaging orange for subtitles/section heads */
    margin-top: 20px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffcc80; /* Lighter orange border */
    font-weight: 700;
}

/* Overriding the H3 for the Chinese main title to be smaller than EN */
#strategy-guide-container h3:first-of-type { /* Targets the Chinese main title */
    font-size: 1.7em; /* Slightly smaller than English main title */
    color: #d84315; /* Slightly different shade of orange */
    margin-bottom: 20px;
    border-bottom: none; /* No border under the Chinese main title */
    text-align: center;
}

#strategy-guide-container h3 .icon {
    margin-right: 8px;
    transform: translateY(2px); /* Align icons better with Nunito */
}

#strategy-guide-container p,
#strategy-guide-container li {
    font-size: 1.1em;
    line-height: 1.75; /* Increased line height for readability */
    margin-bottom: 15px; /* Increased spacing */
    color: #6d4c41; /* Softer brown for text */
}

#strategy-guide-container .strategy-point-en {
    font-weight: 400;
}

#strategy-guide-container .strategy-point-zh {
    /* font-style: italic; (Removed italic) */
    color: #8d6e63; /* Lighter brown for Chinese */
    margin-left: 0; /* No indent, let <br> handle separation */
    display: inline-block; /* Allows margin-top if needed, but <br> is primary */
    margin-top: 5px; /* Add a little space after English part */
}

#strategy-guide-container ol {
    padding-left: 25px; /* Slightly reduced list indent */
    list-style-type: decimal; /* Explicitly decimal */
}
#strategy-guide-container ol li::marker {
    color: #e65100; /* Orange marker color */
    font-weight: 700;
}

#strategy-guide-container #start-puzzle-btn {
    display: block;
    background: linear-gradient(145deg, #ffca28, #ff8f00); /* Yellow-Orange gradient */
    color: #4e342e; /* Dark brown text on button */
    border: none;
    padding: 16px 35px; /* Larger padding */
    font-size: 1.3em;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(255, 143, 0, 0.4), 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

#strategy-guide-container #start-puzzle-btn:hover {
    background: linear-gradient(145deg, #ffd54f, #ffa000);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 6px 15px rgba(255, 143, 0, 0.5), 0 2px 5px rgba(0,0,0,0.15);
}

#strategy-guide-container #start-puzzle-btn:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 0 2px 8px rgba(255, 143, 0, 0.3), 0 1px 2px rgba(0,0,0,0.1);
} 