#game-screen,
#game-screen * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

canvas {
    touch-action: none;
}

#game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

#hud {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-2);
    align-items: start;
    padding: 0 14px;
    z-index: 20;
}

#back-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff, #dff9ff);
    color: #0a4c66;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0,0,0,0.20);
}

.hud-center {
    display: flex;
    justify-content: center;
}

.hud-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.hud-pill {
    min-width: 110px;
    text-align: center;
    padding: var(--space-3);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.76));
    color: var(--blue-dark);
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
}

#game-stage {
    flex: 1;
    min-height: 0;
    padding: 10px 14px 0;
    display: flex;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: var(--shadow);
}

.answer-panel {
    padding: var(--space-2);
    display: grid;
    gap: var(--space-2);
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: var(--space-2);
}

.answer-btn,
.action-btn,
.weight-btn {
    border: none;
    border-radius: 22px;
    padding: var(--space-4);
    cursor: pointer;
    font-weight: 900;
    font-size: 1.1rem;
    color: #0f456b;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.82));
    box-shadow: 0 12px 24px rgba(0,0,0,0.16);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.answer-btn:hover,
.action-btn:hover,
.weight-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(0,0,0,0.20);
    filter: brightness(1.03);
}

.answer-btn.correct,
.action-btn.correct {
    background: linear-gradient(180deg, #d9fff0, #7df1c2);
    color: #075239;
}

.answer-btn.wrong,
.action-btn.wrong {
    background: linear-gradient(180deg, #ffe0e4, #ff9eaa);
    color: #7d1223;
}

.weight-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(100px, 1fr));
    gap: var(--space-1);
}

.weight-btn {
    background: linear-gradient(180deg, #e7fcff, #bafcff);
    color: #0a4c66;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    background: linear-gradient(180deg, #fff4c3, #ffd93d);
    color: #694600;
}

.action-btn.secondary {
    background: linear-gradient(180deg, #ffffff, #e4f8ff);
    color: #0a4c66;
}

.coin-panel {
    display: grid;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.coin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.coin-btn {
    border: none;
    border-radius: 18px;
    min-height: 60px;
    cursor: pointer;
    font-weight: 900;
    font-size: 1rem;
    color: #0d446e;
    background: radial-gradient(circle at 30% 30%, #fff7cb, #ffd54a 60%, #e0a800);
    box-shadow: 0 10px 18px rgba(0,0,0,0.16);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.coin-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 14px 24px rgba(0,0,0,0.18);
    filter: brightness(1.03);
}

.coin-btn:active {
    transform: scale(0.98);
}

.coin-btn.silver {
    background: radial-gradient(circle at 30% 30%, #ffffff, #dfe7ee 55%, #aab8c3);
}

.coin-btn.copper {
    background: radial-gradient(circle at 30% 30%, #ffd9bf, #d98b52 55%, #9f5a2e);
    color: #fff;
}

.coin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.combo-badge {
    display: inline-block;
    padding: var(--space-1);
    border-radius: 999px;
    background: rgba(255, 217, 61, 0.18);
    border: 1px solid rgba(255, 217, 61, 0.35);
    color: #fff3a6;
    font-weight: 900;
    text-align: center;
}

.tabla-panel {
    display: grid;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.tabla-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-1)
}

.tabla-btn {
    border-radius: 14px;
    border: none;
    padding: var(--space-2);
    font-weight: 900;
    background: linear-gradient(180deg, #e8f7ff, #a6e1ff);
    cursor: pointer;
}

.tabla-btn:hover {
    transform: scale(1.05);
}

.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 16, 38, 0.72);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    padding: var(--space-5);
}

.card-content {
    width: min(460px, 94vw);
    padding: var(--space-5);
    border-radius: 30px;
    background: linear-gradient(180deg, #ffffff, #e9fbff);
    color: #0f456b;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.30);
    border: 5px solid rgba(255, 217, 61, 0.75);
}

.result-emoji {
    font-size: 3rem;
    margin-bottom: var(--space-1);
}

.card-content h2 {
    margin: 0 0 12px 0;
}

.card-content p {
    margin: 10px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.result-note {
    font-size: 0.95rem !important;
    color: #4d6d86;
}

.result-actions {
    margin-top: var(--space-4);
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
}

.result-action-btn {
    border: none;
    border-radius: 18px;
    padding: 14px 12px;
    cursor: pointer;
    font-weight: 900;
    font-size: 1rem;
    color: #0f456b;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.84));
    box-shadow: 0 12px 24px rgba(0,0,0,0.16);
}

.result-action-btn.primary {
    background: linear-gradient(135deg, #ffd93d, #ff9f43);
    color: #5b3a00;
}

.result-action-btn.secondary {
    background: linear-gradient(180deg, #e7fcff, #bafcff);
    color: #0a4c66;
}

.mobile-snake-controls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 30;
}

.mobile-snake-controls.hidden {
    display: none;
}

.snake-controls-left,
.snake-controls-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.snake-controls-left {
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.snake-controls-right {
    right: 10px;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.snake-touch-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.50);
    color: #0d446e;
    font-size: 22px;
    font-weight: 900;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.18);
    pointer-events: auto;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.snake-touch-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.68);
}

.menu-card {
    border-radius: 18px;
}

.sequence-box.active {
    outline: 3px solid #00eaff;
    transform: scale(1.05);
}