*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1a1a2e;
  color: #eee;
  font-family: "Segoe UI", system-ui, sans-serif;
}

#app {
  text-align: center;
  padding: 2rem;
}

h1 {
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #c4a35a;
  margin-bottom: 1.5rem;
}

h1 .letter {
  display: inline-block;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

h1 .letter.out {
  transform: translateY(-10px);
  opacity: 0;
}

h1 .letter.in {
  transform: translateY(10px);
  opacity: 0;
}

/* --- controls --- */

#controls {
  margin-bottom: 2rem;
}

#controls label {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: #aaa;
}

#length-display {
  color: #c4a35a;
  font-weight: 700;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 6px;
  background: #333;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c4a35a;
  cursor: pointer;
}

/* --- tiles --- */

#tiles {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 2rem;
  min-height: 72px;
}

.tile {
  width: 56px;
  height: 64px;
  background: #c4a35a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 700;
  color: #1a1a2e;
  text-transform: uppercase;
  user-select: none;
  transition:
    transform 0.35s cubic-bezier(0.4, 1.6, 0.5, 1),
    opacity 0.35s ease,
    background 0.2s ease;
}

.tile.used {
  background: #3a3a50;
  color: #666;
}

.tile.success {
  background: #4a7a4a;
  color: #d0f0d0;
}

.tile.failure {
  background: #7a3a3a;
  color: #f0d0d0;
}

.tile.shuffle-out {
  transform: translateY(-18px) rotate(-8deg);
  opacity: 0;
}

.tile.shuffle-in {
  transform: translateY(18px) rotate(8deg);
  opacity: 0;
}

/* --- input --- */

#input-area {
  margin-bottom: 1.5rem;
}

#guess {
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.5em 1em;
  width: min(90vw, 380px);
  border: none;
  background: transparent;
  color: #eee;
  outline: none;
  caret-color: #c4a35a;
}

/* --- timer bar --- */

#timer-bar {
  width: min(90vw, 380px);
  height: 4px;
  background: #333;
  border-radius: 2px;
  margin: 0 auto 1.2rem;
  overflow: hidden;
}

#timer-fill {
  height: 100%;
  width: 100%;
  background: #c4a35a;
  border-radius: 2px;
  transform-origin: left;
  transition: background-color 0.5s;
}

#timer-fill.urgent {
  background: #e06060;
}

#timer-fill.success {
  background: #4a7a4a;
}

/* --- give up --- */

#give-up {
  margin-top: 1rem;
  padding: 0.4em 1.4em;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s;
}

#give-up:hover {
  color: #ccc;
  border-color: #888;
}

/* --- message --- */

#message {
  font-size: 1.1rem;
  min-height: 1.6em;
  transition: opacity 0.3s;
}

#message.correct {
  color: #7ecf7e;
}

#message.wrong {
  color: #e06060;
}

#message.info {
  color: #aaa;
}
