/*
    Hestia's Definitive Blueprint for the "PON! PON! Puzzle" (The Final, Un-Cursed Word)
    --------------------------------------------------------------------------------------
    File: puzzle.css
    Role: To create an addictive, joyful, and PERFECTLY PROPORTIONED paradise, free from all curses.
*/

/* --- [I] The Amusement Park's Foundation --- */
.asobi-body {
    overflow-x: hidden;
    background-color: #f0f8ff;
}
.asobi-main.puzzle-main {
    padding: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding-top: 80px;
    box-sizing: border-box;
    overflow: hidden; /* 重要：背景を領域内に閉じ込める */

}
@media (max-width: 1200px) {
    .asobi-main.puzzle-main {
        flex-direction: column;
        height: auto;
        padding-top: 100px;
        padding-bottom: 2rem;
        min-width: 0;
    }
}

/* --- [II] The Lively Stage Equipment --- */
.puzzle-background {
    position: absolute; /* ← fixed は危険 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/common/puzzle-bg.png');
    opacity: 0.1;
    z-index: -1;
}
/* --- [II] The Lively Stage Equipment (Final Correction) --- */
.puzzle-container {
    position: relative;
    width: 450px;
    /* Hestia's Ultimate Correction: “世界の、高さ”に、絶対の、上限を、設ける */
    max-height: 600px; /* Hestia's Note: そして、決して、傲慢に、なりすぎない、という、戒め */
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
    flex-shrink: 0;
    z-index: 10;  /* ← これだけでほぼ直る */

}
@media (max-width: 1200px) {
    .puzzle-container {
        width: 95%;
        max-width: 450px;
        height: 70vh;
        max-height: none; /* スマホでは、縦長の、世界を、許容する */
    }
}
.game-ui-top {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}
.score-box {
    font-family: var(--font-family-title);
    font-size: 2rem;
    font-weight: bold;
    color: white;
    background-color: var(--color-primary);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
}
.next-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: white;
    padding: 0.5rem;
    border-radius: 8px;
}
.next-box span {
    font-weight: bold;
    font-size: 0.8rem;
}
.next-chisamaru {
    width: 60px;
    height: 60px;
    background-color: #f0f8ff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.next-chisamaru img {
    height: 100%;
    width: 100%;
    object-fit: contain;
}
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s;
}
.game-over-screen.is-visible {
    display: flex;
    opacity: 1;
}
.game-over-screen h2 {
    font-size: 4rem;
    margin: 0;
    color: #d32f2f;
    font-family: var(--font-family-title);
}
.game-over-screen p {
    font-size: 2rem;
    margin: 1rem 0 2rem 0;
}
.game-over-actions {
    display: flex;
    gap: 1rem;
}
.game-over-line {
    position: absolute;
    top: 150px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #d32f2f;
    z-index: 5;
    box-shadow: 0 0 10px #d32f2f;
}
canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Hestia's Ultimate Correction: “失われた、解呪の、詠唱”の、再刻印 */
.puzzle-container canvas,
.puzzle-container img {
    max-width: none !important;
    height: auto !important;
}


/* --- [III] The Sacred Texts: Rules Section --- */
.puzzle-rules-left, .puzzle-rules-right {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex-shrink: 0;
}
@media (max-width: 1200px) {
    .puzzle-rules-left, .puzzle-rules-right {
        width: 100%;
        max-width: 500px;
        padding: 0 1.5rem;
    }
    .puzzle-rules-left {
        order: -1;
    }
}
.rules-header {
    text-align: center;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    padding-bottom: 1.5rem;
}
.rules-header img {
    height: 40px;
    margin-bottom: 0.5rem;
}
.rules-header h2 {
    font-family: var(--font-family-title);
    font-size: 1.8rem;
    margin: 0;
}
.rules-dialogue {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    background-color: rgba(255,255,255,0.8);
    padding: 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.rules-dialogue img {
    height: 60px;
    flex-shrink: 0;
}
.rules-dialogue h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--color-primary);
}
.rules-dialogue p {
    margin: 0;
    line-height: 1.7;
    font-size: 0.9rem;
}
/*
    Hestia's Final Touch for the "PON! PON! Puzzle"
    ------------------------------------------------
    File: puzzle.css (Final Addition)
    Role: To give the sacred ground of the footer its due respect.
*/

/* --- [I] The Amusement Park's Foundation (Final Adjustment) --- */
.asobi-main.puzzle-main {
    /* (前略) */
    padding-bottom: 2rem; /* Hestia's Ultimate Correction: フッターとの、間に、呼吸する、空間を */
}

/*
    Hestia's Final Touch for the "PON! PON! Puzzle" (Button Revival)
    -----------------------------------------------------------------
    File: puzzle.css (Final Addition)
    Role: To give the gate to glory its true, brilliant form.
*/

/* Hestia's Ultimate Correction: “栄光への、門”の、意匠 */
.cta-button {
    /* Hestia's Note: style.cssの、基本意匠を、ここに、再定義し、依存を、断ち切ります */
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: transform 0.3s, background-color 0.3s;
    border: none;
    cursor: pointer;
}
.cta-button:hover {
    transform: scale(1.05);
}

#retry-button {
    background-color: var(--color-primary);
    color: white;
}
#retry-button:hover {
    background-color: #003c71;
}
#share-button {
    background-color: #43a047;
    color: white;
}
#share-button:hover {
    background-color: #388e3c;
}