/* ===================== RESET & BASE ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  background: #121213;
  color: #fff;
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}


/* ===================== CLOUDFLARE OVERLAY ===================== */
#cf-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s ease;
}

#cf-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.cf-card {
  width: 100%;
  max-width: 600px;
  padding: 0 24px;
  color: #404040;
  font-family: Arial, Helvetica, sans-serif;
}

.cf-header {
  border-bottom: 1px solid #e2e2e2;
  padding: 18px 0;
  margin-bottom: 28px;
}

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

.cf-cloud {
  width: 48px;
  height: 30px;
}

.cf-brand-name {
  font-size: 22px;
  font-weight: 700;
  color: #404040;
  letter-spacing: -0.5px;
}

.cf-body h2 {
  font-size: 19px;
  font-weight: 400;
  color: #404040;
  margin-bottom: 10px;
  line-height: 1.5;
}

.cf-domain {
  font-weight: 700;
}

.cf-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 22px;
  line-height: 1.5;
}

.cf-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.cf-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e2e2e2;
  border-top-color: #F48120;
  border-radius: 50%;
  animation: cf-spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

.cf-wait-text {
  font-size: 14px;
  color: #555;
}

.cf-progress-track {
  height: 5px;
  background: #e2e2e2;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.cf-progress-fill {
  height: 100%;
  background: #F48120;
  width: 0%;
  animation: cf-fill 3s ease-in-out forwards;
}

@keyframes cf-fill {
  0%   { width: 0%; }
  15%  { width: 18%; }
  40%  { width: 45%; }
  70%  { width: 72%; }
  90%  { width: 88%; }
  100% { width: 100%; }
}

.cf-ddos {
  font-size: 12px;
  color: #888;
  margin-bottom: 28px;
}

.cf-footer {
  border-top: 1px solid #e2e2e2;
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
  flex-wrap: wrap;
  gap: 6px;
}

.cf-footer code {
  font-family: monospace;
  font-size: 12px;
  color: #555;
}

.cf-footer strong {
  color: #555;
}


/* ===================== GAME LAYOUT ===================== */
#game {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
}

#game-header {
  width: 100%;
  text-align: center;
  border-bottom: 1px solid #3a3a3c;
  padding: 10px 0;
}

#game-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  color: #fff;
}


/* ===================== TOAST ===================== */
#toast-container {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}

#toast {
  background: #fff;
  color: #121213;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  text-align: center;
}

#toast.show {
  opacity: 1;
}


/* ===================== BOARD ===================== */
#board-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#board {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.row-label {
  width: 28px;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 600;
  color: #565758;
  flex-shrink: 0;
  user-select: none;
}

.row {
  display: flex;
  gap: 5px;
}

.tile {
  width: 44px;
  height: 44px;
  border: 2px solid #3a3a3c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  user-select: none;
}

/* Filled but not yet submitted */
.tile.filled {
  border-color: #565758;
}

/* Revealed states */
.tile.correct {
  background-color: #538d4e;
  border-color: #538d4e;
  color: #fff;
}

.tile.present {
  background-color: #b59f3b;
  border-color: #b59f3b;
  color: #fff;
}

.tile.absent {
  background-color: #3a3a3c;
  border-color: #3a3a3c;
  color: #fff;
}

/* Pop animation when typing */
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.tile.pop {
  animation: pop 0.1s ease;
}

/* Reveal animation — color appears with a scale bump, letters stay visible */
@keyframes reveal-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.tile.reveal-pop {
  animation: reveal-pop 0.3s ease;
}

/* Shake when not enough letters */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-5px); }
  30%       { transform: translateX(5px); }
  45%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
  75%       { transform: translateX(-5px); }
}

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

/* Bounce animation for win */
@keyframes bounce-up {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-18px); }
}

.tile.bounce {
  animation: bounce-up 0.45s ease-in-out;
}


/* ===================== KEYBOARD ===================== */
#keyboard-container {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 8px 0 14px;
}

#keyboard {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
}

.key-row {
  display: flex;
  gap: 5px;
}

.key {
  height: 50px;
  min-width: 36px;
  padding: 0 6px;
  background: #818384;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background-color 0.2s, filter 0.1s;
}

.key.wide {
  min-width: 58px;
  font-size: 0.72rem;
}

.key:hover {
  filter: brightness(1.2);
}

.key:active {
  filter: brightness(0.85);
}

/* Keyboard key states */
.key.correct {
  background-color: #538d4e;
}

.key.present {
  background-color: #b59f3b;
}

.key.absent {
  background-color: #3a3a3c;
}

@keyframes key-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.key.key-updated {
  animation: key-pop 0.25s ease;
}
