/* =========================================================
   지뢰찾기 (mines.html) — 2026-11-17
   위 막대·버튼·오른쪽 칸은 2048·오늘의 영단어와 같은 모양 (연보라 + 따뜻한 노랑)
   안 연 칸: 연보라 볼록 / 연 칸: 아이보리 / 칸 크기는 mines.js가 --m-cell로 정함
   ========================================================= */
:root {
    --g-cream: #fbf7ef;
    --g-paper: #f4ecdd;
    --g-ink: #2c2418;
    --g-mute: #8a7d68;
    --g-gold: #c9a27e;
    --m-cell: 32px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: linear-gradient(180deg, #fff3c4 0%, #fde9a6 100%) fixed;
    color: var(--g-ink);
    font-family: "Noto Sans KR", system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
}
.g-top { background: linear-gradient(180deg, #e6e5ff, #DAD9FF); border-bottom: 3px solid #b3b1f2; }
.g-top-in {
    max-width: 1180px; margin: 0 auto; padding: 14px 16px;
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.g-title { margin: 0; color: #36347a; font-size: 1.5rem; letter-spacing: 0.02em; }
.g-title small { margin-left: 8px; font-size: 0.82rem; font-weight: 600; color: #5a57b5; letter-spacing: 0; }
.g-brand { font-family: "Chewy", cursive; color: #5a57b5; font-size: 1.05rem; white-space: nowrap; }

.g-main {
    max-width: 1180px; margin: 0 auto; padding: 18px 16px 10px;
    display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start;
}
.m-play { min-width: 0; }

/* 난이도 */
.m-levels { display: flex; gap: 6px; max-width: 420px; margin: 0 auto 10px; background: #DAD9FF; border: 1px solid #c3c1f0; border-radius: 12px; padding: 4px; }
.m-level { flex: 1; font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; border: 0; border-radius: 9px; padding: 8px 6px; background: transparent; color: #5a57b5; }
.m-level.on { background: #fff; color: #36347a; box-shadow: 0 2px 6px rgba(54, 52, 122, 0.18); }

/* 지뢰 수 · 얼굴 · 시간 · 소리 */
.m-statusrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 auto 10px; }
.m-count {
    display: flex; align-items: center; gap: 6px; min-width: 86px; justify-content: center;
    padding: 6px 12px; border-radius: 10px; background: #36347a; color: #fff3c4;
    font-variant-numeric: tabular-nums; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.m-count b { font-size: 1.25rem; min-width: 2.2em; text-align: right; }
.m-face {
    width: 46px; height: 46px; border-radius: 12px; cursor: pointer; font-size: 1.6rem; line-height: 1;
    border: 1px solid #b3b1f2; background: linear-gradient(180deg, #fff, #e6e5ff);
    box-shadow: 0 3px 0 #b3b1f2; transition: transform 0.08s;
}
.m-face:active { transform: translateY(2px); box-shadow: 0 1px 0 #b3b1f2; }

.g-mute {
    flex: none; width: 42px; height: 42px; padding: 0;
    display: grid; place-items: center; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: linear-gradient(160deg, rgba(120, 170, 235, 0.55), rgba(40, 80, 150, 0.75));
    box-shadow: 0 4px 12px rgba(30, 50, 100, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: transform 0.12s, filter 0.15s;
}
.g-mute:hover { filter: brightness(1.08); }
.g-mute:active { transform: scale(0.94); }
.g-mute svg { width: 24px; height: 24px; overflow: visible; }
.g-mute .g-spk { fill: #fff; }
.g-mute .g-wave { fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; }
.g-mute .g-slash { fill: none; stroke: #e5402b; stroke-width: 2.6; stroke-linecap: round; opacity: 0; filter: drop-shadow(0 0 1px #fff); }
.g-mute.muted .g-wave { opacity: 0.35; }
.g-mute.muted .g-slash { opacity: 1; }

/* 판 */
.m-board-wrap { position: relative; width: max-content; max-width: 100%; margin: 0 auto; overflow-x: auto; border-radius: 12px; }
.m-board {
    display: grid; gap: 2px; padding: 8px;
    background: #b9b6e8; border-radius: 12px;
    box-shadow: 0 10px 26px rgba(54, 52, 122, 0.22);
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    touch-action: manipulation;
}
.m-cell {
    width: var(--m-cell); height: var(--m-cell);
    display: grid; place-items: center;
    border-radius: 5px; cursor: pointer;
    font-weight: 800; font-size: calc(var(--m-cell) * 0.56); line-height: 1;
    background: linear-gradient(160deg, #f1f0ff 0%, #DAD9FF 60%, #c9c7f6 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 0 rgba(90, 87, 181, 0.25);
}
.m-cell:hover:not(.open) { filter: brightness(1.05); }
.m-cell.press:not(.open):not(.flag) { background: #fffdf6; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15); }
.m-cell.open { background: #fffdf6; box-shadow: inset 0 1px 2px rgba(54, 52, 122, 0.12); cursor: default; }
.m-cell.open.pop { animation: mOpen 0.18s ease-out; }
@keyframes mOpen { from { transform: scale(0.82); } to { transform: scale(1); } }
.m-cell.flag::after { content: "🚩"; font-size: calc(var(--m-cell) * 0.55); }
.m-cell.flag.plant::after { animation: mFlag 0.22s ease-out; display: inline-block; }
@keyframes mFlag { from { transform: translateY(-6px) scale(1.4); } to { transform: none; } }
.m-cell.mine::after { content: "💣"; font-size: calc(var(--m-cell) * 0.58); }
.m-cell.boom { background: #ff6b6b; animation: mBoom 0.4s; }
@keyframes mBoom { 30% { transform: scale(1.25); } }
.m-cell.wrong { background: #ffe0e0; }
.m-cell.wrong::after { content: "❌"; font-size: calc(var(--m-cell) * 0.5); }
/* 숫자 색 */
.m-cell.n1 { color: #3b6fd8; } .m-cell.n2 { color: #2f9e5a; } .m-cell.n3 { color: #e0503a; } .m-cell.n4 { color: #36347a; }
.m-cell.n5 { color: #a0522d; } .m-cell.n6 { color: #1a9a9a; } .m-cell.n7 { color: #2c2418; } .m-cell.n8 { color: #8a7d68; }

/* 결과 창 */
.m-result { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: rgba(54, 52, 122, 0.28); border-radius: 12px; animation: mFade 0.3s ease; }
.m-result[hidden] { display: none; }
@keyframes mFade { from { opacity: 0; } to { opacity: 1; } }
.m-result-card { width: min(90%, 320px); background: var(--g-cream); border: 2px solid var(--g-gold); border-radius: 14px; padding: 18px 20px; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); animation: mCard 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes mCard { from { transform: scale(0.82); } to { transform: scale(1); } }
.m-result-title { margin: 0; font-size: 1.4rem; font-weight: 700; color: #36347a; }
.m-result-sub { white-space: pre-line; margin: 6px 0 14px; color: var(--g-mute); font-size: 0.9rem; line-height: 1.5; }
.m-result-btns { display: flex; gap: 8px; justify-content: center; }

/* 아래: 폰 깃발 모드 버튼 + 안내 */
.m-toolrow { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.m-mode {
    display: none; font: inherit; font-size: 1rem; cursor: pointer;
    padding: 10px 20px; border-radius: 999px; border: 1px solid #b3b1f2;
    background: #fff; color: #36347a; box-shadow: 0 2px 6px rgba(54, 52, 122, 0.15);
}
.m-mode[aria-pressed="true"] { background: #ff5e8a; border-color: #ff5e8a; color: #fff; }
.m-hint { margin: 0; text-align: center; font-size: 0.84rem; color: var(--g-mute); }

/* 오른쪽 칸 */
.g-panel { background: #fff; border: 1px solid #e3d8c4; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.g-actions { display: flex; gap: 8px; }
.g-btn {
    font: inherit; font-size: 0.92rem; font-weight: 700;
    padding: 10px 14px; border-radius: 10px; cursor: pointer;
    border: 1px solid #d8ccb4; background: var(--g-paper); color: var(--g-ink);
    transition: transform 0.1s, background 0.15s;
}
.g-btn:active:not(:disabled) { transform: translateY(1px); }
.g-actions .g-btn { flex: 1; padding-left: 6px; padding-right: 6px; }
.g-exit { background: #f1f1ff; border-color: #c3c1f0; color: #36347a; }
.g-exit:hover { background: #e6e5ff; }
.g-primary { background: linear-gradient(180deg, #e6e5ff, #DAD9FF); border-color: #b3b1f2; color: #36347a; }
.g-primary:hover { background: linear-gradient(180deg, #efeeff, #cfcdfb); }
.g-record { font-size: 0.82rem; color: #5a4c38; background: var(--g-paper); border-radius: 10px; padding: 10px 12px; line-height: 1.75; }
.g-record b { color: var(--g-ink); }
.g-rules { font-size: 0.85rem; color: #4a3d2c; }
.g-rules summary { cursor: pointer; font-weight: 700; color: #36347a; }
.g-rules ul { padding-left: 1.2em; margin: 8px 0 0; line-height: 1.75; }
.g-foot { text-align: center; font-size: 0.78rem; color: var(--g-mute); padding: 18px 16px 26px; }

/* PC에서 고급(30칸)은 넓어서 오른쪽 칸을 아래로 */
body.lv-hard .g-main { grid-template-columns: 1fr; max-width: 1080px; }
body.lv-hard .g-panel { max-width: 560px; width: 100%; margin: 0 auto; }

/* ---------- 폰 ---------- */
@media (max-width: 760px) {
    .g-top-in { padding: 11px 16px; }
    .g-title { font-size: 1.25rem; }
    .g-title small { display: block; margin: 2px 0 0; }
    .g-brand { font-size: 0.92rem; }
    .g-main { grid-template-columns: 1fr; gap: 14px; padding: 10px 6px 6px; }
    .m-board { gap: 1.5px; padding: 5px; }
    .m-cell { border-radius: 3px; }
    .m-mode { display: inline-flex; gap: 6px; align-items: center; }
    .m-count { min-width: 74px; padding: 5px 10px; }
    .m-count b { font-size: 1.1rem; }
    .g-panel { padding: 14px; }
    .g-btn { padding: 12px 14px; }
}
@media (pointer: coarse) { .m-mode { display: inline-flex; gap: 6px; align-items: center; } }
@media (prefers-reduced-motion: reduce) {
    .m-cell.open.pop, .m-cell.flag.plant::after, .m-cell.boom { animation: none; }
}

/* ---------- 2026-11-17: 끝난 뒤 판 전체 보기 ---------- */
.m-cell.seen { background: #f3efe4; opacity: 0.72; box-shadow: none; }          /* 안 열었던 칸: 숫자를 흐리게 */
.m-cell.mine.found { background: #d6f0df; position: relative; }                  /* 깃발로 맞게 찾은 지뢰 */
.m-cell.mine.found::before {
    content: "🚩"; position: absolute; right: 1px; top: 0; line-height: 1;
    font-size: calc(var(--m-cell) * 0.32);
}
