:root {
  --bg: #1e1e2e;
  --surface: #181825;
  --surface2: #313244;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --blue: #89b4fa;
  --green: #a6e3a1;
  --yellow: #f9e2af;
  --red: #f38ba8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Topbar */
.topbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--surface2);
  background: var(--surface);
}

.brand .title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--blue);
}

.brand .subtitle {
  font-size: 0.8rem;
  color: var(--subtext);
}

/* Layout */
.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px;
}

/* Board */
.board {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.tile {
  height: 54px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.3rem;
  transform-style: preserve-3d;
  transition: transform 0.4s;
  backface-visibility: hidden;
}

.tile.filled {
  border-color: var(--blue);
}

.tile.correct {
  background: color-mix(in oklab, var(--green) 30%, var(--surface));
}

.tile.present {
  background: color-mix(in oklab, var(--yellow) 30%, var(--surface));
}

.tile.absent {
  background: var(--surface2);
  color: var(--subtext);
}

.tile.flip {
  transform: rotateX(90deg);
}

.tile.reveal {
  transform: rotateX(0deg);
}

/* Keyboard */
.keyboard {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}

.krow {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.key {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.key.wide {
  padding: 8px 14px;
}

.key.correct { background: var(--green); color: black; }
.key.present { background: var(--yellow); color: black; }
.key.absent { background: var(--surface2); }

/* Status */
.status {
  margin-top: 10px;
  height: 20px;
  font-size: 0.9rem;
  color: var(--subtext);
}

/* Buttons */
.actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--blue);
  color: black;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  opacity: 0.9;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
}

.hidden {
  display: none;
}

.modalBox {
  background: var(--surface);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
}