body {
    font-family: sans-serif;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    background-image: url('images/df67a4b8-ecd1-4f47-8b95-b82b7474e7f5.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    margin: 0;
}

body.game-active {
    align-items: flex-start;
    overflow: hidden;
}

body.game-active #game-container {
    --board-side-col: clamp(42px, 4vw, 60px);
    --board-main-col: clamp(68px, calc((100vw - 680px) / 6), 96px);
    --board-row: clamp(22px, calc((100vh - 92px) / 28), 48px);
    --board-title-row: clamp(34px, calc(var(--board-row) * 1.15), 54px);
}

body.game-active #board-area {
    grid-template-columns: clamp(120px, 12vw, 160px) minmax(0, 1fr) clamp(260px, 25vw, 340px);
    column-gap: 14px;
}

body.game-active .game-header {
    padding: 6px 4px;
}

body.game-active #game-container .app-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 4px;
}

body.game-active #game-container h1 {
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
}

#start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    max-width: 800px;
    width: 90%;
}
#start-screen .app-logo,
#game-container .app-logo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    border: 3px solid rgba(255,255,255,0.8);
    margin-bottom: 10px;
}


#start-screen h1 {
    color: #ff9a9e;
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.welcome-text {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.5;
}

.rules-section {
    margin: 30px 0;
    width: 100%;
}

.rules-section h2 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 25px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.rule-card {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #4a4a4a;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(168, 237, 234, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid rgba(255,255,255,0.4);
}

.rule-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(168, 237, 234, 0.4);
}

.rule-icon {
    font-size: 3em;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.rule-card h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.rule-card p {
    font-size: 1.05em;
    line-height: 1.4;
    opacity: 0.95;
}

#start-screen .player-input {
    margin: 30px 0;
    background: rgba(255,255,255,0.9);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e8f8f5;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

#start-screen .player-input label {
    font-size: 1.2em;
    color: #2c3e50;
    font-weight: bold;
    margin-right: 15px;
}

#start-screen input {
    padding: 12px;
    width: 80px;
    text-align: center;
    font-size: 1.3em;
    margin-left: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#start-screen input:focus {
    outline: none;
    border-color: #a8edea;
    box-shadow: 0 0 10px rgba(168, 237, 234, 0.3);
    transform: scale(1.05);
}

#start-screen button {
    padding: 15px 35px;
    font-size: 1.3em;
    cursor: pointer;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #8b5a3c;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(252, 182, 159, 0.3);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#start-screen button:hover {
    background: linear-gradient(135deg, #fcb69f 0%, #ff8a80 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(252, 182, 159, 0.4);
}

#start-screen button:active {
    transform: translateY(0);
    box-shadow: 0 5px 15px rgba(252, 182, 159, 0.3);
}

#board-area {
    position: relative;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 430px;
    align-items: start;
    gap: 14px;
    column-gap: 26px;
}

#board-area #board-shell {
    position: relative;
    margin: 10px 0;
    max-width: 100%;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(241, 247, 255, 0.75) 100%);
    box-shadow: 0 12px 28px rgba(18, 34, 68, 0.14);
    padding: 10px;
}

#game-container {
    width: min(1360px, calc(100vw - 12px));
    margin: 0 auto;
    text-align: left;
}

.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 0;
    padding: 10px 8px;
    grid-column: 1;
    grid-row: 1 / span 3;
}

#game-container h1 {
    margin: 0;
    color: #000;
    text-shadow: none;
    letter-spacing: 0.04em;
    font-size: 1.55rem;
    line-height: 1.2;
    text-align: center;
}

#board {
    display: grid;
    grid-template-columns: var(--board-side-col, 70px) repeat(6, var(--board-main-col, 120px)) var(--board-side-col, 70px);
    grid-template-rows: var(--board-title-row, auto) repeat(27, var(--board-row, 60px));
    border: 3px solid #333;
    width: calc((var(--board-side-col, 70px) * 2) + (var(--board-main-col, 120px) * 6));
    margin: 0;
    position: relative; /* Make it a positioning context for the players */
}

#game-container.horizontal-layout #board {
    grid-template-columns: 84px repeat(23, 58px) 84px;
    grid-template-rows: 60px 48px repeat(6, 64px) 48px;
    width: 1502px;
    border: 3px solid #36506f;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

#game-container.horizontal-layout .cell {
    font-size: 1em;
    padding: 4px;
}

#game-container.horizontal-layout .label {
    font-size: 1.3em;
    padding: 8px;
    letter-spacing: 0.04em;
}

#game-container.horizontal-layout .number-cell {
    font-size: 1.05em;
    background: linear-gradient(180deg, #ff8ca1 0%, #f9a7c3 100%);
}

#game-container.horizontal-layout .game-cell {
    background: linear-gradient(180deg, #f6fbff 0%, #edf4fb 100%);
}

#game-container.horizontal-layout .game-cell.special.special-card {
    background: linear-gradient(135deg, #cfe9ff 0%, #a9d2f3 100%);
}

#game-container.horizontal-layout .game-cell.special.special-back2 {
    background: linear-gradient(135deg, #ffe1be 0%, #f6c69c 100%);
}

#game-container.horizontal-layout .game-cell.arrival-cell {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    font-size: 0.96em;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    word-break: normal;
}

#game-container.horizontal-layout .game-cell:nth-child(odd) {
    filter: saturate(0.95);
}

#game-container.horizontal-layout #board-area {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 265px;
    align-items: start;
    gap: 14px;
}

#board-area #board-shell {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: 0;
}

#board-area #turn-indicator {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    margin-left: 6px;
}

#board-area #cards-pile {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
    margin-top: 8px;
    margin-left: 6px;
    padding: 14px 10px;
    border-radius: 14px;
}

#board-area #action-bar {
    grid-column: 3;
    grid-row: 3;
    width: 100%;
    margin: 8px 0 0 6px;
    padding: 22px;
    border-radius: 16px;
}

#board-area #action-bar .action-buttons {
    flex-direction: column;
    align-items: stretch;
}

#board-area #action-bar .action-buttons button {
    width: 100%;
    font-size: 1.24rem;
    padding: 16px 20px;
}

#board-area #action-bar #game-status {
    font-size: 1.28rem;
    line-height: 1.4;
}

#board-area #cards-pile .card-stack {
    width: 110px;
    height: 154px;
}

#board-area #cards-pile .card {
    width: 110px;
    height: 154px;
}

#board-area #cards-pile .cards-label {
    font-size: 1.45em;
    font-weight: 800;
}

#board-area #action-bar .action-buttons {
    gap: 14px;
}

#board-area #action-bar .action-buttons button {
    min-height: 58px;
}

body.game-active #board-area #turn-indicator {
    min-height: 78px;
    padding: 12px 8px;
    font-size: 1.25em;
}

body.game-active #board-area #cards-pile {
    padding: 8px;
}

body.game-active #board-area #cards-pile .card-stack,
body.game-active #board-area #cards-pile .card {
    width: 76px;
    height: 106px;
}

body.game-active #board-area #cards-pile .cards-label {
    font-size: 1.05em;
}

body.game-active #board-area #action-bar {
    padding: 10px;
}

body.game-active #board-area #action-bar #game-status {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

body.game-active #board-area #action-bar .action-buttons {
    gap: 8px;
}

body.game-active #board-area #action-bar .action-buttons button {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.9rem;
}

#board-area #turn-indicator {
    font-size: 1.95em;
    min-height: 110px;
    padding: 22px 12px;
}

#game-container.horizontal-layout #board-shell {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: 0;
}

#game-container.horizontal-layout .game-header {
    grid-column: 1;
    grid-row: 1 / span 3;
}

#game-container.horizontal-layout #turn-indicator {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
}

#game-container.horizontal-layout #cards-pile {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
    margin-top: 8px;
}

#game-container.horizontal-layout #action-bar {
    grid-column: 3;
    grid-row: 3;
    width: 100%;
    margin: 8px 0 0;
    padding: 10px;
}

#game-container.horizontal-layout .action-buttons {
    flex-direction: column;
    align-items: stretch;
}

#game-container.horizontal-layout .action-buttons button {
    width: 100%;
}

.cell {
    border: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2em;
    padding: 5px;
    text-align: center;
}

body.game-active #board .cell {
    font-size: clamp(0.58rem, 1.45vh, 0.95rem);
    padding: 2px;
    line-height: 1.05;
}

body.game-active #board .label {
    font-size: clamp(0.95rem, 2vh, 1.3rem);
    padding: 4px;
}

body.game-active #board .number-cell {
    font-size: clamp(0.72rem, 1.8vh, 1rem);
}

body.game-active #board .game-cell.special,
body.game-active #board .game-cell.start-cell {
    font-size: clamp(0.52rem, 1.25vh, 0.86rem);
}

body.game-active #board .game-cell.arrival-cell {
    font-size: clamp(0.58rem, 1.3vh, 0.9rem);
    letter-spacing: 0;
}

.label {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    font-size: 1.6em;
    font-weight: bold;
    padding: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.number-cell {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    font-weight: bold;
    font-size: 1.4em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-cell {
    background-color: #ecf0f1;
}

.game-cell.special {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    line-height: 1.2;
    color: #8b5a3c;
}

.game-cell.special.special-card {
    background: linear-gradient(135deg, #cfe9ff 0%, #a9d2f3 100%);
    color: #2d4f72;
    border-color: #89b8dd;
}

.game-cell.special.special-back2 {
    background: linear-gradient(135deg, #ffe1be 0%, #f6c69c 100%);
    color: #7b4d2a;
    border-color: #e0ad86;
}

.game-cell[data-row="0"],
.game-cell.start-cell {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    color: #8b5a3c;
}

.game-cell[data-row="12"], .game-cell[data-row="-12"],
.game-cell.arrival-cell {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #4a4a4a;
    font-size: 1.3em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    border: 2px solid #4f6f8f;
    letter-spacing: 0.04em;
}

.player {
    width: 34px;
    height: 40px;
    position: absolute;
    transition: all 0.5s ease;
    border: 3px solid var(--player-color);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    background-color: transparent;
    border-radius: 50% 50% 4px 4px;
}

body.game-active #board .player {
    width: clamp(18px, calc(var(--board-row) * 0.56), 30px);
    height: clamp(22px, calc(var(--board-row) * 0.66), 36px);
    border-width: 2px;
}

.player::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--player-color);
    border: 2px solid white;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
}

body.game-active #board .player::before {
    width: clamp(13px, calc(var(--board-row) * 0.42), 22px);
    height: clamp(13px, calc(var(--board-row) * 0.42), 22px);
    top: clamp(-13px, calc(var(--board-row) * -0.38), -8px);
    border-width: 2px;
}

.player.active {
    box-shadow: 0 0 15px 5px #2ecc71; /* Verde */
}

#turn-indicator {
    position: static;
    width: 150px;
    padding: 20px 10px;
    border: 3px solid #333;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    transition: background-color 0.3s ease;
    box-shadow: 0 8px 18px rgba(17, 34, 68, 0.2);
}

#cards-pile {
    position: static;
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(245, 250, 255, 0.7) 100%);
}

.card-stack {
    position: relative;
    width: 80px;
    height: 120px;
}

.card {
    position: absolute;
    width: 80px;
    height: 120px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: 2px solid #b8c5d6;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(168, 237, 234, 0.3);
    transition: transform 0.3s ease;
}

.card-1 { transform: translateY(0px) rotate(-2deg); }
.card-2 { transform: translateY(2px) rotate(1deg); }
.card-3 { transform: translateY(4px) rotate(-1deg); }
.card-4 { transform: translateY(6px) rotate(2deg); }
.card-5 { transform: translateY(8px) rotate(-1deg); }

.card-stack:hover .card {
    transform: translateY(-5px) rotate(0deg);
}

.cards-label {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.last-roll {
    width: min(180px, 100%);
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 2px solid rgba(124, 146, 188, 0.35);
    box-shadow: 0 6px 14px rgba(17, 34, 68, 0.12);
    text-align: center;
}

.last-roll-title {
    margin-bottom: 6px;
    color: #24344f;
    font-size: 0.86rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.last-roll-dice {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.last-roll-die {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 900;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16), 0 5px 10px rgba(0, 0, 0, 0.16);
}

.last-roll-green {
    background: linear-gradient(135deg, #2ecc40 0%, #1f9d34 100%);
}

.last-roll-red {
    background: linear-gradient(135deg, #ff4136 0%, #cf2b23 100%);
}

body.game-active #board-area #cards-pile .last-roll {
    padding: 7px;
}

body.game-active #board-area #cards-pile .last-roll-die {
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
}

#card-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.card-scene {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
    gap: 30px;
}

.animated-card {
    width: 200px;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 2s cubic-bezier(.64,-0.48,.4,1.48);
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
}

.card-face {
    position: absolute;
    width: 200px;
    height: 300px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #ffecd2 100%);
    border: 4px solid #fff;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        0 20px 40px rgba(168, 237, 234, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.4),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    backface-visibility: hidden;
    overflow: hidden;
}

.card-face::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: cardShine 3s ease-in-out infinite;
}

.card-face::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3);
    border-radius: 22px;
    z-index: -1;
    animation: borderGlow 4s linear infinite;
    background-size: 400% 400%;
}

.card-pattern {
    width: 100px;
    height: 100px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><radialGradient id="grad" cx="50%" cy="50%" r="50%"><stop offset="0%" style="stop-color:white;stop-opacity:1" /><stop offset="100%" style="stop-color:white;stop-opacity:0.3" /></radialGradient></defs><circle cx="50" cy="50" r="40" fill="none" stroke="url(%23grad)" stroke-width="4"/><path d="M30 50 L45 65 L70 35" stroke="url(%23grad)" stroke-width="4" fill="none" stroke-linecap="round"/></svg>') center/contain no-repeat;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.card-title {
    font-size: 2.7em;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Arial Black', sans-serif;
    letter-spacing: 2px;
}

.card-subtitle {
    font-size: 1.3em;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    text-align: center;
    opacity: 0.9;
}

.card-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: particleFloat 2s ease-out forwards;
}

@keyframes cardShine {
    0%, 100% { transform: translateX(-100%) translateY(-100%); }
    50% { transform: translateX(100%) translateY(100%); }
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0);
    }
}

.card-enter {
    animation: cardEnter 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes cardEnter {
    0% {
        transform: scale(0) rotateY(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotateY(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotateY(360deg);
        opacity: 1;
    }
}

.card-exit {
    animation: cardExit 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes cardExit {
    0% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotateY(180deg);
        opacity: 0;
    }
}

#card-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#card-modal.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#card-content {
    background-color: #e0f7ff;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    width: 90%;
    max-width: 350px;
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px dashed #007bff;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#card-title {
    color: #0056b3;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
}

#card-question {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
    min-height: 50px;
}

#card-reward {
    font-style: italic;
    color: #555;
    margin-top: 15px;
}

#card-challenge-area {
    margin: 20px 0;
}

#card-modal.visible #card-content {
    transform: scale(1);
}

#controls button {
    padding: 10px 20px;
    font-size: 1.1em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #4a4a4a;
    transition: all 0.3s ease;
    font-weight: bold;
}

#action-bar {
    width: min(980px, calc(100vw - 24px));
    margin: 14px auto 20px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(244, 248, 255, 0.96) 100%);
    border: 2px solid rgba(124, 146, 188, 0.35);
    box-shadow: 0 10px 28px rgba(20, 36, 76, 0.15);
}

#game-status {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2a44;
    margin-bottom: 10px;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.action-buttons button {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #e5f2ff 0%, #f3e9ff 100%);
    color: #24344f;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 6px 15px rgba(36, 52, 79, 0.16);
}

.action-buttons button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(36, 52, 79, 0.18);
}

.action-buttons button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

#confirm-move-btn {
    background: linear-gradient(135deg, #d8fce8 0%, #d7f0ff 100%);
}

#buy-card-btn {
    background: linear-gradient(135deg, #e3e2ff 0%, #f9e6ff 100%);
}

#tutorial-btn {
    background: linear-gradient(135deg, #fff8dc 0%, #ffe2b8 100%);
}

#tutorial-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 450;
}

.tutorial-content {
    width: min(760px, calc(100vw - 24px));
    background: linear-gradient(140deg, #ffffff 0%, #f7fbff 100%);
    border: 2px solid #d4e2f7;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(17, 31, 63, 0.3);
    padding: 30px;
    text-align: left;
}

.tutorial-content h3 {
    margin: 0 0 16px;
    color: #1d325c;
    font-size: 2.1em;
    text-align: center;
}

#tutorial-step-title {
    font-size: 1.45em;
    font-weight: 700;
    color: #2a3f67;
    margin-bottom: 12px;
    text-align: left;
}

#tutorial-step-text {
    margin: 0 0 20px;
    line-height: 1.55;
    color: #3c4f72;
    max-width: none;
    text-align: left;
    font-size: 1.2em;
}

#tutorial-progress {
    font-size: 1.08em;
    color: #5873a1;
    margin-bottom: 18px;
    font-weight: 700;
    text-align: left;
}

.tutorial-actions button {
    font-size: 1.05rem;
    padding: 12px 16px;
}

.tutorial-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.tutorial-actions button {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #e9f2ff 0%, #dff7ed 100%);
    color: #233a62;
}

.tutorial-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

@media (max-width: 980px) {
    .game-header {
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        width: 100%;
    }

    #board-area #board-shell {
        padding: 6px;
    }

    #turn-indicator,
    #cards-pile {
        position: static;
        margin: 8px auto;
        left: auto;
        top: auto;
    }

    #game-container.horizontal-layout #board-area {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    #board-area {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    #board-area #action-bar {
        margin-top: 8px;
        width: calc(100vw - 24px);
    }
}

#controls button:hover {
    background: linear-gradient(135deg, #fed6e3 0%, #a8edea 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(168, 237, 234, 0.3);
}

#dice-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.dice-scene {
    display: flex;
    gap: 50px;
    perspective: 1000px;
}

.die {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.5s cubic-bezier(.64,-0.48,.4,1.48);
}

.face {
    position: absolute;
    width: 100px;
    height: 100px;
    background-color: #fff;
    border: 3px solid #000;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

.dot {
    width: 20px;
    height: 20px;
    background-color: #000;
    border-radius: 50%;
}

/* --- Dice Face Layouts --- */
.face-1 { justify-content: center; align-items: center; }
.face-2 { justify-content: space-between; }
.face-2 .dot:first-child { align-self: flex-start; }
.face-2 .dot:last-child { align-self: flex-end; }
.face-3 { justify-content: space-between; }
.face-3 .dot:first-child { align-self: flex-start; }
.face-3 .dot:nth-child(2) { align-self: center; }
.face-3 .dot:last-child { align-self: flex-end; }
.face-4 { justify-content: space-between; }
.face-4 .column { display: flex; flex-direction: column; justify-content: space-between; }
.face-5 { justify-content: space-between; }
.face-5 .column { display: flex; flex-direction: column; justify-content: space-between; }
.face-5 .column:nth-child(2) { justify-content: center; }
.face-6 { justify-content: space-between; }
.face-6 .column { display: flex; flex-direction: column; justify-content: space-between; }


/* --- 3D Transformations --- */
.face-1 { transform: rotateY(  0deg) translateZ(50px); }
.face-6 { transform: rotateY(180deg) translateZ(50px); }
.face-2 { transform: rotateY( 90deg) translateZ(50px); }
.face-5 { transform: rotateY(-90deg) translateZ(50px); }
.face-3 { transform: rotateX( 90deg) translateZ(50px); }
.face-4 { transform: rotateX(-90deg) translateZ(50px); }

/* --- Colors --- */
#die-1.die .face { background-color: #2ecc40; } /* Green die - positivo */
#die-1.die .dot { background-color: #fff; }
#die-2.die .face { background-color: #ff4136; } /* Red die - negativo */
#die-2.die .dot { background-color: #fff; }

#restart-btn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
}

#restart-btn:hover {
    background: linear-gradient(135deg, #fecfef 0%, #ff9a9e 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 154, 158, 0.3);
}

/* Interface de Movimento */
.movement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.movement-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.movement-content h3 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.dice-info {
    margin: 30px 0;
    padding: 20px;
    background: rgba(168, 237, 234, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(168, 237, 234, 0.3);
}

.dice-result {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    gap: 20px;
}

.dice {
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.3em;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.dice.green {
    background: linear-gradient(135deg, #2ecc40 0%, #27ae60 100%);
}

.dice.red {
    background: linear-gradient(135deg, #ff4136 0%, #e74c3c 100%);
}

.calculation-hint {
    font-size: 1.2em;
    color: #2c3e50;
    margin: 10px 0;
    font-weight: bold;
}

.position-input {
    margin: 30px 0;
}

.position-input label {
    display: block;
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: bold;
}

.position-input input {
    padding: 15px;
    font-size: 1.3em;
    border: 3px solid #bdc3c7;
    border-radius: 10px;
    text-align: center;
    width: 200px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.position-input input:focus {
    outline: none;
    border-color: #a8edea;
    box-shadow: 0 0 15px rgba(168, 237, 234, 0.4);
    transform: scale(1.05);
}

#confirm-movement-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #4a4a4a;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(168, 237, 234, 0.3);
}

#confirm-movement-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(168, 237, 234, 0.4);
}

/* Mensagens de Sucesso e Erro */
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;
}

.message-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 450px;
    width: 90%;
    animation: messagePop 0.5s ease-out;
}

@keyframes messagePop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.message-icon {
    font-size: 4.5em;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.message-content h3 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 20px;
}

.message-content p {
    font-size: 1.2em;
    color: #4a4a4a;
    margin: 10px 0;
    line-height: 1.4;
}

.message-overlay.success .message-content {
    border: 4px solid #2ecc71;
}

.message-overlay.error .message-content {
    border: 4px solid #e74c3c;
}

.error-hint {
    color: #e74c3c !important;
    font-weight: bold;
    font-size: 1.2em;
    margin-top: 15px;
}

/* Estilos para Drag & Drop */
.instruction-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.instruction-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.instruction-content h3 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 30px;
    height: 30px;
    border: none;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.close-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.close-btn:active {
    transform: scale(0.95);
}

.drag-instruction {
    font-size: 1.3em;
    color: #e74c3c;
    font-weight: bold;
    margin-top: 20px;
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 10px;
    border: 2px solid rgba(231, 76, 60, 0.3);
}

/* Pino arrastável */
.player.draggable {
    cursor: grab;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(52, 152, 219, 0.5));
}

.player.draggable:hover {
    cursor: grabbing;
    transform: scale(1.1);
}

.player.draggable:active {
    cursor: grabbing;
}

/* Células drop zone */
.game-cell.drop-zone {
    border: 3px dashed #3498db;
    background-color: rgba(52, 152, 219, 0.1);
    transition: all 0.3s ease;
}

.game-cell.drop-zone:hover {
    background-color: rgba(52, 152, 219, 0.2);
    border-color: #2980b9;
}

/* Estilos removidos - não queremos mostrar casas válidas */ 
