/* =============================================
   도형 맞추기 (shape-memory) — sm- prefix
   ============================================= */

:root {
    --sm-bg: #0f0f1a;
    --sm-card: #1a1a2e;
    --sm-text: #f0f0f0;
    --sm-sub: #9ca3af;
    --sm-border: #2d2d44;
    --sm-accent: #6366f1;
    --sm-correct: #22c55e;
    --sm-wrong: #ef4444;
    --sm-max: 480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #000; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--sm-bg);
    color: var(--sm-text);
    min-height: 100dvh;
    max-width: var(--sm-max);
    margin: 0 auto;
    overflow-x: hidden;
}

/* Top Bar */
.sm-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--sm-border);
    position: relative;
}
.sm-back {
    color: var(--sm-sub);
    text-decoration: none;
    font-size: 14px;
}
.sm-back:hover { color: var(--sm-text); }

.sm-top-info {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--sm-sub);
}
.sm-top-info strong { color: var(--sm-text); }

/* Content */
.sm-content {
    padding: 20px;
    min-height: calc(100dvh - 52px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Intro */
.sm-intro-icon { font-size: 64px; margin: 40px 0 16px; }
.sm-intro-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.sm-intro-desc {
    color: var(--sm-sub);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 8px;
}
.sm-intro-desc strong { color: var(--sm-text); }
.sm-best-record {
    background: rgba(99,102,241,0.12);
    color: var(--sm-accent);
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 24px;
}
.sm-start-btn {
    background: var(--sm-accent);
    color: #fff;
    border: none;
    padding: 16px 48px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.sm-start-btn:hover { background: #4f46e5; }

/* How to play */
.sm-how {
    margin-top: 24px;
    padding: 16px;
    background: var(--sm-card);
    border: 1px solid var(--sm-border);
    border-radius: 14px;
    width: 100%;
}
.sm-how-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--sm-accent);
}
.sm-how-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sm-how-steps li {
    font-size: 13px;
    color: var(--sm-sub);
    line-height: 1.5;
}
.sm-how-steps li::before {
    display: inline-block;
    margin-right: 8px;
}

/* Playing */
.sm-status-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 16px;
}
.sm-status-item {
    font-size: 13px;
    color: var(--sm-sub);
}
.sm-status-item strong {
    color: var(--sm-text);
    font-size: 16px;
}

.sm-phase-label {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    min-height: 28px;
}
.sm-phase-memorize { color: #fbbf24; }
.sm-phase-recall { color: var(--sm-accent); }

.sm-timer-bar {
    width: 100%;
    height: 6px;
    background: var(--sm-border);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}
.sm-timer-fill {
    height: 100%;
    background: #fbbf24;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Grid */
.sm-grid {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
}
.sm-cell {
    background: var(--sm-card);
    border: 2px solid var(--sm-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
    aspect-ratio: 1;
}
.sm-cell:hover { border-color: rgba(99,102,241,0.4); }
.sm-cell.sm-active {
    background: rgba(99,102,241,0.2);
    border-color: var(--sm-accent);
}
.sm-cell.sm-show {
    background: rgba(99,102,241,0.25);
    border-color: var(--sm-accent);
    transform: scale(1.02);
}
.sm-cell.sm-correct-cell {
    background: rgba(34,197,94,0.2);
    border-color: var(--sm-correct);
}
.sm-cell.sm-wrong-cell {
    background: rgba(239,68,68,0.2);
    border-color: var(--sm-wrong);
}
.sm-cell.sm-missed-cell {
    background: rgba(251,191,36,0.15);
    border-color: #fbbf24;
}

.sm-submit-btn {
    margin-top: 20px;
    background: var(--sm-accent);
    color: #fff;
    border: none;
    padding: 14px 40px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.sm-submit-btn:hover { background: #4f46e5; }
.sm-submit-btn:disabled {
    background: var(--sm-border);
    cursor: default;
}

/* Countdown */
.sm-countdown {
    font-size: 72px;
    font-weight: 800;
    color: var(--sm-accent);
    margin: 80px 0;
    animation: sm-pulse 0.6s ease-in-out;
}
@keyframes sm-pulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Round result */
.sm-round-result {
    text-align: center;
    margin-top: 20px;
    font-size: 20px;
    font-weight: 700;
}
.sm-round-correct { color: var(--sm-correct); }
.sm-round-wrong { color: var(--sm-wrong); }

/* Result — 공통 game-result.css 사용 */

/* Toast */
.sm-toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    transition: bottom 0.3s;
    z-index: 1000;
    white-space: nowrap;
}
.sm-toast.sm-show-toast { bottom: 40px; }
