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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #E8DCC4 0%, #F5EFE6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 900px;
    width: 95%;
    background: #FFFFFF;
    border-radius: 30px;
    box-shadow: 
        0 10px 40px rgba(107, 68, 35, 0.15),
        0 4px 12px rgba(107, 68, 35, 0.08);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #A5B770 0%, #8B9556 100%);
    color: #FFFFFF;
    padding: 35px 30px;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.screen {
    padding: 35px;
    min-height: 400px;
    display: none;
}

.screen.active {
    display: block;
}

.hidden {
    display: none !important;
}

h2 {
    color: #4A5D23;
    margin-bottom: 25px;
    font-weight: 600;
    font-size: 1.8rem;
}

h3 {
    color: #556B2F;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 600;
}

h4 {
    color: #556B2F;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

p {
    color: #6B4423;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

button {
    background: #FFFFFF;
    color: #556B2F;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 5px;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.15);
    position: relative;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(107, 68, 35, 0.25);
    background: #F5EFE6;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 3px 12px rgba(107, 68, 35, 0.15);
}

button:disabled {
    background: #E0E0E0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.secondary-btn {
    background: #A5B770;
    color: #FFFFFF;
    box-shadow: 0 4px 16px rgba(165, 183, 112, 0.3);
}

.secondary-btn:hover {
    background: #8B9556;
    box-shadow: 0 6px 24px rgba(165, 183, 112, 0.4);
}

#view-article-btn {
    background: #CD8558;
    color: #FFFFFF;
    font-size: 1.2rem;
    padding: 18px 36px;
    box-shadow: 0 6px 20px rgba(205, 133, 88, 0.4);
    font-weight: 700;
}

#view-article-btn:hover {
    background: #A0694F;
    box-shadow: 0 8px 28px rgba(205, 133, 88, 0.5);
    transform: translateY(-3px);
}

.point-btn, .option-btn {
    display: block;
    width: 100%;
    margin: 10px 0;
    text-align: left;
    background: #FFFFFF;
    color: #556B2F;
    border: 2px solid #E8DCC4;
    font-size: 1.1rem;
    border-radius: 20px;
}

.point-btn:hover, .option-btn:hover {
    background: #F5EFE6;
    border-color: #A5B770;
}

.point-btn.selected {
    background: #A5B770;
    color: #FFFFFF;
    border-color: #8B9556;
}

#start-points-list, #destination-points-list, #options-list {
    margin: 20px 0;
}

#current-location {
    background: #FFFFFF;
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 2px solid #E8DCC4;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.1);
}

#current-location h3 {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#current-location span {
    background: #A5B770;
    color: #FFFFFF;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
}

#scenario-content {
    background: #FFFFFF;
    padding: 25px;
    border-radius: 20px;
    border: 2px solid #E8DCC4;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.1);
}

#scenario-title {
    color: #4A5D23;
    font-size: 1.4rem;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px solid #E8DCC4;
    padding-bottom: 10px;
}

#scenario-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #6B4423;
    margin-bottom: 20px;
    text-align: justify;
}

#input-container {
    background: #F5EFE6;
    padding: 20px;
    border-radius: 20px;
    margin-top: 15px;
    border: 2px solid #E8DCC4;
}

#player-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E8DCC4;
    border-radius: 15px;
    font-size: 1rem;
    margin-bottom: 10px;
    background: #FFFFFF;
}

#player-input:focus {
    outline: none;
    border-color: #A5B770;
    box-shadow: 0 0 0 3px rgba(165, 183, 112, 0.2);
}

#end-screen {
    text-align: center;
}

#end-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #4A5D23;
}

#end-message {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: #6B4423;
}

.dice-result {
    display: inline-block;
    background: #FFFFFF;
    color: #556B2F;
    padding: 15px 25px;
    border: 3px solid #A5B770;
    border-radius: 20px;
    font-size: 2.5rem;
    font-weight: 700;
    min-width: 70px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(107, 68, 35, 0.15);
    transition: transform 0.1s ease;
}

#physical-dice-section {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#physical-dice-input {
    width: 80px;
    padding: 10px;
    font-size: 1.8rem;
    text-align: center;
    border: 2px solid #A5B770;
    border-radius: 10px;
    color: #556B2F;
    font-weight: 700;
}

.error-text {
    color: #c0392b;
    font-size: 0.95rem;
    margin: 0;
}

#object-physical-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

@keyframes dice-shake {
    0%   { transform: rotate(0deg) scale(1); }
    20%  { transform: rotate(-10deg) scale(1.15); }
    40%  { transform: rotate(10deg) scale(1.2); }
    60%  { transform: rotate(-7deg) scale(1.1); }
    80%  { transform: rotate(5deg) scale(1.05); }
    100% { transform: rotate(0deg) scale(1); }
}

.dice-rolling {
    animation: dice-shake 0.15s ease-in-out infinite;
    color: #A5B770;
}

#game-status {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.status-box {
    flex: 1;
    min-width: 200px;
    background: #FFFFFF;
    padding: 18px;
    border-radius: 20px;
    border: 2px solid #E8DCC4;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.1);
}

.status-box h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #556B2F;
}

.status-box span {
    color: #A5B770;
    font-weight: 700;
    font-size: 1.3rem;
}

#action-buttons {
    background: #FFFFFF;
    padding: 25px;
    border-radius: 20px;
    border: 2px solid #E8DCC4;
    text-align: center;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.1);
}

#action-buttons h3 {
    margin-bottom: 20px;
    color: #4A5D23;
}

#action-buttons button {
    min-width: 160px;
    margin: 10px;
    font-size: 1.1rem;
}

#available-destinations {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.destination-btn {
    background: #FFFFFF;
    color: #556B2F;
    border: 2px solid #E8DCC4;
    padding: 15px 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.12);
    border-radius: 25px;
    transition: all 0.2s ease;
    min-width: 180px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.destination-btn:hover {
    background: #F5EFE6;
    border-color: #A5B770;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 68, 35, 0.18);
}

.btn-icon {
    font-size: 1.3rem;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

#map-container {
    margin: 30px 0;
    background: #FFFFFF;
    padding: 25px;
    border: 2px solid #E8DCC4;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.1);
    overflow-x: auto;
}

#journey-details summary {
    list-style: none;
    user-select: none;
}

#journey-details summary::-webkit-details-marker {
    display: none;
}

#journey-details summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
    color: #A5B770;
}

#journey-details[open] summary::before {
    transform: rotate(90deg);
}

#grid-map {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    padding: 15px;
    background: #F5EFE6;
    border-radius: 15px;
    width: fit-content;
    min-width: 100%;
    transform: rotate(-90deg);
    transform-origin: center center;
}

.map-cell {
    aspect-ratio: 1;
    border: none;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 3px 12px rgba(107, 68, 35, 0.12);
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 15px;
    transition: all 0.2s ease;
    transform: rotate(90deg);
}

.map-cell.start {
    background: linear-gradient(135deg, #A5B770 0%, #8B9556 100%);
    color: #FFFFFF;
}

.map-cell.end {
    background: linear-gradient(135deg, #CD8558 0%, #A0694F 100%);
    color: #FFFFFF;
}

.map-cell.node {
    background: linear-gradient(135deg, #E8DCC4 0%, #F5EFE6 100%);
    color: #556B2F;
    border: 2px solid #E8DCC4;
}

.map-cell.house {
    background: linear-gradient(135deg, #CD8558 0%, #A0694F 100%);
    color: #FFFFFF;
}

.map-cell.placeholder {
    background: #F5F5F5;
    opacity: 0.4;
}

.map-cell.current {
    border: 3px solid #8B5A3C;
    box-shadow: 0 0 0 4px rgba(139, 90, 60, 0.3), 0 6px 20px rgba(107, 68, 35, 0.25);
    transform: scale(1.12);
    z-index: 10;
}

.map-cell.visited {
    opacity: 0.7;
    position: relative;
}

.map-cell.visited::after {
    content: '✓';
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 1rem;
    font-weight: bold;
}

.map-cell-id {
    font-size: 0.7rem;
    font-weight: 700;
}

.map-cell-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.9;
    margin-top: 2px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(85, 107, 47, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #FFFFFF;
    padding: 35px;
    border-radius: 30px;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 15px 50px rgba(107, 68, 35, 0.3);
}

#object-modal .modal-content,
#house-choice-modal .modal-content,
#event-modal .modal-content {
    background: linear-gradient(135deg, #F5EFE6 0%, #FFFFFF 100%);
    border: 2px solid #E8DCC4;
}

.modal-content h2 {
    margin-top: 0;
    color: #4A5D23;
    padding-bottom: 15px;
    text-align: center;
    border-bottom: 2px solid #E8DCC4;
    margin-bottom: 20px;
}

.modal-content p {
    color: #6B4423;
    line-height: 1.7;
}

.results-box {
    background: #FFFFFF;
    padding: 25px;
    border-radius: 20px;
    margin: 20px 0;
    border: 2px solid #E8DCC4;
    box-shadow: 0 4px 16px rgba(107, 68, 35, 0.12);
}

.results-box h3 {
    margin-top: 0;
    color: #4A5D23;
    border-bottom: 2px solid #E8DCC4;
    padding-bottom: 12px;
}

.results-box p {
    margin: 12px 0;
    font-size: 1.1rem;
}

.results-box strong {
    color: #A5B770;
    font-weight: 700;
}

@media (max-width: 600px) {
    .container {
        width: 98%;
        margin: 10px;
        border-radius: 20px;
    }
    
    .screen {
        padding: 20px;
    }
    
    header {
        padding: 25px 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    button {
        font-size: 1rem;
        padding: 12px 24px;
    }

    #game-status {
        flex-direction: column;
    }

    .status-box {
        min-width: 100%;
    }
    
    .modal-content {
        padding: 25px;
        border-radius: 20px;
    }
}
