@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Roboto:wght@700&display=swap');

:root{
  --ink: #1A1A1D;
  --yellow: #FDE365;
  --grey: #E4E4E4;
  --white: #FFFFFF;
  --teal: #31A38B;

  --cell-size: 64px;
}

body{
  font-family: "DM Sans", system-ui, -apple-system, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: var(--white);
  color: var(--ink);
  margin: 0;
}

h1,h2,h3{
  font-family: "Roboto", system-ui, -apple-system, Arial, sans-serif;
  font-weight: 700;
  margin: 0;
}

.header{
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 12px;
}

.logo{
  display: block;
  margin: 0 auto 8px;
  max-width: 280px;
  height: auto;
}

.instruction {
  font-size: 15px;
  color: var(--ink);
  margin: 4px 0;
  max-width: 400px;
}

/* --- HUD --- */

#hud{
  width: 100%;
  max-width: 340px; /* Aligned with grid width roughly */
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  margin-bottom: 4px;
}

#moves{
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  color: var(--ink);
  font-size: 16px;
}

/* --- GRID --- */

#grid{
  display: grid;
  grid-template-columns: repeat(5, var(--cell-size));
  grid-template-rows: repeat(5, var(--cell-size));
  gap: 6px; /* Slightly wider gap for clean look */
  margin-top: 5px;
  padding: 8px;
  background: var(--white);
  /* Optional: wrapper border? No, keeping it clean */
}

.cell{
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;          /* Bigger */
  font-weight: 800;         /* Bolder */
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--white);
  cursor: pointer;
  border: 3px solid var(--ink); /* Thick borders like WordIt */
  box-sizing: border-box;
  position: relative;
  user-select: none;
  border-radius: 8px; /* Slight rounding */
  transition: transform 0.1s, background 0.2s;
}

.cell:active {
  transform: scale(0.95);
}

.black{
  background: var(--ink);
  border-color: var(--ink);
  cursor: default;
}

.number{
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
  color: var(--ink);
  opacity: 1;
  pointer-events: none;
}

.letter{ z-index: 1; pointer-events: none; margin-top: 4px; }

.selected{
  outline: 4px solid var(--teal);
  outline-offset: 2px;
  z-index: 10;
  background: var(--grey) !important;
}

.locked{
  background: var(--yellow) !important;
  border-color: var(--ink);
  cursor: default;
}

/* --- CLUES --- */

#clues{
  margin-top: 24px;
  font-size: 16px;
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.clue-block {
  flex: 1 1 250px;
  min-width: 200px;
}

.clue-block h3 {
  border-bottom: 2px solid var(--grey);
  padding-bottom: 4px;
  margin-bottom: 8px;
  font-size: 18px;
}

.clue-block ul{ 
  padding-left: 0; 
  margin: 0; 
  list-style: none;
}

.clue-block li{
  margin: 8px 0;
  line-height: 1.4;
  font-size: 15px;
}

.clue-block b {
  display: inline-block;
  min-width: 24px;
  color: var(--teal);
}

/* --- CONTROLS --- */

#controls{
  margin-top: 20px;
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.hidden{ display: none !important; }

#message{
  margin-top: 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--teal);
  min-height: 27px;
  text-align: center;
}

/* Buttons similar to WordIt example */
.btn{
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Sans", sans-serif;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

/* Teal outline style for Give Up */
.btn-teal{
  background: var(--white);
  color: var(--teal);
  border: 2px solid var(--teal);
}

/* New Game can be solid teal or ink */
#resetBtn {
  background: var(--teal);
  color: var(--white);
  border: 2px solid var(--teal);
}

.btn-icon{
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* --- LOADING --- */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  z-index: 999;
  font-family: "Roboto", sans-serif;
}

.loading.hidden {
  display: none;
}

/* Mobile Tweak */
@media (max-width: 400px) {
  :root {
    --cell-size: 56px;
  }
  .cell { font-size: 28px; }
  .instruction { font-size: 14px; padding: 0 10px; }
}