* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: radial-gradient(circle at top, #dff4ff 0%, #b8e7ff 35%, #91d1f8 70%, #79c2ee 100%);
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.page-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.storybook-panel {
    width: 1000px;
    max-width: 100%;
    padding: 18px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.22);
    box-shadow:
        0 20px 50px rgba(24, 72, 108, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(6px);
}

.storybook-stage {
    position: relative;
    width: 1000px;
    height: 600px;
    max-width: 100%;
}

.game-container {
    width: 1000px;
    height: 600px;
    max-width: 100%;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(to bottom, #aee3ff 0%, #dff5ff 100%);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.28),
        inset 0 -20px 40px rgba(0, 0, 0, 0.05);
}

.game-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.story-card {
    position: absolute;
    top: 40px;
    right: 34px;
    width: 300px;
    min-height: 360px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 18px 38px rgba(41, 78, 115, 0.16);
    padding: 0;
    z-index: 5;
}

.story-card-inner {
    padding: 22px 22px 18px;
}

.story-kicker {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eef9ff;
    color: #4981a3;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}

.story-title {
    margin: 0 0 14px;
    font-size: 28px;
    line-height: 1.1;
    color: #2b4c5d;
}

.story-text {
    margin: 0;
    font-size: 20px;
    line-height: 1.7;
    color: #35596b;
    min-height: 190px;
}

.story-word {
    display: inline;
    padding: 2px 4px;
    border-radius: 8px;
    transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.story-word.is-active {
    background: #ffec8d;
    color: #1f3a4a;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.read-button {
    margin-top: 18px;
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    font-size: 18px;
    font-weight: 700;
    color: white;
    background: linear-gradient(180deg, #66c66d 0%, #4faf56 100%);
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(79, 175, 86, 0.28);
    transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.read-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 13px 24px rgba(79, 175, 86, 0.32);
}

.read-button:active {
    transform: translateY(1px);
}

.read-button.is-playing {
    background: linear-gradient(180deg, #6b9bff 0%, #4f79df 100%);
    box-shadow: 0 10px 22px rgba(79, 121, 223, 0.28);
}

@media (max-width: 1060px) {
    body {
        padding: 16px;
    }

    .storybook-panel {
        padding: 12px;
        border-radius: 22px;
    }

    .storybook-stage {
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .game-container {
        aspect-ratio: 5 / 3;
        width: 100%;
        height: auto;
    }

    .story-card {
        position: static;
        width: 100%;
        min-height: 0;
    }

    .story-text {
        min-height: 0;
    }
}
