/* =========================================================
   WORDLE — CRADLE MINI GAME
   Complete Stylesheet
========================================================= */

/* =========================================================
   RESET
========================================================= */

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

html {
  width: 100%;
  min-height: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
}

/* =========================================================
   THEME VARIABLES
========================================================= */

:root {
  /* Background */
  --bg: #f1edff;
  --bg-secondary: #eae4fb;

  /* Cards */
  --card: rgba(255, 255, 255, 0.94);
  --surface: #faf9ff;
  --surface-hover: #f3effc;

  /* Text */
  --text: #272033;
  --muted: #81798f;

  /* Borders */
  --border: #ded7eb;
  --border-dark: #c9bfdc;

  /* Keyboard */
  --key: #eeeaf5;
  --key-hover: #e5def5;

  /* Cradle Purple */
  --purple: #7654dc;
  --purple-dark: #6040c5;
  --purple-light: #eee8ff;

  /* Wordle Colors */
  --correct: #6aaa64;
  --present: #c9b458;
  --absent: #787c7e;

  /* Shadows */
  --shadow: 0 25px 70px rgba(83, 59, 145, 0.14);

  --small-shadow: 0 8px 25px rgba(83, 59, 145, 0.09);
}

/* =========================================================
   DARK THEME
========================================================= */

body.dark {
  --bg: #171326;
  --bg-secondary: #1d1830;

  --card: rgba(31, 27, 46, 0.96);
  --surface: #262137;
  --surface-hover: #302943;

  --text: #f7f4ff;
  --muted: #aaa2ba;

  --border: #40374f;
  --border-dark: #554968;

  --key: #322d40;
  --key-hover: #3b344c;

  --purple: #9878f3;
  --purple-dark: #8262df;
  --purple-light: #352c52;

  --correct: #6aaa64;
  --present: #c9b458;
  --absent: #787c7e;

  --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);

  --small-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

/* =========================================================
   BODY
========================================================= */

body {
  position: relative;

  overflow-x: hidden;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--text);

  background:
    radial-gradient(
      circle at 12% 15%,
      rgba(118, 84, 220, 0.18),
      transparent 27%
    ),
    radial-gradient(
      circle at 88% 78%,
      rgba(118, 84, 220, 0.15),
      transparent 30%
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.35),
      transparent 40%
    ),
    linear-gradient(135deg, #f5f2ff 0%, #eee9fc 48%, #f3efff 100%);

  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body.dark {
  background:
    radial-gradient(
      circle at 12% 15%,
      rgba(118, 84, 220, 0.2),
      transparent 27%
    ),
    radial-gradient(
      circle at 88% 78%,
      rgba(118, 84, 220, 0.15),
      transparent 30%
    ),
    #171326;
}

/* =========================================================
   BACKGROUND DECORATION
========================================================= */

/* Top-left soft circle */

body::before {
  content: "";

  position: fixed;

  width: 270px;
  height: 270px;

  top: -145px;
  left: -75px;

  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(118, 84, 220, 0.18),
    rgba(118, 84, 220, 0.02)
  );

  pointer-events: none;

  z-index: 0;
}

/* Bottom-right soft circle */

body::after {
  content: "";

  position: fixed;

  width: 330px;
  height: 330px;

  right: -145px;
  bottom: -150px;

  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(118, 84, 220, 0.18),
    rgba(118, 84, 220, 0)
  );

  pointer-events: none;

  z-index: 0;
}

/* =========================================================
   MAIN CONTAINER
========================================================= */

.game-container {
  position: relative;

  z-index: 2;

  width: 100%;

  min-height: 100vh;

  padding: 24px 20px 35px;

  display: flex;

  align-items: center;

  justify-content: center;
}

/* =========================================================
   COMPLETE GAME CARD
========================================================= */

.game-card {
  position: relative;

  width: min(760px, 100%);

  overflow: hidden;

  background: var(--card);

  border: 1px solid rgba(255, 255, 255, 0.8);

  border-radius: 24px;

  box-shadow: var(--shadow);

  backdrop-filter: blur(15px);

  -webkit-backdrop-filter: blur(15px);

  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

/* =========================================================
   CARD DECORATIVE GLOW
========================================================= */

.game-card::before {
  content: "";

  position: absolute;

  width: 230px;
  height: 230px;

  top: -150px;
  left: -120px;

  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(118, 84, 220, 0.12),
    transparent 70%
  );

  pointer-events: none;
}

.game-card::after {
  content: "";

  position: absolute;

  width: 220px;
  height: 220px;

  right: -130px;
  bottom: -140px;

  border-radius: 50%;

  background: radial-gradient(circle, rgba(118, 84, 220, 0.1), transparent 70%);

  pointer-events: none;
}

/* =========================================================
   FLOATING DECORATIVE LETTERS
========================================================= */

.game-container::before {
  content: "W";

  position: fixed;

  left: 11%;
  top: 32%;

  width: 68px;
  height: 68px;

  display: flex;

  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background: linear-gradient(145deg, #ddd1ff, #bda7f5);

  color: #7654dc;

  font-size: 40px;

  font-weight: 800;

  transform: rotate(-11deg);

  box-shadow: 0 15px 30px rgba(118, 84, 220, 0.14);

  opacity: 0.72;

  pointer-events: none;
}

.game-container::after {
  content: "A";

  position: fixed;

  right: 11%;
  top: 23%;

  width: 64px;
  height: 64px;

  display: flex;

  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background: linear-gradient(145deg, #ded4ff, #c4aff5);

  color: #7654dc;

  font-size: 37px;

  font-weight: 800;

  transform: rotate(12deg);

  box-shadow: 0 15px 30px rgba(118, 84, 220, 0.13);

  opacity: 0.72;

  pointer-events: none;
}

/* =========================================================
   HEADER
========================================================= */

.game-header {
  position: relative;

  z-index: 3;

  width: 100%;

  display: grid;

  grid-template-columns: 1fr auto 1fr;

  align-items: center;

  padding: 22px 26px 18px;

  background: transparent;

  border: none;
}

.title-section {
  text-align: center;
}

/* Mini game label */

.game-label {
  display: inline-block;

  margin-bottom: 7px;

  padding: 5px 12px;

  border-radius: 20px;

  background: var(--purple-light);

  color: var(--purple);

  font-size: 9px;

  font-weight: 800;

  letter-spacing: 1.5px;
}

/* Title */

.title-section h1 {
  color: var(--text);

  font-size: 30px;

  line-height: 1;

  letter-spacing: -1px;
}

/* Subtitle */

.title-section p {
  margin-top: 7px;

  color: var(--muted);

  font-size: 12px;

  line-height: 1.4;
}

/* =========================================================
   THEME BUTTON
========================================================= */

.theme-btn {
  justify-self: end;

  width: 40px;
  height: 40px;

  display: flex;

  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);

  border-radius: 11px;

  background: var(--surface);

  color: var(--purple);

  cursor: pointer;

  font-size: 17px;

  transition:
    transform 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease;
}

.theme-btn:hover {
  background: var(--purple-light);

  border-color: var(--purple);

  transform: rotate(12deg);
}

.theme-btn:active {
  transform: scale(0.94);
}

/* =========================================================
   GAME CONTENT
========================================================= */

.game-content {
  position: relative;

  z-index: 3;

  width: 100%;

  padding: 7px 30px 28px;

  display: flex;

  flex-direction: column;

  align-items: center;

  background: transparent;
}

/* =========================================================
   STATS
========================================================= */

.game-info {
  display: flex;

  justify-content: center;

  gap: 10px;

  margin: 0 0 15px;
}

.game-info > div {
  min-width: 130px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 20px;

  padding: 8px 13px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: 9px;

  box-shadow: 0 4px 12px rgba(80, 55, 135, 0.04);
}

.game-info span {
  color: var(--muted);

  font-size: 10px;
}

.game-info strong {
  color: var(--purple);

  font-size: 12px;
}

/* =========================================================
   WORD GRID
========================================================= */

.word-grid {
  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 5px;

  margin: 5px auto 14px;
}

.row {
  display: flex;

  gap: 5px;
}

/* =========================================================
   WORD TILES
========================================================= */

.tile {
  width: 53px;
  height: 53px;

  display: flex;

  align-items: center;
  justify-content: center;

  border: 1.5px solid var(--border-dark);

  border-radius: 8px;

  background: var(--surface);

  color: var(--text);

  font-size: 21px;

  font-weight: 750;

  transition:
    transform 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

/* Letter entered */

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

  background: var(--purple-light);

  transform: scale(1.03);
}

/* =========================================================
   WORDLE FEEDBACK COLORS
========================================================= */

/* Correct position */

.tile.correct {
  background: var(--correct);

  border-color: var(--correct);

  color: #ffffff;
}

/* Correct letter, wrong position */

.tile.present {
  background: var(--present);

  border-color: var(--present);

  color: #ffffff;
}

/* Letter not present */

.tile.absent {
  background: var(--absent);

  border-color: var(--absent);

  color: #ffffff;
}

/* =========================================================
   MESSAGE
========================================================= */

.message {
  width: 100%;

  min-height: 20px;

  margin: 0 0 7px;

  text-align: center;

  color: var(--purple);

  font-size: 12px;

  font-weight: 650;
}

/* =========================================================
   KEYBOARD
========================================================= */

.keyboard {
  width: min(100%, 560px);

  margin: 0 auto;
}

.keyboard-row {
  display: flex;

  align-items: center;

  justify-content: center;

  gap: 5px;

  margin-bottom: 5px;
}

/* Keyboard buttons */

.keyboard button {
  min-width: 40px;

  height: 43px;

  padding: 0 5px;

  border: 1px solid transparent;

  border-radius: 8px;

  background: var(--key);

  color: var(--text);

  font-size: 11px;

  font-weight: 750;

  cursor: pointer;

  transition:
    transform 0.12s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

/* Hover */

.keyboard button:hover {
  background: var(--key-hover);

  border-color: var(--purple);
}

/* Press */

.keyboard button:active {
  transform: scale(0.92);
}

/* =========================================================
   KEYBOARD WORDLE STATES
========================================================= */

.keyboard button.correct {
  background: var(--correct);

  border-color: var(--correct);

  color: #ffffff;
}

.keyboard button.present {
  background: var(--present);

  border-color: var(--present);

  color: #ffffff;
}

.keyboard button.absent {
  background: var(--absent);

  border-color: var(--absent);

  color: #ffffff;
}

/* Enter + Backspace */

.keyboard .wide-key {
  min-width: 63px;
}

/* =========================================================
   PLAY AGAIN
========================================================= */

.restart-btn {
  display: block;

  margin: 11px auto 0;

  padding: 10px 21px;

  border: none;

  border-radius: 9px;

  background: linear-gradient(135deg, var(--purple), var(--purple-dark));

  color: #ffffff;

  font-size: 12px;

  font-weight: 700;

  cursor: pointer;

  box-shadow: 0 7px 18px rgba(118, 84, 220, 0.25);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.restart-btn:hover {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));

  transform: translateY(-2px);

  box-shadow: 0 10px 24px rgba(118, 84, 220, 0.32);
}

.restart-btn:active {
  transform: translateY(0) scale(0.97);
}

/* =========================================================
   DESKTOP — MAKE CARD COMPACT
========================================================= */

@media (min-width: 901px) {
  .game-card {
    min-height: 720px;

    display: flex;

    flex-direction: column;

    justify-content: flex-start;
  }

  .game-content {
    flex: 1;
  }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {
  .game-container::before {
    left: 4%;

    transform: scale(0.8);
  }

  .game-container::after {
    right: 4%;

    transform: scale(0.8);
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 650px) {
  .game-container {
    min-height: 100vh;

    padding: 10px;
  }

  .game-card {
    width: 100%;

    border-radius: 18px;
  }

  .game-header {
    padding: 17px 14px 13px;
  }

  .game-content {
    padding: 6px 9px 20px;
  }

  .title-section h1 {
    font-size: 24px;
  }

  .title-section p {
    font-size: 10px;
  }

  .game-label {
    font-size: 8px;

    padding: 4px 9px;
  }

  .theme-btn {
    width: 36px;
    height: 36px;
  }

  .game-info {
    gap: 6px;
  }

  .game-info > div {
    min-width: 105px;

    padding: 7px 10px;
  }

  .game-info span {
    font-size: 9px;
  }

  .game-info strong {
    font-size: 11px;
  }

  .tile {
    width: 46px;
    height: 46px;

    font-size: 19px;
  }

  .row {
    gap: 4px;
  }

  .keyboard {
    width: 100%;
  }

  .keyboard-row {
    gap: 3px;
  }

  .keyboard button {
    min-width: 8.5vw;

    height: 41px;

    padding: 0 3px;

    font-size: 10px;
  }

  .keyboard .wide-key {
    min-width: 13vw;
  }

  .restart-btn {
    margin-top: 10px;

    padding: 9px 18px;
  }

  /* Reduce decorative elements */

  .game-container::before {
    left: -15px;
    top: 26%;

    width: 48px;
    height: 48px;

    font-size: 28px;
  }

  .game-container::after {
    right: -10px;
    top: 20%;

    width: 45px;
    height: 45px;

    font-size: 26px;
  }
}

/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 380px) {
  .game-container {
    padding: 7px;
  }

  .game-header {
    padding-left: 10px;
    padding-right: 10px;
  }

  .game-content {
    padding-left: 6px;
    padding-right: 6px;
  }

  .tile {
    width: 42px;
    height: 42px;

    font-size: 17px;
  }

  .row {
    gap: 3px;
  }

  .keyboard-row {
    gap: 2px;
  }

  .keyboard button {
    height: 38px;

    font-size: 9px;
  }

  .keyboard .wide-key {
    min-width: 12.5vw;
  }
}

/* =========================================================
   REDUCE MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    transition: none !important;

    animation: none !important;
  }
}
