:root {
    --bg-color: #0f172a;
    --panel-bg: #1e293b;
    --board-bg: #94a3b8;
    --cell-closed: #cbd5e1;
    --cell-closed-hover: #e2e8f0;
    --cell-opened: #f8fafc;
    --border-light: #ffffff;
    --border-dark: #64748b;
    --text-main: #f1f5f9;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    
    --c-1: #2563eb;
    --c-2: #16a34a;
    --c-3: #dc2626;
    --c-4: #4f46e5;
    --c-5: #7c3aed;
    --c-6: #0d9488;
    --c-7: #000000;
    --c-8: #52525b;

    --detector-cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><ellipse cx="16" cy="48" rx="14" ry="7" fill="%2300000066" stroke="%23f59e0b" stroke-width="3"/><ellipse cx="16" cy="48" rx="6" ry="3" fill="none" stroke="%2310b981" stroke-width="2"/><line x1="16" y1="48" x2="52" y2="12" stroke="%23cbd5e1" stroke-width="5" stroke-linecap="round"/><path d="M 28 36 L 40 24 L 46 30 L 34 42 Z" fill="%231e293b" stroke="%2364748b" stroke-width="2"/><circle cx="37" cy="33" r="2.5" fill="%23ef4444"/><line x1="42" y1="22" x2="52" y2="32" stroke="%23ef4444" stroke-width="6" stroke-linecap="round"/></svg>') 16 48, auto;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    max-width: 100%;
}

.header {
    text-align: center;
}

.title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.toolbar {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.select-wrapper select {
    appearance: none;
    background-color: var(--panel-bg);
    color: white;
    border: 1px solid var(--border-dark);
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.select-wrapper select:hover {
    border-color: var(--accent);
}

.btn-detector {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-detector:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-detector.active {
    background: linear-gradient(135deg, #10b981, #059669);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.game-panel {
    background-color: var(--panel-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #0f172a;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: inset 2px var(--border-dark);
}

.digital-display {
    background-color: black;
    color: #ef4444;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    min-width: 4ch;
    text-align: right;
    letter-spacing: 2px;
}

.face-btn {
    font-size: 2rem;
    background: var(--cell-closed);
    border-top: 3px solid var(--border-light);
    border-left: 3px solid var(--border-light);
    border-bottom: 3px solid var(--border-dark);
    border-right: 3px solid var(--border-dark);
    width: 3rem;
    height: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 0.25rem;
}
.face-btn:active {
    border-top: 3px solid var(--border-dark);
    border-left: 3px solid var(--border-dark);
    border-bottom: 3px solid var(--border-light);
    border-right: 3px solid var(--border-light);
    background: var(--board-bg);
}

.board-container {
    position: relative;
    padding: 0.5rem;
    background-color: var(--board-bg);
    border-top: 3px solid var(--border-dark);
    border-left: 3px solid var(--border-dark);
    border-bottom: 3px solid var(--border-light);
    border-right: 3px solid var(--border-light);
    overflow: hidden;
}

/* 금속탐지기 모드 시 보드 전체 커서 변경 */
.board-container.detector-mode,
.board-container.detector-mode .board,
.board-container.detector-mode .cell {
    cursor: var(--detector-cursor) !important;
}

.board {
    display: grid;
    gap: 1px;
    background-color: #94a3b8;
}

.cell {
    width: 30px;
    height: 30px;
    background-color: var(--cell-closed);
    border-top: 3px solid var(--border-light);
    border-left: 3px solid var(--border-light);
    border-bottom: 3px solid var(--border-dark);
    border-right: 3px solid var(--border-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: default;
    transition: filter 0.2s;
}

.cell:not(.opened):hover {
    background-color: var(--cell-closed-hover);
}

.cell.opened {
    background-color: var(--cell-opened);
    border: 1px solid var(--border-dark);
}

.cell.mine {
    background-color: #ef4444;
    border: 1px solid var(--border-dark);
}

.cell.mine-death {
    background-color: #b91c1c;
}

/* Numbers */
.cell[data-value="1"] { color: var(--c-1); }
.cell[data-value="2"] { color: var(--c-2); }
.cell[data-value="3"] { color: var(--c-3); }
.cell[data-value="4"] { color: var(--c-4); }
.cell[data-value="5"] { color: var(--c-5); }
.cell[data-value="6"] { color: var(--c-6); }
.cell[data-value="7"] { color: var(--c-7); }
.cell[data-value="8"] { color: var(--c-8); }

footer {
    color: #64748b;
    font-size: 0.875rem;
}

/* 금속탐지기 오버레이 이펙트 (반지름 이펙트) */
.detector-ring {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: width 0.15s ease-out, height 0.15s ease-out, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 10;
    opacity: 0;
    border: 3px dashed rgba(255, 255, 255, 0.9);
}

.detector-ring.active {
    opacity: 1;
}

/* 거리별 탐지기 상태 클래스 */
.detector-danger {
    background: radial-gradient(circle, rgba(255, 0, 0, 0.6) 0%, rgba(255, 0, 0, 0) 70%);
    width: 70px;
    height: 70px;
    border-color: #ff3333;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.9), inset 0 0 20px rgba(255, 0, 0, 0.9);
    animation: spin-dash 4s linear infinite, pulse-danger 0.3s infinite alternate;
}

.detector-warning {
    background: radial-gradient(circle, rgba(255, 153, 0, 0.5) 0%, rgba(255, 153, 0, 0) 70%);
    width: 120px;
    height: 120px;
    border-color: #ffaa00;
    box-shadow: 0 0 20px rgba(255, 153, 0, 0.8), inset 0 0 20px rgba(255, 153, 0, 0.8);
    animation: spin-dash 6s linear infinite;
}

.detector-safe {
    background: radial-gradient(circle, rgba(0, 255, 136, 0.4) 0%, rgba(0, 255, 136, 0) 70%);
    width: 180px;
    height: 180px;
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.7), inset 0 0 15px rgba(0, 255, 136, 0.7);
    animation: spin-dash 8s linear infinite;
}

@keyframes spin-dash {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

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