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

body {
    background: linear-gradient(135deg, #2c1810 0%, #1a0f08 100%);
    font-family: 'Crimson Text', serif;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

.manuscript-container {
    max-width: 1400px;
    margin: 0 auto;
    background: url('parchment_bg.png');
    background-size: cover;
    padding: 60px;
    border: 8px double #4a3425;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9), 
                inset 0 0 100px rgba(139, 90, 43, 0.2),
                inset 0 0 30px rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    position: relative;
    z-index: 2;
}

.manuscript-container::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 2px solid #8b5a2b;
    border-style: double;
    pointer-events: none;
    opacity: 0.6;
}

.manuscript-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('scroll_border.png');
    background-size: 200px;
    background-repeat: repeat;
    opacity: 0.15;
    pointer-events: none;
}

.title-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    border-top: 3px double #4a3425;
    border-bottom: 3px double #4a3425;
    background: rgba(139, 90, 43, 0.05);
    position: relative;
}

.title-section::before,
.title-section::after {
    content: '✦';
    position: absolute;
    font-size: 2em;
    color: #8b5a2b;
    top: 50%;
    transform: translateY(-50%);
}

.title-section::before {
    left: 20px;
}

.title-section::after {
    right: 20px;
}

.manuscript-title {
    font-family: 'Cinzel', serif;
    font-size: 3.5em;
    color: #2c1810;
    text-shadow: 2px 2px 4px rgba(139, 90, 43, 0.3),
                 1px 1px 0px rgba(139, 90, 43, 0.2);
    letter-spacing: 5px;
    margin-bottom: 10px;
    text-transform: uppercase;
    border-bottom: 1px solid #8b5a2b;
    padding-bottom: 10px;
    display: inline-block;
}

.manuscript-subtitle {
    font-family: 'Cinzel', serif;
    font-size: 1.8em;
    color: #5d3a1a;
    font-style: italic;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.manuscript-subtitle::before,
.manuscript-subtitle::after {
    content: '~';
    margin: 0 10px;
    color: #8b5a2b;
}

.manuscript-date {
    font-size: 1.1em;
    color: #6d4c2e;
    font-style: italic;
    letter-spacing: 1px;
}

.manuscript-date::before {
    content: '※ ';
    color: #8b5a2b;
}

.manuscript-date::after {
    content: ' ※';
    color: #8b5a2b;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin: 30px 0;
    padding: 30px;
    background: rgba(139, 90, 43, 0.08);
    border: 4px double #4a3425;
    border-radius: 0;
    position: relative;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.2);
}

.game-board::before {
    content: '◆';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    color: #8b5a2b;
    background: url('parchment_bg.png');
    padding: 0 15px;
}

.square {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f4e8d0 0%, #e8d4b0 100%);
    border: 3px double #4a3425;
    padding: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: inset 0 0 30px rgba(139, 90, 43, 0.3),
                0 4px 8px rgba(0, 0, 0, 0.3);
}

.square::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(139, 90, 43, 0.3);
    pointer-events: none;
}

.square:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(139, 90, 43, 0.3);
}

.square.start {
    background: linear-gradient(135deg, #d4af37 0%, #c9a961 100%);
    grid-column: 1;
    border-color: #8b6914;
    box-shadow: inset 0 0 40px rgba(212, 175, 55, 0.4),
                0 6px 12px rgba(0, 0, 0, 0.4);
}

.square.start::after {
    content: '✦';
    position: absolute;
    top: 3px;
    right: 3px;
    color: #8b6914;
    font-size: 0.8em;
}

.square.active {
    background: linear-gradient(135deg, #d4af37 0%, #c19a2e 100%);
    border-color: #8b6914;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.6); }
    50% { box-shadow: 0 0 50px rgba(212, 175, 55, 0.9); }
}

.square-number {
    font-family: 'Cinzel', serif;
    font-size: 1.2em;
    font-weight: 700;
    color: #2c1810;
    margin-bottom: 5px;
}

.square-title {
    font-family: 'Crimson Text', serif;
    font-size: 0.85em;
    color: #3d2817;
    font-weight: 600;
    line-height: 1.2;
}

.square-image {
    width: 60%;
    height: 60%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #4a3425;
    margin-bottom: 5px;
}

.controls {
    text-align: center;
    padding: 40px;
    background: rgba(139, 90, 43, 0.08);
    border: 4px double #4a3425;
    border-radius: 0;
    margin-top: 20px;
    position: relative;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.2);
}

.controls::before,
.controls::after {
    content: '❦';
    position: absolute;
    top: 15px;
    color: #8b5a2b;
    font-size: 1.2em;
}

.controls::before {
    left: 20px;
}

.controls::after {
    right: 20px;
}

.manuscript-button {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, #8b5a2b 0%, #6d4520 100%);
    color: #f4e8d0;
    border: 3px double #4a3425;
    padding: 15px 40px;
    font-size: 1.2em;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.manuscript-button:hover {
    background: linear-gradient(135deg, #a0672f 0%, #7d5124 100%);
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

.manuscript-button:active {
    transform: translateY(0);
}

.dice-result {
    font-family: 'Cinzel', serif;
    font-size: 2.5em;
    color: #2c1810;
    margin: 20px 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-turn {
    font-family: 'Cinzel', serif;
    font-size: 1.5em;
    color: #2c1810;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.current-turn span {
    font-weight: 700;
}

.current-position {
    font-family: 'Crimson Text', serif;
    font-size: 1.3em;
    color: #3d2817;
    font-weight: 600;
    margin-top: 15px;
}

.current-position span {
    color: #8b5a2b;
    font-weight: 700;
}

.player-marker {
    position: absolute;
    bottom: 5px;
    font-size: 1.8em;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    animation: bounce 1s ease-in-out infinite;
    z-index: 10;
}

.player-marker:first-of-type {
    left: 10px;
}

.player-marker:nth-of-type(2) {
    right: 10px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow-y: auto;
}

.modal-content {
    background: url('parchment_bg.png');
    background-size: cover;
    margin: 5% auto;
    padding: 50px;
    border: 6px double #4a3425;
    width: 90%;
    max-width: 700px;
    border-radius: 0;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.9),
                inset 0 0 60px rgba(139, 90, 43, 0.2);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 2px solid rgba(139, 90, 43, 0.4);
    border-style: double;
    pointer-events: none;
}

.modal-content::after {
    content: '✦';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    color: #8b5a2b;
}

.close {
    color: #4a3425;
    float: right;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #2c1810;
}

.question-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 2em;
    color: #2c1810;
    margin-bottom: 20px;
    margin-top: 20px;
    padding-bottom: 15px;
    border-bottom: 2px double #8b5a2b;
    text-align: center;
    letter-spacing: 1px;
}

.question-header h3::before {
    content: '※ ';
    color: #8b5a2b;
}

.question-header h3::after {
    content: ' ※';
    color: #8b5a2b;
}

.question-body p {
    font-family: 'Crimson Text', serif;
    font-size: 1.4em;
    color: #3d2817;
    line-height: 1.6;
    margin-bottom: 25px;
}

.answer-section {
    margin-top: 30px;
    padding: 25px;
    background: rgba(139, 90, 43, 0.12);
    border: 3px double #8b5a2b;
    border-radius: 0;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.answer-section::before {
    content: '◆';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: url('parchment_bg.png');
    padding: 0 10px;
    color: #8b5a2b;
}

.answer-section h4 {
    font-family: 'Cinzel', serif;
    font-size: 1.5em;
    color: #2c1810;
    margin-bottom: 15px;
}

.answer-section p {
    font-family: 'Crimson Text', serif;
    font-size: 1.3em;
    color: #3d2817;
    line-height: 1.6;
}

.score-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 3px double #4a3425;
}

.score-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5em;
    color: #2c1810;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.score-controls {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 25px;
}

.player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.player-name {
    font-family: 'Cinzel', serif;
    font-size: 1.3em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(139, 90, 43, 0.12);
    padding: 15px 25px;
    border: 2px double #4a3425;
    border-radius: 0;
}

.score-value {
    font-family: 'Cinzel', serif;
    font-size: 2.5em;
    color: #2c1810;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.score-button {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, #8b5a2b 0%, #6d4520 100%);
    color: #f4e8d0;
    border: 2px solid #4a3425;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.score-button:hover {
    background: linear-gradient(135deg, #a0672f 0%, #7d5124 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

.score-button:active {
    transform: translateY(0);
}

.manuscript-button.secondary {
    background: linear-gradient(135deg, #6d4520 0%, #5a3617 100%);
    font-size: 1em;
    padding: 10px 30px;
}

.manuscript-button.secondary:hover {
    background: linear-gradient(135deg, #7d5124 0%, #65401b 100%);
}

@media (max-width: 768px) {
    .score-controls {
        flex-direction: column;
        gap: 30px;
    }
    .manuscript-container {
        padding: 20px;
    }

    .manuscript-title {
        font-size: 2em;
    }

    .manuscript-subtitle {
        font-size: 1.2em;
    }

    .game-board {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .square-title {
        font-size: 0.7em;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }

    .question-header h3 {
        font-size: 1.5em;
    }

    .question-body p {
        font-size: 1.1em;
    }
}