:root {
  color-scheme: only light;
  forced-color-adjust: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  forced-color-adjust: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  forced-color-adjust: none;
  color-scheme: only light;
}

/* Base utility */
.hidden {
  display: none !important;
}

/* Practice Mode Badge */
.practice-badge {
  position: fixed;
  top: max(env(safe-area-inset-top), 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 60, 60, 0.25);
  color: #ff8888;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 12px;
  z-index: 9999;
  pointer-events: none;
  text-align: center;
  font-weight: 600;
}

/* Guide Labels (hidden by default in stealth mode) */
.guide-label {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

/* When Practice Mode is enabled on body */
body.practice-mode .guide-label {
  opacity: 1;
}

body.practice-mode .suit-zone,
body.practice-mode .rank-zone,
body.practice-mode .rank-bottom-zone {
  border: 1px dashed rgba(255, 255, 255, 0.15) !important;
  background: rgba(255, 255, 255, 0.02);
}

body.practice-mode .scratch-progress {
  display: block !important;
}

/* Layer 1: Suit Selector (4 Quadrants) */
#suit-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  background-color: #000000 !important;
  background: #000000 !important;
  z-index: 10;
}

.suit-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000 !important;
  border: none;
  cursor: pointer;
  touch-action: none;
}

/* Layer 2: Rank Selector (13 Ranks: 4x3 Grid + Bottom Bar) */
#rank-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #000000 !important;
  background: #000000 !important;
  z-index: 20;
}

.rank-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  width: 100%;
}

.rank-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000 !important;
  border: none;
  cursor: pointer;
  touch-action: none;
}

.rank-bottom-zone {
  height: 18vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000 !important;
  border: none;
  cursor: pointer;
  touch-action: none;
}

/* Layer 3: Card Layer (Bicycle Card Presentation - 100% Pure Black Background) */
.card-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000 !important;
  background: #000000 !important;
  z-index: 30;
}

.card-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  width: 100%;
  height: 100%;
}

.card-container {
  width: min(85vw, 420px);
  aspect-ratio: 167.08 / 242.66;
  background: #ffffff !important;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateZ(0);
  forced-color-adjust: none;
  color-scheme: only light;
  border: none;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  background: #ffffff !important;
  border-radius: 18px;
  forced-color-adjust: none;
  color-scheme: only light;
}

/* Layer 4: Scratch-off Canvas Overlay (100% Pure Black) */
.scratch-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 50;
  cursor: crosshair;
  touch-action: none;
  background-color: transparent;
  transition: opacity 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scratch-canvas.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Scratch Progress (shown only in practice mode) */
.scratch-progress {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), 16px);
  right: 16px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #00ffcc;
  font-family: monospace;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 9999;
  pointer-events: none;
}
