* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0d0d1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
    color: #e0e0ff;
}

#game-wrapper {
    position: relative;
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16/10;
    border: 3px solid #2a1f4e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 0 30px rgba(100, 60, 200, 0.3),
        inset 0 0 20px rgba(0,0,0,0.5);
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

/* Watch Button */
#watch-btn {
    position: absolute;
    bottom: 60px;
    left: 12px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

#watch-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 220, 0.4) 0%, transparent 70%);
    animation: pulse-glow 2s ease-in-out infinite;
}

#watch-icon {
    position: relative;
    font-size: 28px;
    filter: drop-shadow(0 0 6px #00ffd4);
    z-index: 2;
    animation: bob 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

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

/* Watch Overlay */
#watch-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

#watch-overlay.hidden {
    display: none;
}

#watch-panel {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#watch-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #00ffd4;
    box-shadow:
        0 0 20px rgba(0, 255, 212, 0.5),
        inset 0 0 20px rgba(0, 255, 212, 0.15);
    animation: ring-spin 8s linear infinite;
    background: conic-gradient(from 0deg, transparent 0%, rgba(0,255,212,0.1) 25%, transparent 50%, rgba(0,255,212,0.1) 75%, transparent 100%);
}

@keyframes ring-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#watch-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

#watch-title {
    font-size: 9px;
    color: #00ffd4;
    text-shadow: 0 0 8px #00ffd4;
    letter-spacing: 2px;
}

#watch-input {
    width: 220px;
    padding: 8px 12px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background: rgba(0, 20, 30, 0.9);
    border: 2px solid #00ffd4;
    border-radius: 4px;
    color: #e0fffa;
    outline: none;
    text-align: center;
}

#watch-input::placeholder {
    color: rgba(0, 255, 212, 0.4);
    font-size: 6px;
}

#watch-input:focus {
    box-shadow: 0 0 12px rgba(0, 255, 212, 0.4);
}

#conjure-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 10px 24px;
    background: linear-gradient(180deg, #00ffd4 0%, #008f76 100%);
    color: #001a14;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: none;
}

#conjure-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 212, 0.6);
}

#conjure-btn:active {
    transform: scale(0.95);
}

#conjure-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

#watch-hint {
    font-size: 5px;
    color: rgba(0, 255, 212, 0.5);
    text-align: center;
    line-height: 1.8;
}

#watch-charges {
    font-size: 7px;
    color: #ffd700;
    text-shadow: 0 0 4px rgba(255,215,0,0.5);
}

/* Hotbar */
#hotbar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 10;
}

.hotbar-slot {
    width: 44px;
    height: 44px;
    border: 2px solid #2a1f4e;
    border-radius: 4px;
    background: rgba(10, 5, 30, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
    image-rendering: pixelated;
}

.hotbar-slot.active {
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.hotbar-slot img {
    width: 36px;
    height: 36px;
    image-rendering: pixelated;
}

.hotbar-key {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 5px;
    color: rgba(255,255,255,0.4);
    font-family: 'Press Start 2P', monospace;
}

.hotbar-label {
    position: absolute;
    bottom: -12px;
    font-size: 4px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    font-family: 'Press Start 2P', monospace;
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    padding: 0 10px;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}

#mobile-left, #mobile-right {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.mobile-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.5);
    color: white;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-btn:active {
    background: rgba(255,255,255,0.2);
}

@media (max-width: 768px), (hover: none) {
    #mobile-controls { display: flex; }
    #watch-btn { bottom: 110px; }
    #watch-panel { width: 260px; height: 260px; }
    #watch-input { width: 180px; font-size: 7px; }
    #conjure-btn { font-size: 8px; padding: 8px 16px; }
}

/* Settings Button */
#settings-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    transition: all 0.2s;
    filter: grayscale(0.3);
}

#settings-btn:hover {
    background: rgba(0,0,0,0.7);
    border-color: #ffd700;
    filter: grayscale(0);
    transform: rotate(30deg) scale(1.1);
}

/* Settings Overlay */
#settings-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    backdrop-filter: blur(6px);
    transition: opacity 0.3s ease;
}

#settings-overlay.hidden {
    display: none;
}

#settings-panel {
    background: linear-gradient(135deg, #1a0e40 0%, #0d0d2a 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2), inset 0 0 20px rgba(0,0,0,0.5);
    max-width: 360px;
    width: 90%;
}

#settings-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    letter-spacing: 2px;
}

.settings-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.settings-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.settings-options {
    display: flex;
    gap: 6px;
}

.settings-opt {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-opt:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.4);
    color: #fff;
}

.settings-opt.active {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

#settings-close {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px 20px;
    background: linear-gradient(180deg, #ff4466 0%, #cc2244 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 6px;
}

#settings-close:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(255, 68, 102, 0.5);
}

.settings-hint {
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
}

/* Footer */
#game-footer {
    padding: 12px;
    text-align: center;
}

#game-footer a {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: rgba(255,255,255,0.25);
    text-decoration: none;
    transition: color 0.3s;
}

#game-footer a:hover {
    color: #00ffd4;
}