:root {
  --yellow: #f7da21;
  --gray-cell: #e6e6e6;
  --border: #dcdcdc;
  --text: #121212;
  --gray-text: #959595;
}

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

html, body { height: 100%; }

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

/* ---------- Header ---------- */

.header {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.date {
  font-size: 16px;
  font-weight: 300;
}

/* ---------- Layout ---------- */

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  min-height: calc(100vh - 62px);
}

.game {
  width: 45%;
  min-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 96px;
  position: relative;
}

.sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 0 40px 24px;
}

/* ---------- Message toast ---------- */

.message {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  z-index: 10;
}

.message.visible { opacity: 1; }

/* ---------- Word input ---------- */

.word-input {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  user-select: none;
  margin-bottom: 34px;
}

.word-input.shake { animation: shake 0.25s linear 2; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.placeholder {
  color: var(--text);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.typed .center-letter { color: #e6b800; }
.typed .bad-letter { color: var(--gray-text); }

.cursor {
  display: inline-block;
  width: 3px;
  height: 42px;
  margin-left: 2px;
  background: var(--yellow);
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---------- Hive ---------- */

.hive {
  position: relative;
  width: 314px;
  height: 328px;
  margin-bottom: 40px;
}

.hive-cell {
  position: absolute;
  width: 120px;
  height: 104px;
  clip-path: polygon(0 50%, 25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%);
  background: var(--gray-cell);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
  transition: transform 0.05s ease;
}

.hive-cell:active { transform: scale(0.94); }

.hive-cell.center { background: var(--yellow); }

.cell-letter {
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  transition: opacity 0.15s ease;
}

.hive.shuffling .outer .cell-letter { opacity: 0; }

/* Hive positions: container center is (157, 164); cells are 120x104 */
.hive-cell[data-pos="center"] { left: 97px;  top: 112px; }
.hive-cell[data-pos="n"]      { left: 97px;  top: 0; }
.hive-cell[data-pos="s"]      { left: 97px;  top: 224px; }
.hive-cell[data-pos="nw"]     { left: 0;     top: 56px; }
.hive-cell[data-pos="ne"]     { left: 194px; top: 56px; }
.hive-cell[data-pos="sw"]     { left: 0;     top: 168px; }
.hive-cell[data-pos="se"]     { left: 194px; top: 168px; }

/* ---------- Controls ---------- */

.controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.pill {
  border: 1px solid var(--border);
  border-radius: 40px;
  background: #fff;
  font-size: 16px;
  padding: 15px 28px;
}

.pill:active, .round:active { background: var(--gray-cell); }

.round {
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Progress ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  height: 40px;
}

.rank-label {
  font-size: 16px;
  font-weight: 700;
  min-width: 88px;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 24px;
}

.progress-line {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.progress-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.progress-marker.done { background: var(--yellow); }

.progress-marker.final { border-radius: 1px; width: 9px; height: 9px; }

.progress-marker.current {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  z-index: 2;
}

/* ---------- Found words ---------- */

.found-panel {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 26px;
  overflow-y: auto;
}

.found-count {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 18px;
}

.found-list {
  list-style: none;
  columns: 3;
  column-gap: 40px;
}

.found-list li {
  font-size: 15px;
  text-transform: capitalize;
  padding: 5px 1px;
  border-bottom: 1px solid var(--border);
  break-inside: avoid;
  margin-bottom: 6px;
}

.found-list li.pangram { font-weight: 700; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .app { flex-direction: column; align-items: center; }
  .game { width: 100%; min-width: 0; padding-top: 60px; }
  .sidebar { width: 100%; padding: 32px 0; }
}
