* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

::selection { background: #565758; color: #ffffff; }

body {
  background: #121213;
  font-family: 'Helvetica Neue', Arial, 'Segoe UI', sans-serif;
  color: #ffffff;
}

.page {
  min-height: 100%;
  width: 100%;
  background: #121213;
  padding: 20px 14px 32px;
  display: flex;
  justify-content: center;
  position: relative;
}

.container {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #3a3a3c;
  padding-bottom: 12px;
}

.title {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffffff;
  text-transform: uppercase;
}

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

.stat-chip {
  font-size: 12px;
  color: #b0b0b1;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.stat-dot {
  font-size: 12px;
  color: #565758;
}

.round-label {
  text-align: center;
  font-size: 12px;
  color: #818384;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.frame-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Bigger photo frame than the original */
.frame-outer {
  width: 260px;
  height: 260px;
  max-width: 80vw;
  max-height: 80vw;
  border-radius: 14px;
  background: #1a1a1b;
  border: 1px solid #3a3a3c;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}

.frame-inner {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #282829;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hint-text {
  font-size: 12px;
  color: #b59f3b;
  font-weight: 600;
}

.board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.tile-row {
  display: flex;
  gap: 6px;
}

.tile {
  width: clamp(28px, 9vw, 40px);
  height: clamp(28px, 9vw, 40px);
  border: 2px solid #3a3a3c;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(14px, 4vw, 18px);
  text-transform: uppercase;
  color: #ffffff;
  background: transparent;
}

.tile.filled { border-color: #565758; }
.tile.green { background: #538d4e; border-color: #538d4e; }
.tile.yellow { background: #b59f3b; border-color: #b59f3b; }
.tile.gray { background: #3a3a3c; border-color: #3a3a3c; }

.message-row {
  min-height: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.message-warn { color: #b59f3b; }
.message-win { color: #6aaa64; }
.message-lose { color: #e37878; }

.control-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid #565758;
  color: #ffffff;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  cursor: pointer;
}

.ghost-btn:hover { background: rgba(255,255,255,0.06); }

.primary-btn {
  background: #121213;
  border: 1px solid #ffffff;
  color: #ffffff;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  cursor: pointer;
}

.primary-btn:hover { background: rgba(255,255,255,0.1); }

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.kb-row {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.key {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: none;
  border-radius: 4px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: #818384;
  color: #ffffff;
}

.key.wide { flex: 1.6; }
.key.green { background: #538d4e; }
.key.yellow { background: #b59f3b; }
.key.gray { background: #3a3a3c; }

/* --------------------------------------------------
   Win / Lose reveal screen
-------------------------------------------------- */

.result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 11, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.result-overlay[hidden] {
  display: none;
}

.result-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  animation: resultIn 0.35s ease;
}

.result-status {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b0b0b1;
}

.result-status.won { color: #6aaa64; }
.result-status.lost { color: #e37878; }

.result-photo-frame {
  width: 300px;
  height: 300px;
  max-width: 78vw;
  max-height: 78vw;
  border-radius: 18px;
  background: #1a1a1b;
  border: 2px solid #565758;
  overflow: hidden;
  padding: 8px;
}

.result-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.result-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
}

.result-stats {
  font-size: 13px;
  color: #b0b0b1;
  font-weight: 600;
}

@keyframes resultIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shakeX {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

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

@keyframes popIn {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.tile-shake { animation: shakeX 0.42s; }
.tile-flip { animation: flipIn 0.5s ease; }
.avatar-pop { animation: popIn 0.5s ease; }
