html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        #87CEEB 0%,
        #87CEEB 30%,
        #1E90FF 30%,
        #0066CC 50%,
        #004080 100%);
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-sizing: border-box;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Top Bar Container - Fixed position, outside game-container for Safari iOS */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 15px;
    padding-top: max(12px, env(safe-area-inset-top, 12px));
    padding-left: max(15px, env(safe-area-inset-left, 15px));
    padding-right: max(15px, env(safe-area-inset-right, 15px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    z-index: 9999;
    pointer-events: auto;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.top-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

.top-bar-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    white-space: nowrap;
}

.home-button {
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.collection-button {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

.shop-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    color: #000;
}

.top-bar-btn:hover {
    transform: scale(1.05);
}

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

/* Bottom Score Panel - Fixed position for mobile HP */
#score-panel {
    position: fixed;
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    left: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 18px;
    border-radius: 25px;
    display: flex;
    gap: 16px;
    pointer-events: auto;
    max-width: 95vw;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    font-size: 17px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

#start-screen,
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 40, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    text-align: center;
    z-index: 500;
    box-sizing: border-box;
    padding: 20px;
}

#start-screen h1,
#game-over-screen h1 {
    font-size: 48px;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

#start-screen p,
#game-over-screen p {
    font-size: 18px;
    color: #ddd;
}

#start-screen button,
#game-over-screen button {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #00B4DB 0%, #0083B0 100%);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 15px rgba(0, 150, 200, 0.4);
}

#start-screen button:hover,
#game-over-screen button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 150, 200, 0.6);
}

#start-screen button:active,
#game-over-screen button:active {
    transform: scale(0.98);
}

#final-score,
#final-fish {
    font-weight: bold;
    color: #00B4DB;
    font-size: 24px;
}

/* Money Display */
.money-item .score-value {
    color: #FFD700;
}

#score-panel .score-item:nth-child(4) .score-value {
    color: #8B4513;
}

/* Message Notification */
#message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    border-radius: 10px;
    border: 2px solid #FFD700;
    animation: fadeInOut 2s ease-in-out;
    pointer-events: none;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Fish Catch Notification */
#fish-catch-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 450px;
    max-width: 90vw;
    background: rgba(0, 20, 40, 0.98);
    border-radius: 25px;
    border: 4px solid #FFD700;
    padding: 30px;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#fish-catch-notification.show {
    opacity: 1;
    visibility: visible;
    animation: popIn 0.4s ease-out;
}

@keyframes popIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#fish-catch-notification.hide {
    animation: popOut 0.3s ease-in forwards;
}

@keyframes popOut {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.fish-catch-content {
    text-align: center;
}

.fish-catch-content h2 {
    color: #FFD700;
    font-size: 28px;
    margin-bottom: 25px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.fish-catch-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.fish-catch-icon {
    font-size: 80px;
    animation: bounce 0.6s ease-in-out infinite alternate;
}

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

.fish-catch-details {
    flex: 1;
    text-align: left;
}

.fish-catch-name {
    font-size: 26px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.fish-catch-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fish-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.fish-stat-label {
    font-size: 16px;
    color: #aaa;
}

.fish-stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #00B4DB;
}

/* Rarity colors */
.fish-rarity-1 { color: #888; } /* Common - Gray */
.fish-rarity-2 { color: #1EFF00; } /* Uncommon - Green */
.fish-rarity-3 { color: #0070DD; } /* Rare - Blue */
.fish-rarity-4 { color: #A335EE; } /* Very Rare - Purple */
.fish-rarity-5 { color: #FF8000; } /* Legendary - Orange */
.fish-rarity-6 { color: #FF1493; text-shadow: 0 0 10px #FF1493, 0 0 20px #FF69B4; } /* ????? - Glowing Pink */

/* QTE Panel */
#qte-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    background: rgba(0, 20, 40, 0.95);
    border-radius: 20px;
    border: 3px solid #FFD700;
    padding: 20px;
    pointer-events: none;
    z-index: 50;
}

#qte-panel.shake {
    animation: qteShake 0.1s ease-in-out infinite;
}

@keyframes qteShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-51%, -50%) rotate(-1deg); }
    75% { transform: translate(-49%, -50%) rotate(1deg); }
}

.qte-content {
    text-align: center;
}

.qte-content h3 {
    color: #FFD700;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.qte-problem {
    font-size: 40px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6);
}

.qte-answer {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 800;
    color: #FFD700;
    background: rgba(255, 255, 255, 0.08);
    border: 3px solid rgba(255, 215, 0, 0.5);
    border-radius: 12px;
    margin-bottom: 18px;
    letter-spacing: 4px;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.qte-answer.wrong {
    color: #FF4D4D;
    border-color: #FF4D4D;
    animation: qteWrong 0.3s ease;
}

@keyframes qteWrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.qte-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.qte-timer {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.qte-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #00B4DB, #FFD700);
}

.qte-timer-bar.warning {
    background: linear-gradient(90deg, #FFA500, #FF6347);
}

.qte-timer-bar.danger {
    background: linear-gradient(90deg, #FF6347, #DC143C);
    animation: dangerPulse 0.3s ease-in-out infinite;
}

@keyframes dangerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Shop Sections */
.shop-section {
    color: #FFD700;
    font-size: 18px;
    margin: 20px 0 15px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.money-bait {
    margin-left: 20px;
    font-size: 20px;
    color: #8B4513;
}

.money-bait span {
    font-weight: bold;
}

/* Bait Grid */
.bait-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.bait-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(139, 69, 19, 0.1);
    border-radius: 12px;
    border: 2px solid rgba(139, 69, 19, 0.3);
    transition: all 0.2s;
}

.bait-item:hover {
    background: rgba(139, 69, 19, 0.2);
    border-color: rgba(139, 69, 19, 0.5);
    transform: translateY(-2px);
}

.bait-icon {
    font-size: 32px;
}

.bait-info {
    text-align: center;
}

.bait-name {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
}

.bait-cost {
    font-size: 13px;
    font-weight: bold;
    color: #FFD700;
}

.bait-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.bait-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.5);
}

.bait-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.bait-btn:disabled {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    cursor: not-allowed;
    opacity: 0.5;
}

.bait-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Shop Panel */
#shop-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 40, 0.95);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: 2000;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.shop-header h2 {
    font-size: 28px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.close-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 100, 100, 0.5);
    border-color: #ff6464;
    transform: rotate(90deg);
}

.shop-content {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
}

.money-display {
    text-align: center;
    padding: 15px;
    margin-bottom: 20px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.money-label {
    font-size: 14px;
    color: #aaa;
    margin-right: 10px;
}

.money-value {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.upgrade-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.upgrade-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 180, 219, 0.5);
    transform: translateY(-2px);
}

.upgrade-icon {
    font-size: 36px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
}

.upgrade-level {
    font-size: 12px;
    color: #00B4DB;
    margin-bottom: 6px;
}

.upgrade-desc {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 4px;
}

.upgrade-effect {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.upgrade-purchase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upgrade-cost {
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
}

.upgrade-btn {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #00B4DB 0%, #0083B0 100%);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.upgrade-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 180, 219, 0.5);
}

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

.upgrade-btn.disabled {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    cursor: not-allowed;
    opacity: 0.5;
}

.upgrade-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.upgrade-btn.maxed {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    cursor: default;
}

.upgrade-btn.maxed:hover {
    transform: none;
    box-shadow: none;
}

/* Scrollbar styling for shop */
.shop-content::-webkit-scrollbar {
    width: 8px;
}

.shop-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.shop-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.shop-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Collection Panel */
#collection-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 40, 0.95);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: 2000;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    gap: 20px;
}

.collection-header h2 {
    font-size: 28px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.collection-stats {
    display: flex;
    align-items: center;
    gap: 15px;
}

.collection-progress {
    font-size: 20px;
    font-weight: bold;
    color: #00B4DB;
}

.collection-percent {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.collection-content {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
}

/* Collection Rarity Sections */
.collection-rarity-section {
    margin-bottom: 25px;
}

.collection-rarity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.collection-rarity-title {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.collection-rarity-count {
    font-size: 16px;
    color: #aaa;
    font-weight: bold;
}

/* Collection Fish Grid */
.collection-fish-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.collection-fish-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    min-height: 100px;
}

.collection-fish-item.caught {
    background: rgba(0, 180, 219, 0.1);
    border-color: rgba(0, 180, 219, 0.3);
}

.collection-fish-item.caught:hover {
    background: rgba(0, 180, 219, 0.15);
    border-color: rgba(0, 180, 219, 0.5);
    transform: translateY(-3px);
}

.collection-fish-item.uncaught {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
    opacity: 0.6;
}

.collection-fish-icon {
    font-size: 48px;
    line-height: 1;
}

.collection-fish-item.uncaught .collection-fish-icon {
    font-size: 36px;
    color: #666;
}

.collection-fish-name {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.collection-fish-item.uncaught .collection-fish-name {
    color: #666;
    font-style: italic;
}

/* Scrollbar styling for collection */
.collection-content::-webkit-scrollbar {
    width: 8px;
}

.collection-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.collection-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.collection-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Home Button */
.home-button {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    text-decoration: none;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.home-button:hover {
    transform: scale(1.05);
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.home-button:active {
    transform: scale(0.95);
}

/* Numeric keypad for Mobile QTE (Hidden on Desktop) */
.qte-virtual-pad {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    pointer-events: auto;
}

.qte-vbtn {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 165, 0, 0.35));
    border: 2px solid #FFD700;
    color: #FFF;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, background 0.1s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.qte-vbtn:active {
    transform: scale(0.9);
    background: rgba(255, 215, 0, 0.6);
}

.qte-vbtn-del {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.35), rgba(220, 20, 60, 0.45));
    border-color: #FFA500;
}

.qte-vbtn-ok {
    background: linear-gradient(135deg, rgba(30, 255, 0, 0.3), rgba(0, 180, 100, 0.5));
    border-color: #1EFF00;
}

@media (max-width: 600px) {
    #top-bar {
        padding: 6px 8px;
        padding-top: max(6px, env(safe-area-inset-top, 6px));
        gap: 6px;
    }
    .top-bar-btn {
        padding: 5px 8px;
        font-size: 11px;
        border-radius: 14px;
        gap: 3px;
    }
    .top-bar-actions {
        gap: 5px;
    }
    #score-panel {
        bottom: max(8px, env(safe-area-inset-bottom, 8px));
        padding: 5px 10px;
        gap: 10px;
        border-radius: 20px;
    }
    .score-label {
        font-size: 8px;
    }
    .score-value {
        font-size: 14px;
    }
    #qte-panel {
        top: 64px;
        left: 4vw;
        right: 4vw;
        width: auto;
        transform: none;
        -webkit-transform: none;
        padding: 12px;
    }
    #qte-panel.shake {
        animation: qteShakeMobile 0.12s ease-in-out infinite;
    }
    .qte-content h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    .qte-problem {
        font-size: 30px;
        margin-bottom: 8px;
    }
    .qte-answer {
        min-height: 48px;
        font-size: 32px;
        margin-bottom: 10px;
    }
    .qte-hint {
        display: none;
    }
    @keyframes qteShakeMobile {
        0%, 100% { transform: rotate(0deg); }
        25% { transform: rotate(-0.6deg); }
        75% { transform: rotate(0.6deg); }
    }
    .qte-virtual-pad.active {
        display: grid;
        grid-template-columns: repeat(3, clamp(46px, 13vw, 68px));
        position: fixed;
        bottom: calc(max(8px, env(safe-area-inset-bottom, 8px)) + 84px);
        left: 50%;
        transform: translateX(-50%);
        -webkit-transform: translateX(-50%);
        margin-top: 0;
        z-index: 9999;
        background: rgba(0, 20, 40, 0.9);
        padding: 6px;
        border-radius: 16px;
        border: 2px solid rgba(255, 215, 0, 0.6);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        gap: 6px;
        opacity: 0.5;
    }
    .qte-vbtn {
        width: clamp(46px, 13vw, 68px);
        height: clamp(46px, 13vw, 68px);
        font-size: clamp(20px, 6vw, 30px);
        border-radius: 12px;
    }
    #start-screen {
        padding: 65px 15px 20px 15px;
        gap: 10px;
    }
    #start-screen h1 {
        font-size: 24px;
    }
    #start-screen p {
        font-size: 13px;
    }
    #start-btn {
        margin-top: 10px !important;
        padding: 10px 25px !important;
        font-size: 16px !important;
    }
}


