/**
 * Gameplay screen — complete SVG layout (454.55×323.77 design space)
 */

.game-body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-ar);
  background: #a4daf2;
}

[dir='ltr'] .game-body {
  font-family: var(--font-en);
}

.game-viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: manipulation;
  background: #a4daf2;
}

.game-viewport.is-dragging {
  touch-action: none;
  cursor: grabbing;
}

.game-scene {
  position: relative;
  transform-origin: center center;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.game-scene__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 0;
}

.game-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.game-layer--board .game-item,
.game-layer--board .game-item-slot,
.game-layer--board .game-drop-zone,
.game-layer--controls .game-nav-btn {
  pointer-events: auto;
}

.game-layer--hud {
  z-index: 10;
  pointer-events: none;
}

.game-progress {
  position: absolute;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  box-shadow: none;
  overflow: hidden;
  pointer-events: none;
}

.game-progress__fill {
  height: 100%;
  width: 0;
  min-width: 0;
  background: linear-gradient(
    180deg,
    #f17c75 0%,
    #ee2a24 34%,
    #e92923 44%,
    #db2621 55%,
    #c4221f 66%,
    #a51c1b 78%,
    #821618 100%
  );
  border-radius: 5px;
  transition: width 0.45s ease;
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.game-progress.has-progress .game-progress__fill {
  min-width: 4px;
}

.game-stars {
  position: absolute;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.game-star {
  display: block;
  width: 18px;
  height: 13px;
  object-fit: contain;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast), transform var(--dur-fast), visibility var(--dur-fast);
}

.game-stars.is-revealed .game-star.is-visible {
  opacity: 1;
  visibility: visible;
}

.game-stars.is-revealed .game-star.is-visible:not(.is-earned) {
  opacity: 0.75;
  transform: none;
}

.game-star.is-earned {
  opacity: 1;
  visibility: visible;
  transform: scale(1.04);
}

.game-layer--board { z-index: 20; }

.game-item-slot,
.game-drop-zone,
.game-mascot {
  position: absolute;
  transform: translate(-50%, -50%);
}

.game-item {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast), filter var(--dur-fast);
  position: relative;
  z-index: 30;
}

.game-item:active,
.game-item.is-dragging {
  cursor: grabbing;
  z-index: 100;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
  transform: scale(1.08);
}

.game-item.is-placed {
  cursor: default;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.game-item.is-locked {
  cursor: default;
  pointer-events: none;
}

.game-item__img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  pointer-events: none;
}

.game-drop-zone--compact .game-drop-zone__num {
  font-size: 0.85rem;
}

.game-drop-zone--compact .game-item__img {
  width: 46px;
  height: 46px;
}

.game-item-slot .game-item__img {
  width: 60px;
  height: 60px;
}

.game-scene[data-compact-items="1"] .game-item {
  width: 52px;
  height: 52px;
}

.game-scene[data-compact-items="1"] .game-item__img {
  width: 48px;
  height: 48px;
}

.game-drop-zone {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-sizing: border-box;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast), filter var(--dur-fast);
  touch-action: none;
  z-index: 25;
}

.game-drop-zone__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.game-drop-zone__num {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-drop-stroke);
  opacity: 0.55;
}

.game-drop-zone.is-hover {
  transform: translate(-50%, -50%) scale(1.06);
  filter: drop-shadow(0 0 8px rgba(28, 176, 246, 0.55));
}

.game-drop-zone.is-correct {
  filter: drop-shadow(0 0 10px rgba(88, 204, 2, 0.65));
}

.game-drop-zone.is-wrong {
  animation: game-shake 0.4s ease;
}

.game-drop-zone.is-filled .game-drop-zone__num {
  display: none;
}

.game-drop-zone.is-filled .game-drop-zone__ring {
  opacity: 0;
}

.game-scene:not(.game-scene--slot-fit) .game-drop-zone.is-filled .game-item__img {
  width: 56px;
  height: 56px;
}

/* Prayer screen — items fill SVG slot rects exactly */
.game-scene--slot-fit .game-item-slot {
  width: var(--source-w, 55px);
  height: var(--source-h, 55px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.game-scene--slot-fit .game-item-slot .game-item {
  width: 100%;
  height: 100%;
  border-radius: var(--slot-radius, 12px);
  overflow: hidden;
}

.game-scene--slot-fit .game-item-slot .game-item__img {
  width: calc(100% - var(--slot-pad, 4px) * 2);
  height: calc(100% - var(--slot-pad, 4px) * 2);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.game-scene--slot-fit .game-drop-zone {
  width: var(--drop-w, 49px);
  height: var(--drop-h, 49px);
  border-radius: var(--slot-radius, 12px);
  overflow: hidden;
  box-sizing: border-box;
  transition: transform var(--dur-fast), outline-color var(--dur-fast);
}

.game-scene--slot-fit .game-drop-zone__num {
  display: none;
}

.game-scene--slot-fit .game-drop-zone.is-hover {
  transform: translate(-50%, -50%) scale(1.04);
  filter: none;
}

.game-scene--slot-fit .game-drop-zone.is-correct {
  filter: none;
  box-shadow: none;
}

.game-scene--slot-fit .game-drop-zone.is-wrong {
  filter: none;
}

.game-scene--slot-fit .game-drop-zone .game-item {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  transform: none;
  border-radius: var(--slot-radius, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  box-sizing: border-box;
}

.game-scene--slot-fit .game-drop-zone.is-filled .game-item__img,
.game-scene--slot-fit .game-drop-zone .game-item__img {
  width: var(--drop-img-w, 42px);
  height: var(--drop-img-h, 42px);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  flex-shrink: 0;
}

.game-scene:not(.game-scene--slot-fit) .game-drop-zone .game-item {
  position: relative;
  inset: auto;
  width: 64px;
  height: 64px;
  margin: 0;
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

@keyframes game-shake {
  0%, 100% { transform: translate(-50%, -50%); }
  20% { transform: translate(calc(-50% - 8px), -50%); }
  40% { transform: translate(calc(-50% + 8px), -50%); }
  60% { transform: translate(calc(-50% - 6px), -50%); }
  80% { transform: translate(calc(-50% + 6px), -50%); }
}

.game-mascot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.game-mascot--left {
  transform: translate(0, -50%);
}

.game-mascot--right {
  transform: translate(-50%, -50%);
}

.game-mascot__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  transform: scaleX(-1);
  animation: game-mascot-float 3.6s ease-in-out infinite;
}

.game-mascot--right .game-mascot__img {
  animation-delay: -1.4s;
}

.game-mascot.is-celebrate .game-mascot__img {
  animation: game-bounce 0.6s ease infinite alternate;
}

@keyframes game-mascot-float {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50% { transform: scaleX(-1) translateY(-7px); }
}

@keyframes game-bounce {
  from { transform: scaleX(-1) translateY(0); }
  to { transform: scaleX(-1) translateY(-12px); }
}

.game-layer--controls {
  z-index: 30;
  pointer-events: none;
}

.game-nav-btn {
  position: absolute;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast), opacity var(--dur-fast);
}

.game-nav-btn--overlay {
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
}

.game-nav-btn--overlay:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.94);
}

.game-nav-btn--overlay:disabled {
  cursor: not-allowed;
}

.game-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--color-text);
  color: #fff;
  padding: 14px 24px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.game-toast[hidden] { display: none; }

.game-complete {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.game-complete[hidden] { display: none; }

.game-complete__card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}

.game-complete__card h2 { margin: 16px 0 8px; font-size: 1.75rem; font-weight: 800; }
.game-complete__card p { margin: 0 0 24px; color: var(--color-text-muted); }

.game-complete__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.game-complete__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  border: none;
  border-radius: 16px;
  background: #257239;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 114, 57, 0.35);
  transition: transform var(--dur-fast), opacity var(--dur-fast);
}

.game-complete__nav:active {
  transform: scale(0.96);
}

.game-complete__nav[hidden] {
  display: none;
}

.game-complete__nav--next {
  background: #ee2a24;
  box-shadow: 0 6px 18px rgba(238, 42, 36, 0.35);
}

.game-complete__nav--home {
  background: #3a9845;
  box-shadow: 0 6px 18px rgba(58, 152, 69, 0.35);
}

.game-complete__nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

[dir='rtl'] .game-complete__nav-icon {
  transform: scaleX(-1);
}

.game-complete__stars { display: flex; justify-content: center; gap: 8px; }
.game-complete__stars .game-star {
  opacity: 1;
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.game-nav-btn--primary {
  position: static;
  transform: none;
  width: auto;
  height: auto;
  padding: 16px 32px;
  border-radius: 16px;
  color: #fff;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
}

.game-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.92;
  transform: translate(-50%, -50%);
}
