/* game.css — Game screen: sentence card, timer, gesture hints */

/* === GAME SCREEN LAYOUT === */
#screen-game.screen-active {
  display: flex;
  flex-direction: column;
}

.game-header {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  gap: var(--space-sm);
  z-index: 2;
}

.game-score {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-pixel);
  font-size: 12px;
  margin-left: auto;
  margin-right: var(--space-md);
}

.score-known { color: var(--success); }
.score-divider { color: var(--text-muted); }
.score-unknown { color: var(--warning); }

.game-progress-bar {
  flex: 1;
  max-width: 120px;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.game-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--warning);
  transition: width 0.3s ease;
  border-radius: 3px;
}

/* === GAME CARD AREA === */
.game-card-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  position: relative;
  touch-action: none; /* Prevent browser gestures */
  user-select: none;
  -webkit-user-select: none;
}

/* === GESTURE HINTS === */
.gesture-hints {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.9;
  transition: opacity 0.5s ease;
}

.gesture-hints.fading {
  opacity: 0;
}

.hint {
  position: absolute;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.6;
  animation: hint-pulse 2s ease-in-out infinite;
}

.hint-up {
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
}

.hint-down {
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
}

.hint-left {
  left: 8%;
  top: 50%;
  transform: translateY(-50%);
}

.hint-double {
  right: 8%;
  top: 50%;
  transform: translateY(-50%);
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* === SENTENCE CARD === */
.sentence-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 36px 28px 28px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease,
    box-shadow 0.3s ease;
  cursor: grab;
}

.sentence-card:active {
  cursor: grabbing;
}

/* Card fly-out animations (applied via JS) */
.sentence-card.fly-up {
  animation: fly-up 0.35s ease-in forwards;
}

.sentence-card.fly-down {
  animation: fly-down 0.35s ease-in forwards;
}

.sentence-card.fly-left {
  animation: fly-left 0.35s ease-in forwards;
}

.sentence-card.fly-in {
  animation: fly-in 0.35s ease-out forwards;
}

@keyframes fly-up {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(-150%) rotate(-5deg); opacity: 0; }
}

@keyframes fly-down {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(150%) rotate(5deg); opacity: 0; }
}

@keyframes fly-left {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-120%); opacity: 0; }
}

@keyframes fly-in {
  0% { transform: translateY(60px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* === TIMER RING === */
.card-timer {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 48px;
  height: 48px;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: var(--bg-primary);
  stroke-width: 4;
}

.timer-ring-fill {
  fill: none;
  stroke: var(--success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 163.36; /* 2 * PI * 26 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--text-primary);
}

/* === SENTENCE TEXT === */
.sentence-text {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: var(--space-md);
  letter-spacing: 0.3px;
}

/* === WORD BADGE === */
.word-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  text-align: center;
  width: 100%;
}

/* === KEYBOARD HINTS (Mac) === */
.card-hint-text {
  margin-top: var(--space-sm);
  text-align: center;
}

.key-hint {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.5;
  font-family: var(--font-pixel);
  letter-spacing: 0.5px;
}

/* === ACTION TOAST === */
.action-toast {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

.action-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.action-toast.toast-known { color: var(--success); }
.action-toast.toast-unknown { color: var(--warning); }
.action-toast.toast-timeout { color: var(--danger); }
.action-toast.toast-undo { color: var(--info); }
.action-toast.toast-fav { color: #E91E63; }
.action-toast.toast-session-end {
  font-size: 11px;
  padding: 12px 20px;
}

/* === HEART BURST === */
.heart-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
}

.floating-heart {
  position: absolute;
  animation: heart-float 1s ease-out forwards;
  color: #E91E63;
}

@keyframes heart-float {
  0% { transform: translateY(0) scale(0); opacity: 1; }
  50% { transform: translateY(-30px) scale(1.3); opacity: 0.9; }
  100% { transform: translateY(-70px) scale(0.5); opacity: 0; }
}

/* === RESPONSIVE === */
@media (max-width: 374px) {
  .sentence-text { font-size: 16px; }
  .sentence-card { padding: 30px 20px 22px; }
}

[data-device="ipad"] .sentence-card {
  max-width: 520px;
  padding: 44px 36px 34px;
}
[data-device="ipad"] .sentence-text {
  font-size: 22px;
}

[data-device="mac"] .sentence-card {
  max-width: 600px;
}
