/* ============================================================
   Dice & Dare — Shared Game Theme
   ============================================================ */

/* ---- Board layout ---- */
.game-board { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; min-height: calc(100vh - 80px); }
.board-body { display: flex; gap: 1rem; width: 100%; flex: 1; }

/* ---- Scoreboard ---- */
.scoreboard { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.score-card {
    background: linear-gradient(135deg, #2a1a0e 0%, #1c1008 100%);
    padding: 0.8rem 1.2rem; border-radius: 8px; text-align: center; min-width: 120px;
    border: 2px solid #5a3a28;
    box-shadow: inset 0 1px 0 rgba(240,192,64,0.05), 0 2px 8px rgba(0,0,0,0.3);
}
.score-card.active {
    border-color: #f0c040;
    box-shadow: 0 0 12px rgba(240,192,64,0.25), inset 0 1px 0 rgba(240,192,64,0.1);
}
.score-card.you { background: linear-gradient(135deg, #1a2a12 0%, #0d1a08 100%); border-color: #3d6b2a; }
.score-card.you.active { border-color: #f0c040; }
.score-name { font-size: 0.85rem; color: #c4a36a; font-weight: 600; letter-spacing: 0.03em; }
.score-value {
    font-size: 1.5rem; font-weight: 900; color: #f0c040;
    text-shadow: 0 0 8px rgba(240,192,64,0.3), 0 1px 0 #8b6914;
}

/* ---- Game area — felt table background ---- */
.game-area {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E") repeat,
        radial-gradient(ellipse at center, #1a5c2a 0%, #0d3d1a 70%, #082a10 100%) !important;
    border: 4px solid #3d2b1f !important;
    box-shadow:
        inset 0 0 60px rgba(0, 0, 0, 0.35),
        inset 0 0 120px rgba(0, 0, 0, 0.15),
        0 4px 20px rgba(0, 0, 0, 0.5) !important;
    border-radius: 16px !important;
    position: relative;
    flex: 1; padding: 1.5rem; text-align: center; min-width: 0;
    display: flex; flex-direction: column;
}

.game-area::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 20px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='20'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02 0.2' numOctaves='4' seed='2'/%3E%3CfeColorMatrix type='saturate' values='0.3'/%3E%3C/filter%3E%3Crect width='100' height='20' filter='url(%23w)' opacity='0.15'/%3E%3C/svg%3E") repeat,
        linear-gradient(135deg, #5a3a28 0%, #3d2b1f 40%, #4a3428 60%, #3d2b1f 100%);
    z-index: -1;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
}

.game-area::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.25) 100%);
    pointer-events: none;
    z-index: 0;
}

.game-area > * { position: relative; z-index: 1; }

/* ---- Player header ---- */
.player-header { margin-bottom: 0.5rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.player-header h3 { margin: 0; font-size: 1.5rem; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; }
.player-header.my-turn h3 { color: #f0c040; text-shadow: 0 0 12px rgba(240,192,64,0.4), 0 2px 0 #8b6914; }
.player-header.other-turn h3 { color: #e94560; text-shadow: 0 0 12px rgba(233,69,96,0.4); }

/* ---- Dice field — rolling center, kept sidebar far left ---- */
.dice-field { display: flex; align-items: flex-start; justify-content: center; gap: 1rem; margin: auto 0 1rem 0; position: relative; }
.kept-sidebar { 
    position: absolute; left: 0; top: 0;
    display: flex; flex-direction: column; gap: 0.2rem; 
    max-width: 220px; 
}
.kept-inline { display: flex; align-items: center; gap: 0.3rem; }
.kept-round-label { font-size: 0.65rem; color: #27ae60; font-weight: 700; min-width: 24px; }
.kept-tray { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rolling-section { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.pending-label { font-size: 0.7rem; color: #0fbcf9; text-transform: uppercase; letter-spacing: 0.05em; font-weight: bold; margin-top: 0.5rem; }
.pending-tray { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.pending-tray-area { min-height: 90px; display: flex; flex-direction: column; align-items: center; }
.dice-tray { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ---- SVG Dice ---- */
.die-svg-wrap {
    width: 64px; height: 64px; border: none; background: none; padding: 0;
    cursor: pointer; transition: all 0.15s; border-radius: 12px;
    box-sizing: border-box; display: inline-block;
}
.die-svg-wrap:hover:not(:disabled):not(.kept) { transform: scale(1.1); filter: drop-shadow(0 0 6px rgba(233, 69, 96, 0.6)); }
.die-svg-wrap.selected { transform: scale(1.1); filter: drop-shadow(0 0 10px rgba(15, 188, 249, 0.7)); }
.die-svg-wrap.busted { filter: drop-shadow(0 0 6px rgba(233, 69, 96, 0.5)); opacity: 0.8; }
.die-svg-wrap.kept { width: 48px; height: 48px; opacity: 0.75; cursor: default; }
.die-svg-wrap.empty-die { width: 64px; height: 64px; cursor: default; opacity: 0.3; }
.die-svg-wrap:disabled { cursor: default; }
.die-svg { width: 100%; height: 100%; display: block; }

/* ---- Info zone — fixed height to prevent bounce ---- */
.info-zone { text-align: center; min-height: 140px; }
.turn-info { margin: 0.8rem 0; font-size: 1.1rem; }
.turn-label { color: #c4a36a; font-weight: 600; letter-spacing: 0.03em; }
.turn-points { 
    color: #f0c040; font-weight: 900; font-size: 1.6rem; margin: 0 0.5rem;
    text-shadow: 0 0 10px rgba(240,192,64,0.3), 0 1px 0 #8b6914;
}
.dice-remaining { color: #8a7050; font-size: 0.85rem; font-style: italic; }

.status-text { font-size: 1rem; font-weight: 700; min-height: 1.5rem; padding: 0.3rem 0; }
.status-text.bust { color: #ff4757; text-shadow: 0 0 8px rgba(255,71,87,0.3); }
.status-text.score { color: #f0c040; text-shadow: 0 0 8px rgba(240,192,64,0.3); }
.status-text.fill { color: #2ed573; text-shadow: 0 0 8px rgba(46,213,115,0.3); }

/* ---- Commentary ---- */
.commentary {
    font-size: 1.4rem; font-weight: 900; text-align: center; padding: 0.8rem 1rem;
    min-height: 2rem; letter-spacing: 0.02em; line-height: 1.3;
    color: #f0c040;
    text-shadow: 0 0 10px rgba(240,192,64,0.4), 0 2px 0 #b8860b, 0 3px 0 #a0750a, 0 4px 6px rgba(0,0,0,0.4);
    animation: commentFade 0.5s ease-out;
}
.comment-gold { color: #f0c040; text-shadow: 0 0 10px rgba(240,192,64,0.4), 0 2px 0 #b8860b, 0 3px 0 #a0750a, 0 4px 6px rgba(0,0,0,0.4); }
.comment-red { color: #ff4757; text-shadow: 0 0 15px rgba(255,71,87,0.5), 0 2px 0 #b33040, 0 3px 0 #8b1a2a, 0 4px 6px rgba(0,0,0,0.4); }
.comment-green { color: #2ed573; text-shadow: 0 0 10px rgba(46,213,115,0.4), 0 2px 0 #1e8a4a, 0 3px 0 #15693a, 0 4px 6px rgba(0,0,0,0.4); }
.comment-cyan { color: #0fbcf9; text-shadow: 0 0 10px rgba(15,188,249,0.4), 0 2px 0 #0a7ab5, 0 3px 0 #065a8a, 0 4px 6px rgba(0,0,0,0.4); }
.comment-purple { color: #c56cf0; text-shadow: 0 0 10px rgba(197,108,240,0.4), 0 2px 0 #8854a0, 0 3px 0 #6a3f80, 0 4px 6px rgba(0,0,0,0.4); }
@keyframes commentFade {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---- Selection hint ---- */
.selection-info { font-size: 1.1rem; font-weight: 800; padding: 0.3rem 0; min-height: 1.5rem; }
.sel-valid { color: #2ed573; text-shadow: 0 0 8px rgba(46,213,115,0.3); }
.sel-invalid { color: #ff4757; text-shadow: 0 0 8px rgba(255,71,87,0.3); }

/* ---- Action buttons ---- */
.actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.card-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; align-items: center; margin-top: 0.5rem; min-height: 2.5rem; }

.btn-action {
    background: linear-gradient(180deg, #ff6b81 0%, #e94560 50%, #c0392b 100%);
    color: white; border: none; padding: 0.8rem 2rem; border-radius: 10px; font-size: 1.1rem;
    font-weight: 700; cursor: pointer; letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(233,69,96,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.2s ease;
}
.btn-action:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(233,69,96,0.6), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-action:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 2px 8px rgba(233,69,96,0.3); }
.btn-action:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-bank {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%);
    color: white; border: none; padding: 0.8rem 2rem; border-radius: 10px; font-size: 1.1rem;
    font-weight: 700; cursor: pointer; letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(39,174,96,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.2s ease;
}
.btn-bank:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(39,174,96,0.6); }
.btn-bank:active { transform: translateY(1px); }

.btn-draw-again {
    background: linear-gradient(180deg, #f9ca24 0%, #f39c12 50%, #d68910 100%);
    color: #1a1a2e; border: none; padding: 0.8rem 2rem; border-radius: 10px; font-size: 1.1rem;
    font-weight: 700; cursor: pointer; letter-spacing: 0.03em;
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(243,156,18,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
    transition: all 0.2s ease;
}
.btn-draw-again:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(243,156,18,0.6); }
.btn-draw-again:active { transform: translateY(1px); }

.waiting-turn { color: #8a7050; font-style: italic; padding: 1rem; }

/* ---- Active card in playfield ---- */
.active-card-area { display: flex; justify-content: center; margin: auto 0 0.5rem 0; min-height: 295px; }
.playfield-card { position: relative !important; width: 210px !important; height: 294px !important; font-size: 1.1rem !important; box-shadow: 0 0 25px rgba(255,255,255,0.2); }
.card-slot { width: 210px; height: 294px; border: 2px dashed rgba(255,255,255,0.15); border-radius: 10px; opacity: 0.3; }

/* ---- Card animations ---- */
.card-fly-in { animation: flyIn 0.5s ease-out; }
@keyframes flyIn {
    0% { transform: translateY(200px) scale(0.6); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.card-fly-out { animation: flyOut 0.4s ease-in forwards; }
@keyframes flyOut {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(200px) scale(0.6); opacity: 0; }
}

/* ---- Card draw area — deck and discard ---- */
.card-draw-area { display: flex; justify-content: center; align-items: flex-start; gap: 2rem; padding-top: 0.5rem; border-top: 1px solid rgba(255,255,255,0.1); }
.card-area { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.card-label { font-size: 0.75rem; color: #c4a36a; text-transform: uppercase; letter-spacing: 0.05em; }

/* Deck stack */
.deck-stack { position: relative; width: 208px; height: 292px; }
.deck-stack.clickable { cursor: pointer; }
.deck-stack.clickable:hover .card-back:nth-child(3) { box-shadow: 0 0 15px rgba(233,69,96,0.5); transform: scale(1.02); }

/* SVG Card Back */
.card-back {
    position: absolute; width: 200px; height: 280px; border-radius: 10px;
    background: none !important; border: none; box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    overflow: hidden;
}
.card-back:nth-child(1) { top: 6px; left: 6px; }
.card-back:nth-child(2) { top: 3px; left: 3px; }
.card-back:nth-child(3) { top: 0; left: 0; }
.card-back-svg { width: 100%; height: 100%; display: block; }
.card-back-img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 10px; }

/* Discard pile & card faces */
.discard-pile { position: relative; width: 208px; height: 292px; }
.card-face {
    position: absolute; width: 200px; height: 280px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-weight: bold; font-size: 1.1rem; box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.1); top: 0; left: 0;
    overflow: hidden; padding: 0 !important;
}
.card-face.old { opacity: 1; }
.card-face-svg { width: 100%; height: 100%; display: block; }
.card-face-img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 10px; }
.card-bonus { background: none; }
.card-fill { background: none; }
.card-mustbust { background: none; }
.card-nodice { background: none; }
.card-double { background: none; }
.card-vengeance { background: none; }
.card-empty { background: #1a1a2e; border: 2px dashed #333; color: #444; padding: 6px; }

/* ---- Game over ---- */
.game-over { padding: 2rem; }
.game-over h2 { color: #f0c040; text-shadow: 0 0 15px rgba(240,192,64,0.4), 0 2px 0 #8b6914; }

/* ---- Game log ---- */
.game-log {
    width: 280px; flex-shrink: 0; border-radius: 10px; padding: 1rem;
    max-height: 500px; overflow-y: auto;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='l'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.08' numOctaves='3' seed='12'/%3E%3CfeColorMatrix type='saturate' values='0.15'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23l)' opacity='0.08'/%3E%3C/svg%3E") repeat,
        linear-gradient(180deg, #2a1a0e 0%, #1c1008 50%, #150d06 100%);
    border: 2px solid #5a3a28;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.3);
}
.game-log h4 { margin: 0 0 0.5rem; color: #c4a36a; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.log-entries { display: flex; flex-direction: column; }
.log-entry { font-size: 0.82rem; color: #b8a080; padding: 0.2rem 0; border-bottom: 1px solid rgba(90,58,40,0.3); }
.log-entry.log-round { color: #f0c040; font-weight: bold; border-bottom: 1px solid rgba(240,192,64,0.2); margin-top: 0.3rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .board-body { flex-direction: column; }
    .game-log { width: 100%; max-height: 200px; }
}
