/* Word Ladder — Game Anything · tokens: --wld-* */

#wldPlayShell.game-worlds-play-shell {
  min-height: 0;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 110% 80% at 50% 10%, rgba(74, 222, 128, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 90% 70% at 100% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
    linear-gradient(165deg, #05070c 0%, #0c1118 42%, #080b10 100%);
}

#wldPlayShell.game-worlds-play-shell:not([data-wld-sized]) {
  height: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.wld-outer-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

:root {
  --wld-panel: rgba(15, 23, 42, 0.78);
  --wld-border: rgba(56, 189, 248, 0.22);
  --wld-text: #f1f5f9;
  --wld-muted: #94a3b8;
  --wld-accent: #4ade80;
  --wld-radius: 18px;
  --wld-font: "Outfit", "DM Sans", system-ui, sans-serif;
}

.ga-casual-scope.wld-app {
  --wld-panel: var(--ga-surface);
  --wld-border: var(--ga-border);
  --wld-text: var(--ga-text);
  --wld-muted: var(--ga-muted);
  --ga-accent-game: #4ade80;
}

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

body.wld-standalone {
  margin: 0;
  min-height: 100%;
  font-family: var(--wld-font);
  color: var(--wld-text);
  background: #000;
  -webkit-tap-highlight-color: transparent;
}

.wld-app {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 5vw, 30px)
    max(30px, env(safe-area-inset-bottom));
  font-family: var(--wld-font);
  color: var(--wld-text);
}

#wldPlayShell .wld-app.wld-gw {
  align-items: stretch;
  padding: clamp(0.5rem, 2vw, 0.8rem) clamp(0.6rem, 2.2vw, 1rem);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wld-screen {
  width: min(960px, 100%);
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  justify-content: center;
  align-items: center;
}

.wld-screen.wld-screen-active {
  display: flex;
  flex-direction: column;
}

.wld-screen-play.wld-screen-active {
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
}

#wldPlayShell .wld-screen-play.wld-screen-active {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
}

#wldPlayShell .wld-screen-play.wld-screen-active .wld-play {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
}

#wld-screen-menu.wld-screen,
#wld-screen-difficulty.wld-screen,
#wld-screen-how.wld-screen {
  width: 100%;
  max-width: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#wld-screen-menu .wld-panel,
#wld-screen-difficulty .wld-panel,
#wld-screen-how .wld-panel {
  width: min(var(--ga-puzzle-menu-max), 100%);
  max-width: min(var(--ga-puzzle-menu-max), 100%);
  margin-inline: auto;
}

.wld-screen.wld-screen-active .wld-panel {
  animation: wld-panel-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

@media (prefers-reduced-motion: reduce) {
  .wld-screen.wld-screen-active .wld-panel {
    animation: none;
  }
}

.wld-panel {
  width: min(520px, 100%);
  padding: clamp(22px, 4.5vw, 34px) clamp(20px, 4vw, 30px);
  border-radius: var(--wld-radius);
  background: var(--wld-panel);
  border: 1px solid var(--wld-border);
  box-shadow: 0 24px 56px rgba(2, 6, 23, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.wld-panel h1,
.wld-panel h2 {
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wld-panel h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  background: linear-gradient(102deg, #f8fafc 0%, #86efac 45%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wld-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #4ade80;
}

.wld-lead {
  margin: 0 0 20px;
  line-height: 1.55;
  color: var(--wld-muted);
  font-size: 0.98rem;
}

.wld-muted {
  color: var(--wld-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.wld-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.wld-btn {
  border: 1px solid var(--wld-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--wld-text);
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
}

.wld-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.wld-btn:active {
  transform: scale(0.98);
}

.wld-btn-primary {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(135deg, #15803d, #22c55e 48%, #4ade80);
  color: #052e16;
  box-shadow: 0 10px 32px rgba(34, 197, 94, 0.3);
}

.wld-btn-ghost {
  background: transparent;
  margin-top: 8px;
}

.wld-diff-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0 8px;
}

.wld-diff-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--wld-border);
  background: rgba(15, 23, 42, 0.65);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.wld-diff-card:hover {
  border-color: rgba(74, 222, 128, 0.45);
}

.wld-diff-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.wld-diff-meta {
  color: var(--wld-muted);
  font-size: 0.88rem;
}

.wld-list {
  margin: 0 0 18px;
  padding-left: 1.15rem;
  color: var(--wld-muted);
  line-height: 1.55;
}

.wld-list li {
  margin-bottom: 8px;
}

.wld-list strong {
  color: var(--wld-text);
}

.wld-play {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  width: 100%;
}

.wld-play-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
}

.wld-hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.wld-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wld-muted);
}

.wld-pill-accent {
  border-color: rgba(74, 222, 128, 0.35);
  color: #86efac;
}


.wld-diff-wrap {
  display: inline-flex;
  align-items: center;
}

.wld-diff-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 30px;
  padding: 4px 28px 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background:
    rgba(15, 23, 42, 0.78)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%94a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: var(--wld-muted, #94a3b8);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.wld-diff-select:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.45);
  color: var(--wld-text, #e2e8f0);
}

.wld-diff-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wld-diff-select:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.wld-diff-select option {
  background: #0f172a;
  color: #e2e8f0;
}

.wld-hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wld-tool {
  border: 1px solid var(--wld-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--wld-text);
  font: inherit;
  font-weight: 600;
  font-size: 0.75rem;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.wld-tool-ghost {
  background: transparent;
}

.wld-icon-btn {
  border: 1px solid var(--wld-border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.9rem;
}

.wld-ladder-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.wld-ladder {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.wld-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(30, 41, 59, 0.65);
  cursor: default;
}

.wld-row--rung {
  cursor: pointer;
}

.wld-row--rung:hover {
  border-color: rgba(74, 222, 128, 0.35);
}

.wld-row--start {
  background: linear-gradient(160deg, rgba(30, 58, 138, 0.45), rgba(15, 23, 42, 0.9));
  border-color: rgba(96, 165, 250, 0.35);
}

.wld-row--target {
  background: linear-gradient(160deg, rgba(20, 83, 45, 0.5), rgba(15, 23, 42, 0.9));
  border-color: rgba(74, 222, 128, 0.4);
}

.wld-row--active {
  box-shadow: inset 0 0 0 2px rgba(74, 222, 128, 0.7);
  border-color: rgba(74, 222, 128, 0.55);
}

.wld-row--filled .wld-word {
  color: #e2e8f0;
  letter-spacing: 0.28em;
}

.wld-row-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wld-muted);
}

.wld-word {
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.wld-row--rung:not(.wld-row--filled) .wld-word {
  color: rgba(148, 163, 184, 0.45);
  letter-spacing: 0.2em;
  font-weight: 600;
}

.wld-arrow {
  text-align: center;
  color: rgba(148, 163, 184, 0.45);
  font-size: 0.85rem;
  line-height: 1;
  padding: 1px 0;
}

.wld-entry {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 5;
}

.wld-input {
  width: min(220px, 55vw);
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
}

.wld-input:focus {
  outline: none;
  border-color: rgba(74, 222, 128, 0.75);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

.wld-input--bad {
  border-color: rgba(251, 113, 133, 0.85);
  animation: wld-shake 0.35s ease;
}

@keyframes wld-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.wld-status {
  margin: 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 0.82rem;
  color: var(--wld-muted);
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
}

.wld-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wldPlayShell .wld-overlay.ga-game-overlay,
.wld-app .wld-overlay.ga-game-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  border-radius: inherit;
}

.wld-overlay[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .wld-play-head {
    flex-direction: column;
    align-items: stretch;
  }

  .wld-row {
    grid-template-columns: 56px 1fr;
  }
}

/* Game Worlds: center menu cards in the full play shell */
.game-worlds-body #wldPlayShell #wld-screen-menu.wld-screen-active,
.game-worlds-body #wldPlayShell #wld-screen-difficulty.wld-screen-active,
.game-worlds-body #wldPlayShell #wld-screen-how.wld-screen-active,
.game-worlds-body .game-worlds-play-shell #wld-screen-menu.wld-screen-active,
.game-worlds-body .game-worlds-play-shell #wld-screen-difficulty.wld-screen-active,
.game-worlds-body .game-worlds-play-shell #wld-screen-how.wld-screen-active {
  width: 100%;
  align-items: center;
  justify-content: center;
}
