:root {
  --bg: #191425;
  --bg2: #241d35;
  --bg3: #352a4f;
  --bg4: #483a6b;
  --border: #423563;
  --border2: #5c4b8a;

  --accent: #45d6a8;
  --accent-glow: rgba(69, 214, 168, 0.2);
  --accent2: #6bf2c7;
  --gold: #e2c883;
  --gold2: #f2deb0;
  --red: #ff5e7e;
  --red-glow: rgba(255, 94, 126, 0.15);
  --green: #45d6a8;
  --green-glow: rgba(69, 214, 168, 0.15);

  --text: #f0eef5;
  --text2: #b1a6cc;
  --text3: #8476a3;

  /* mapped roles used throughout this file */
  --ink: var(--bg);
  --ink-2: var(--bg2);
  --bone: var(--text);
  --bone-dim: var(--text2);
  --crimson: var(--red);
  --crimson-bright: var(--red);
  --gold-dim: #a3925e;
  --none: var(--bg3);
  --partial: var(--gold);

  --font-display: 'Cinzel', serif;
  --font-serif: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 14px;
}

.grain-overlay { display: none; }

.site-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, #1f1930 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.case-number {
  font-family: var(--font-body);
  letter-spacing: 0.25em;
  font-size: 0.7rem;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  margin: 0;
  color: var(--accent2);
  text-shadow: 0 0 24px var(--accent-glow);
}

.subtitle {
  font-family: var(--font-body);
  color: var(--text2);
  font-size: 1.05rem;
  margin: 0.5rem 0 0;
}

.game-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  position: relative;
  z-index: 2;
}

.search-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.autocomplete {
  position: relative;
  width: 100%;
  max-width: 420px;
  z-index: 50;
}

.guess-input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.guess-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.guess-input::placeholder {
  color: var(--text3);
  opacity: 0.8;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  max-height: 340px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.suggestions:empty { display: none; }

.suggestions::-webkit-scrollbar { width: 8px; }
.suggestions::-webkit-scrollbar-track { background: var(--bg); border-radius: 4px; }
.suggestions::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
.suggestions::-webkit-scrollbar-thumb:hover { background: var(--border2); }

.suggestions.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.sugg-dorm-header {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 6px 2px 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.sugg-dorm-header:first-child { margin-top: 0; }

.sugg-empty {
  padding: 0.75rem;
  text-align: center;
  color: var(--text3);
  font-size: 0.85rem;
  grid-column: 1 / -1;
}

.sugg-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sugg-card:hover,
.sugg-card.active {
  border-color: var(--accent);
  background: var(--bg4);
}

.sugg-card-guessed {
  cursor: not-allowed;
  opacity: 0.35;
  filter: grayscale(1);
}

.sugg-card-guessed:hover {
  border-color: var(--border);
  background: var(--bg3);
}

.sugg-card-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg4);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sugg-card-img-wrap.img-missing::after {
  content: '?';
  color: var(--text3);
  font-size: 1.1rem;
  font-family: var(--font-display);
}

.sugg-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; 
}

.sugg-card-img-wrap.img-missing .sugg-card-img { display: none; }

.sugg-card-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
}

.sugg-card-char {
  font-size: 0.58rem;
  color: var(--text3);
  margin-top: 1px;
}

.guess-count {
  font-family: var(--font-body);
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--text3);
  text-transform: uppercase;
}


.board { width: 100%; }

.board-header {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1.2fr 1.1fr 1fr 1.3fr 1fr;
  gap: 6px;
  padding: 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.6rem;
}

.guess-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guess-row {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1.2fr 1.1fr 1fr 1.3fr 1fr;
  gap: 6px;
}

.cell {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.5rem;
  font-size: 0.82rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  line-height: 1.15;
  color: var(--text);
  opacity: 0;
  transform: rotateX(-90deg);
  animation: flip-reveal 0.5s ease forwards;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.cell.name-cell {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  justify-content: flex-start;
  text-align: left;
  background: var(--bg2);
  border-color: var(--border2);
  color: var(--gold);
  gap: 12px; 
}

.cell.name-cell img {
  width: 50px;  /* Adjust this number to make the whole row shorter or taller */
  height: 50px; /* Keep this the same as the width for a perfect square */
  object-fit: cover; 
  object-position: center top;
  border-radius: 6px; /* Softens the corners to match your UI */
  flex-shrink: 0; /* Prevents the text from squishing the image */
}

.cell.name-cell.incorrect {
  background: rgba(255, 94, 126, 0.16);
  border-color: var(--red);
  color: #ff9fb2;
}

.cell.name-cell.correct {
  background: rgba(69, 214, 168, 0.18);
  border-color: var(--accent);
  color: var(--accent2);
}

.cell.match { background: rgba(69, 214, 168, 0.18); border-color: var(--accent); color: var(--accent2); }
.cell.partial { background: rgba(226, 200, 131, 0.16); border-color: var(--gold); color: var(--gold2); }
.cell.none { background: var(--bg3); border-color: var(--border); }
.cell.none-red { background: rgba(255, 94, 126, 0.16); border-color: var(--red); color: #ff9fb2; }

.cell.arrow-up, .cell.arrow-down {
  background: var(--bg4);
  border-color: var(--border2);
  color: var(--text2);
}

@keyframes flip-reveal {
  0% { opacity: 0; transform: rotateX(-90deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: rotateX(0deg); }
}

.win-banner {
  margin-bottom: 1.5rem;
  text-align: center;
  padding: 1.5rem;
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.win-banner.hidden { display: none; }

.win-seal {
  font-family: var(--font-display);
  letter-spacing: 0.15em;
  color: var(--accent2);
  font-size: 1.3rem;
  font-weight: 700;
  display: inline-block;
  border: 2px solid var(--accent2);
  border-radius: 20px;
  padding: 0.3rem 1.2rem;
  margin-bottom: 0.75rem;
}

#win-text {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text);
  margin: 0;
}

.infinite-prompt {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.infinite-prompt-text {
  font-family: var(--font-body);
  color: var(--text2);
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
}

.infinite-btn {
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  color: var(--accent2);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.2s;
}

.infinite-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  color: var(--bone-dim);
  font-size: 0.72rem;
  opacity: 0.6;
  position: relative;
  z-index: 0;
}

@media (max-width: 720px) {
  .board-header span:nth-child(6),
  .board-header span:nth-child(7) { display: none; }
  .guess-row .cell:nth-child(6),
  .guess-row .cell:nth-child(7) { display: none; }
}