/* 수학 탐험 전용. 기존 게임의 공통 셸 스타일은 바꾸지 않는다. */
body.m50-game { --m50-color: #245cb2; --m50-tint: #edf5ff; }
.m50-game :is(button, input, a):focus-visible { outline: 4px solid #155eef; outline-offset: 3px; }
.m50-game .sp-btn-primary, .m50-game .sp-seg-btn.is-on { background: #c84835; }
.m50-game .sp-btn { font-family: var(--sp-font-body); font-weight: 800; }
.m50-game .sp-iconbtn, .m50-game .sp-home { width: 48px; min-width: 48px; height: 48px; }
.m50-game .sp-top-tools { gap: 8px; }
.m50-game .sp-title { font-size: clamp(30px, 4vw, 44px); line-height: 1.25; }
.m50-game .sp-howto li { font-size: 16px; line-height: 1.5; }
.m50-game .sp-seg-btn small { font-size: 14px; }
.m50-game .sp-field { margin: 12px 0; }
.m50-game .sp-start { padding: 20px; background: #fff8e9; backdrop-filter: none; }
.m50-game .sp-start-grid.no-rank { width: min(1080px, 100%); grid-template-columns: minmax(0, 1.4fr) minmax(270px, .9fr); gap: 24px; }
.m50-game .sp-start-btn { margin-top: 14px; }
.m50-game .sp-card { padding: 24px; }
.m50-game .sp-result { max-height: calc(100dvh - var(--sp-top-h) - 32px); overflow-y: auto; }
.m50-game .sp-result-ov { padding-block: 16px; }
.m50-game .sp-confetti { z-index: 49; }
.m50-game .sp-result .sp-btnrow { position: sticky; bottom: -24px; background: #fff; padding: 12px 0 24px; margin-bottom: -24px; z-index: 2; }
.m50-game .sp-hud-lives { display: none; }
.m50-preview { align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 28px; border-radius: 30px; color: var(--m50-color); background: var(--m50-tint); border: 1px solid #d8e4ec; }
.m50-preview .m50-hero-icon { font-size: 100px; line-height: 1.2; text-align: center; filter: drop-shadow(0 8px 0 #0000000a); }
.m50-preview h2 { font-family: var(--sp-font-display); text-align: center; margin: 0; font-size: 30px; }
.m50-preview p { color: var(--sp-ink); font-size: 16px; line-height: 1.6; margin: 0; }
.m50-preview small { display: block; line-height: 1.7; font-size: 16px; color: var(--sp-ink-soft); }
.m50-preview-link { color: var(--m50-color); font-size: 16px; font-weight: 700; padding-block: 14px; }
.m50-root { height: 100%; overflow-y: auto; padding: 16px 24px 24px; background: var(--m50-tint); overscroll-behavior: contain; }
.m50-banner { max-width: 1440px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.m50-banner p { margin: 0; font-size: 16px; color: var(--sp-ink-soft); }
.m50-banner strong { font-family: var(--sp-font-display); font-size: 24px; color: var(--m50-color); }
.m50-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1440px; margin: auto; }
.m50-duel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m50-pane { min-width: 0; background: #fff; border: 2px solid #dce6ec; border-radius: 28px; padding: 20px; box-shadow: 0 10px 24px #24394a0c; }
.m50-duel .m50-pane:first-child { border-top: 8px solid #245cb2; }
.m50-duel .m50-pane:last-child { border-top: 8px solid #b53f68; }
.m50-lanehead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; margin-bottom: 12px; }
.m50-lanehead strong { font-size: 20px; }
.m50-lanehead .m50-score { margin-left: auto; background: var(--m50-tint); padding: 6px 12px; border-radius: 12px; color: var(--m50-color); font-family: var(--sp-font-num); font-size: 24px; }
.m50-keyboard { color: #64716c; font-size: 14px; }
.m50-route { display: flex; gap: 6px; align-items: center; margin: 4px 0 16px; }
.m50-stop { flex: 1; height: 9px; border-radius: 8px; background: #e9eef1; }
.m50-stop.is-done { background: #087567; }
.m50-stop.is-current { background: var(--m50-color); }
.m50-prompt { font-family: var(--sp-font-display); font-size: clamp(24px, 2.5vw, 36px); line-height: 1.35; margin: 0 0 8px; word-break: keep-all; }
.m50-instruction { font-size: 16px; line-height: 1.55; margin: 0 0 18px; color: #52645b; }
.m50-play { min-width: 0; }
.m50-solo .m50-play { max-width: 980px; margin: auto; }
.m50-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.m50-actions .sp-btn-primary { flex: 1; }
.m50-actions .sp-btn { min-height: 52px; font-size: 18px; padding-inline: 18px; }
.m50-feedback { font-size: 17px; line-height: 1.6; border-radius: 16px; padding: 14px 16px; margin-top: 12px; color: #26332f; background: #edf5ff; }
.m50-feedback[hidden] { display: none; }
.m50-feedback.is-good { background: #e4f4e9; border-left: 5px solid #217a48; }
.m50-feedback.is-bad { background: #fff0ee; border-left: 5px solid #b8323a; }
.m50-hint { margin-top: 10px; font-size: 16px; line-height: 1.6; }
.m50-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.m50-options.m50-many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m50-option, .m50-card { min-height: 68px; border: 2px solid #dce6ec; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 #dce6ec; padding: 12px; font-size: 26px; font-family: var(--sp-font-num); font-weight: 800; cursor: pointer; overflow-wrap: anywhere; }
.m50-option:active, .m50-card:active { transform: translateY(2px); box-shadow: 0 2px 0 #dce6ec; }
.m50-option.is-on, .m50-card.is-on { border-color: var(--m50-color); background: var(--m50-tint); box-shadow: 0 4px 0 var(--m50-color); }
.m50-option.is-on::after { content: ' ✓'; font-size: 18px; }
.m50-option:disabled, .m50-card:disabled { cursor: default; }
.m50-option.is-matched { background: #e4f4e9; border-color: #217a48; opacity: 1; color: #217a48; }
.m50-pair-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; position: relative; }
.m50-pair-col { display: grid; gap: 12px; }
.m50-pair-col .m50-option { font-size: clamp(18px, 2vw, 28px); }
.m50-ribbon { display: flex; flex-wrap: wrap; gap: 10px; background: var(--m50-tint); border-radius: 20px; padding: 16px; min-height: 100px; align-items: center; margin-bottom: 18px; }
.m50-ribbon .m50-card { color: var(--m50-color); }
.m50-sortbank { display: flex; flex-wrap: wrap; gap: 12px; }
.m50-sortbank .m50-card { flex: 1 0 60px; }
.m50-sortbank .m50-card:disabled { visibility: hidden; }
.m50-scene { text-align: center; background: var(--m50-tint); border-radius: 24px; margin-bottom: 14px; padding: 12px; }
.m50-scene svg { display: block; width: 100%; max-width: 440px; height: auto; max-height: 260px; margin: auto; }
.m50-solo .m50-numberlayout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); align-items: start; gap: 24px; }
.m50-numberinput { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 18px; }
.m50-numberinput input { width: 100%; min-width: 0; height: 62px; border: 2px solid #b0c3d5; border-radius: 16px; background: #fff; font-family: var(--sp-font-num); font-size: 32px; text-align: center; }
.m50-numberinput label { white-space: nowrap; }
.m50-numpad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m50-numpad button { min-height: 52px; font-size: 24px; background: #f1f5f8; border: 1px solid #c8d7e2; border-radius: 14px; cursor: pointer; font-family: var(--sp-font-num); font-weight: 800; }
.m50-numpad .m50-erase { grid-column: span 2; font-family: var(--sp-font-body); font-size: 16px; }
.m50-dials { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.m50-dial { border: 1px solid #dce6ec; border-radius: 20px; background: #f7fafb; padding: 12px; flex: 1 1 130px; min-width: 0; }
.m50-dial label { display: block; font-size: 16px; text-align: center; margin-bottom: 8px; font-weight: 700; }
.m50-dialrow { display: flex; gap: 8px; align-items: center; justify-content: center; }
.m50-dialrow button { width: 48px; height: 48px; border: 1px solid #b0c3d5; border-radius: 14px; background: #fff; font-size: 26px; cursor: pointer; flex: none; }
.m50-dialrow input { width: 74px; min-width: 0; height: 52px; text-align: center; border: 1px solid #b0c3d5; border-radius: 12px; font-size: 24px; font-family: var(--sp-font-num); }
.m50-dial small { display: block; text-align: center; font-size: 15px; color: #52645b; margin-top: 4px; }
.m50-quick { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.m50-quick button { min-height: 48px; min-width: 60px; border: 1px solid #b0c3d5; background: #fff; border-radius: 12px; font-size: 16px; cursor: pointer; }
.m50-gridscroll { overflow-x: auto; padding-bottom: 6px; }
.m50-grid { display: grid; grid-template-columns: repeat(var(--w), minmax(48px, 1fr)); gap: 8px; width: max(100%, calc(var(--w) * 56px - 8px)); max-width: 560px; margin: auto; position: relative; }
.m50-cell { position: relative; min-height: 48px; aspect-ratio: 1; border: 2px solid #c7d8e4; border-radius: 10px; background: #f7fafc; cursor: pointer; font-size: 16px; font-weight: 700; }
.m50-cell.is-on { background: var(--m50-color); color: #fff; border-color: var(--m50-color); }
.m50-cell.is-on::after { content: '●'; }
.m50-cell.is-fixed { border-color: #26332f; cursor: default; }
.m50-cell.is-fixed::after { content: '◆'; }
.m50-cell.shade-col { background-image: linear-gradient(#bdd6f677,#bdd6f677); }
.m50-cell.shade-row { box-shadow: inset 0 0 0 6px #f3be3566; }
.m50-cell.shade-col.is-on { background-color: #245cb2; }
.m50-source { max-width: 190px; display: grid; gap: 4px; margin: 0 auto 16px; grid-template-columns: repeat(var(--w),1fr); }
.m50-source span { width: 100%; aspect-ratio: 1; background: #e8eef3; border-radius: 4px; }
.m50-source span.is-on { background: #245cb2; }
.m50-grid.transform-line::after { content: ''; position: absolute; left: calc(50% - 2px); top: -4px; bottom: -4px; width: 4px; background: #b54d28; pointer-events: none; }
.m50-grid.transform-point::after { content: '⊕'; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: #fff; color: #b54d28; font-size: 28px; pointer-events: none; }
.m50-clock { width: 240px; max-width: 100%; margin: auto; }
.m50-clock svg { max-height: 250px; }
.m50-flowers { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 4px; max-width: 350px; margin: auto; }
.m50-flowers span { font-size: clamp(22px, 3vw, 32px); }
.m50-readout { font-family: var(--sp-font-num); font-size: 32px; color: var(--m50-color); text-align: center; margin: 14px 0; }
.m50-signals { display: grid; gap: 10px; padding: 12px; font-size: 20px; }
.m50-signals div { display: flex; gap: 12px; align-items: center; }
.m50-lamp { width: 42px; height: 42px; border-radius: 50%; background: #dce6ec; border: 3px solid #64716c; }
.m50-lamp.on { background: #f3be35; }
.m50-segments { position: relative; width: 220px; height: 300px; margin: auto; background: #edf5ff; border-radius: 24px; }
.m50-segment { position: absolute; border: 2px solid #a4bad2; border-radius: 12px; background: #dce6ec; cursor: pointer; }
.m50-segment.is-on { background: #245cb2; border-color: #245cb2; }
.m50-segment.horizontal { width: 96px; height: 48px; left: 62px; }
.m50-segment.vertical { width: 48px; height: 82px; }
.m50-segment.s0 { top: 10px; }.m50-segment.s1 { left: 10px; top: 58px; }.m50-segment.s2 { right: 10px; top: 58px; }.m50-segment.s3 { top: 126px; }.m50-segment.s4 { left: 10px; top: 171px; }.m50-segment.s5 { right: 10px; top: 171px; }.m50-segment.s6 { top: 242px; }
.m50-decimal { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; }
.m50-digit { font-size: 42px; font-family: var(--sp-font-num); }
.m50-dot { width: 48px; height: 56px; border: 1px dashed #9ab0c2; background: #fff; border-radius: 12px; font-size: 32px; cursor: pointer; }
.m50-dot.is-on { background: var(--m50-tint); border: 3px solid var(--m50-color); color: var(--m50-color); }
.m50-logic { display: grid; gap: 12px; }
.m50-logrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-radius: 16px; background: #f1f5f8; }
.m50-logrow strong { width: 100%; font-size: 18px; }
.m50-logrow button { flex: 1 1 48px; min-width: 48px; min-height: 52px; border: 2px solid #c7d8e4; background: #fff; font-size: 17px; border-radius: 12px; cursor: pointer; }
.m50-logrow button.is-on { border-color: var(--m50-color); background: var(--m50-tint); }
.m50-clues { font-size: 17px; line-height: 1.8; padding: 16px 16px 16px 36px; background: #fff1d6; border-radius: 20px; }
.m50-spinner { position: relative; width: 240px; height: 240px; margin: 0 auto 16px; }
.m50-spinner svg { width: 100%; height: 100%; }
.m50-spinsectors { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.m50-spinsectors button { min-height: 48px; border: 2px solid #b54d28; background: #fff1d6; border-radius: 12px; font-size: 16px; cursor: pointer; }
.m50-spinsectors button.is-on { background: #dceaf9; border-color: #245cb2; }
.m50-finish { text-align: center; padding: 36px 16px; }
.m50-finish .m50-hero-icon { font-size: 80px; }
.m50-finish h3 { font-family: var(--sp-font-display); font-size: 32px; }
.m50-timer { font-family: var(--sp-font-num); font-size: 24px; color: var(--m50-color); background: #fff; padding: 8px 16px; border-radius: 14px; }
.m50-timer.is-urgent { color: #b8323a; }
.m50-coordinate-label { display: block; font-size: 14px; }
@media (min-width: 961px) {
  .m50-root-solo { display: flex; flex-direction: column; overflow: hidden; }
  .m50-root-solo .m50-banner { width: 100%; flex: none; }
  .m50-root-solo .m50-panes { width: 100%; min-height: 0; flex: 1; }
  .m50-root-solo .m50-pane { min-height: 0; display: flex; flex-direction: column; }
  .m50-root-solo .m50-play { width: 100%; flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; }
  .m50-root-solo :is(.m50-lanehead,.m50-route,.m50-prompt,.m50-instruction,.m50-actions,.m50-feedback,.m50-hint) { flex-shrink: 0; }
  .m50-solo :is(.m50-kind-clock,.m50-kind-angle,.m50-kind-dials) { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; align-items: center; }
  .m50-solo :is(.m50-kind-clock,.m50-kind-angle,.m50-kind-dials) .m50-scene { margin-bottom: 0; }
}
@media (min-width: 601px) {
  .m50-root-duel { display: flex; flex-direction: column; overflow: hidden; }
  .m50-root-duel .m50-banner { width: 100%; flex: none; }
  .m50-root-duel .m50-panes { width: 100%; min-height: 0; flex: 1; }
  .m50-duel .m50-pane { min-height: 0; display: flex; flex-direction: column; }
  .m50-duel .m50-play { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 4px 8px; }
  .m50-duel :is(.m50-lanehead,.m50-route,.m50-prompt,.m50-instruction,.m50-actions,.m50-feedback,.m50-hint) { flex-shrink: 0; }
}
@media (min-width: 1100px) { .m50-solo .m50-pane { padding: 24px 40px; } }
@media (max-width: 860px) {
  .m50-game .sp-start-grid.no-rank { grid-template-columns: 1fr; }
  .m50-preview { display: none; }
  .m50-root { padding: 12px; }
  .m50-pane { padding: 16px; }
  .m50-options.m50-many { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .m50-duel .m50-dial { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .m50-game { --sp-top-h: 64px; }
  .m50-game .sp-top { height: 64px; padding: 0 6px; gap: 4px; }
  .m50-game .sp-hud-item { min-width: 48px; padding: 0 4px; }
  .m50-game .sp-hud-item small { font-size: 12px; }
  .m50-game .sp-hud-item b { font-size: 18px; }
  .m50-game .sp-hud-combo { display: none; }
  .m50-game .sp-start { padding: 12px; }
  .m50-game .sp-card { padding: 20px; }
  .m50-game .sp-title { font-size: 30px; }
  .m50-game .sp-seg-btn { flex-basis: 120px; }
  .m50-duel { grid-template-columns: 1fr; }
  .m50-solo .m50-numberlayout { grid-template-columns: 1fr; gap: 12px; }
  .m50-scene svg { max-height: 180px; }
  .m50-dial { flex-basis: 160px; }
  .m50-pair-columns { gap: 12px; }
  .m50-option { font-size: 22px; }
  .m50-logrow strong { width: 100%; }
  .m50-logrow button { min-width: 48px; }
  .m50-game .sp-result .sp-btnrow { bottom: -20px; margin-bottom: -20px; }
}
@media (prefers-reduced-motion: reduce) {
  .m50-game *, .m50-game *::before, .m50-game *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
