body {
    text-align: center;
    counter-reset: bombs;
}
* {
    margin: 0;
    padding: 0;
}
article {
    display: block;
}

td a.beach {
    display: none;
}

a {
    text-decoration: none;
}
table a:visited {
    cursor: default;
}
article :focus {
    outline: 0;
}
table {
    margin: 5px;
    padding: 3px;
}

/* Basic box */
td {
    padding: 1px;
    width: 16px;
    height: 16px;
}

/* Number positioning */
td.count a.info span {
    font-size: 12px;
    position: absolute;
}

/* Make the whole box clickable */
table a {
    display: block;
    width: 100%;
    height: 16px;
}

/* By default, the box is shown empty */
td a span {
    display: none;
}

.bomb {
    counter-increment: bombs;
}

/* For a visited box, the text is shown */
td.count .beach:visited ~ a.info span,
td.count a.info:visited span {
    display: block;
}

/* The flagging button */
td input {
    visibility: hidden;
    position: absolute;
    z-index: 500;
    margin-top: -5px;
    margin-left: 10px;
    display: block;
    border: 1px solid black;
    opacity: 0.7;
}
td:hover input {
    visibility: visible;
}

td:hover .beach:visited ~ input,
td:hover .info:visited ~ input {
    visibility: hidden;
}

:checked {
    counter-increment: bombs -1;
}
span.flag {
    background-repeat: no-repeat;
}

#lose span {
    display: none;
}

p#controls {
    position: absolute;
    height: 30px;
    width: 100%;
}
/* #lose points to the same URL as the mines. When visited (game lost), the control bar expands so that
   it masks the board and makes it unclickable. */
#lose:visited + p#controls {
    height: 400px; /* FIXME: I don't know how to make the height fit exactly the board, so I'm just using a "high enough" value... */
}
