/* ---- WordForge: scoped styles ---- */

.game-word-forge {
  --tile-w: 42px;
  --tile-h: 52px;

  max-width: 420px;
  width: 100%;
  position: relative;
}

.game-word-forge .hidden { display: none !important; }

/* MENU */
.game-word-forge .menu-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  text-align: center;
  padding: 20px;
}

.game-word-forge .menu-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 3.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  margin-bottom: 4px;
  animation: wf-titlePulse 3s ease-in-out infinite;
}

@keyframes wf-titlePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.1); }
}

.game-word-forge .menu-sub {
  color: var(--muted-light);
  font-size: 0.95rem;
  margin-bottom: 28px;
  font-weight: 400;
}

.game-word-forge .menu-tiles {
  display: flex;
  gap: 8px;
  margin-bottom: 36px;
}

.game-word-forge .menu-tile {
  width: 52px;
  height: 62px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  animation: wf-tileFloat 2s ease-in-out infinite;
}

.game-word-forge .menu-tile:nth-child(1) {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  animation-delay: 0s;
}
.game-word-forge .menu-tile:nth-child(2) {
  background: linear-gradient(135deg, var(--gold), #E0B84A);
  animation-delay: 0.15s;
}
.game-word-forge .menu-tile:nth-child(3) {
  background: linear-gradient(135deg, var(--teal), #28C4A0);
  animation-delay: 0.3s;
}
.game-word-forge .menu-tile:nth-child(4) {
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  animation-delay: 0.45s;
}

@keyframes wf-tileFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.game-word-forge .btn-play {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, var(--teal), #28C4A0);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  padding: 14px 56px;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(43, 168, 144, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.game-word-forge .btn-play:active {
  transform: scale(0.96);
  box-shadow: 0 2px 10px rgba(43, 168, 144, 0.25);
}

.game-word-forge .btn-play:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.game-word-forge .menu-how {
  margin-top: 20px;
  color: var(--muted-light);
  font-size: 0.82rem;
  max-width: 300px;
  line-height: 1.5;
}

/* GAME SCREEN */
.game-word-forge .game-screen {
  padding-bottom: 130px;
}

.game-word-forge .game-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 6px;
  font-size: 0.82rem;
}

.game-word-forge .game-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-word-forge .ante-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--gold);
  font-size: 0.9rem;
}

.game-word-forge .money {
  font-family: 'Fredoka', sans-serif;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
}

.game-word-forge .score-bar {
  background: var(--muted);
  border-radius: 10px;
  height: 28px;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}

.game-word-forge .score-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
  background: linear-gradient(90deg, var(--teal), #28C4A0);
  min-width: 2px;
}

.game-word-forge .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.game-word-forge .stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.78rem;
}

.game-word-forge .stat {
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 8px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.game-word-forge .stat-icon { font-size: 0.9rem; }
.game-word-forge .stat-val { font-weight: 600; color: var(--text-bright); }

.game-word-forge .section-label {
  font-size: 0.72rem;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 6px 0 4px;
  font-weight: 500;
}

.game-word-forge .challenger-box {
  background: linear-gradient(135deg, rgba(221, 76, 79, 0.08), rgba(221, 76, 79, 0.03));
  border: 1px solid rgba(221, 76, 79, 0.2);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.game-word-forge .challenger-box .section-label {
  margin: 0;
  width: 100%;
}

.game-word-forge .joker-row {
  display: flex;
  gap: 5px;
  margin-bottom: 6px;
  overflow-x: auto;
  padding: 2px 0;
  min-height: 36px;
}

.game-word-forge .joker-chip {
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.game-word-forge .word-preview {
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 12px;
  padding: 10px 8px 6px;
  margin-bottom: 4px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.game-word-forge .word-letters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 36px;
  align-items: center;
}

.game-word-forge .word-letter {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.game-word-forge .word-letter.challenger { color: var(--accent); }
.game-word-forge .word-letter.hand { color: var(--text-bright); }

.game-word-forge .word-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 6px;
  display: inline-block;
}

.game-word-forge .word-status.valid {
  background: rgba(212, 168, 58, 0.15);
  color: var(--gold);
}

.game-word-forge .word-status.invalid {
  background: rgba(107, 107, 112, 0.08);
  color: var(--muted-light);
}

.game-word-forge .word-empty {
  color: var(--muted-light);
  font-size: 0.82rem;
  font-style: italic;
}

.game-word-forge .hand-area {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0 6px;
  min-height: 56px;
}

/* TILES */
.game-word-forge .tile {
  width: var(--tile-w);
  height: var(--tile-h);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
}

.game-word-forge .tile .letter {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.game-word-forge .tile .points {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 0.55rem;
  font-weight: 600;
  opacity: 0.7;
}

.game-word-forge .tile-hand {
  background: linear-gradient(145deg, var(--surface), var(--muted));
  color: var(--text-bright);
  border: 1px solid var(--muted);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.game-word-forge .tile-hand.selected {
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(221, 76, 79, 0.3);
}

.game-word-forge .tile-challenger {
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  color: #fff;
  box-shadow: 0 2px 6px rgba(221, 76, 79, 0.2);
}

.game-word-forge .tile-challenger.selected {
  transform: translateY(-5px);
  border: 2px solid var(--gold);
  box-shadow: 0 4px 14px rgba(212, 168, 58, 0.35);
}

/* ACTIONS BAR */
.game-word-forge .actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, var(--bg) 70%, transparent);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 100;
}

.game-word-forge .actions .stats-row {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  justify-content: center;
}

.game-word-forge .actions .btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.game-word-forge .actions .btn-row button {
  font-family: 'Fredoka', sans-serif;
  flex: 1;
  max-width: 190px;
  padding: 12px 0;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  transition: transform 0.12s, opacity 0.12s;
}

.game-word-forge .actions .btn-row button:active { transform: scale(0.95); }
.game-word-forge .actions .btn-row button:disabled { opacity: 0.4; pointer-events: none; }

.game-word-forge .btn-submit {
  background: linear-gradient(135deg, var(--teal), #28C4A0);
  box-shadow: 0 3px 12px rgba(43, 168, 144, 0.3);
}

.game-word-forge .btn-discard {
  background: linear-gradient(135deg, var(--gold), #BF962F);
  box-shadow: 0 3px 12px rgba(212, 168, 58, 0.3);
}

/* CHALLENGER BAR */
.game-word-forge .chall-bar {
  background: var(--muted);
  border-radius: 10px;
  height: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 6px;
}

.game-word-forge .chall-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  min-width: 2px;
}

.game-word-forge .chall-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* PLAY LOG */
.game-word-forge .play-log { margin-top: 8px; padding-bottom: 4px; }

.game-word-forge .play-log-title {
  font-size: 0.72rem;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-weight: 500;
}

.game-word-forge .log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 3px;
  background: var(--surface);
  border: 1px solid var(--muted);
  font-size: 0.75rem;
}

.game-word-forge .log-word {
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.5px;
}

.game-word-forge .log-word .log-chall { color: var(--accent); }
.game-word-forge .log-detail { color: var(--muted-light); font-size: 0.68rem; }
.game-word-forge .log-score { color: var(--gold); font-weight: 600; }

.game-word-forge .log-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

.game-word-forge .log-badge.word {
  background: rgba(212, 168, 58, 0.15);
  color: var(--gold);
}

.game-word-forge .log-badge.noword {
  background: rgba(107, 107, 112, 0.06);
  color: var(--muted-light);
}

/* SHOP */
.game-word-forge .shop-screen { padding: 12px 16px 30px; }

.game-word-forge .shop-header { text-align: center; margin-bottom: 14px; }

.game-word-forge .shop-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}

.game-word-forge .shop-money {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 600;
}

.game-word-forge .shop-next {
  font-size: 0.78rem;
  color: var(--muted-light);
  margin-top: 4px;
}

.game-word-forge .shop-section { margin-bottom: 16px; }

.game-word-forge .shop-section-title {
  font-size: 0.82rem;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 500;
}

.game-word-forge .shop-jokers {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.game-word-forge .shop-joker {
  background: var(--surface);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 10px;
  padding: 8px;
  min-width: 130px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-word-forge .shop-joker-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #8B5CF6;
}

.game-word-forge .shop-joker-desc {
  font-size: 0.68rem;
  color: var(--muted-light);
  line-height: 1.3;
}

.game-word-forge .shop-joker-cost {
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 600;
  margin-top: auto;
}

.game-word-forge .shop-joker button {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  color: #fff;
  border-radius: 8px;
  padding: 5px 0;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
  width: 100%;
}

.game-word-forge .shop-joker button:disabled { opacity: 0.4; }

.game-word-forge .shop-letters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-word-forge .shop-letter-card {
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 68px;
}

.game-word-forge .shop-letter-card .cost {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
}

.game-word-forge .shop-letter-card button {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, var(--teal), #28C4A0);
  color: #fff;
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.game-word-forge .shop-letter-card button:disabled { opacity: 0.4; }
.game-word-forge .owned-jokers { display: flex; gap: 5px; flex-wrap: wrap; }

.game-word-forge .btn-next-round {
  font-family: 'Fredoka', sans-serif;
  display: block;
  margin: 16px auto 0;
  background: linear-gradient(135deg, var(--teal), #28C4A0);
  color: #fff;
  padding: 12px 40px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 3px 12px rgba(43, 168, 144, 0.3);
}

.game-word-forge .btn-next-round:active { transform: scale(0.96); }

/* END SCREENS */
.game-word-forge .end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  text-align: center;
  padding: 20px;
}

.game-word-forge .end-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.game-word-forge .end-sub {
  color: var(--muted-light);
  font-size: 0.9rem;
  margin-bottom: 6px;
  line-height: 1.5;
}

.game-word-forge .end-stat {
  font-family: 'Fredoka', sans-serif;
  color: var(--gold);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.game-word-forge .btn-retry {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  padding: 12px 44px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
}

/* TOAST */
.game-word-forge .wf-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-bright);
  color: #fff;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.game-word-forge .wf-toast.show { opacity: 1; }

/* PREGAME / DECK VIEWER */
.game-word-forge .pregame-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  text-align: center;
  padding: 20px;
}

.game-word-forge .pregame-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.game-word-forge .pregame-sub {
  font-size: 0.85rem;
  color: var(--muted-light);
  margin-bottom: 16px;
}

.game-word-forge .deck-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 360px;
  margin-bottom: 20px;
}

.game-word-forge .deck-toggle {
  background: var(--surface);
  border: 1px solid var(--muted);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 12px;
  cursor: pointer;
}

.game-word-forge .deck-toggle:active { opacity: 0.7; }

/* Button resets inside game */
.game-word-forge button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
