/* One motion rhythm for controls, game feedback and overlays. */
:root {
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --motion-fast: 140ms;
  --motion-panel: 280ms;
}

.tile {
  border-radius: 5px;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.tile.filled { animation: none; }
.tile.cursor {
  border-width: 2px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-text), transparent 86%);
}
.tile:is(.green, .yellow, .gray) { box-shadow: inset 0 1px 0 #ffffff12; }

button, .game-btn, .radio-pill, .drawer-btn, .keyboard button {
  transition: transform var(--motion-fast) var(--ease-out), background-color 180ms ease,
    border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.keyboard button { box-shadow: 0 2px 0 #0003, inset 0 1px 0 #ffffff0a; }
:is(button, .game-btn, .radio-pill, .drawer-btn):active:not(:disabled) { transform: translateY(1px) scale(.97); }
@media (hover: hover) {
  :is(.game-btn, .modal-btn, .radio-pill, .drawer-btn, .theme-btn, .hamburger-btn):hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px #0002;
  }
  .keyboard button:hover:not(:disabled) { transform: translateY(-2px); }
}

.theme-dropdown, .hamburger-dropdown {
  margin-top: .45rem;
  border-radius: 10px;
  box-shadow: 0 12px 36px #0005;
  transform-origin: top center;
}
:is(.theme-dropdown, .hamburger-dropdown).open {
  animation: menu-enter 200ms var(--ease-out) backwards;
}
.hamburger-overlay { backdrop-filter: blur(4px); transition: opacity var(--motion-panel) ease; }
.hamburger-drawer {
  box-shadow: 12px 0 48px #0003;
  transition: transform 320ms var(--ease-out), visibility 320ms;
}
.hamburger-drawer.open .hamburger-drawer-section {
  animation: content-enter 260ms var(--ease-out) backwards;
}
.hamburger-drawer-section:nth-child(2) { animation-delay: 25ms; }
.hamburger-drawer-section:nth-child(3) { animation-delay: 50ms; }
.hamburger-drawer-section:nth-child(4) { animation-delay: 75ms; }
.hamburger-drawer-section:nth-child(n+5) { animation-delay: 100ms; }

.result-overlay { animation: none; backdrop-filter: blur(5px); }
.result-overlay.hidden.is-exiting, .countdown-overlay.hidden.is-exiting { display: flex; pointer-events: none; }
.result-modal {
  position: relative;
  overflow: hidden auto;
  border-radius: 18px;
  box-shadow: 0 24px 80px #0006;
}
.result-overlay[data-outcome="won"] .result-modal {
  border-color: color-mix(in srgb, var(--color-green), var(--color-border) 60%);
  background: radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--color-green), transparent 90%), transparent 60%), var(--color-surface);
}
.result-overlay[data-outcome="won"] #result-title { color: var(--color-green); }
.result-word-item { border-radius: 8px; }
.result-modal .modal-btn { border-radius: 9px; }
.result-modal .modal-btn:not(.secondary) { color: var(--color-bg); }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: .75rem; }
.result-stat { min-width: 0; }
.result-stats .stat-label { font-size: .72rem; }
.message:not(:empty) { border-width: 1px; border-radius: 12px; box-shadow: 0 8px 28px #0005; }
.phase:not(.hidden), .opponent-board-compact.expanded, .game-help[open] p {
  animation: content-enter var(--motion-panel) var(--ease-out) backwards;
}
.connection-status:not(:empty) { animation: status-enter 180ms ease-out; }
.timer.warning { animation: timer-attention 900ms ease-in-out 3; }
.countdown-number.pop { animation: countdown-arrive 300ms var(--ease-out); }

@keyframes menu-enter {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes content-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes status-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes timer-attention {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes countdown-arrive {
  from { opacity: 0; transform: translateY(8px) scale(.82); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
  .result-modal { border-radius: 20px 20px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
