/* Marketing Connections Game — Mobile-first styles */

:root {
  --color-yellow: #f9df6d;
  --color-green: #a0c35a;
  --color-blue: #b0c4ef;
  --color-purple: #ba81c5;
  --color-selected: #5a594e;
  --color-tile-bg: #efefe6;
  --color-tile-text: #1a1a1a;
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --tile-gap: 8px;
  --tile-radius: 8px;
  --max-width: 600px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.header {
  text-align: center;
  padding: 24px 16px 8px;
  width: 100%;
  max-width: var(--max-width);
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.header__subtitle {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: 4px;
}

/* Mistakes */
.mistakes {
  text-align: center;
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.mistakes-label {
  margin-right: 4px;
}

.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e0e0d8;
  margin: 0 2px;
  vertical-align: middle;
  transition: background 0.3s ease;
}

.dot--filled {
  background: var(--color-text);
}

/* Game area */
.game {
  width: 100%;
  max-width: var(--max-width);
  padding: 0 16px;
  flex: 1;
}

/* Solved category bars */
.solved-container {
  display: flex;
  flex-direction: column;
  gap: var(--tile-gap);
  margin-bottom: var(--tile-gap);
}

.solved-bar {
  border-radius: var(--tile-radius);
  padding: 16px 12px;
  text-align: center;
  color: var(--color-tile-text);
  animation: revealBar 0.4s ease-out;
}

.solved-bar__name {
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.solved-bar__words {
  font-size: 0.8125rem;
  margin-top: 4px;
}

@keyframes revealBar {
  from {
    opacity: 0;
    transform: scaleY(0.8);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* Tile grid */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--tile-gap);
}

/* Tiles */
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-tile-bg);
  color: var(--color-tile-text);
  border: none;
  border-radius: var(--tile-radius);
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 8px 4px;
  min-height: 60px;
  aspect-ratio: 1;
  word-break: break-word;
  text-align: center;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.tile:hover {
  transform: scale(1.03);
}

.tile--selected {
  background: var(--color-selected);
  color: #ffffff;
  transform: scale(1.03);
}

.tile--shake {
  animation: shake 0.4s ease;
}

.tile:disabled {
  cursor: default;
  opacity: 0.7;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Action buttons */
.actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  width: 100%;
  max-width: var(--max-width);
}

.btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 24px;
  border: 1.5px solid var(--color-text);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover:not(:disabled) {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn--primary {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn--primary:hover:not(:disabled) {
  background: #333;
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.footer a {
  color: var(--color-muted);
  text-decoration: underline;
}

.footer a:hover {
  color: var(--color-text);
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--color-text);
  color: var(--color-bg);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.3s ease;
  pointer-events: none;
}

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

/* Game Over Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 900;
  padding: 16px;
}

.modal--visible {
  opacity: 1;
  visibility: visible;
}

.modal__content {
  background: var(--color-bg);
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-category {
  border-radius: var(--tile-radius);
  padding: 12px;
  margin-bottom: 8px;
  color: var(--color-tile-text);
}

.modal-category__name {
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-category__words {
  font-size: 0.75rem;
  margin-top: 2px;
}

.modal__share {
  margin-top: 20px;
}

.modal__countdown {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin-top: 12px;
}

/* Desktop */
@media (min-width: 600px) {
  .header {
    padding-top: 40px;
  }

  .header__title {
    font-size: 1.5rem;
  }

  .tile {
    font-size: 0.95rem;
    min-height: 72px;
  }

  .solved-bar {
    padding: 20px 16px;
  }
}
