/* =========================================================
   MINER styles
   ---------------------------------------------------------
   The CSS is split into small sections so designers can tune
   visual systems without touching game logic.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
    --bg-color: #0d0d11;
    --grid-bg: #2d2d36;
    --tile-empty: #1a1a20;
    --tile-wall: #3e3e4e;
    --text-main: #e0e0e0;
    --text-muted: #888;
    --accent-primary: #00f3ff;
    --accent-secondary: #ff0055;
    --accent-tertiary: #ccff00;
    --accent-gold: #ffb700;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --tile-size: 60px;
    --gap-size: 8px;
}

/* ---------- Base layout ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

body {
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud {
    width: 100%;
    margin-bottom: 20px;
    padding: 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--accent-primary);
}

.stats {
    font-size: 0.9rem;
    color: var(--text-muted);
}

#msg-log {
    margin-left: 15px;
    color: var(--accent-primary);
    font-weight: bold;
}

/* ---------- Mine grid ---------- */
#game-container {
    position: relative;
    padding: 20px;
    background: var(--grid-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.grid-container {
    position: relative;
    width: calc((var(--tile-size) * 5) + (var(--gap-size) * 4));
    height: calc((var(--tile-size) * 5) + (var(--gap-size) * 4));
}

.tile {
    position: absolute;
    width: var(--tile-size);
    height: var(--tile-size);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    cursor: default;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.tile.wall {
    background: var(--tile-wall);
    border: 1px solid #555;
}

.tile.wall:hover {
    filter: brightness(1.2);
    cursor: crosshair;
}

.tile.empty {
    background: var(--tile-empty);
}

.tile.start {
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid var(--accent-tertiary);
}

.tile.finish {
    background: rgba(255, 183, 0, 0.2);
    border: 1px solid var(--accent-gold);
}

.tile.silver {
    background: linear-gradient(135deg, #3e3e4e 0%, #7d7d8a 50%, #3e3e4e 100%);
    border: 1px solid #aaa;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.tile.silver::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 10%, transparent 10.5%);
    background-size: 15px 15px;
    animation: sparkle 2s linear infinite;
}

.hp-indicator {
    z-index: 1;
    color: #fff;
    font-weight: bold;
}

.item-pickup {
    width: 20px;
    height: 30px;
    border-radius: 3px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    animation: bounce 1.5s infinite ease-in-out;
}

.player {
    position: absolute;
    z-index: 10;
    width: var(--tile-size);
    height: var(--tile-size);
    border-radius: 50%;
    pointer-events: none;
    background: transparent url('miner-sprite.png') center / cover no-repeat;
    box-shadow: 0 0 15px var(--accent-primary);
    transform: scale(0.8);
    transition: top 0.2s, left 0.2s;
}

.arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 15px solid var(--bg-color);
    transform-origin: center center;
}

/* ---------- Cards ---------- */
#hand-container {
    position: relative;
    width: 100%;
    height: 180px;
    margin-top: auto;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
}

.card {
    position: absolute;
    bottom: 20px;
    width: 90px;
    height: 130px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transform-origin: center bottom;
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.card.selected {
    border: 2px solid var(--accent-primary);
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-primary);
}

.card.selected-booster,
.card.booster {
    border-color: var(--accent-gold);
}

.card.selected-booster {
    border-width: 2px;
    background: rgba(255, 183, 0, 0.1);
    box-shadow: 0 0 15px var(--accent-gold);
}

.card.mining { color: var(--accent-primary); }
.card.booster { color: var(--accent-gold); }

.card-value {
    font-size: 2rem;
    font-weight: 900;
}

.card-type {
    margin-top: 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.deck-shake { animation: deckShake 0.3s ease-out; }
.card-spin-in { animation: spinIn 0.5s ease-out; }

/* ---------- Controls and modal ---------- */
#controls-hint { margin-top: 6px; }

#deck-controls {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

button {
    padding: 10px 20px;
    border: 0;
    border-radius: 5px;
    background: var(--accent-primary);
    color: #000;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

button:active { transform: scale(0.95); }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-secondary);
    color: var(--accent-secondary);
    box-shadow: 0 0 5px rgba(255, 0, 85, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 0, 85, 0.1);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    padding: 40px;
    border: 1px solid var(--accent-primary);
    border-radius: 15px;
    background: var(--grid-bg);
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.2);
}

.modal-content p { margin: 12px 0 20px; }
.hidden { display: none !important; }

/* ---------- Animations ---------- */
@keyframes sparkle {
    0% { transform: translateY(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-10px); opacity: 0; }
}

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

@keyframes deckShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    50% { transform: rotate(-2deg); }
    75% { transform: rotate(1deg); }
}

@keyframes spinIn {
    from { transform: translateY(-200px) rotate(720deg) scale(0); opacity: 0; }
    to { opacity: 1; }
}

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