/* tac aesthetic: white page, hard black borders, monospace, chunky buttons */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: "Courier New", Courier, monospace;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

h1, h2, h3 {
  font-weight: bold;
  margin: 0.5em 0 0.3em;
}

a {
  color: #000;
}

button {
  font-family: inherit;
  border: 2px solid #000;
  border-radius: 0;
  background: #fff;
  padding: 10px 16px;
  font-size: 18px;
  cursor: pointer;
  color: #000;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.big {
  width: 100%;
  height: 70px;
  font-size: 30px;
}

input, select {
  font-family: inherit;
  font-size: 18px;
  border: 2px solid #000;
  border-radius: 0;
  padding: 10px;
  background: #fff;
  width: 100%;
}

input:focus, select:focus {
  outline: 3px solid #000;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
}

.topbar .brand {
  font-size: 22px;
  font-weight: bold;
  text-decoration: none;
}

.profile-chip {
  border: 2px solid #000;
  padding: 4px 10px;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row > * {
  flex: 1;
}

.banner {
  border: 2px solid #000;
  padding: 10px;
  margin: 10px 0;
  font-size: 15px;
}

.banner.error {
  border-color: #c00;
  color: #c00;
}

.banner.rainbow {
  border: 2px solid;
  border-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet) 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

th, td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #000;
}

td.right, th.right {
  text-align: right;
}

/* --- board ------------------------------------------------------------- */

/* Full-bleed and square: breaks out of the page padding so the board spans
   the entire viewport width on mobile. */
.board-wrap {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  touch-action: none;
  user-select: none;
  cursor: pointer;
}

@media (min-width: 592px) {
  .board-wrap {
    width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* --- d-pad ------------------------------------------------------------- */

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(2, 58px);
  gap: 8px;
  justify-content: center;
  margin: 14px auto 4px;
  user-select: none;
}

.dpad button {
  width: 100%;
  height: 100%;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  background: #fff;
  border: 2px solid #000;
  touch-action: manipulation;
}

.dpad button:active {
  background: #000;
  color: #fff;
}

.d-up { grid-column: 2; grid-row: 1; }
.d-left { grid-column: 1; grid-row: 2; }
.d-right { grid-column: 3; grid-row: 2; }
.d-down { grid-column: 2; grid-row: 2; }
.d-mid { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 100;
  font-size: 34px;
  pointer-events: none;
  white-space: pre-line;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  font-size: 24px;
}

.emoji-grid .pick {
  border: 2px solid transparent;
  padding: 4px;
  cursor: pointer;
  text-align: center;
}

.emoji-grid .pick.selected {
  border-color: #000;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.swatches .pick {
  height: 32px;
  border: 2px solid transparent;
  cursor: pointer;
}

.swatches .pick.selected {
  border-color: #000;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal {
  background: #fff;
  border: 3px solid #000;
  max-width: 480px;
  width: 100%;
  padding: 16px;
  max-height: 90vh;
  overflow-y: auto;
}

.scrubber {
  width: 100%;
}

.footnote {
  font-size: 13px;
  color: #333;
}

/* --- winner emoji rain -------------------------------------------------- */

.emoji-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}

.emoji-rain span {
  position: absolute;
  top: -8%;
  animation-name: emoji-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes emoji-fall {
  to {
    transform: translateY(120vh) rotate(300deg);
  }
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

.shake {
  animation: shake 0.5s ease infinite;
}
