:root {
  --sky: #7ec8f5;
  --sun: #ffd166;
  --coral: #ff6b6b;
  --mint: #4ecdc4;
  --lime: #95e06c;
  --grape: #7b68ee;
  --cream: #fff8f0;
  --ink: #2d3436;
  --ink-soft: #636e72;
  --bubble: #ffffff;
  --shadow: rgba(45, 52, 54, 0.18);
  --radius-bubble: 1.75rem;
  --font-ui: Georgia, "Times New Roman", Times, serif;
  --font-letter: "Times New Roman", Times, Georgia, serif;
  --teal: #2bb8ad;
  --teal-deep: #1f9e94;
  --light-orange: #ffb35c;
  --light-orange-deep: #f59e3b;
  --soft-rose: #e08a92;
  --soft-rose-deep: #d97c86;
  --tile: linear-gradient(145deg, #4fd4c9, var(--teal));
}

body.theme-easy {
  --tile: linear-gradient(145deg, #4fd4c9, var(--teal));
}

body.theme-medium {
  --tile: linear-gradient(145deg, #ffc278, var(--light-orange));
}

body.theme-hard {
  --tile: linear-gradient(145deg, #eba0a6, var(--soft-rose-deep));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: linear-gradient(165deg, #a8e0ff 0%, #7ec8f5 35%, #ffe8a3 70%, #ffc9a8 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.45;
  animation: float-blob 12s ease-in-out infinite;
}

.blob-a {
  width: 220px;
  height: 220px;
  background: var(--sun);
  top: -40px;
  right: -30px;
}

.blob-b {
  width: 180px;
  height: 180px;
  background: var(--mint);
  bottom: 10%;
  left: -50px;
  animation-delay: -4s;
}

.blob-c {
  width: 140px;
  height: 140px;
  background: var(--coral);
  bottom: -20px;
  right: 15%;
  animation-delay: -7s;
}

@keyframes float-blob {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12px, -18px) scale(1.06);
  }
}

#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.25rem 2rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: screen-in 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.screen.active {
  display: flex;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* —— Home —— */
.brand-block {
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.brand-tag {
  display: inline-block;
  margin: 0 0 0.35rem;
  padding: 0.3rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--sun);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
}

.brand-title {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(2.4rem, 10vw, 3.35rem);
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.5);
}

.brand-sub {
  margin: 0.5rem auto 0;
  max-width: 22rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}

.session-best {
  text-align: center;
  font-weight: 600;
  margin: 0 0 1.25rem;
  color: var(--ink);
}

.setup-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.picker-label {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.5rem 0 0.35rem;
  color: var(--ink);
}

.choice-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bubble-btn {
  font-family: var(--font-ui);
  border: none;
  cursor: pointer;
  border-radius: var(--radius-bubble);
  box-shadow: 0 6px 0 var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.bubble-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--shadow);
}

.bubble-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--shadow);
}

.bubble-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: 0 4px 0 var(--shadow);
}

.length-btn,
.difficulty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.95rem 1.35rem;
  color: white;
  font-size: 1.15rem;
}

.difficulty-btn[data-difficulty="easy"] {
  background: linear-gradient(145deg, #4fd4c9, var(--teal));
}

.difficulty-btn[data-difficulty="medium"] {
  background: linear-gradient(145deg, #ffc278, var(--light-orange));
}

.difficulty-btn[data-difficulty="hard"] {
  background: linear-gradient(145deg, #eba0a6, var(--soft-rose-deep));
}

.difficulty-btn.selected {
  outline: 3px solid rgba(45, 52, 54, 0.35);
  outline-offset: 3px;
}

.btn-num {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  flex-shrink: 0;
}

.btn-label {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.theme-select {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-radius: 1.25rem;
  border: 3px solid rgba(45, 52, 54, 0.12);
  background: var(--bubble);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--shadow);
  width: 100%;
}

.start-btn {
  margin-top: 0.75rem;
  padding: 1rem 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(145deg, #95e06c, #6bcb4a);
}

.about-link {
  margin-top: 0.85rem;
  align-self: center;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
}

.about-link:hover {
  color: var(--ink);
}

.about-header {
  margin-bottom: 0.75rem;
}

.about-content {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 1.5rem;
  padding: 1.25rem 1.15rem 1.4rem;
  box-shadow: 0 6px 0 var(--shadow);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
}

.about-content h2 {
  margin: 1.15rem 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.about-content p {
  margin: 0 0 0.75rem;
}

.about-content ul {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

.about-content li {
  margin-bottom: 0.35rem;
}

/* —— Game —— */
.game-nav {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.75rem;
}

.nav-btn {
  padding: 0.5rem 1rem;
  background: var(--bubble);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 1rem;
  margin-bottom: 0.85rem;
}

.status-item {
  margin: 0;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.06);
}

.game-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-ui);
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
}

.answer-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 3.6rem;
  margin-bottom: 1rem;
}

.answer-slot {
  width: 3.15rem;
  height: 3.45rem;
  border-radius: 1rem;
  background: var(--bubble);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06), 0 4px 0 var(--shadow);
  display: grid;
  place-items: center;
  font-family: var(--font-letter);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: lowercase;
  transition: background 0.2s ease, transform 0.2s ease;
}

.answer-slot.filled {
  background: linear-gradient(160deg, #fff9e6, var(--sun));
  transform: scale(1.04);
  animation: letter-bounce 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.answer-slot.hinted {
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(78, 205, 196, 0.55),
    0 4px 0 var(--shadow);
}

.answer-slot.correct-flash {
  background: linear-gradient(160deg, #c8f7c5, var(--lime));
  animation: slot-win 0.45s ease;
}

@keyframes letter-bounce {
  from {
    transform: scale(0.7);
  }
  to {
    transform: scale(1.04);
  }
}

@keyframes slot-win {
  0%,
  100% {
    transform: scale(1.04);
  }
  50% {
    transform: scale(1.12) rotate(-3deg);
  }
}

.hints-panel {
  min-height: 0;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hint-line {
  margin: 0;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.05);
}

.hint-text {
  text-align: center;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.letter-area {
  min-height: 3.5rem;
  margin-bottom: 2.5rem;
}

.letter-bank {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 3.5rem;
}

.letter-bank[hidden],
.hint-text[hidden],
.game-actions[hidden],
.success-banner[hidden] {
  display: none;
}

.letter-tile {
  width: 3.25rem;
  height: 3.25rem;
  border: none;
  border-radius: 50%;
  font-family: var(--font-letter);
  font-size: 1.55rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  background: var(--tile);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  text-transform: lowercase;
}

.letter-tile:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.05);
}

.letter-tile:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.letter-tile:disabled,
.letter-tile.used {
  opacity: 0.28;
  cursor: default;
  transform: scale(0.9);
  box-shadow: none;
}

.success-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 3.5rem;
  animation: success-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.success-flash {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.85rem, 7vw, 2.5rem);
  font-weight: 700;
  color: #2d6a4f;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
  animation: success-flash 1.1s ease-in-out 2;
}

.success-banner .action-play {
  flex: 0 0 auto;
  min-width: 10rem;
  padding: 0.85rem 1.5rem;
}

@keyframes success-pop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes success-flash {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(1.08);
  }
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.action-btn {
  flex: 1 1 30%;
  min-width: 5.5rem;
  padding: 0.8rem 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
}

.action-delete {
  background: linear-gradient(145deg, #74b9ff, #0984e3);
}

.action-clear {
  background: linear-gradient(145deg, #ff8e6b, var(--coral));
}

.action-hint {
  background: linear-gradient(145deg, #ffd76a, #f4b942);
  color: var(--ink);
}

.action-play {
  background: linear-gradient(145deg, #95e06c, #6bcb4a);
}

/* —— Round complete —— */
.complete-header {
  margin-bottom: 1.25rem;
}

.complete-stats {
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 1.5rem;
  padding: 1.25rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 6px 0 var(--shadow);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.7;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.complete-home {
  align-self: center;
}

@media (min-width: 520px) {
  .choice-row {
    flex-direction: row;
  }

  .difficulty-btn {
    flex: 1;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.1rem 0.65rem;
  }

  .btn-label {
    align-items: center;
    text-align: center;
  }
}
