:root {
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  padding: 24px;
  background: #f2f5f7;
  color: #1f2933;
}

/* ------ Mode Selection Screen ------ */
#mode-select {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  box-sizing: border-box;
}

.mode-select-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  text-align: center;
  max-width: 560px;
  width: 100%;
}

.mode-select-card h1 {
  margin-top: 0;
}

.mode-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.mode-buttons button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 28px;
  border-radius: 10px;
  background: #0b69ff;
  color: white;
  border: none;
  cursor: pointer;
  min-width: 200px;
}

.mode-buttons button:hover {
  opacity: 0.9;
}

.mode-description {
  font-size: 0.85em;
  margin-top: 4px;
  opacity: 0.9;
}

.mode-home-row {
  justify-content: center;
  margin-top: 12px;
}

.game-layout {
  max-width: 760px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

h1 {
  margin-top: 0;
}

.mode-selection {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  background: #f8fbff;
}

.mode-title {
  margin: 0 0 8px;
  font-weight: 700;
}

.image-panel {
  position: relative;
  margin-bottom: 16px;
}

.image-panel.is-loading::before {
  content: "Loading mystery animal...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #102a43;
  font-size: 0.92rem;
  font-weight: 700;
}

.image-panel.is-loading::after {
  content: "";
  position: absolute;
  top: calc(50% + 28px);
  left: 50%;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  margin-left: -16px;
  z-index: 1;
  border: 3px solid rgba(11, 105, 255, 0.25);
  border-top-color: #0b69ff;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  pointer-events: none;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

#animal-image {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  transition: filter 0.5s linear;
}

.timer-bar {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-weight: 700;
}

.controls {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

#guess-input {
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #cbd2d9;
  border-radius: 8px;
}

.button-row {
  display: flex;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: #0b69ff;
  color: white;
  font-weight: 700;
}

button:hover {
  opacity: 0.92;
}

.status-message {
  min-height: 22px;
  margin: 0;
}

.fact-message {
  min-height: 22px;
  margin: 0;
  color: #102a43;
  font-weight: 600;
}

.hint-message {
  min-height: 22px;
  margin: 0;
  color: #486581;
  font-weight: 600;
}

.summary-panel {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #eef6ff;
  border: 1px solid #d6e4ff;
}

.summary-panel h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.scoreboard {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 1.05rem;
}

dialog {
  border: 0;
  border-radius: 10px;
  padding: 16px;
  max-width: 420px;
}

#home-button {
  background: #6c757d;
}

#home-button:hover {
  opacity: 0.92;
}

#show-hint:disabled {
  background: #9fb3c8;
  cursor: not-allowed;
}

#reset-high-score {
  background: #d64545;
}

#high-score.new-record {
  animation: pulse-record 0.7s ease-in-out 2;
}

@keyframes pulse-record {
  0% {
    color: #102a43;
  }
  50% {
    color: #0b69ff;
  }
  100% {
    color: #102a43;
  }
}
