* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #f4f7fc; color: #0b1a33; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; }
.mines-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; flex-shrink: 0; min-height: 66px; padding: 10px 28px; background: #fff; border-bottom: 1px solid #e7edf5; }
.mines-plan { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; font-size: .8rem; font-weight: 500; }
.mines-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.mines-plan.is-free { color: #16803d; background: #eaf8ef; }
.mines-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 1.325rem; font-weight: 700; line-height: 1.4; }
.mines-title-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #006acd; font-size: 1.5rem; }
.mines-title-icon > i { display: flex; align-items: center; justify-content: center; line-height: 1; }
.mines-open-link { display: inline-flex; align-items: center; gap: 6px; justify-self: end; color: #69798d; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.mines-open-link:hover { color: #006acd; text-decoration: none; }
.mines-main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; padding: 32px 24px 16px; }
.mines-wrapper { display: flex; flex: 1 0 auto; align-items: center; justify-content: center; width: 100%; }
.mines-layout { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); align-items: start; gap: 24px; width: 100%; max-width: 1100px; }
.settings-card, .mines-card { min-width: 0; padding: 24px 22px 28px; background: #fff; border: 1px solid #e5ebf3; border-radius: 24px; box-shadow: 0 12px 40px rgba(18,61,107,.06); }
.settings-card h2, .game-heading h2 { margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.5; }
.intro { margin: 10px 0 20px; color: #66758a; font-size: .82rem; line-height: 1.8; }
#minesSettings > label, .dimension-fields label { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: #4b5a6a; font-size: .8rem; font-weight: 550; }
#minesSettings input, #minesSettings select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid #d2dce9; border-radius: 10px; background: #fff; color: #0b1a33; font: inherit; }
#minesSettings input:disabled { color: #8895a7; background: #f4f7fc; }
#minesSettings input[aria-invalid="true"] { border-color: #c43d4b; }
.dimension-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 10px; margin: 16px 0; }
.dimension-fields > span { padding-bottom: 10px; color: #8895a7; }
.help { margin: 8px 0 0; color: #66758a; font-size: .75rem; line-height: 1.8; }
#applySettings { margin-top: 16px; }
.mines-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 12px; border: 1px solid #e0e7f0; border-radius: 10px; background: #f4f7fc; color: #4b5a6a; font: inherit; font-size: .8rem; font-weight: 500; line-height: 1.5; cursor: pointer; }
.mines-btn:hover { color: #0b1a33; background: #eaf0f8; }
.mines-btn.primary { color: #fff; background: #006acd; border-color: #006acd; box-shadow: 0 4px 14px rgba(0,106,205,.15); }
.mines-btn.primary:hover { background: #0059b3; }
.mines-btn:disabled { opacity: .45; cursor: not-allowed; }
.full-width { width: 100%; }
.settings-status { min-height: 20px; margin: 10px 0 0; color: #315d8d; font-size: .75rem; line-height: 1.7; }
.settings-status.is-error, .game-status.is-error { color: #c43d4b; }
.how-to { margin-top: 18px; padding-top: 18px; border-top: 1px solid #eef2f8; }
.how-to h3 { margin: 0 0 12px; color: #315d8d; font-size: .9rem; }
.how-to p { margin: 0 0 12px; color: #66758a; font-size: .78rem; line-height: 1.8; }
.how-to p:last-child { margin-bottom: 0; }
.how-to strong { display: block; margin-bottom: 3px; color: #4b5a6a; font-weight: 600; }
.game-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.game-heading p { margin: 8px 0 0; color: #66758a; font-size: .8rem; }
.game-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.game-stats > div { min-width: 0; padding: 12px; border: 1px solid #eef2f8; border-radius: 14px; background: #f8faff; }
.game-stats span { display: block; margin-bottom: 7px; color: #66758a; font-size: .75rem; }
.game-stats strong { display: block; color: #315d8d; font-size: 1.25rem; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.game-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-toolbar > span { color: #66758a; font-size: .78rem; }
.flag-toggle[aria-pressed="true"] { color: #006acd; border-color: #8ec7ff; background: #eef4fe; }
.mobile-help { display: none; margin: 0 0 12px; color: #66758a; font-size: .75rem; line-height: 1.8; }
.board-viewport { width: 100%; max-width: 100%; overflow: auto; overscroll-behavior-x: contain; padding: 12px; border: 1px solid #d2dce9; border-radius: 16px; background: #f4f7fc; }
.mines-board { --cell-size: 36px; display: grid; width: max-content; gap: 2px; margin: 0 auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-x pan-y; }
.board-row { display: grid; grid-template-columns: repeat(var(--columns), var(--cell-size)); gap: 2px; }
.mine-cell { display: grid; place-items: center; width: var(--cell-size); height: var(--cell-size); padding: 0; border: 1px solid #c4d2e4; border-radius: 5px; background: linear-gradient(145deg,#fff,#e2ebf7); color: #315d8d; box-shadow: inset 1px 1px 0 #fff, 0 1px 1px rgba(18,61,107,.06); font: 750 calc(var(--cell-size) * .48)/1 Consolas, monospace; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mine-cell:hover { border-color: #72ade2; background: #dbeafc; }
.mine-cell.open { border-color: #dde5ef; background: #edf2f8; box-shadow: none; cursor: default; }
.mine-cell.flagged { color: #c77a17; }
.mine-cell.mine { color: #35465c; background: #f9e8e9; border-color: #ebc8cc; }
.mine-cell.exploded { color: #fff; background: #d95360; border-color: #c43d4b; }
.mine-cell.wrong-flag { color: #cf4655; background: #fff0f1; border-color: #efcbd0; }
.mine-cell.n1 { color: #006acd; }.mine-cell.n2 { color: #16803d; }.mine-cell.n3 { color: #cf4655; }.mine-cell.n4 { color: #7354b1; }.mine-cell.n5 { color: #9c5b20; }.mine-cell.n6 { color: #128b98; }.mine-cell.n7 { color: #243244; }.mine-cell.n8 { color: #66758a; }
.mines-board.flag-mode .mine-cell:not(.open) { cursor: crosshair; }
.game-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 14px; margin-top: 16px; padding: 14px; border: 1px solid #d8ebdf; border-radius: 12px; background: #f0faf3; color: #16803d; }
.game-result.is-loss { color: #b63847; border-color: #efcbd0; background: #fff4f5; }
.game-result strong { font-size: 1rem; }.game-result span { font-size: .8rem; line-height: 1.7; }
.game-status { min-height: 40px; margin: 14px 0 0; color: #315d8d; font-size: .82rem; line-height: 1.8; }
.board-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding-top: 12px; border-top: 1px solid #eef2f8; color: #8895a7; font-size: .73rem; line-height: 1.8; }
.mines-tips { flex-shrink: 0; width: 100%; max-width: 1100px; margin-top: auto; padding: 18px 16px 0; border-top: 1px solid #eef2f8; color: #66758a; font-size: .85rem; line-height: 1.8; text-align: center; }
.mines-tips p { margin: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid #8ec7ff; outline-offset: 2px; }
.mine-cell:focus-visible { position: relative; z-index: 1; outline-color: #006acd; outline-offset: -2px; }
@media (max-width: 991.98px) { .mines-layout { grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; }.settings-card, .mines-card { padding: 20px 16px; } }
@media (max-width: 767.98px) {
    .mines-header { padding: 8px 16px; gap: 10px; }.mines-plan { padding: 5px 8px; font-size: .72rem; }.mines-title { gap: 7px; font-size: 1.175rem; }.mines-title-icon { width: 32px; height: 32px; font-size: 1.3rem; }.mines-open-link { font-size: .8rem; }
    .mines-main { padding: 24px 16px 16px; gap: 20px; }.mines-layout { grid-template-columns: minmax(0, 1fr); max-width: 620px; }.settings-card, .mines-card { padding: 18px 16px 22px; border-radius: 22px; }
    .how-to { display: none; }.mobile-help { display: block; }.mines-board { --cell-size: clamp(24px, calc((100vw - 100px) / 9 - 2px), 36px); }.board-viewport { padding: 8px; }
}
@media (max-width: 575.98px) {
    .mines-header { grid-template-columns: minmax(0, 1fr) auto; }.mines-title { grid-column: 1 / -1; grid-row: 1; }.mines-plan { grid-column: 1; grid-row: 2; }.mines-open-link { grid-column: 2; grid-row: 2; }
    .game-stats { gap: 6px; }.game-stats > div { padding: 10px 8px; }.game-stats strong { font-size: 1.05rem; }.game-stats span { font-size: .68rem; }.mines-tips { padding: 18px 12px 0; font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
