/* Crown Puzzle — Game Anything
 * Shell: /play/shared/ga-casual-shell.css · tokens: --cwn-* */

#cwnPlayShell.game-worlds-play-shell {
  min-height: 0;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 120% 80% at 50% 30%, rgba(250, 204, 21, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 80% 70% at 0% 100%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
    linear-gradient(165deg, #05070c 0%, #0c1118 42%, #080b10 100%);
}

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

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

:root {
  --cwn-panel: rgba(15, 23, 42, 0.78);
  --cwn-border: rgba(56, 189, 248, 0.22);
  --cwn-text: #f1f5f9;
  --cwn-muted: #94a3b8;
  --cwn-accent: #fbbf24;
  --cwn-danger: #fb7185;
  --cwn-radius: 18px;
  --cwn-font: "Outfit", "DM Sans", system-ui, sans-serif;
  --cwn-cell-gap: 2px;
  --cwn-cols: 6;
  --cwn-rows: 6;
  --cwn-cell-w: 48px;
  --cwn-cell-h: 48px;
}

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

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

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

.cwn-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(--cwn-font);
  color: var(--cwn-text);
}

#cwnPlayShell .cwn-app.cwn-gw {
  align-items: stretch;
  padding: clamp(0.55rem, 2vw, 0.85rem) clamp(0.65rem, 2.5vw, 1rem);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

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

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

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

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

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

/* Infinite Maze–style: frosted menu over a live board preview */
#cwn-app.cwn-mode-overlay {
  position: relative;
}

#cwn-app.cwn-mode-overlay #cwn-screen-play.cwn-screen-active {
  display: flex;
}

#cwn-app.cwn-mode-overlay #cwn-screen-play .cwn-play-head,
#cwn-app.cwn-mode-overlay #cwn-screen-play .cwn-status {
  visibility: hidden;
  pointer-events: none;
}

#cwn-app.cwn-mode-overlay #cwn-screen-play .cwn-board-wrap {
  pointer-events: none;
}

.cwn-screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
  margin: 0;
  padding: clamp(12px, 3vw, 24px);
  box-sizing: border-box;
  background: rgba(2, 6, 23, 0.46);
  backdrop-filter: blur(11px) saturate(1.06);
  -webkit-backdrop-filter: blur(11px) saturate(1.06);
}

.cwn-screen-overlay.cwn-screen-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

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

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

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

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

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

.cwn-panel {
  width: min(480px, 100%);
  padding: clamp(22px, 4.5vw, 34px) clamp(20px, 4vw, 30px);
  border-radius: var(--cwn-radius);
  background: var(--cwn-panel);
  border: 1px solid var(--cwn-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);
}

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

.cwn-panel h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  background: linear-gradient(102deg, #f8fafc 0%, #fde68a 42%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

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

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

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

.cwn-btn {
  border: 1px solid var(--cwn-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cwn-text);
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.18, 0.64, 1),
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

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

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

.cwn-btn-primary {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, #b45309, #f59e0b 48%, #fbbf24);
  color: #1c1917;
  box-shadow: 0 10px 32px rgba(245, 158, 11, 0.35);
}

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

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

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

.cwn-diff-card:hover {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(40, 30, 12, 0.55);
}

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

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

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

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

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

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

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

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

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

.cwn-pill-accent {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}


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

.cwn-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(--cwn-muted, #94a3b8);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

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

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

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

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

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

.cwn-tool {
  border: 1px solid var(--cwn-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cwn-text);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
}

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

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

.cwn-board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cwn-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cwn-cols), var(--cwn-cell-w));
  grid-template-rows: repeat(var(--cwn-rows), var(--cwn-cell-h));
  gap: var(--cwn-cell-gap);
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  user-select: none;
  -webkit-user-select: none;
}

.cwn-cell {
  position: relative;
  z-index: 1;
  width: var(--cwn-cell-w);
  height: var(--cwn-cell-h);
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  background: var(--cwn-region);
  color: var(--cwn-text);
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    box-shadow 0.15s ease,
    filter 0.15s ease,
    transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.cwn-cell:hover {
  filter: brightness(1.12);
}

.cwn-cell:active {
  transform: scale(0.96);
}

/* Stronger borders between different regions */
.cwn-cell.cwn-edge-n {
  border-top-width: 2px;
  border-top-color: rgba(248, 250, 252, 0.35);
}
.cwn-cell.cwn-edge-s {
  border-bottom-width: 2px;
  border-bottom-color: rgba(248, 250, 252, 0.35);
}
.cwn-cell.cwn-edge-w {
  border-left-width: 2px;
  border-left-color: rgba(248, 250, 252, 0.35);
}
.cwn-cell.cwn-edge-e {
  border-right-width: 2px;
  border-right-color: rgba(248, 250, 252, 0.35);
}

.cwn-glyph {
  position: relative;
  z-index: 2;
  font-size: clamp(0.95rem, 3.2vw, 1.35rem);
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.cwn-cell--mark .cwn-glyph {
  color: rgba(226, 232, 240, 0.72);
  font-size: clamp(0.85rem, 2.8vw, 1.15rem);
}

.cwn-cell--crown .cwn-glyph {
  color: #fef3c7;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.55);
}

.cwn-cell--crown {
  box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.45);
}

.cwn-cell--conflict {
  box-shadow:
    inset 0 0 0 2px rgba(251, 113, 133, 0.85),
    0 0 16px rgba(251, 113, 133, 0.35);
  animation: cwn-conflict-pulse 0.9s ease-in-out infinite;
}

.cwn-cell--conflict .cwn-glyph {
  color: #fecdd3;
}

@keyframes cwn-conflict-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cwn-cell--conflict {
    animation: none;
  }
}

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

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

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

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

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

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