* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 50% -10%, #1a1f2e 0%, #0b0d14 55%, #07080d 100%);
  color: #e7edf6;
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  overflow-x: hidden;
}

#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#fx-canvas canvas { display: block; }

#app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

header { text-align: center; }
header h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #ff8a3d, #ffd23d 45%, #5fb0ff 65%, #8fd3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header .subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: #9fb0c8;
}

.card {
  background: rgba(20, 24, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(6px);
}

#dailyInfo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #b7c3d9;
}
#dailyInfo b { color: #ffd23d; }

.help {
  font-size: 12.5px;
  color: #8ea0ba;
  line-height: 1.5;
}
.help b { color: #cfd8e8; }

.gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gauge {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.gauge.a { background: linear-gradient(160deg, rgba(255, 90, 54, 0.16), rgba(20, 24, 36, 0.6)); }
.gauge.b { background: linear-gradient(160deg, rgba(95, 176, 255, 0.16), rgba(20, 24, 36, 0.6)); }
.gauge .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gauge.a .label { color: #ff8a3d; }
.gauge.b .label { color: #5fb0ff; }
.gauge .found-tag {
  display: none;
  font-size: 11px;
  background: #ffd23d;
  color: #241a00;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 800;
}
.gauge.found .found-tag { display: inline-block; }
.thermo {
  margin-top: 8px;
  height: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.thermo-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  transition: width 0.5s ease, background-color 0.4s ease;
  background: #3b4b66;
}
.gauge .rank-text {
  margin-top: 6px;
  font-size: 12px;
  color: #b7c3d9;
}
.gauge .rank-text b { color: #e7edf6; }

form#guessForm {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#guessInput {
  flex: 1 1 140px;
  min-width: 120px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 16, 0.75);
  color: #e7edf6;
  font-size: 15px;
  outline: none;
}
#guessInput:focus { border-color: #ffd23d; }
.btn {
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: #0c0d12;
  background: #ffd23d;
}
.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e7edf6;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }

#toast {
  min-height: 18px;
  font-size: 12.5px;
  color: #ffb37a;
  text-align: center;
}

#guessCount {
  font-size: 12.5px;
  color: #9fb0c8;
  text-align: right;
}

#history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 44vh;
  overflow-y: auto;
  padding-right: 2px;
}
.guess-row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
}
.guess-row.latest {
  border-color: rgba(255, 210, 61, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 210, 61, 0.25) inset;
}
.guess-row .n { color: #6d7d99; font-size: 11px; text-align: right; }
.guess-row .word { font-weight: 600; text-transform: capitalize; }
.guess-row .rank-chip {
  min-width: 58px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #0c0d12;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 10, 0.72);
  padding: 20px;
}
#overlay.show { display: flex; }
.modal {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(165deg, rgba(28, 32, 46, 0.98), rgba(12, 14, 20, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 24px 22px;
  text-align: center;
}
.modal h2 {
  margin: 0 0 6px;
  font-size: 24px;
}
.modal p { color: #b7c3d9; font-size: 14px; margin: 4px 0; }
.modal .reveal {
  margin: 14px 0;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 12px;
}
.modal .reveal div { flex: 1; }
.modal .reveal b { display: block; font-size: 17px; margin-top: 2px; }
.modal .actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

footer {
  text-align: center;
  font-size: 11px;
  color: #5c6b85;
}

@media (max-width: 420px) {
  header h1 { font-size: 27px; }
  .gauges { grid-template-columns: 1fr; }
}
