Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
    <form class="game" style="--columns:9; --rows:9;">
      <div class="screen">
        <div class="dialog">
          <div class="dialog__content dialog__content--intro">
            <h1>MineCSSweeper</h1>
            <p>An old classic! Try and open all the cells without tripping a mine.</p>
            <label for="start-game" class="faux-button">Start Game</label>
            <input tabindex="-1" type="checkbox" id="start-game">
          </div>
          <div class="dialog__content dialog__content--lose">
            <h1>Uh Oh!</h1>
            <p>Looks like you tripped a mine!</p>
            <button tabindex="-1" class="faux-button" type="reset" title="Reset Board">Replay</button>
          </div>
          <div class="dialog__content dialog__content--win">
            <h1>Well Done!</h1>
            <div class="timer">
              <div class="digit second m m--tens">0</div>
              <div class="digit second m m--singles">0</div>
              <span>:</span>
              <div class="digit second s s--tens">0</div>
              <div class="digit second s s--singles">0</div>
              <span>:</span>
              <div class="digit digit--small ms ms--tens">0</div>
              <div class="digit digit--small ms ms--singles">0</div>
            </div>
            <button tabindex="-1" class="faux-button" type="reset" title="Reset Board">Replay</button>
          </div>
        </div>
      </div>
      <div class="board__flag-toggle toggle">
        <input type="checkbox" id="flag-toggle">
        <div class="toggle__thumb"></div>
        <label for="flag-toggle" class="toggle__control"></label>
      </div>
      <div class="board">
        <div class="board__group-controls"><input type="checkbox" id="group--0"><input type="checkbox" id="prompt--18"><input type="checkbox" id="prompt--27"><input type="checkbox" id="prompt--36"><input type="checkbox" id="prompt--58"><input type="checkbox" id="prompt--76"><input type="checkbox" id="prompt--77"><input type="checkbox" id="prompt--78"></div>
      <div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--0"><label for="flag--0"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--1"><label for="flag--1"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--2"><label for="flag--2"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--3"><label for="flag--3"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--4"><label for="flag--4"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--5"><label for="flag--5"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--6"><label for="flag--6"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--7"><label for="flag--7"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--8"><label for="flag--8"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--9"><label for="flag--9"></label><input type="checkbox" id="placeholder--9"><label for="placeholder--9"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--10"><label for="flag--10"></label><input type="checkbox" id="placeholder--10"><label for="placeholder--10"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--11"><label for="flag--11"></label><input type="checkbox" id="placeholder--11"><label for="placeholder--11"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--12"><label for="flag--12"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--13"><label for="flag--13"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--14"><label for="flag--14"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--15"><label for="flag--15"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--16"><label for="flag--16"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--17"><label for="flag--17"></label><label for="group--0"></label></div><div class="board__cell board__cell--1" style="--hue: 0;"><span>1</span><input type="checkbox" id="flag--18"><label for="flag--18"></label><label for="prompt--18"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--19"><label for="flag--19"></label><input type="checkbox" id="placeholder--19"><label for="placeholder--19"></label><input type="checkbox" id="bomb--19"><label for="bomb--19"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--20"><label for="flag--20"></label><input type="checkbox" id="placeholder--20"><label for="placeholder--20"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--21"><label for="flag--21"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--22"><label for="flag--22"></label><input type="checkbox" id="placeholder--22"><label for="placeholder--22"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--23"><label for="flag--23"></label><input type="checkbox" id="placeholder--23"><label for="placeholder--23"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--24"><label for="flag--24"></label><input type="checkbox" id="placeholder--24"><label for="placeholder--24"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--25"><label for="flag--25"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--26"><label for="flag--26"></label><label for="group--0"></label></div><div class="board__cell board__cell--1" style="--hue: 0;"><span>1</span><input type="checkbox" id="flag--27"><label for="flag--27"></label><label for="prompt--27"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--28"><label for="flag--28"></label><input type="checkbox" id="placeholder--28"><label for="placeholder--28"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--29"><label for="flag--29"></label><input type="checkbox" id="placeholder--29"><label for="placeholder--29"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--30"><label for="flag--30"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--31"><label for="flag--31"></label><input type="checkbox" id="placeholder--31"><label for="placeholder--31"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--32"><label for="flag--32"></label><input type="checkbox" id="placeholder--32"><label for="placeholder--32"></label><input type="checkbox" id="bomb--32"><label for="bomb--32"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--33"><label for="flag--33"></label><input type="checkbox" id="placeholder--33"><label for="placeholder--33"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--34"><label for="flag--34"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--35"><label for="flag--35"></label><label for="group--0"></label></div><div class="board__cell board__cell--1" style="--hue: 0;"><span>1</span><input type="checkbox" id="flag--36"><label for="flag--36"></label><label for="prompt--36"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--37"><label for="flag--37"></label><input type="checkbox" id="placeholder--37"><label for="placeholder--37"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--38"><label for="flag--38"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--39"><label for="flag--39"></label><input type="checkbox" id="placeholder--39"><label for="placeholder--39"></label></div><div class="board__cell board__cell--2 board__cell-group--0" style="--hue: 120;"><span>2</span><input type="checkbox" id="flag--40"><label for="flag--40"></label><input type="checkbox" id="placeholder--40"><label for="placeholder--40"></label></div><div class="board__cell board__cell--2 board__cell-group--0" style="--hue: 120;"><span>2</span><input type="checkbox" id="flag--41"><label for="flag--41"></label><input type="checkbox" id="placeholder--41"><label for="placeholder--41"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--42"><label for="flag--42"></label><input type="checkbox" id="placeholder--42"><label for="placeholder--42"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--43"><label for="flag--43"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--44"><label for="flag--44"></label><label for="group--0"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--45"><label for="flag--45"></label><input type="checkbox" id="placeholder--45"><label for="placeholder--45"></label><input type="checkbox" id="bomb--45"><label for="bomb--45"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--46"><label for="flag--46"></label><input type="checkbox" id="placeholder--46"><label for="placeholder--46"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--47"><label for="flag--47"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--48"><label for="flag--48"></label><input type="checkbox" id="placeholder--48"><label for="placeholder--48"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--49"><label for="flag--49"></label><input type="checkbox" id="placeholder--49"><label for="placeholder--49"></label><input type="checkbox" id="bomb--49"><label for="bomb--49"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--50"><label for="flag--50"></label><input type="checkbox" id="placeholder--50"><label for="placeholder--50"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--51"><label for="flag--51"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--52"><label for="flag--52"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--53"><label for="flag--53"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--54"><label for="flag--54"></label><input type="checkbox" id="placeholder--54"><label for="placeholder--54"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--55"><label for="flag--55"></label><input type="checkbox" id="placeholder--55"><label for="placeholder--55"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--56"><label for="flag--56"></label><label for="group--0"></label></div><div class="board__cell board__cell--2 board__cell-group--0" style="--hue: 120;"><span>2</span><input type="checkbox" id="flag--57"><label for="flag--57"></label><input type="checkbox" id="placeholder--57"><label for="placeholder--57"></label></div><div class="board__cell board__cell--3" style="--hue: 0;"><span>3</span><input type="checkbox" id="flag--58"><label for="flag--58"></label><label for="prompt--58"></label></div><div class="board__cell board__cell--3 board__cell-group--0" style="--hue: 180;"><span>3</span><input type="checkbox" id="flag--59"><label for="flag--59"></label><input type="checkbox" id="placeholder--59"><label for="placeholder--59"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--60"><label for="flag--60"></label><input type="checkbox" id="placeholder--60"><label for="placeholder--60"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--61"><label for="flag--61"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--62"><label for="flag--62"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--63"><label for="flag--63"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--64"><label for="flag--64"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--65"><label for="flag--65"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--66"><label for="flag--66"></label><input type="checkbox" id="placeholder--66"><label for="placeholder--66"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--67"><label for="flag--67"></label><input type="checkbox" id="placeholder--67"><label for="placeholder--67"></label><input type="checkbox" id="bomb--67"><label for="bomb--67"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--68"><label for="flag--68"></label><input type="checkbox" id="placeholder--68"><label for="placeholder--68"></label><input type="checkbox" id="bomb--68"><label for="bomb--68"></label></div><div class="board__cell board__cell--2 board__cell-group--0" style="--hue: 120;"><span>2</span><input type="checkbox" id="flag--69"><label for="flag--69"></label><input type="checkbox" id="placeholder--69"><label for="placeholder--69"></label></div><div class="board__cell board__cell--2 board__cell-group--0" style="--hue: 120;"><span>2</span><input type="checkbox" id="flag--70"><label for="flag--70"></label><input type="checkbox" id="placeholder--70"><label for="placeholder--70"></label></div><div class="board__cell board__cell--2 board__cell-group--0" style="--hue: 120;"><span>2</span><input type="checkbox" id="flag--71"><label for="flag--71"></label><input type="checkbox" id="placeholder--71"><label for="placeholder--71"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--72"><label for="flag--72"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--73"><label for="flag--73"></label><label for="group--0"></label></div><div class="board__cell board__cell--0 board__cell-group--0" style="--hue: 0;"><span></span><input type="checkbox" id="flag--74"><label for="flag--74"></label><label for="group--0"></label></div><div class="board__cell board__cell--1 board__cell-group--0" style="--hue: 60;"><span>1</span><input type="checkbox" id="flag--75"><label for="flag--75"></label><input type="checkbox" id="placeholder--75"><label for="placeholder--75"></label></div><div class="board__cell board__cell--2" style="--hue: 0;"><span>2</span><input type="checkbox" id="flag--76"><label for="flag--76"></label><label for="prompt--76"></label></div><div class="board__cell board__cell--2" style="--hue: 0;"><span>2</span><input type="checkbox" id="flag--77"><label for="flag--77"></label><label for="prompt--77"></label></div><div class="board__cell board__cell--2" style="--hue: 0;"><span>2</span><input type="checkbox" id="flag--78"><label for="flag--78"></label><label for="prompt--78"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--79"><label for="flag--79"></label><input type="checkbox" id="placeholder--79"><label for="placeholder--79"></label><input type="checkbox" id="bomb--79"><label for="bomb--79"></label></div><div class="board__cell board__cell--X board__cell--exploder" style="--hue: 0;"><span>💣</span><input type="checkbox" id="flag--80"><label for="flag--80"></label><input type="checkbox" id="placeholder--80"><label for="placeholder--80"></label><input type="checkbox" id="bomb--80"><label for="bomb--80"></label></div></div>
      <div class="game__controls">
        <div class="flag-controls">
          <div class="flag-counter">
            <span>⛳️:</span>
            <span class="mine-count"></span>
          </div>
        </div>
        <div class="timer-container">
          <div class="timer game-timer">
            <div class="digit second m m--tens">0</div>
            <div class="digit second m m--singles">0</div>
            <span>:</span>
            <div class="digit second s s--tens">0</div>
            <div class="digit second s s--singles">0</div>
            <span>:</span>
            <div class="digit digit--small ms ms--tens">0</div>
            <div class="digit digit--small ms ms--singles">0</div>
          </div>
        </div>
        <div class="game-state-controls">
          <button class="game-reset faux-button" type="reset" title="Reset">
            <svg class="reset" viewBox="0 0 24 24">
              <path d="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"></path>
            </svg>
          </button>
        </div>
      </div>
    </form>
    <script type="module" src="./script.js"></script>
  
<div class="support-warnings"><div class="support-warning support-warning--has">This browser is not supported... yet. :has is currently supported in Chrome v105+, Chrome Canary with the "Experimental Web Platform Features" flag enabled or Safari.</div><div class="support-warning support-warning--popup">This browser is not supported... yet. popup is currently supported in Chrome Canary with the "Experimental Web Platform Features" flag enabled.</div><div class="support-warning support-warning--houdini">This browser is not supported... yet. Some Houdini features are currently supported in Chromium based browsers. Check <a href="https://ishoudinireadyyet.com/" rel="noopener noreferrer" target="_blank">ishoudinireadyyet.com</a>.</div><div class="support-warning support-warning--object-view-box">This browser is not supported... yet. object-view-box is currently supported in Chrome Canary with the "Experimental Web Platform Features" flag enabled.</div><div class="support-warning support-warning--scroll-timeline">This browser is not supported... yet. @scroll-timeline is currently supported in Chrome Canary with the "Experimental Web Platform Features" flag enabled.</div><div class="support-warning support-warning--set">This browser is not supported... yet. The "Shared Element Transitions" API is currently supported in Chrome Canary with the "Experimental Web Platform Features" and "Document Transition" flags enabled.</div><div class="support-warning support-warning--anchoring">This browser is not supported... yet. CSS anchoring can be experimented with in Chrome Canary with the "Experimental Web Platform Features" flag enabled.</div><div class="support-warning support-warning--selectmenu">This browser is not supported... yet. SelectMenu can be experimented with in Chrome Canary with the "Experimental Web Platform Features" flag enabled.</div></div><style>:root:has(#group--0:checked) .board__cell-group--0 label,:root:has(#prompt--18:checked) .board__cell:has([for=prompt--18]) label ,:root:has(#prompt--27:checked) .board__cell:has([for=prompt--27]) label ,:root:has(#prompt--36:checked) .board__cell:has([for=prompt--36]) label ,:root:has(#prompt--58:checked) .board__cell:has([for=prompt--58]) label ,:root:has(#prompt--76:checked) .board__cell:has([for=prompt--76]) label ,:root:has(#prompt--77:checked) .board__cell:has([for=prompt--77]) label ,:root:has(#prompt--78:checked) .board__cell:has([for=prompt--78]) label  {display: none; } :root:has(#group--0:checked ~#prompt--18:checked ~#prompt--27:checked ~#prompt--36:checked ~#prompt--58:checked ~#prompt--76:checked ~#prompt--77:checked ~#prompt--78:checked ) body { --screen-hide: 0; --show-win: 1; --state: paused; } :root:has(#group--0:checked ~#prompt--18:checked ~#prompt--27:checked ~#prompt--36:checked ~#prompt--58:checked ~#prompt--76:checked ~#prompt--77:checked ~#prompt--78:checked ) body 
    :where(.dialog__content--intro, .dialog__content--lose) {
      --z: -1;
      --opacity: 0;
    }
   :root:has(#group--0:checked ~#prompt--18:checked ~#prompt--27:checked ~#prompt--36:checked ~#prompt--58:checked ~#prompt--76:checked ~#prompt--77:checked ~#prompt--78:checked ) body 
    :where(.dialog__content--win) {
      --z: 2;
      opacity: 1;
    }
  </style>
              
            
!

CSS

              
                @import "https://unpkg.com/open-props/open-props.min.css";
@import "https://unpkg.com/open-props/normalize.min.css";

* {
  box-sizing: border-box;
}
:root {
  --mine-count: 8;
  --digit: var(--red);
  --state: paused;
  --stan-win: 0;
  --stan-star-scale: 0;
  --stan-star-rotate: 0;
  --red: #ff4d00;
  --yellow: #ebb624;
  --green: #38b24d;
  --blue: #0f73ff;
  --screen-hide: 0;
  --screen-delay: 0;
  --show-results: 0;
  --deck: hsl(210 34% 10%);
}

h1 {
	color: var(--gray-0);
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  font-family: 'Google Sans', sans-serif;
  background: var(--gradient-9);
  clip-path: inset(0 0 0 0);
}
form {
  margin: 0;
  position: relative;
}
.game-state-controls {
  justify-self: end;
}
.game__controls {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  justify-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--columns) * 5.25vmin);
  transform: translate(-50%, calc(-50% - ((var(--columns) * 0.65) * 5vmin)));
}
svg {
  fill: currentColor;
}
.board {
  background: var(--gray-6);
  border: 0.4vmin solid var(--gray-6);
  display: grid;
  grid-template-columns: repeat(var(--columns), 5vmin);
  grid-template-rows: repeat(var(--rows), 5vmin);
  grid-gap: 0.2vmin;
}
.board__cell {
  display: grid;
  place-items: center;
  color: hsl(var(--hue, 210) 100% 40% / 1);
  font-weight: bold;
  position: relative;
  font-family: sans-serif;
  font-size: 3vmin;
  background: var(--gray-2);
}
.board__cell--exploder {
  background: var(--red-8);
}
.board__group-controls {
  position: absolute;
}
.board__flag-toggle {
  position: absolute;
  top: 110%;
  right: 0;
  min-height: 5vmin;
  min-width: 5vmin;
}
.board__cell label {
  background: var(--gray-2);
  border: var(--size-2) solid var(--gray-0);
  border-right-color: var(--gray-5);
  border-bottom-color: var(--gray-5);
}
.board__cell :where(label,
span) {
  position: absolute;
  inset: 0;
  display: inline-block;
  display: grid;
  place-items: center;
}
:root:has(#flag-toggle:checked) {
  --flagging: 1;
}
:root:has(#flag-toggle:checked) .board__cell:has([id*="flag--"]:checked) [for*="flag--"],
:root:has(#flag-toggle:not(:checked)) .board__cell:has([id*="flag--"]:checked) [for*="flag--"] {
  display: block;
  z-index: 2;
}
body {
  counter-reset: flag var(--mine-count);
}
[id*=flag--]:checked {
  counter-increment: flag -1;
}
.mine-count:after {
  color: var(--text-1);
  content: counter(flag);
}
.board__cell:has(:checked:not([id*="flag"])) label {
  opacity: 0;
  z-index: -1;
}
.board__cell:has(:checked[id*="flag"]) label[for*="flag"]:after {
  content: "⛳️";
  position: absolute;
  inset: 0;
  font-size: 3vmin;
}
.board__cell:has(:checked[id*="flag"]) span {
  cursor: not-allowed;
}
label {
  opacity: calc(1 - var(--show-fail, 0));
  z-index: 1;
}
label[for*="flag"],
label[for*="defuse"] {
  z-index: calc(1 + var(--flagging, 0));
}
.timer {
  color: var(--digit);
  display: inline-flex;
  font-size: 6vmin;
  padding: 1.75vmin;
  background: #000;
}
@property --ms-tens {
  initial-value: 0;
  inherits: false;
  syntax: '<integer>';
}
@property --ms-singles {
  initial-value: 0;
  inherits: false;
  syntax: '<integer>';
}
@property --s-tens {
  initial-value: 0;
  inherits: false;
  syntax: '<integer>';
}
@property --s-singles {
  initial-value: 0;
  inherits: false;
  syntax: '<integer>';
}
@property --m-tens {
  initial-value: 0;
  inherits: false;
  syntax: '<integer>';
}
@property --m-singles {
  initial-value: 0;
  inherits: false;
  syntax: '<integer>';
}
.digit {
  position: relative;
  color: transparent;
  font-family: 'Orbitron', 'Google Sans', sans-serif;
  counter-reset: var(--counter-name) var(--counter-variable);
  -webkit-animation: var(--name, none) var(--duration, 1s) infinite steps(var(--steps)) var(--state);
          animation: var(--name, none) var(--duration, 1s) infinite steps(var(--steps)) var(--state);
}
.digit:after {
  content: counter(var(--counter-name));
  font-variant: tabular-nums;
  color: var(--digit);
  position: absolute;
  bottom: 0;
  right: 0;
}
:root:has(#start-game:checked) {
  --state: running;
}
:root:has(#start-game:checked) .ms--tens {
  --name: ms-tens;
}
:root:has(#start-game:checked) .ms--singles {
  --name: ms-singles;
}
:root:has(#start-game:checked) .s--tens {
  --name: s-tens;
}
:root:has(#start-game:checked) .s--singles {
  --name: s-singles;
}
:root:has(#start-game:checked) .m--tens {
  --name: m-tens;
}
:root:has(#start-game:checked) .m--singles {
  --name: m-singles;
}
.game-timer {
  font-size: 3vmin;
  padding: 1vmin;
}
.game-timer .ms {
  font-size: 2vmin;
}
.ms {
  font-size: 4vmin;
  transform: translate(0, -6%);
}
.ms--tens {
  --duration: 1s;
  --steps: 10;
  --counter-name: ms-tens;
  --counter-variable: var(--ms-tens);
}
.ms--singles {
  --duration: 0.1s;
  --steps: 10;
  --counter-name: ms-singles;
  --counter-variable: var(--ms-singles);
}
.s--tens {
  --duration: 60s;
  --steps: 6;
  --counter-name: s-tens;
  --counter-variable: var(--s-tens);
}
.s--singles {
  --duration: 10s;
  --steps: 10;
  --counter-name: s-singles;
  --counter-variable: var(--s-singles);
}
.m--tens {
  --duration: 3600s;
  --steps: 6;
  --counter-name: m-tens;
  --counter-variable: var(--m-tens);
}
.m--singles {
  --duration: 600s;
  --steps: 10;
  --counter-name: m-singles;
  --counter-variable: var(--m-singles);
}
@property --screen-hide {
  initial-value: 0;
  inherits: true;
  syntax: '<number>';
}
@property --screen-y {
  initial-value: 0;
  inherits: true;
  syntax: '<length>';
}
@property --screen-scale {
  initial-value: 1;
  inherits: true;
  syntax: '<number>';
}
.screen {
  height: 100vh;
  width: 100vw;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(calc(var(--screen-y, 0))) scale(var(--screen-scale, 0)) translateY(calc(var(--screen-hide, 0) * 100vh));
  z-index: 5;
  display: grid;
  place-items: center;
  transition: --screen-hide 0.2s;
}
.dialog {
  display: grid;
  grid-template-columns: auto;
  grid-template-rows: auto;
  font-family: 'Google Sans', sans-serif;
  font-size: clamp(1rem, 2vmin, 2rem);
  backdrop-filter: blur(10px) saturate(0.75);
  color: var(--gray-0);
  background: hsl(210 29% 20% / 0.8);
  position: absolute;
  box-shadow: var(--shadow-6);
  text-align: center;
  border-style: solid;
  border-top-color: var(--red);
  border-right-color: var(--green);
  border-bottom-color: var(--yellow);
  border-left-color: var(--blue);
  border-width: var(--size-2);
}
.dialog__content {
  padding: var(--size-4);
  inset: 0;
  display: grid;
  place-items: center;
  grid-column: 1;
  grid-row: 1;
}

.dialog__content .timer {
  margin-bottom: 1rem;
}
:root:has(#start-game:checked) {
  --screen-hide: 1;
}
:root:has([id*="bomb"]:checked) body {
  --show-fail: 1;
  --screen-hide: 0;
  --state: paused;
}
:root:has([id*="bomb"]:checked) :where(.dialog__content--lose) {
  --opacity: 1;
  --z: 2;
}
:root:has([id*="bomb"]:checked) :where(.dialog__content--intro,
.dialog__content--win),
.dialog__content--win,
.dialog__content--lose {
  --opacity: 0;
  --z: -1;
}
.dialog__content {
  opacity: var(--opacity, 1);
  z-index: var(--z, 2);
}
p + * {
  margin-top: var(--size-4);
}
.faux-button {
  --bg: var(--gray-9);
  box-sizing: border-box;
  font-size: var(--font-size-fluid-1);
  padding: var(--size-4) var(--size-6);
  background: var(--bg);
  color: var(--gray-0);
  font-weight: bold;
  font-family: 'Google Sans', sans-serif;
  border: var(--size-2) solid var(--gray-0);
  display: inline-block;
  transform: translateY(calc(var(--y, 0) * 1%)) scale(var(--s));
  transition: transform 0.1s, background 0.1s;
}
.faux-button:hover {
  --bg: #000;
  --y: -5;
  --s: 1.1;
}
.faux-button:active {
  --bg: #000;
  --y: 5;
  --s: 0.9;
}
h1 {
  text-align: center;
}
p {
  margin: 0;
}
[type="checkbox"] {
  opacity: 0;
  position: fixed;
}
.board__flag-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + ((var(--columns) * 0.65) * 5vmin)));
}
.toggle {
  --checked: -1;
  height: 2vmin;
  aspect-ratio: 2/1;
  border-radius: 4vmin;
  background: var(--gray-4);
}
.toggle:after {
  content: "⛳️";
  right: 0;
  transform: translate(120%, -50%);
}
.toggle:before {
  content: "👊";
  left: 0;
  transform: translate(-120%, -50%);
}
.toggle:before,
.toggle:after {
  position: absolute;
  top: 50%;
  font-size: 4vmin;
}
.toggle:has(:checked) {
  --checked: 1;
}
.toggle__thumb {
  height: 4vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--gray-2);
  position: absolute;
  left: 50%;
  top: 50%;
  border: 0.5vmin solid var(--gray-0);
  border-right-color: var(--gray-5);
  border-bottom-color: var(--gray-5);
  transition: transform 0.2s;
  transform: translate(-50%, -50%) translateX(calc(60% * var(--checked, -1)));
}
.toggle__control {
  position: absolute;
  cursor: pointer;
  inset: 0;
  z-index: 2;
  background: none;
}
.game-reset {
  background: none;
  color: var(--gray-8);
  height: 48px;
  aspect-ratio: 1;
  padding: 0;
  justify-self: flex-end;
  border: none;
  display: grid;
  place-items: center;
}

.game-reset svg {
  width: 65%;
}
.flag-controls {
  color: var(--gray-8);
  font-size: 4vmin;
  font-weight: bold;
  justify-self: start;
}
@keyframes ms-tens {
  to {
    --ms-tens: 10;
  }
}
@keyframes ms-singles {
  to {
    --ms-singles: 10;
  }
}
@keyframes s-tens {
  to {
    --s-tens: 6;
  }
}
@keyframes s-singles {
  to {
    --s-singles: 10;
  }
}
@keyframes m-tens {
  to {
    --m-tens: 6;
  }
}
@keyframes m-singles {
  to {
    --m-singles: 10;
  }
}
              
            
!

JS

              
                // 404
/**
* For a version that generates on refresh: https://codepen.io/jh3y/pen/eYKEMXY
* JavaScript is used to generate the board and the styles.
* The first version used Pug to generate the markup and styles.
*/
              
            
!
999px

Console