/*
Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

:root {
  --bg-color: #e3f2fd;
  --container-bg: white;
  --text-color: #333;
  --primary-blue: #1565c0;
  --tile-border: #b0bec5;
  --tile-focus: #64b5f6;
  --color-correct: #6aaa64;
  --color-present: #c9b458;
  --suffix-color: #546e7a;
  --btn-bg: #bbdefb;
  --btn-text: #0d47a1;
  --btn-hover: #90caf9;

  --tile-size: 160px;
  --font-size-huge: 8rem;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  color: var(--text-color);
}

.container {
  background-color: var(--container-bg);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  text-align: center;
  max-width: 1400px;
  width: 98%;
}

h1 {
  color: var(--suffix-color);
  margin-bottom: 0.5rem;
  font-size: 2rem;
  font-weight: normal;
}

h2 {
  color: var(--primary-blue);
  margin-bottom: 1.5rem;
  font-size: 4.5rem;
  /* More significant */
  font-weight: bold;
}

.game-board {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  row-gap: 70px;
  /* Space for index numbers below tiles */
  column-gap: 20px;
  margin-bottom: 4rem;
  /* Increased space for indices */
  min-height: 150px;
}

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  border: 4px solid var(--tile-border);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-huge);
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  background-color: white;
  outline: none;
}

.tile:focus {
  border-color: var(--tile-focus);
  box-shadow: 0 0 15px rgba(100, 181, 246, 0.6);
}

.tile.correct {
  background-color: var(--color-correct);
  border-color: var(--color-correct);
  color: white;
}

.tile.present {
  background-color: var(--color-present);
  border-color: var(--color-present);
  color: white;
}

.suffix {
  font-size: var(--font-size-huge);
  font-weight: bold;
  color: var(--suffix-color);
  margin-left: 60px;
  /* Increased spacing */
  display: flex;
  align-items: center;
  height: var(--tile-size);
}

.palette {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  margin-top: 4rem;
  /* Increased spacing above */
  margin-bottom: 1rem;
}

.palette-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  border: 4px solid transparent;
  transition: transform 0.1s;
}

.palette-btn:hover {
  transform: scale(1.1);
}

.palette-btn.active {
  border-color: var(--btn-text);
}

.palette-white {
  background-color: white;
  border: 4px solid var(--tile-border);
}

.palette-green {
  background-color: var(--color-correct);
}

.palette-yellow {
  background-color: var(--color-present);
}

.controls {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

button {
  background-color: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition:
    background-color 0.2s,
    transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

button:hover {
  background-color: var(--btn-hover);
  transform: scale(1.1);
}

.snapshots-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
  width: 100%;
  align-items: center;
}

.snapshot-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.snapshot-board .tile {
  width: 60px;
  height: 60px;
  font-size: 3rem;
  border: 2px solid var(--tile-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  text-transform: uppercase;
}

.snapshot-board .tile.correct {
  background-color: var(--color-correct);
  border-color: var(--color-correct);
  color: white;
}

.snapshot-board .tile.present {
  background-color: var(--color-present);
  border-color: var(--color-present);
  color: white;
}

.snapshot-board .suffix {
  font-size: 3rem;
  height: 60px;
  margin-left: 5px;
  display: flex;
  align-items: center;
  color: var(--suffix-color);
  font-weight: bold;
}

/* Index labels for tiles */
.tile {
  position: relative;
}

.tile::after {
  content: attr(data-index);
  position: absolute;
  bottom: -50px;
  /* Moved further down */
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  /* Bigger index */
  font-weight: bold;
  color: #616161;
  /* Dark gray */
  text-transform: none;
}

.snapshot-board .tile {
  position: relative;
}

.snapshot-board .tile::after {
  content: none;
  /* Snapshot row does not need index number */
}

/* Config Menu Overlay Styles */
.config-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-width: 800px;
  width: 90%;
  display: block;
  /* Shown by default */
  text-align: left;
}

.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: block;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 1rem;
}

.config-grid label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
}

.config-grid input,
.config-grid select {
  padding: 5px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

.instructions {
  background-color: #f9f9f9;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #eee;
  margin-bottom: 1rem;
}

/* Girl Theme */
body.theme-girl {
  --bg-color: #fce4ec;
  --primary-blue: #c2185b;
  --tile-focus: #f48fb1;
  --btn-bg: #f8bbd0;
  --btn-text: #880e4f;
  --btn-hover: #f48fb1;
  --suffix-color: #880e4f;
}

/* Neutral Theme */
body.theme-neutral {
  --bg-color: #e8f5e9;
  /* Light Green */
  --primary-blue: #2e7d32;
  /* Dark Green */
  --tile-focus: #81c784;
  --btn-bg: #c8e6c9;
  --btn-text: #1b5e20;
  --btn-hover: #a5d6a7;
  --suffix-color: #1b5e20;
}

/* Shake Animation */
@keyframes shake {
  0% {
    transform: translate(1px, 1px) rotate(0deg);
  }

  10% {
    transform: translate(-1px, -2px) rotate(-1deg);
  }

  20% {
    transform: translate(-3px, 0px) rotate(1deg);
  }

  30% {
    transform: translate(3px, 2px) rotate(0deg);
  }

  40% {
    transform: translate(1px, -1px) rotate(1deg);
  }

  50% {
    transform: translate(-1px, 2px) rotate(-1deg);
  }

  60% {
    transform: translate(-3px, 1px) rotate(0deg);
  }

  70% {
    transform: translate(3px, 1px) rotate(-1deg);
  }

  80% {
    transform: translate(-1px, -1px) rotate(1deg);
  }

  90% {
    transform: translate(1px, 2px) rotate(0deg);
  }

  100% {
    transform: translate(1px, -2px) rotate(-1deg);
  }
}

.shake {
  animation: shake 0.5s;
  animation-iteration-count: 1;
}

/* Rounded Square Button */
.btn-square {
  width: auto !important;
  height: auto !important;
  padding: 10px 20px !important;
  border-radius: 8px !important;
  font-size: 1.2rem !important;
}

#cfg-answer-label {
  display: none;
}

.instructions hr {
  border: 0;
  border-top: 1px solid #eee;
  margin: 10px 0;
}

.config-menu > p {
  text-align: center;
  margin-bottom: 1rem;
}
