/* ── WHISKers — speed memory game styles ── */

#canvas-wrap {
  background: #0f172a;
  align-items: stretch;
  overflow-y: auto;
  padding: 0;
}

.wh-hide { display: none !important; }

/* ── Start screen ── */
#wh-start {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 20px 40px;
}

.wh-start-inner {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.wh-start-title {
  font-family: 'DM Serif Display', serif;
  font-size: 3.2rem;
  color: #e0e7ff;
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

.wh-start-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: rgba(148, 163, 184, 0.9);
  line-height: 1.7;
  margin: 0 0 32px;
}

.wh-start-preview {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 36px;
}

.wh-preview-card {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.wh-preview-card img {
  width: 68%;
  height: 68%;
  object-fit: contain;
  /* original icon colors — no filter */
}

/* ── Game wrapper ── */
#wh-game {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ── HUD ── */
#wh-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

#wh-reveal-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #a855f7;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: wh-pulse 1s ease-in-out infinite;
}

@keyframes wh-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Reveal bar ── */
#wh-reveal-bar {
  height: 3px;
  background: rgba(255,255,255,0.07);
  margin: 2px 18px 0;
  border-radius: 2px;
  overflow: hidden;
}

#wh-reveal-bar-fill {
  height: 100%;
  background: #a855f7;
  border-radius: 2px;
  width: 0%;
  transition: none;
}

/* ── Status text ── */
#wh-status {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 6px 0 8px;
  min-height: 1.2em;
}

/* ── Board wrap ── */
#wh-board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 16px;
}

/* ── Card grid ── */
#wh-board {
  display: grid;
  /* grid-template-columns and gap set by JS */
}

/* ── Card ── */
.wh-card {
  perspective: 700px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border-radius: 10px;
  /* width/height set by JS */
}

.wh-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.32s ease;
  transform-style: preserve-3d;
}

.wh-card.wh-face-up .wh-card-inner {
  transform: rotateY(180deg);
}

.wh-card-back,
.wh-card-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Card back */
.wh-card-back {
  background: #1e293b;
  border: 1.5px solid #334155;
}

.wh-card-back img {
  width: 45%;
  height: 45%;
  object-fit: contain;
  opacity: 0.15;
  filter: brightness(0) invert(1);
}

/* Card front — real icon colors, no filter */
.wh-card-front {
  transform: rotateY(180deg);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.12);
}

.wh-card-front img {
  width: 62%;
  height: 62%;
  object-fit: contain;
  /* original colors — no brightness/invert filter */
}

/* ── First-click selected state ── */
.wh-card.wh-selected {
  box-shadow: 0 0 0 2.5px #a855f7, 0 0 10px rgba(168,85,247,0.45);
}

/* ── Match flash (brief green glow before card hides) ── */
@keyframes wh-match-flash-anim {
  0%   { box-shadow: 0 0 0 0px rgba(34,197,94,0); }
  30%  { box-shadow: 0 0 0 3px #22c55e, 0 0 14px rgba(34,197,94,0.65); }
  100% { box-shadow: 0 0 0 2px rgba(34,197,94,0); }
}

.wh-card.wh-match-flash {
  animation: wh-match-flash-anim 0.45s ease-out forwards;
}

/* Matched — invisible but keeps grid space */
.wh-card.wh-matched {
  visibility: hidden;
  pointer-events: none;
}

/* ── Dead cell (3×3 odd slot — static, never flips, never clickable) ── */
.wh-dead {
  background: #334155;
  border-radius: 10px;
  border: 1.5px dashed #475569;
  cursor: default;
  pointer-events: none;
}

/* ── Wrong match ── */
@keyframes wh-wrong-flash-anim {
  0%   { box-shadow: 0 0 0 0px rgba(239,68,68,0); }
  20%  { box-shadow: 0 0 0 3px #ef4444, 0 0 12px rgba(239,68,68,0.55); }
  100% { box-shadow: 0 0 0 2px rgba(239,68,68,0); }
}

.wh-card.wh-wrong {
  animation: wh-wrong-flash-anim 0.6s ease-out forwards;
}

/* ── Wrong flash overlay (screen-level red tint) ── */
#wh-wrong-flash {
  position: absolute;
  inset: 0;
  background: rgba(220, 38, 38, 0.22);
  pointer-events: none;
  opacity: 0;
  z-index: 15;
}

@keyframes wh-flash-anim {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

#wh-wrong-flash.wh-flashing {
  animation: wh-flash-anim 0.96s ease-out forwards;
}

/* ── Shared overlay base (board-clear, round, countdown) ── */
.wh-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* Board-cleared overlay */
.wh-overlay-clear-text {
  font-family: 'DM Serif Display', serif;
  font-size: 2.8rem;
  line-height: 1.1;
  color: #22c55e;
  margin: 0;
  text-align: center;
  animation: wh-count-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Next-round overlay */
.wh-overlay-small-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 4px;
}

.wh-overlay-big-num {
  font-family: 'DM Serif Display', serif;
  font-size: 7rem;
  line-height: 1;
  color: #e0e7ff;
  margin: 0;
  animation: wh-count-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Countdown overlay ── */
#wh-countdown-num {
  font-family: 'DM Serif Display', serif;
  font-size: 8rem;
  line-height: 1;
  color: #e0e7ff;
  animation: wh-count-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wh-count-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── End screen ── */
#wh-end {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 20px 40px;
}

.wh-end-inner {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.wh-end-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #475569;
  margin: 0 0 10px;
}

.wh-end-headline {
  font-family: 'DM Serif Display', serif;
  font-size: 3.4rem;
  line-height: 1.1;
  color: #e0e7ff;
  margin: 0 0 14px;
}

.wh-end-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: rgba(148, 163, 184, 0.9);
  line-height: 1.65;
  margin: 0 0 36px;
}

.wh-end-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}

/* ── Buttons ── */
.wh-btn-primary {
  display: block;
  width: 100%;
  background: #7c3aed;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 15px 0;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #4c1d95, 0 6px 16px rgba(0,0,0,0.45);
  transition: transform 0.07s, box-shadow 0.07s, background 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.wh-btn-primary:hover  { background: #8b5cf6; }
.wh-btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #4c1d95, 0 2px 8px rgba(0,0,0,0.4);
}

.wh-btn-ghost {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid #334155;
  color: #64748b;
  padding: 14px 0;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: border-color 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.wh-btn-ghost:hover  { border-color: #64748b; color: #94a3b8; }
.wh-btn-ghost:active { background: rgba(255,255,255,0.04); }
