/* ==== CSS Variables ==== */ 
:root {
  --bg-color: #333;
  --bg-color-alt: #444;
  --text-color: white;
  --text-color-alt: lightgray;
  --text-color-alt2: black;
  --btn-color-blue: #2196f3;
  --btn-color-green: #4caf50;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  --shadow-button: 0 2px 8px rgba(0, 0, 0, 0.6);
  --font-family: Arial, sans-serif;
}

/* ==== Global Reset ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* outline: 1px red dashed; */
}

html, body {
  overflow: hidden;
}

/* ==== App Layout ==== */
body {
  background-color: var(--bg-color);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.app {
  width: 100svw;
  max-width: 370px;
  height: 100svh;
  max-height: 640px;
  position: relative;
  background-color: var(--bg-color-alt);
  box-shadow: var(--shadow);
  border-radius: 12px;
  color: var(--text-color);
  font-family: var(--font-family);
  margin: 10px;
}

/* ==== Header ==== */
.header {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-color);
  text-shadow: 2px 2px 4px black;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  padding: 0 10px;
}

.header-image {
  width: 50px;
  height: 50px;
}

.header-title {
  font-size: 42px;
  margin: 5px;
}

#newGameBtn {
  width: 45px;
  height: 35px;
  background-color: var(--btn-color-blue);
  color: var(--text-color);
  border: none;
  border-radius: 5px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.3s;
  font-weight: bold;
  box-shadow: var(--shadow-button);
}

#newGameBtn:active {
  filter: brightness(0.8);
}

/* ==== Main ==== */
.main {
  width: 100%;
  height: 415px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.main-title {
  width: 100%;
  height: 20px;
  display: grid;
  grid-template-columns: repeat(5, 69px);
  align-items: center;
  justify-content: center;
  column-gap: 5px;
  font-size: 10px;
  color: var(--text-color);;
  text-align: center;
}

.main-board {
  width: 350px;
  height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(5, 69px);
  grid-template-rows: repeat(5, 69px);
  gap: 5px;
}

.cell {
  width: 70px;
  height: 70px;
  background: var(--text-color);
  color: var(--text-color-alt2);
  border: none;
  border-radius: 5px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  font-size: 12px;
  overflow-wrap: break-word;
  text-align: center;
  user-select: none;
}

.cell.marked {
  background: var(--btn-color-green);;
  color: var(--text-color);;
}

.cell:active {
  filter: brightness(0.8);
}

.cell.win {
  background: linear-gradient(135deg, #ffe066 0%, #ffd700 20%, #fff7ae 60%, #fff7ae 100%);
  color: var(--text-color-alt2) !important;
  box-shadow: 0 0 4px 2px #ffd70066, 0 0 2px 1px #fff7ae;
  border: 1px solid #ffd700;
  animation: gold-sparkle 2s infinite linear;
}

@keyframes gold-sparkle {
  0% { filter: brightness(1) drop-shadow(0 0 8px #fffbe8aa);}
  40% { filter: brightness(1.08) drop-shadow(0 0 12px #fffbe8cc);}
  60% { filter: brightness(1.15) drop-shadow(0 0 14px #fffde3);}
  100% { filter: brightness(1) drop-shadow(0 0 8px #fffbe8aa);}
}

.main-stats {
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  padding: 0 10px;
}

/* ==== Footer ==== */
.footer {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 10px;
  color: var(--text-color-alt);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.footer-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.footer a {
  color: var(--text-color-alt);
  text-decoration: none;
}
