/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #1a0e00;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    max-height: 800px;
    background: #2a1a00;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.2);
    display: flex;
    flex-direction: column;
}

/* Top bar */
#top-bar {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #3d2200 0%, #2a1a00 100%);
    border-bottom: 1px solid #5a3a00;
    z-index: 10;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #f0d080;
    font-size: 13px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 10px;
    border-radius: 30px;
    border: 1px solid #5a3a00;
}

.stat-item .value {
    color: #ffd700;
    min-width: 24px;
    text-align: center;
}

/* CSS-drawn icons */
.icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    vertical-align: middle;
}

.icon-coin {
    background: radial-gradient(circle at 30% 30%, #fff8a0, #ffd700 60%, #b8860b);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

.icon-gem {
    position: relative;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #7ff0ff 0%, #00d4ff 50%, #0099cc 100%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 0 6px rgba(0, 212, 255, 0.7);
}

.icon-heart {
    position: relative;
    width: 12px;
    height: 11px;
}
.icon-heart::before,
.icon-heart::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 9px;
    background: #ff4466;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 0 4px rgba(255, 68, 102, 0.6);
}
.icon-heart::before {
    left: 6px;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
}
.icon-heart::after {
    left: 0;
    transform: rotate(45deg);
    transform-origin: 100% 100%;
}

.icon-pickaxe {
    position: relative;
    width: 14px;
    height: 14px;
}
.icon-pickaxe::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    width: 2px;
    height: 14px;
    background: #c0a060;
    border-radius: 1px;
    transform: rotate(-30deg);
}
.icon-pickaxe::after {
    content: '';
    position: absolute;
    left: 1px;
    top: 3px;
    width: 12px;
    height: 3px;
    background: #c0a060;
    border-radius: 2px;
    transform: rotate(-15deg);
}

/* Canvas */
#canvas-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a0e00;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 20;
    transition: opacity 0.3s;
    padding: 20px;
    text-align: center;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* LINEA LOGO on start screen */
#lineaLogo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin-bottom: 12px;
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.6),
                0 0 48px rgba(0, 212, 255, 0.25);
    animation: logoPulse 3s ease-in-out infinite;
    object-fit: cover;
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 24px rgba(0, 212, 255, 0.6), 0 0 48px rgba(0, 212, 255, 0.25); }
    50%      { transform: scale(1.05); box-shadow: 0 0 32px rgba(0, 212, 255, 0.8), 0 0 64px rgba(0, 212, 255, 0.35); }
}

.overlay h1 {
    color: #ffd700;
    font-size: 28px;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.overlay h2 {
    color: #f0d080;
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 400;
}

.overlay p {
    color: #c0a060;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.total-gold {
    color: #ffd700 !important;
    font-size: 14px !important;
    font-weight: 600;
    margin-top: 4px;
}

.total-gold span:last-child {
    color: #fff;
}

/* Buttons */
.btn {
    background: linear-gradient(180deg, #ffd700 0%, #e6a800 100%);
    border: none;
    border-radius: 50px;
    padding: 16px 48px;
    font-size: 20px;
    font-weight: 700;
    color: #2a1a00;
    cursor: pointer;
    box-shadow: 0 6px 0 #8a6000, 0 8px 20px rgba(255, 215, 0, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    margin-top: 16px;
    min-width: 200px;
    letter-spacing: 1px;
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #8a6000, 0 4px 10px rgba(255, 215, 0, 0.2);
}

.btn.secondary {
    background: linear-gradient(180deg, #00d4ff 0%, #0099cc 100%);
    box-shadow: 0 6px 0 #006688, 0 8px 20px rgba(0, 212, 255, 0.3);
    color: #fff;
    font-size: 16px;
    padding: 12px 36px;
    margin-top: 10px;
}

.btn.secondary:active {
    box-shadow: 0 2px 0 #006688, 0 4px 10px rgba(0, 212, 255, 0.2);
}

.exchange-box {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #5a3a00;
    border-radius: 16px;
    padding: 14px 20px;
    margin: 8px 0;
    width: 100%;
    max-width: 320px;
}

.exchange-box .rate {
    color: #ffd700;
    font-size: 18px;
    font-weight: 700;
}

.exchange-box .sub {
    color: #c0a060;
    font-size: 12px;
    margin-top: 4px;
}

.howto-content {
    text-align: left;
    max-width: 340px;
    width: 100%;
    color: #c0a060;
    font-size: 14px;
    line-height: 1.7;
}

.howto-content p {
    margin-bottom: 10px;
}

.gameover-stats {
    display: flex;
    gap: 18px;
    margin: 10px 0 16px;
}

.gameover-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.gameover-stats .stat .num {
    color: #ffd700;
    font-size: 28px;
    font-weight: 700;
}

.gameover-stats .stat .label {
    color: #c0a060;
    font-size: 12px;
    margin-top: 4px;
}

#lang-toggle {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 30;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #5a3a00;
    color: #f0d080;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    min-width: 44px;
    text-align: center;
}

.touch-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(240, 208, 128, 0.5);
    font-size: 12px;
    text-align: center;
    pointer-events: none;
    animation: fadeHint 2s ease-in-out infinite;
}

@keyframes fadeHint {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Safari gate */
#safariGate {
    z-index: 100;
    background: rgba(0, 0, 0, 0.92);
}

#safariGate h1 {
    color: #00d4ff;
    font-size: 26px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

#safariGate h2 {
    color: #f0d080;
    font-size: 15px;
    margin-bottom: 18px;
    font-weight: 400;
}

#safariGate p {
    color: #c0a060;
    font-size: 14px;
    line-height: 1.7;
    max-width: 340px;
}

#safariGate .safari-tip {
    color: #00d4ff;
    font-size: 13px;
    margin-top: 12px;
    opacity: 0.9;
}

/* Copy toast */
.copy-toast {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 212, 255, 0.95);
    color: #002233;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.copy-toast.show {
    opacity: 1;
}

.copy-toast.hidden {
    display: none;
}

::-webkit-scrollbar {
    display: none;
}