body {
  font: 16px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #111;
  background: #fff;
  margin: 0 auto;
  padding: 16px;
  max-width: 500px;
}

header {
  border-bottom: 1px solid #ccc;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

h1 {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

nav a {
  color: #111;
  margin-right: 12px;
  font-size: 14px;
}

nav a.on {
  font-weight: bold;
  text-decoration: none;
}

#account {
  margin: 8px 0 0;
  font-size: 13px;
  color: #555;
}

#account-name {
  margin-right: 8px;
}

button {
  font: inherit;
  font-size: 13px;
  color: #111;
  background: #fff;
  border: 1px solid #888;
  padding: 3px 8px;
  cursor: pointer;
}

button:hover {
  background: #eee;
}

#puzzle-no {
  font-size: 13px;
  color: #555;
  margin: 0 0 12px;
}

/* board */

#board {
  display: grid;
  grid-template-rows: repeat(6, 58px);
  gap: 5px;
  width: 305px;
  margin: 0 auto;
}

.row {
  display: grid;
  grid-template-columns: repeat(5, 58px);
  gap: 5px;
}

.tile {
  border: 2px solid #d3d6da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: bold;
  text-transform: uppercase;
  line-height: 1;
  color: #111;
  background: #fff;
  user-select: none;
}

.tile.filled {
  border-color: #878a8c;
}

.tile.correct,
.tile.present,
.tile.absent {
  color: #fff;
  border-color: transparent;
}

.tile.correct { background: #6aaa64; }
.tile.present { background: #c9b458; }
.tile.absent  { background: #787c7e; }

.tile.flip {
  animation: flip 0.5s ease forwards;
}

@keyframes flip {
  0%   { transform: rotateX(0); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.row.bad {
  animation: shake 0.4s;
}

@keyframes shake {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

#message {
  text-align: center;
  min-height: 20px;
  font-size: 14px;
  margin: 12px 0;
}

#prefs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 13px;
  color: #333;
}

#prefs label {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

#prefs button,
#notify-status {
  flex: 0 0 auto;
}

#prefs input {
  margin-right: 6px;
}

#notify-status {
  color: #555;
}

#save-status {
  text-align: center;
  font-size: 13px;
  color: #555;
  margin: -6px 0 12px;
}

/* Board and keyboard until you have signed in. */
.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* keyboard */

#keyboard {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.krow {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 5px;
}

.key {
  flex: 1 1 34px;
  min-width: 0;
  height: 52px;
  border: 0;
  border-radius: 3px;
  background: #d3d6da;
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
}

.key.wide {
  flex: 1.6 1 52px;
  font-size: 11px;
}

.spacer {
  flex: 0.5 1 auto;
}

.key.correct { background: #6aaa64; color: #fff; }
.key.present { background: #c9b458; color: #fff; }
.key.absent  { background: #787c7e; color: #fff; }

/* tables */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  margin-top: 24px;
}

caption {
  text-align: left;
  font-weight: bold;
  padding-bottom: 6px;
}

th, td {
  border: 1px solid #ccc;
  padding: 5px 8px;
  text-align: left;
}

thead th {
  background: #f2f2f2;
}

#stats {
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

#stats th {
  font-weight: normal;
}

#stats td {
  text-align: right;
  width: 60px;
}

#leaderboard td:nth-child(n+3),
#leaderboard th:nth-child(n+3),
#today td:nth-child(n+3),
#today th:nth-child(n+3) {
  text-align: right;
}

tr.me td {
  font-weight: bold;
}

#board-note, #board-status, #today-note, #today-status {
  font-size: 13px;
  color: #555;
}

#board-status, #today-status {
  margin-top: 12px;
}

footer {
  border-top: 1px solid #ccc;
  margin-top: 32px;
  padding-top: 10px;
  font-size: 12px;
  color: #777;
}

@media (max-width: 380px) {
  #board { grid-template-rows: repeat(6, 50px); width: 265px; }
  .row { grid-template-columns: repeat(5, 50px); }
  .tile { font-size: 26px; }
  .key { height: 46px; }
}
