/* Game-specific styles — What The Emoji */

/* ── App shell ─────────────────────────────────────────────────────────── */
#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding-bottom: 80px;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 16px;
  gap: 12px;
  animation: fadeUp 0.22s ease both;
}

/* ── Ad placeholder ─────────────────────────────────────────────────────── */
.ad-placeholder {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text2);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Game header ─────────────────────────────────────────────────────────── */
.game-header { text-align: center; padding: 12px 0 4px; }

.back-link {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text2);
  text-decoration: none;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: color var(--t), background var(--t);
}
.back-link:hover { color: var(--accent); background: var(--border); }

.game-title {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #fd79a8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-subtitle {
  color: var(--text2);
  font-size: 0.88rem;
  margin-top: 3px;
}

.settings-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 12px;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px; height: 38px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t);
}
.icon-btn:hover { transform: scale(1.1); }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.text-input {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--t);
  width: 100%;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--text2); }
.text-input:disabled { opacity: 0.55; }

.username-wrap { display: flex; align-items: center; gap: 10px; }
.username-wrap .text-input { flex: 1; }

.answer-input { flex: 1; }

/* ── Lobby / onboarding ──────────────────────────────────────────────────── */
.lobby-heading {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
}
.lobby-hint {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.5;
}
.username-label {
  font-size: 0.85rem;
  color: var(--text2);
  white-space: nowrap;
  font-weight: 600;
}
.mode-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
  margin-bottom: 10px;
}
.mode-start-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 10px;
  font-style: italic;
}

/* ── Mode grid ───────────────────────────────────────────────────────────── */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mode-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 6px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  color: var(--text);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mode-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,92,231,0.3);
}
.mode-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mode-emoji { font-size: 1.5rem; }
.mode-name  { font-size: 0.82rem; font-weight: 800; }
.mode-desc  { font-size: 0.7rem; color: var(--text2); }
.mode-btn:hover:not(:disabled) .mode-desc { color: rgba(255,255,255,0.75); }

/* ── Best score pill ─────────────────────────────────────────────────────── */
.best-pill {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text2);
}
.best-pill strong { color: var(--accent); font-size: 1rem; }

/* ── How to play ─────────────────────────────────────────────────────────── */
.how-to-play {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.75;
  text-align: center;
  padding: 14px 18px;
}

/* ── HUD ─────────────────────────────────────────────────────────────────── */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hud-lives  { font-size: 1.1rem; letter-spacing: 2px; }
.hud-score  { font-size: 0.92rem; font-weight: 700; }
.hud-score strong { color: var(--accent); }
.hud-streak { font-size: 0.82rem; min-width: 44px; }
.hud-mode   { font-size: 0.72rem; color: var(--text2); margin-top: 2px; }
.hud-mid    { flex: 1; padding: 0 12px; }

.progress-wrap {
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #fd79a8);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── Timer ───────────────────────────────────────────────────────────────── */
.timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.timer-bar-wrap {
  flex: 1;
  background: var(--surface2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
#timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--orange), var(--red));
  border-radius: 99px;
  transition: width 1s linear;
  width: 100%;
}
.timer-num {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent);
  min-width: 30px;
  text-align: right;
  transition: color 0.2s;
}
.timer-num.urgent { color: var(--red); animation: pulse 0.5s ease infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.15); } }

/* ── Puzzle card ─────────────────────────────────────────────────────────── */
.puzzle-card {
  text-align: center;
  padding: 26px 20px 20px;
}
.category-tag {
  display: inline-block;
  background: var(--accent-lt);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}
.emoji-display {
  font-size: 3.8rem;
  line-height: 1.2;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hint-text {
  font-size: 0.83rem;
  color: var(--text2);
  font-style: italic;
  margin-top: 8px;
  animation: fadeUp 0.2s ease;
}

/* ── Answer input row ────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 8px;
}

/* ── Feedback ────────────────────────────────────────────────────────────── */
.feedback {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  animation: fadeUp 0.18s ease;
}
.feedback.correct { background: rgba(0,184,148,0.12); color: var(--green); }
.feedback.wrong   { background: rgba(225,112,85,0.12); color: var(--red); }
.feedback.skip    { background: rgba(253,203,110,0.15); color: #9a7a00; }

/* ── Action row ──────────────────────────────────────────────────────────── */
.action-row { display: flex; gap: 8px; }
.action-row .btn { flex: 1; }

/* Next button — large and obvious when it's the only action */
#next-btn {
  padding: 15px 24px;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
}

/* ── Emoji animations ────────────────────────────────────────────────────── */
.emoji-display.bounce { animation: bounce 0.4s ease; }
.emoji-display.shake  { animation: shake  0.4s ease; }

@keyframes bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  70%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
}

/* ── Game Over ───────────────────────────────────────────────────────────── */
.over-title { font-size: 1.7rem; font-weight: 900; margin-bottom: 4px; }
.over-sub   { color: var(--text2); font-size: 0.88rem; margin-bottom: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.stat-item {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
}
.stat-value {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--accent);
  display: block;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
  display: block;
}

/* ── iPhone notch ────────────────────────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #app { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ── Tiny screens ────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .emoji-display { font-size: 3rem; }
  .game-title    { font-size: 1.45rem; }
  .mode-grid     { grid-template-columns: 1fr; }
}

/* ── Desktop centering ───────────────────────────────────────────────────── */
@media (min-width: 500px) {
  body { padding-top: 20px; background: var(--bg); }
  #app { border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; background: var(--bg); }
}
