:root {
  --bg-top: #091a3f;
  --bg-bottom: #102959;
  --panel: #142d5f;
  --panel-soft: #173772;
  --panel-border: #5b7ec1;
  --text-main: #f2f7ff;
  --text-soft: #bfd3f7;
  --danger: #e33b3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.game-page {
  width: min(1140px, 100%);
  margin: 0 auto;
  padding: 12px 14px 18px;
  flex: 1 0 auto;
}

.top-row {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 58px;
}

.home-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #f8fbff;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  font-weight: 800;
  line-height: 1;
}

.home-brand-icons {
  display: inline-flex;
  gap: 5px;
  font-size: clamp(1.1rem, 2.1vw, 1.5rem);
}

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

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

.game-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

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

.hud-left {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.hud-center {
  display: flex;
  justify-content: center;
}

.hud-right {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.hud-box {
  min-width: 146px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-soft);
  text-align: center;
  padding: 8px 10px;
}

.hud-label {
  display: block;
  color: var(--text-soft);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hud-value {
  display: block;
  margin-top: 4px;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.lives-box {
  min-width: 154px;
}

.lives-track {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.heart {
  color: #f23434;
  font-size: 1.18rem;
  text-shadow: 0 0 6px rgba(242, 52, 52, 0.44);
  transition: opacity 0.2s ease;
}

.heart.lost {
  opacity: 0.2;
  text-shadow: none;
}

.settings-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.board-wrap {
  margin-top: 10px;
}

.game-board {
  position: relative;
  height: min(64vh, 700px);
  min-height: 470px;
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 38, 80, 0.9), rgba(8, 21, 45, 0.96));
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.board-column {
  border-left: 1px solid rgba(149, 182, 236, 0.2);
}

.board-column:first-child {
  border-left: none;
}

.idle-ambient {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.idle-card {
  position: absolute;
  width: 84px;
  height: 122px;
  opacity: 0.18;
  filter: drop-shadow(0 0 12px rgba(130, 184, 255, 0.3));
  animation: idleCardFall 5.5s linear infinite;
}

.idle-card-1 {
  left: 10%;
  animation-delay: 0s;
}

.idle-card-2 {
  left: 72%;
  animation-delay: 1.2s;
}

.idle-card-3 {
  left: 32%;
  animation-delay: 2.3s;
}

@keyframes idleCardFall {
  0% {
    transform: translateY(-165px) rotate(-8deg);
    opacity: 0;
  }
  18% {
    opacity: 0.2;
  }
  82% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(calc(100% + 180px)) rotate(8deg);
    opacity: 0;
  }
}

.center-suit {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(132px, 14vw, 220px);
  line-height: 1;
  z-index: 2;
  opacity: 0.96;
  pointer-events: none;
  animation: suitPulse 1.1s ease-in-out infinite;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.22);
}

.center-suit.heart,
.center-suit.diamond {
  color: #e11d48;
}

.center-suit.spade,
.center-suit.club {
  color: #000000;
}

.center-suit.pre-change-warning {
  text-shadow:
    0 0 18px rgba(250, 204, 21, 0.95),
    0 0 34px rgba(250, 204, 21, 0.8),
    0 0 52px rgba(250, 204, 21, 0.55);
  filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.9));
}

.target-banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  z-index: 8;
  border: 2px solid rgba(254, 240, 138, 0.95);
  background: rgba(120, 53, 15, 0.9);
  color: #fef9c3;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: 0 8px 20px rgba(120, 53, 15, 0.4);
  pointer-events: none;
}

.bonus-banner {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 9;
  border: 2px solid rgba(125, 211, 252, 0.9);
  background: rgba(8, 47, 73, 0.92);
  color: #e0f2fe;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: 0 8px 18px rgba(8, 47, 73, 0.35);
  pointer-events: none;
}

.combo-pop {
  position: absolute;
  z-index: 10;
  transform: translate(-50%, -100%);
  border: 1px solid rgba(253, 224, 71, 0.92);
  background: rgba(120, 53, 15, 0.9);
  color: #fef9c3;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  pointer-events: none;
  animation: comboRiseFade 1s ease forwards;
}

.combo-pop.combo-lost {
  border-color: rgba(254, 202, 202, 0.98);
  background: rgba(127, 29, 29, 0.95);
  color: #fee2e2;
}

@keyframes comboRiseFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -92%);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -104%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -136%);
  }
}

.drop-card {
  position: absolute;
  width: 144px;
  height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.34));
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.card-glow,
.card-overlay,
.card-shake-layer,
.card-effect {
  pointer-events: none;
}


.drop-card.wrong-click {
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);
  outline: 2px solid rgba(255, 0, 0, 0.9);
  animation: wrongShake 0.15s linear;
}

.click-receiver-highlight {
  outline: 2px dashed rgba(56, 189, 248, 0.95);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
}

@keyframes wrongShake {
  0% {
    transform: translateX(0) scale(1.03);
  }
  25% {
    transform: translateX(-3px) scale(1.03);
  }
  50% {
    transform: translateX(3px) scale(1.03);
  }
  75% {
    transform: translateX(-2px) scale(1.03);
  }
  100% {
    transform: translateX(0) scale(1.03);
  }
}

@keyframes suitPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0.76;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0.76;
  }
}

.center-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  padding: 14px 32px;
  cursor: pointer;
}

.play-btn {
  background: #2563eb;
}

.resume-btn {
  background: #306dd7;
}

.hidden {
  display: none !important;
}

.game-over-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: min(420px, 92%);
  border: 1px solid #8fb2ef;
  border-radius: 12px;
  background: #f4f8ff;
  color: #13213a;
  padding: 16px;
  text-align: center;
}

.game-over-panel h2 {
  margin: 0 0 12px;
  letter-spacing: 0.06em;
}

.game-over-stats {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.game-over-stats p {
  margin: 0;
  border: 1px solid #afc7ee;
  border-radius: 9px;
  background: #eaf2ff;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.game-over-stats span {
  color: #33496d;
  letter-spacing: 0.03em;
}

.game-over-stats strong {
  font-size: 1.16rem;
}

.game-over-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.action-btn {
  border: none;
  border-radius: 9px;
  background: #1d57be;
  color: #fff;
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
  width: 100%;
}

.action-btn.secondary {
  background: #3f6fb5;
}

.pulse-info-panel {
  margin-top: 12px;
  border: 2px solid #3f6fb5;
  border-radius: 12px;
  background: rgba(16, 38, 80, 0.82);
  padding: 12px 14px;
}

.pulse-info-panel h2 {
  margin: 0 0 8px;
  color: #f2f7ff;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
}

.pulse-info-panel p {
  margin: 6px 0;
  color: #dce9ff;
  font-size: 0.94rem;
  line-height: 1.35;
}

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

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

.site-footer {
  border-top: 1px solid rgba(154, 186, 239, 0.4);
  padding: 12px 14px 16px;
  text-align: center;
}

.footer-game-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  justify-content: center;
}

.footer-game-btn {
  text-decoration: none;
  border: 1px solid #5f88cc;
  border-radius: 999px;
  color: #dceaff;
  background: #1a3a76;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.92rem;
}

button.footer-game-btn {
  cursor: pointer;
}

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

.burst-word {
  color: #f13838;
}

.footer-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  justify-content: center;
}

.footer-legal-links a {
  color: #dce9ff;
}

.footer-meta {
  margin: 10px 0 0;
  color: #b8cbef;
  font-size: 0.9rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-panel {
  width: min(280px, 92vw);
  border: 1px solid #7ca1dc;
  border-radius: 12px;
  background: #f4f8ff;
  color: #13213a;
  padding: 12px;
}

.bug-report-modal-panel {
  width: min(580px, 95vw);
  max-height: 86vh;
  overflow: auto;
}

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

.bug-form-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: #1e3a8a;
}

.bug-report-form input[type="text"],
.bug-report-form select,
.bug-report-form textarea {
  width: 100%;
  border: 1px solid rgba(124, 161, 220, 0.72);
  border-radius: 8px;
  background: #ffffff;
  color: #13213a;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
}

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

.bug-report-status {
  margin: 4px 0 0;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

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

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

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

.bug-submit-btn {
  min-width: 148px;
}

.modal-panel h3 {
  margin: 0 0 10px;
  text-align: center;
}

.settings-row {
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sfx-toggle,
.modal-close {
  border: none;
  border-radius: 8px;
  background: #1e57ba;
  color: #fff;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 900px) {
  .top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .game-title {
    position: static;
    transform: none;
    margin-left: auto;
    text-align: right;
    font-size: clamp(1.2rem, 5vw, 1.8rem);
  }

  .hud-row {
    grid-template-columns: repeat(3, max-content);
    justify-content: center;
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
  }

  .hud-left {
    grid-column: 1 / span 2;
    justify-content: center;
    flex-wrap: nowrap;
  }

  .hud-center {
    grid-column: 3;
    justify-content: center;
  }

  .hud-right {
    grid-column: 1 / span 3;
    justify-content: center;
    flex-wrap: nowrap;
  }

  .game-board {
    min-height: 420px;
  }

  .idle-card {
    width: 64px;
    height: 94px;
  }

  .center-suit {
    font-size: clamp(100px, 24vw, 168px);
  }

  .target-banner {
    font-size: 0.86rem;
    top: 34%;
    max-width: 88%;
  }

  .bonus-banner {
    max-width: 88%;
    font-size: 0.84rem;
    bottom: 8px;
  }

  .combo-pop {
    font-size: 0.86rem;
  }
}
