
@import url('https://fonts.googleapis.com/css2?family=Creepster&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #09070b;
  --panel: #151019;
  --panel-light: #201724;
  --red: #e33445;
  --red-bright: #ff4657;
  --text: #f8f3f4;
  --muted: #a69ba8;
  --border: #382737;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(ellipse at 50% 0%, #48121c 0%, transparent 48%),
    radial-gradient(ellipse at 100% 100%, #211024 0%, transparent 40%),
    var(--bg);
}

button,
input {
  font: inherit;
}

.auth-container {
  width: min(100%, 440px);
  padding: 38px 30px;
  background: linear-gradient(145deg, #19121d, #100c13);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 90px #0009, 0 0 40px #e3344510;
  animation: appear 0.7s ease both;
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--red-bright);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
}

h1 {
  margin: 0;
  font-family: 'Creepster', Georgia, serif;
  font-size: clamp(42px, 10vw, 62px);
  line-height: 1.1;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 0 30px #e3344533;
}

h1 span {
  display: block;
  color: var(--red-bright);
}

.subtitle {
  margin: 17px 0 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 25px;
  background: #0b080e;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tab {
  padding: 12px 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: 0.2s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: white;
  background: #38202b;
  box-shadow: inset 0 0 0 1px #66313e;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#auth-form label {
  margin-top: 8px;
  color: #e6dce6;
  font-size: 12px;
  font-weight: 700;
}

#auth-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: #0c090f;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#auth-form input::placeholder {
  color: #716775;
}

#auth-form input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px #e3344520;
}

.primary-button {
  min-height: 50px;
  margin-top: 18px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(110deg, #a91e32, #ed3548);
  border: 0;
  border-radius: 9px;
  box-shadow: 0 8px 24px #e3344525;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
}

.primary-button:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.message {
  min-height: 18px;
  margin: 3px 0 0;
  color: #ff8c96;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
}

.footer-text {
  margin: 28px 0 0;
  padding-top: 20px;
  color: #766b7a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  border-top: 1px solid var(--border);
}

[hidden] {
  display: none !important;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .auth-container {
    padding: 30px 22px;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}



/* Mobile-first clue page */
.clue-container {
  width: min(100%, 520px);
}

.clue-container h2 {
  margin: 18px 0;
  font-size: clamp(25px, 7vw, 36px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#clue-story {
  color: #e5dbe6;
  font-size: 16px;
  line-height: 1.8;
  text-align: left;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

#clue-hint-box {
  margin: 20px 0;
  padding: 15px;
  background: #24151e;
  border: 1px solid #66313e;
  border-radius: 10px;
}

#clue-hint {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

#answer-input {
  min-height: 54px;
  font-size: 16px;
  touch-action: manipulation;
}

#answer-submit,
#go-login,
#retry-button {
  width: 100%;
  min-height: 52px;
  padding: 14px;
  font-size: 12px;
}

#player-score {
  margin: 0 0 12px;
}

#logout-button {
  min-height: 44px;
  padding: 10px 18px;
}

@media (max-width: 480px) {
  .clue-container {
    padding: 26px 20px;
  }

  #clue-story {
    font-size: 16px;
  }

  #answer-form label {
    font-size: 14px;
  }
}

/* Answer form — mobile-first */
#answer-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  margin-top: 24px;
}

#answer-form label {
  display: block;
  margin: 0;
  color: #e6dce6;
  font-size: 14px;
  font-weight: 700;
}

#answer-form #answer-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 14px;
  color: #f8f3f4;
  background: #0c090f;
  border: 1px solid #382737;
  border-radius: 9px;
  font-size: 16px;
  outline: none;
}

#answer-form #answer-input:focus {
  border-color: #e33445;
  box-shadow: 0 0 0 3px #e3344520;
}

#answer-form #answer-submit {
  width: 100%;
  margin-top: 8px;
}



/* Leaderboard */
.leaderboard-container {
  width: min(100%, 520px);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 22px 0;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 12px;
  background: #120d15;
  border: 1px solid #382737;
  border-radius: 10px;
}

.leaderboard-row:first-child {
  background: linear-gradient(110deg, #38202b, #1a111c);
  border-color: #a94454;
}

.leaderboard-rank {
  color: #ff6877;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.leaderboard-username {
  min-width: 0;
  color: #f8f3f4;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.leaderboard-points {
  color: #ff6978;
  font-size: 12px;
  white-space: nowrap;
}

#refresh-leaderboard {
  width: 100%;
}

.back-button {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
}

@media (max-width: 380px) {
  .leaderboard-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 10px 8px;
  }

  .leaderboard-username {
    font-size: 12px;
  }

  .leaderboard-points {
    font-size: 11px;
  }
}


/* Player progress */
.progress-panel {
  width: 100%;
  margin: 22px 0;
  padding: 16px;
  background: #100c13;
  border: 1px solid #382737;
  border-radius: 12px;
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-heading h2 {
  margin: 0;
  color: #f8f3f4;
  font-size: 15px;
  letter-spacing: 1.5px;
}

.progress-heading strong {
  color: #ff4657;
  font-size: 14px;
}

.progress-track {
  height: 8px;
  margin: 14px 0;
  overflow: hidden;
  background: #302330;
  border-radius: 99px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #a91e32, #ff4657);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.progress-summary {
  color: #a69ba8;
  font-size: 12px;
  line-height: 1.6;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.progress-item {
  min-width: 0;
  padding: 12px 4px;
  color: #a69ba8;
  background: #19121d;
  border: 1px solid #382737;
  border-radius: 8px;
  font-size: 11px;
  text-align: center;
  overflow-wrap: anywhere;
}

.progress-item.solved {
  color: #70e6a1;
  background: #102019;
  border-color: #285c41;
}

.progress-item .progress-points {
  display: block;
  margin-top: 5px;
  font-size: 10px;
}

@media (max-width: 380px) {
  .progress-panel {
    padding: 12px;
  }

  .progress-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
}

