:root {
  --bg-top: #0f2f1f;
  --bg-bottom: #062018;
  --panel: #103728;
  --panel-border: #2f9b70;
  --board: #0b3524;
  --board-dark: #082919;
  --text-main: #f4fff9;
  --text-muted: #b8dbc8;
  --accent: #ffe08a;
  --danger: #ff3b30;
  --card-width: 144px;
  --card-height: 210px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  display: grid;
  place-items: center;
  padding: 4px 20px 20px;
}

.game-shell {
  width: min(1100px, 100%);
}

.top-brand-row {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: nowrap;
  position: relative;
  min-height: clamp(2.1rem, 4.2vw, 3rem);
}

.home-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-left: 18px;
  color: #f5f9ff;
  text-decoration: none;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: clamp(1.7rem, 3.6vw, 2.3rem);
  letter-spacing: 0.03em;
  font-weight: 700;
  line-height: 1;
}

.home-brand-link:focus-visible {
  outline: 2px solid rgba(147, 197, 253, 0.8);
  outline-offset: 4px;
  border-radius: 8px;
}

.home-brand-icons {
  display: inline-flex;
  gap: 6px;
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
  line-height: 1;
  transform: translateY(1px);
}

.home-brand-icon.spade,
.home-brand-icon.club {
  color: #b08a48;
}

.home-brand-icon.heart,
.home-brand-icon.diamond {
  color: #ff1e1e;
}

.game-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: clamp(1.8rem, 3.8vw, 2.7rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  margin-bottom: 14px;
}

.hud-group {
  display: flex;
  gap: 10px;
}

.hud-group-left {
  justify-content: flex-start;
}

.hud-group-right {
  justify-content: flex-end;
  align-items: center;
}

.hud-item {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
  min-height: 44px;
}

.hud-item-center {
  justify-self: center;
  min-width: 260px;
  width: max-content;
  max-width: min(70vw, 760px);
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
}

.hand-info-icon {
  border: 1px solid rgba(191, 219, 254, 0.85);
  background: rgba(30, 58, 138, 0.85);
  color: #eff6ff;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  padding: 0;
}

.hand-hint-tooltip {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translate(10px, -50%);
  border: 1px solid rgba(147, 197, 253, 0.85);
  background: rgba(15, 44, 79, 0.96);
  color: #dbeafe;
  border-radius: 10px;
  padding: 7px 10px;
  white-space: nowrap;
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.4);
}

.hud-item-center:hover .hand-hint-tooltip,
.hand-info-icon:focus-visible + .hand-hint-tooltip,
.hand-hint-tooltip.open {
  opacity: 1;
}

.hand-hint-tooltip .tooltip-label {
  color: #c7dcff;
  font-weight: 700;
  margin-right: 6px;
}

.hand-hint-tooltip .go-card.hud-go-card {
  margin-right: 3px;
  padding: 1px 6px;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
}

.hud-label {
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

.hud-value {
  color: var(--accent);
  font-size: 1.02rem;
  font-weight: 800;
}

.hud-item.time-urgent {
  border-color: rgba(239, 68, 68, 0.95);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.42), 0 0 18px rgba(239, 68, 68, 0.35);
}

.hud-item.time-urgent .hud-value {
  color: #fecaca;
  animation: timer-urgent-pulse 600ms ease-in-out infinite;
}

@keyframes timer-urgent-pulse {
  0% {
    transform: scale(1);
    text-shadow: 0 0 0 rgba(254, 202, 202, 0);
  }
  50% {
    transform: scale(1.08);
    text-shadow: 0 0 9px rgba(254, 202, 202, 0.95);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 0 rgba(254, 202, 202, 0);
  }
}

.danger {
  animation: pulseRed 0.6s infinite;
  box-shadow: 0 0 10px red;
}

@keyframes pulseRed {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.lives {
  color: var(--danger);
  font-size: 1.1rem;
  letter-spacing: 0.09em;
  display: inline-flex;
  gap: 4px;
}

.lives-heart {
  transition: opacity 140ms ease, filter 140ms ease, transform 140ms ease;
}

.lives-heart.off {
  opacity: 0.22;
  filter: grayscale(1);
  transform: scale(0.96);
}

.hud-icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--panel-border);
  background: var(--panel);
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hud-icon-button:hover {
  border-color: #7dd3fc;
  color: #e0f2fe;
}

.board-wrap,
.selection-wrap {
  background: rgba(11, 53, 36, 0.6);
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
}

.game-board {
  position: relative;
  min-height: 620px;
  border: 2px solid rgba(231, 255, 243, 0.28);
  border-radius: 10px;
  overflow: hidden;
  background-color: var(--board);
  background-image:
    repeating-linear-gradient(
      to right,
      transparent,
      transparent calc(20% - 1px),
      rgba(231, 255, 243, 0.18) calc(20% - 1px),
      rgba(231, 255, 243, 0.18) 20%
    ),
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 48px,
      rgba(231, 255, 243, 0.12) 49px,
      rgba(231, 255, 243, 0.12) 50px
    ),
    linear-gradient(180deg, var(--board), var(--board-dark));
}

.cards-layer {
  position: absolute;
  inset: 0;
}

.hand-complete-flash {
  position: absolute;
  inset: 0;
  z-index: 38;
  display: grid;
  place-items: center;
  background: rgba(2, 12, 8, 0.22);
}

.hand-complete-box {
  border: 5px solid rgba(125, 211, 252, 1);
  background: rgba(6, 32, 24, 0.9);
  border-radius: 12px;
  padding: 32px 26px 34px;
  box-shadow:
    0 0 0 4px rgba(96, 165, 250, 0.9),
    0 0 44px rgba(56, 189, 248, 0.72),
    0 0 64px rgba(59, 130, 246, 0.58),
    0 0 26px rgba(16, 185, 129, 0.3);
  display: grid;
  gap: 12px;
  justify-items: center;
  overflow: visible;
}

.hand-complete-title {
  color: #fef08a;
  font-size: 1.42rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
  margin-top: -14px;
  margin-bottom: 8px;
  transform: translateY(-10px);
  text-shadow:
    0 0 8px rgba(250, 204, 21, 0.45),
    0 1px 0 rgba(2, 6, 23, 0.55);
  position: relative;
  z-index: 2;
}

.hand-complete-cards {
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hand-complete-cards img {
  width: 84px;
  height: 117px;
  object-fit: contain;
  border-radius: 8px;
  animation: hand-complete-pop 1s ease-in-out 1;
  filter: drop-shadow(0 0 14px rgba(34, 197, 94, 0.45));
}

.hand-complete-cards img.flash-prevalent-red {
  border: 2px solid rgba(248, 113, 113, 0.96);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.62),
    0 0 16px rgba(220, 38, 38, 0.52);
}

.hand-complete-cards img.flash-prevalent-green {
  border: 2px solid rgba(74, 222, 128, 0.96);
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.62),
    0 0 16px rgba(34, 197, 94, 0.52);
}

.hand-complete-cards img.flash-prevalent-all {
  border: 2px solid rgba(125, 211, 252, 0.96);
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.62),
    0 0 16px rgba(56, 189, 248, 0.52);
}

@keyframes hand-complete-pop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.42;
  }
  100% {
    transform: scale(1.5);
    opacity: 1;
  }
}

.drop-card {
  position: absolute;
  width: var(--card-width);
  height: var(--card-height);
  object-fit: contain;
  user-select: none;
  cursor: pointer;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.32));
}

.drop-card.attract-card {
  pointer-events: none;
  cursor: default;
  opacity: 0.78;
  z-index: 8;
  filter:
    saturate(0.96)
    brightness(1.02)
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}

.drop-card.correct-hit {
  animation: correct-hit-pop 460ms ease-out forwards;
  z-index: 20;
  pointer-events: none;
}

.drop-card.duplicate-hit {
  animation: duplicate-hit-shake 500ms ease;
  filter:
    saturate(1.35)
    hue-rotate(-22deg)
    brightness(1.05)
    drop-shadow(0 0 10px rgba(255, 59, 48, 0.8));
}

.drop-card.invalid-hit {
  animation: invalid-hit-glow 1000ms ease;
  filter:
    saturate(1.2)
    brightness(1.08)
    drop-shadow(0 0 14px rgba(250, 204, 21, 0.92));
}

@keyframes duplicate-hit-shake {
  0% { transform: translateX(0); }
  15% { transform: translateX(-3px); }
  30% { transform: translateX(3px); }
  45% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

@keyframes invalid-hit-glow {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.duplicate-banner {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(185, 28, 28, 0.9);
  border: 1px solid rgba(254, 202, 202, 0.9);
  color: #fff5f5;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 8px;
  z-index: 35;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(127, 29, 29, 0.35);
}

.click-feedback-banner {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  z-index: 36;
  pointer-events: none;
  animation: click-banner-in 180ms ease;
}

.click-feedback-banner.warn {
  background: rgba(185, 28, 28, 0.9);
  border: 1px solid rgba(254, 202, 202, 0.9);
  color: #fff5f5;
  box-shadow: 0 4px 12px rgba(127, 29, 29, 0.35);
}

.click-feedback-banner.info {
  background: rgba(30, 58, 138, 0.9);
  border: 1px solid rgba(191, 219, 254, 0.9);
  color: #eff6ff;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.35);
}

.click-feedback-banner.invalid {
  background: rgba(245, 158, 11, 0.95);
  border: 1px solid rgba(254, 240, 138, 0.98);
  color: #fff7cc;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.click-feedback-banner.impossible {
  background: rgba(109, 40, 217, 0.95);
  border: 1px solid rgba(216, 180, 254, 0.98);
  color: #f5e8ff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.42);
}

@keyframes click-banner-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes correct-hit-pop {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.32));
  }
  20% {
    transform: scale(1.4);
    opacity: 0.38;
    filter: brightness(1.55) drop-shadow(0 0 14px rgba(255, 255, 255, 0.82));
  }
  40% {
    transform: scale(1.4);
    opacity: 1;
    filter: brightness(1.1) drop-shadow(0 0 8px rgba(255, 255, 255, 0.48));
  }
  60% {
    transform: scale(1.4);
    opacity: 0.38;
    filter: brightness(1.55) drop-shadow(0 0 14px rgba(255, 255, 255, 0.82));
  }
  80% {
    transform: scale(1.4);
    opacity: 1;
    filter: brightness(1.1) drop-shadow(0 0 8px rgba(255, 255, 255, 0.48));
  }
  100% {
    transform: scale(1.4);
    opacity: 1;
    filter: brightness(1.1) drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
  }
}

.play-toggle-button {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #8b1e1e;
  background: #dc2626;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 900;
  border-radius: 11px;
  padding: 11px 24px;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.play-toggle-secondary {
  top: calc(50% + 70px);
  font-size: 0.98rem;
  line-height: 1.25;
  border-color: #0f4694;
  background: #f1f6ff;
  color: #0a2653;
  max-width: min(90%, 500px);
  padding: 10px 14px;
}

.play-toggle-secondary:hover {
  background: #e4eeff;
}

.play-toggle-button.hidden {
  display: none;
}

.game-over-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: fit-content;
  min-width: 480px;
  max-width: 94vw;
  border: 2px solid #0b3b88;
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.97);
  color: #0f172a;
  z-index: 120;
  padding: 18px 18px 14px;
  max-height: none;
  overflow: visible;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.45);
}

.game-over-panel h2 {
  margin: 0 0 10px;
  text-align: center;
}

.game-over-panel p {
  margin: 6px 0;
  line-height: 1.3;
  font-size: 0.96rem;
}

#gameOverScore {
  font-size: 1.35rem;
  font-weight: 900;
  color: #0f172a;
  margin-top: 2px;
  margin-bottom: 10px;
}

.game-over-progress {
  margin-top: 8px;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
  font-size: 0.94rem;
  line-height: 1.35;
  width: fit-content;
  max-width: min(680px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.progress-cards {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.hands-done-list {
  margin-top: 6px;
  display: grid;
  gap: 4px;
}

.hands-done-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hands-done-label {
  display: inline-block;
  min-width: 148px;
  font-weight: 800;
  color: #0f172a;
}

.hands-done-cards-table {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 44px));
  gap: 6px;
}

.hands-done-card-cell {
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid #9ca3af;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.22);
  font-weight: 800;
  line-height: 1;
  padding: 3px 2px;
}

.hands-done-card-cell.empty {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  box-shadow: none;
}

.hands-done-card-cell.prevalent-red {
  border-color: rgba(248, 113, 113, 0.95);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.58),
    0 0 10px rgba(220, 38, 38, 0.35);
}

.hands-done-card-cell.prevalent-green {
  border-color: rgba(74, 222, 128, 0.95);
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.58),
    0 0 10px rgba(34, 197, 94, 0.35);
}

.hands-done-card-cell.prevalent-all {
  border-color: rgba(125, 211, 252, 0.95);
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.55),
    0 0 10px rgba(56, 189, 248, 0.35);
}

.progress-count {
  color: #475569;
  font-weight: 700;
}

.go-card {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 3px;
  border-radius: 5px;
}

.go-card-important {
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.72),
    0 0 10px rgba(34, 197, 94, 0.42);
  transform: scale(1.03);
}

.progress-missing {
  color: #334155;
  font-weight: 800;
}

.missing-chip {
  display: inline-block;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 2px 7px;
  transform: scale(1.03);
}

.suit-red-text {
  color: #b91c1c;
}

.suit-black-text {
  color: #0f172a;
}

.game-over-play-again {
  margin: 10px auto 0;
  display: block;
  border: 2px solid #8b1e1e;
  background: #dc2626;
  color: #ffffff;
  font-weight: 900;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
}

.game-over-play-again:hover {
  background: #b91c1c;
}

.game-over-learn-mode {
  margin-top: 8px;
  background: #f1f6ff;
  border-color: #0f4694;
  color: #0a2653;
}

.game-over-learn-mode:hover {
  background: #e4eeff;
}

.game-over-download-log {
  margin-top: 8px;
  background: #f1f6ff;
  border-color: #0f4694;
  color: #0a2653;
}

.game-over-download-log:hover {
  background: #e4eeff;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 12, 8, 0.58);
  z-index: 120;
  display: grid;
  place-items: center;
}

.sfx-modal {
  background: #102e23;
  border: 2px solid #34d399;
  border-radius: 14px;
  min-width: 250px;
  padding: 16px 18px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.sfx-modal h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: #d1fae5;
}

.sfx-toggle-button {
  border: 2px solid #0f4694;
  background: #f1f6ff;
  color: #0a2653;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 900;
  padding: 9px 18px;
  cursor: pointer;
  min-width: 140px;
}

.sfx-toggle-button:hover {
  background: #e4eeff;
}

.report-bug-btn {
  border-color: #f59e0b;
  background: #6a2b08;
  color: #ffedd5;
}

.bug-report-modal-panel {
  min-width: min(540px, 95vw);
}

.bug-report-form {
  display: grid;
  gap: 8px;
  text-align: left;
}

.bug-form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #d1fae5;
}

.bug-report-form input[type="text"],
.bug-report-form select,
.bug-report-form textarea {
  width: 100%;
  border: 1px solid rgba(167, 243, 208, 0.45);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 0.88rem;
  background: rgba(16, 46, 35, 0.95);
  color: #f0fdf4;
}

.bug-report-form textarea {
  resize: vertical;
  min-height: 72px;
}

.bug-report-status {
  margin: 2px 0 0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.bug-report-status.ok {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(5, 150, 105, 0.45);
  color: #d1fae5;
}

.bug-report-status.error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(220, 38, 38, 0.42);
  color: #fecaca;
}

.bug-form-actions {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.bug-submit-btn {
  background: #0f4694;
  color: #f8fbff;
}

#timeHud.learn-mode-box {
  justify-content: center;
}

#timeHud.learn-mode-box #timeLabel {
  display: none;
}

#timeHud.learn-mode-box #timeValue {
  color: #d9f99d;
  letter-spacing: 0.05em;
}

.selection-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.info-panel {
  margin-top: 12px;
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(6, 32, 24, 0.78);
  padding: 12px 14px;
}

.info-panel h2 {
  margin: 0 0 8px;
  color: var(--text-main);
  font-size: 1.08rem;
  letter-spacing: 0.02em;
}

.info-panel p {
  margin: 6px 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.35;
}

.info-panel strong {
  color: #fef08a;
}

.info-panel a,
.info-panel a:link,
.info-panel a:visited,
.info-panel a:hover,
.info-panel a:focus,
.info-panel a:active,
.info-panel p a,
.info-panel strong + a {
  color: #ffffff !important;
}

.how-to-play-footer {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  border: 2px solid rgba(143, 182, 232, 0.75);
  border-radius: 12px;
  background: #b3c8e8;
  padding: 12px 14px;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.footer-game-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.how-to-play-button {
  border: 3px solid #0f4694;
  background: #f1f6ff;
  color: #0a2653;
  font-weight: 900;
  border-radius: 14px;
  padding: 10px 18px;
  cursor: pointer;
  min-width: 190px;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.how-to-play-button:hover {
  background: #e4eeff;
}

.footer-link-button {
  user-select: none;
}

.footer-game-links a[href="/"],
.footer-game-links a[href="/suit-blast/"] {
  min-width: 138px;
}

.footer-game-links a[href="/card-burst-drop/"] {
  min-width: 174px;
}

#howToPlayButton,
a[href="/play-suit-blast/"] {
  min-width: 160px;
}

#howToPlayButton {
  background: #0b3524;
  border-color: #2f9b70;
  color: #f4fff9;
}

#gameModeFooterButton {
  border-color: #dc2626;
}

#howToPlayButton:hover {
  background: #082919;
}

.footer-legal {
  text-align: right;
}

.footer-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
}

.footer-legal-links a {
  color: #0f4694;
  font-weight: 800;
  text-decoration: none;
  font-size: 0.94rem;
}

.footer-legal-links a:hover {
  text-decoration: underline;
}

.footer-copyright,
.footer-note {
  margin: 4px 0 0;
  color: #4e6285;
  font-size: 0.86rem;
}

.how-to-play-content {
  border: 2px solid rgba(74, 125, 199, 0.7);
  border-radius: 12px;
  background: rgba(7, 33, 60, 0.88);
  padding: 12px 14px;
}

.how-to-play-content h2 {
  margin: 0 0 10px;
  color: #fef08a;
  font-size: 1.05rem;
}

.how-to-play-content h3 {
  margin: 12px 0 6px;
  color: #fef08a;
  font-size: 0.95rem;
}

.how-to-play-content p {
  margin: 5px 0;
  color: var(--text-muted);
  line-height: 1.35;
  font-size: 0.92rem;
}

.how-to-play-content .go-card {
  margin-right: 4px;
  padding: 1px 6px;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
}

.how-to-play-content br + span.go-card,
.how-to-play-content br + strong {
  margin-top: 6px;
  display: inline-block;
}

.already-clicked-box {
  border: 1px solid rgba(231, 255, 243, 0.5);
  background: rgba(6, 32, 24, 0.82);
  border-radius: 9px;
  padding: 7px 8px;
  display: grid;
  gap: 6px;
  min-width: 236px;
  justify-items: center;
  text-align: center;
}

.already-clicked-title {
  color: var(--text-main);
  font-size: 0.79rem;
  font-weight: 800;
}

.already-clicked-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(62px, 76px));
  gap: 10px;
}

.already-slot {
  border: 1px dashed rgba(231, 255, 243, 0.5);
  background: rgba(6, 32, 24, 0.78);
  border-radius: 7px;
  min-height: 98px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 1.12rem;
  font-weight: 700;
}

.already-slot img {
  width: 62px;
  height: 88px;
  object-fit: contain;
}

.already-card-prototype {
  width: 62px;
  height: 88px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid rgba(15, 23, 42, 0.25);
  position: relative;
  overflow: hidden;
}

.already-card-prototype.red {
  color: #dc2626;
}

.already-card-prototype.black {
  color: #0f172a;
}

.already-card-prototype-corner {
  position: absolute;
  left: 4px;
  top: 3px;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
}

.already-card-prototype-suit {
  font-size: 0.94rem;
}

.already-card-prototype-corner-bottom {
  left: auto;
  right: 4px;
  top: auto;
  bottom: 3px;
  transform: rotate(180deg);
}

.already-card-prototype-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.selection-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-self: center;
  width: max-content;
  position: relative;
  border: 1px solid rgba(231, 255, 243, 0.5);
  background: rgba(6, 32, 24, 0.82);
  border-radius: 10px;
  padding: 10px 12px 12px;
}

.mini-hint-banner {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  border: 1px solid rgba(254, 240, 138, 0.95);
  background: rgba(120, 53, 15, 0.92);
  color: #fef9c3;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  z-index: 70;
  white-space: nowrap;
  pointer-events: none;
}

.flush-lock-hint-banner {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  border: 1px solid rgba(147, 197, 253, 0.95);
  background: rgba(30, 58, 138, 0.92);
  color: #dbeafe;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  z-index: 70;
  white-space: nowrap;
  pointer-events: none;
}

.selection-info-inline {
  display: grid;
  grid-template-columns: auto;
  grid-template-areas:
    "selected"
    "suit"
    "progress";
  align-items: center;
  gap: 8px;
  width: fit-content;
  justify-content: flex-start;
  align-self: center;
}

#selectedCounter {
  grid-area: selected;
  justify-self: center;
}

#suitRuleBox {
  grid-area: suit;
}

#handProgressBox {
  grid-area: progress;
}

.selected-counter {
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.98rem;
  white-space: nowrap;
  margin-top: -12px;
  margin-bottom: 13px;
}

.suit-rule-box {
  border: 1px solid rgba(231, 255, 243, 0.5);
  background: rgba(6, 32, 24, 0.82);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
}

.suit-rule-value {
  color: #fef08a;
  font-size: 0.86rem;
  font-weight: 900;
}

.progress-hit {
  animation: popGreen 0.3s;
}

@keyframes popGreen {
  0% {
    transform: scale(1);
    color: #ffffff;
  }
  50% {
    transform: scale(1.1);
    color: #00ff88;
  }
  100% {
    transform: scale(1);
  }
}

.selected-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(68px, 84px));
  gap: 8px;
}

.selected-slots-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clear-selected-btn {
  border: 2px solid #0f4694;
  background: #f1f6ff;
  color: #0a2653;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
  min-width: 92px;
}

.clear-selected-btn:hover {
  background: #e4eeff;
}

.clear-selected-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.learn-assist-actions {
  display: grid;
  gap: 8px;
  align-self: center;
}

.learn-assist-actions.hidden {
  display: none !important;
}

.learn-assist-btn {
  border: 2px solid #0f4694;
  background: #f1f6ff;
  color: #0a2653;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
  min-width: 116px;
}

.learn-assist-btn:hover {
  background: #e4eeff;
}

.undo-btn.glow-pulse,
.tip-btn.glow-pulse {
  animation: undoGlowPulse 820ms ease-in-out infinite;
}

@keyframes undoGlowPulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(250, 204, 21, 0.0),
      0 0 0 rgba(250, 204, 21, 0.0);
    border-color: #f59e0b;
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(250, 204, 21, 0.6),
      0 0 16px rgba(250, 204, 21, 0.8);
    border-color: #facc15;
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(250, 204, 21, 0.0),
      0 0 0 rgba(250, 204, 21, 0.0);
    border-color: #f59e0b;
  }
}

.drop-card.tip-pulse {
  animation: undoGlowPulse 500ms ease-in-out 3;
}

.board-center-hint {
  position: absolute;
  left: 50%;
  top: 20%;
  transform: translate(-50%, -50%);
  z-index: 80;
  border: 2px solid rgba(254, 240, 138, 0.96);
  background: rgba(146, 64, 14, 0.92);
  color: #fef9c3;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 20px rgba(120, 53, 15, 0.4);
  pointer-events: none;
}

.mini-slot {
  border: 1px dashed rgba(231, 255, 243, 0.5);
  background: rgba(6, 32, 24, 0.78);
  border-radius: 7px;
  min-height: 114px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 700;
}

.mini-slot img {
  width: 66px;
  height: 96px;
  object-fit: contain;
}

.mini-card-prototype {
  width: 74px;
  height: 108px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid rgba(15, 23, 42, 0.25);
  position: relative;
  overflow: hidden;
}

.mini-card-prototype.red {
  color: #dc2626;
}

.mini-card-prototype.black {
  color: #0f172a;
}

.mini-card-prototype-corner {
  position: absolute;
  left: 5px;
  top: 4px;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
}

.mini-card-prototype-suit {
  font-size: 1.02rem;
}

.mini-card-prototype-corner-bottom {
  left: auto;
  right: 5px;
  top: auto;
  bottom: 4px;
  transform: rotate(180deg);
}

.mini-card-prototype-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}

.mini-slot.prevalent-red {
  border-color: rgba(248, 113, 113, 0.95);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.6),
    0 0 14px rgba(220, 38, 38, 0.45);
}

.mini-slot.prevalent-green {
  border-color: rgba(74, 222, 128, 0.95);
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.62),
    0 0 14px rgba(34, 197, 94, 0.42);
}

.mini-slot.prevalent-all {
  border-color: rgba(125, 211, 252, 0.95);
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.52),
    0 0 14px rgba(56, 189, 248, 0.42);
}

@media (max-width: 760px) {
  :root {
    --card-width: 94px;
    --card-height: 138px;
  }

  body {
    display: block;
    place-items: initial;
    padding: 8px;
  }

  .game-shell {
    width: 100%;
  }

  .top-brand-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .home-brand-link {
    width: auto;
    margin-left: 0;
    padding-left: 8px;
    justify-content: flex-start;
    font-size: clamp(1.15rem, 4.8vw, 1.45rem);
  }

  .home-brand-icons {
    gap: 4px;
    font-size: clamp(1.05rem, 4.8vw, 1.35rem);
  }

  .game-title {
    display: inline-block;
    position: static;
    left: auto;
    top: auto;
    transform: none;
    margin: 0 0 0 auto;
    text-align: right;
    font-size: clamp(1.18rem, 4.9vw, 1.55rem);
    line-height: 1;
  }

  .hud {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .hud-group-left,
  .hud-group-right {
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .hud-group-left {
    justify-content: flex-start;
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .hud-group-right {
    justify-content: flex-end;
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
  }

  .hud-item-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: auto;
    min-width: min(78vw, 360px);
    max-width: 90vw;
    justify-content: center;
    text-align: center;
    padding: 6px 10px;
    gap: 6px;
  }

  .hud-item {
    min-width: 0;
    flex: 0 0 auto;
    padding: 6px 8px;
  }

  /* Mobile tuning for top HUD widths */
  .hud-group-left .hud-item:nth-child(1) {
    flex: 0 0 auto;
    min-width: 82px;
    padding: 6px 6px;
    gap: 6px;
  }

  #timeHud {
    flex: 0 0 auto;
    min-width: 102px;
    padding: 6px 8px;
    gap: 6px;
  }

  #livesHud {
    flex: 0 0 auto;
    min-width: 98px;
    padding: 6px 6px;
    gap: 5px;
  }

  #livesHud .lives {
    font-size: 0.95rem;
    letter-spacing: 0;
    gap: 3px;
  }

  .game-board {
    min-height: 50vh;
    max-height: 56vh;
  }

  .selection-wrap {
    grid-template-columns: 1fr;
    align-items: flex-start;
    padding: 8px;
  }

  .already-clicked-box {
    min-width: 0;
    width: 100%;
  }

  /* Temporarily disabled on mobile (can be restored later). */
  .already-clicked-box {
    display: none !important;
  }

  .already-clicked-slots {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .already-slot {
    min-height: 86px;
  }

  .already-slot img {
    width: 46px;
    height: 66px;
  }

  .selection-main {
    width: 100%;
    display: grid;
    gap: 8px;
    padding: 8px;
  }

  .selection-info-inline {
    width: 100%;
    justify-content: stretch;
    gap: 6px;
  }

  .selected-counter {
    margin-top: 2px;
    margin-bottom: 8px;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .footer-legal {
    text-align: left;
  }

  .footer-legal-links {
    justify-content: flex-start;
  }

  .selected-slots {
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .mini-slot {
    min-height: 76px;
  }

  .mini-slot img {
    width: 42px;
    height: 60px;
  }

  .mini-card-prototype {
    width: 46px;
    height: 66px;
  }

  .selected-slots-wrap {
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }

  .how-to-play-button,
  .footer-link-button {
    min-width: 0 !important;
    width: 100%;
  }

  .game-over-panel {
    min-width: 0;
    width: 92vw;
    max-height: 84vh;
    overflow: auto;
  }

  .hand-complete-cards {
    gap: 6px;
  }

  .hand-complete-cards img {
    width: 56px;
    height: 78px;
  }
}

@media (max-width: 520px) {
  :root {
    --card-width: 82px;
    --card-height: 120px;
  }

  .game-title {
    font-size: 1.45rem;
  }

  .hud-label {
    font-size: 0.72rem;
  }

  .hud-value {
    font-size: 0.92rem;
  }

  .hud-group-left .hud-item:nth-child(1) {
    min-width: 74px;
    padding: 5px 5px;
  }

  #timeHud {
    min-width: 94px;
    padding: 5px 6px;
  }

  #livesHud {
    min-width: 90px;
    padding: 5px 5px;
  }

  #livesHud .lives {
    font-size: 0.88rem;
    gap: 2px;
  }

  .game-board {
    min-height: 46vh;
    max-height: 52vh;
  }

  .play-toggle-button {
    font-size: 0.92rem;
    padding: 9px 14px;
  }

  .play-toggle-secondary {
    top: calc(50% + 56px);
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  .hand-complete-cards {
    gap: 4px;
  }

  .hand-complete-cards img {
    width: 48px;
    height: 67px;
  }
}

