
.magic-scratch-studio[hidden] {
  display: none !important;
}

.scratch-win-modal[hidden] {
  display: none !important;
}
/* Chunnu Ji — Magic Scratch 3D Studio Styles
   Universal Mobile, Tablet & Desktop Responsive Layout */

.magic-scratch-studio {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 100%);
  color: #f8fafc;
  overflow: hidden;
  position: relative;
  min-height: calc(100vh - 65px);
  user-select: none;
  -webkit-user-select: none;
}

/* Studio Header */
.scratch-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
  z-index: 10;
}

.scratch-main-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scratch-sub-title {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}

.scratch-close-btn {
  background: #334155;
  color: #f1f5f9;
  border: 1px solid #475569;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scratch-close-btn:hover {
  background: #dc2626;
  border-color: #ef4444;
  color: #ffffff;
  transform: scale(1.04);
}

/* Studio Body: Two Columns on Desktop/Tablet, Single Column on Mobile */
.scratch-studio-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 16px;
  gap: 20px;
  align-items: stretch;
}

/* Left/Center Stage Area */
.scratch-stage-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: 650px;
  margin: 0 auto;
}

/* Scratch Card Wrapper */
.scratch-card-wrapper {
  position: relative;
  width: min(85vw, 460px);
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 4px #fbbf24, 0 0 30px rgba(251, 191, 36, 0.25);
  background: #020617;
  cursor: crosshair;
  touch-action: none;
}

.scratch-card-underlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.scratch-mask-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.scratch-particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Scratch Hint Badge */
.scratch-hint-badge {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid #fbbf24;
  padding: 8px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  animation: floatBounce 2s infinite ease-in-out;
}

.hint-hand {
  font-size: 1.3rem;
}

.hint-text {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fbbf24;
}

@keyframes floatBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

/* Progress Box */
.scratch-progress-box {
  width: min(85vw, 460px);
  margin-top: 14px;
}

.scratch-progress-bar-bg {
  height: 14px;
  background: rgba(51, 65, 85, 0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.scratch-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #f59e0b, #10b981);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

.scratch-progress-info {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

#scratchProgressLabel {
  color: #38bdf8;
}

.scratch-target-tip {
  color: #fbbf24;
}

/* Control Buttons Row */
.scratch-controls-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  width: min(85vw, 460px);
}

.scratch-ctrl-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.scratch-ctrl-btn:active {
  transform: scale(0.96);
}

.btn-reset {
  background: #334155;
  color: #f1f5f9;
}
.btn-reset:hover {
  background: #475569;
}

.btn-reveal {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #ffffff;
}
.btn-reveal:hover {
  filter: brightness(1.15);
}

.btn-next {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #0f172a;
}
.btn-next:hover {
  filter: brightness(1.1);
}

/* Right Column: Cards Shelf */
.scratch-shelf-col {
  width: 290px;
  display: flex;
  flex-direction: column;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
}

.shelf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shelf-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #38bdf8;
}

.card-counter {
  background: #0284c7;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.scratch-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.scratch-grid-card {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.scratch-grid-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.scratch-grid-card.selected {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
  background: #1e293b;
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
}

.card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: #fbbf24;
  font-weight: 800;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.card-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: #cbd5e1;
}

/* 3D Comedy Video Celebration Modal */
.scratch-win-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.scratch-win-dialog {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  border: 3px solid #fbbf24;
  border-radius: 24px;
  width: min(94vw, 560px);
  padding: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(251, 191, 36, 0.3);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: zoomPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.scratch-win-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #334155;
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.scratch-win-close:hover {
  background: #dc2626;
  transform: rotate(90deg);
}

.scratch-win-header {
  text-align: center;
  margin-bottom: 14px;
}

.win-sparkle {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 4px;
}

#scratchWinTitle {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: #fbbf24;
}

.win-subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}

.scratch-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.scratch-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scratch-win-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

.scratch-win-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-replay {
  background: #334155;
  color: #f1f5f9;
}
.btn-replay:hover {
  background: #475569;
}

.btn-next-win {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}
.btn-next-win:hover {
  filter: brightness(1.15);
}

/* ========================================================= */
/* Responsive Adjustments: Mobile, Tablet & Desktop          */
/* ========================================================= */

/* Mobile Portrait & Small Screens (<= 859px) */
@media (max-width: 859px) {
  .scratch-studio-header {
    padding: 10px 14px;
  }
  .scratch-main-title {
    font-size: 1.1rem;
  }
  .scratch-sub-title {
    font-size: 0.75rem;
  }
  .scratch-studio-body {
    flex-direction: column;
    padding: 10px;
    gap: 12px;
    overflow-y: auto;
  }
  .scratch-card-wrapper {
    width: min(88vw, 360px);
  }
  .scratch-progress-box,
  .scratch-controls-row {
    width: min(88vw, 360px);
  }
  .scratch-shelf-col {
    width: 100%;
    max-height: 160px;
    padding: 10px;
  }
  .scratch-cards-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 6px;
  }
  .scratch-grid-card {
    min-width: 80px;
    width: 80px;
    flex-shrink: 0;
  }
}

/* Tablet Screens (860px to 1080px) */
@media (min-width: 860px) and (max-width: 1080px) {
  .scratch-shelf-col {
    width: 240px;
  }
  .scratch-card-wrapper {
    width: min(48vw, 420px);
  }
}

/* Landscape Mobile (Short Height <= 540px) */
@media (max-height: 540px) and (orientation: landscape) {
  .scratch-studio-header {
    padding: 6px 14px;
  }
  .scratch-studio-body {
    flex-direction: row;
    padding: 8px;
    gap: 12px;
  }
  .scratch-card-wrapper {
    width: min(65vh, 320px);
  }
  .scratch-progress-box,
  .scratch-controls-row {
    width: min(65vh, 320px);
  }
  .scratch-shelf-col {
    width: 180px;
  }
}
