/* ═══════════════════════════════════════════
   StoryQuest — Story Reader
   Immersive reading experience
   ═══════════════════════════════════════════ */

.reader-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

.reader-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--color-gray-300);
    margin-bottom: 32px;
}

.reader-story-info {
    flex: 1;
}

.reader-story-title {
    font-size: 1.25rem;
    color: var(--color-primary);
}

.reader-author {
    font-size: 0.85rem;
    color: var(--color-gray-700);
}

.reader-progress {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-gray-700);
    background: var(--color-gray-100);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* ═══ Page Content ═══ */

.reader-page {
    animation: pageIn 0.4s ease-out;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-body {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--color-dark);
    margin-bottom: 40px;
    min-height: 100px;
}

.page-body p {
    margin-bottom: 16px;
}

.page-body img {
    border-radius: var(--radius-md);
    margin: 16px 0;
}

/* ═══ Choices ═══ */

.page-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    background: var(--color-white);
    border: 3px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-dark);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.choice-btn:hover {
    border-color: var(--color-primary);
    background: #F0EDFF;
    transform: translateX(8px);
}

.choice-btn:active {
    transform: translateX(4px);
}

.choice-btn.chosen {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
    pointer-events: none;
}

/* ═══ Dice Section ═══ */

.dice-roll-section {
    text-align: center;
    padding: 32px 0;
}

.dice-prompt {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-gray-700);
    margin-bottom: 20px;
    font-style: italic;
}

.dice-roll-btn {
    font-size: 1.25rem;
    padding: 18px 40px;
    animation: dicePulse 2s ease-in-out infinite;
}

@keyframes dicePulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 8px 24px rgba(255, 107, 107, 0.5); transform: scale(1.02); }
}

.dice-roll-btn:hover {
    animation: none;
}

.dice-animation-container {
    margin-top: 24px;
}

/* Dice animation elements */
.dice-animation {
    display: inline-block;
}

.dice-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.dice-body .dice-icon {
    font-size: 4rem;
}

.dice-body .dice-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-primary);
    min-width: 80px;
    text-align: center;
}

.dice-body .dice-type-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-gray-500);
    text-transform: uppercase;
}

.dice-body.rolling {
    animation: diceShake 0.3s ease-in-out infinite;
}

@keyframes diceShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.dice-body.landed .dice-value {
    animation: diceReveal 0.4s ease-out;
    color: var(--color-coral);
}

@keyframes diceReveal {
    from { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.3); }
    to { transform: scale(1); opacity: 1; }
}

.dice-burst-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    animation: burstOut 0.6s ease-out forwards;
}

@keyframes burstOut {
    from { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    to { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1); opacity: 0; }
}

.dice-result-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 16px;
    animation: resultIn 0.5s ease-out;
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══ Ending Section ═══ */

.ending-section {
    text-align: center;
    padding: 40px 0;
    animation: endingIn 0.5s ease-out;
}

@keyframes endingIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.ending-icon {
    font-size: 5rem;
    margin-bottom: 16px;
}

.ending-section h3 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 24px;
}

.ending-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ═══ Loading State ═══ */

.page-loading {
    text-align: center;
    padding: 40px;
}

.page-loading .spinner {
    margin: 0 auto;
    width: 40px;
    height: 40px;
}
