:root {
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --text-main: #2d3436;
    --text-sub: #636e72;
    --border-color: #dfe6e9;
    --accent-color: #e84393;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

.hidden { display: none !important; }

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.highlight { color: var(--primary-color); }

/* Settings */
.settings {
    width: 100%;
    max-width: 400px;
    margin-bottom: 3rem;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-sub);
    font-size: 0.9rem;
}

.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
}

.btn-opt {
    padding: 12px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-opt.active {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.05);
    color: var(--primary-color);
}

/* Buttons */
.btn-main {
    width: 100%;
    max-width: 400px;
    padding: 18px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    transition: transform 0.2s, background 0.2s;
}

.btn-main:active { transform: scale(0.98); }
.btn-main.disabled {
    background: var(--border-color);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-sub {
    margin-top: 1rem;
    background: transparent;
    border: none;
    color: var(--text-sub);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Upload Area */
.drop-zone {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 16 / 9;
    border: 3px dashed var(--border-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    margin-bottom: 2rem;
}

.drop-zone:hover { border-color: var(--primary-color); background: rgba(74, 144, 226, 0.02); }

.drop-content { text-align: center; }
.drop-content .icon { font-size: 3rem; display: block; margin-bottom: 1rem; }

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.preview-item img { width: 100%; height: 100%; object-fit: cover; }

/* Game View */
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    align-items: center;
}

.canvas-wrapper {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    line-height: 0;
}

.canvas-wrapper .label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    z-index: 10;
    pointer-events: none;
}

canvas {
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

/* PC Layout */
@media (min-width: 1024px) {
    .game-container {
        flex-direction: row;
        justify-content: center;
    }
    .canvas-wrapper {
        flex: 1;
        max-width: calc(50% - 10px);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Wrong Click Effect */
.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.found-mark {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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