* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100vh;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
  font-family: 'Georgia', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: #fff;
  gap: 16px;
}

.header {
  text-align: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: 14px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #c9a96e;
  opacity: 0.85;
  margin-bottom: 4px;
}

h1 {
  font-size: clamp(30px, 6vw, 48px);
  font-weight: 400;
  color: #fff;
  letter-spacing: 2px;
}

h1 span { color: #c9a96e; }

.subtitle {
  font-size: 12px;
  color: #888;
  font-style: italic;
  margin-top: 2px;
}

.instruction {
  background: rgba(201, 169, 110, 0.1);
  border: 1px solid rgba(201, 169, 110, 0.3);
  border-radius: 8px;
  padding: 10px 20px;
  text-align: center;
  font-size: 16px;
  color: #e0c98a;
  flex-shrink: 0;
}

.safes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 600px;
  width: 100%;
  flex-shrink: 0;
}

.safe-card {
  width: clamp(100px, 18vw, 140px);
  cursor: pointer;
  perspective: 1000px;
}

.safe-inner {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.safe-card.opened .safe-inner {
  transform: rotateY(180deg);
}

.safe-front, .safe-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
}

.safe-front {
  background: linear-gradient(160deg, #1e1e1e, #2a2a2a);
  border: 1px solid rgba(201, 169, 110, 0.4);
  padding: 18px 10px 14px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.safe-card:hover:not(.opened):not(.disabled) .safe-front {
  border-color: rgba(201, 169, 110, 0.8);
  box-shadow: 0 10px 32px rgba(201, 169, 110, 0.2);
}

.safe-icon {
  font-size: clamp(32px, 6vw, 44px);
  display: block;
  margin-bottom: 8px;
  transition: transform 0.3s;
}

.safe-card:hover:not(.opened):not(.disabled) .safe-icon {
  transform: scale(1.08);
}

.safe-number {
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #c9a96e;
}

.safe-back {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #1a1a0a, #2a2510);
  border: 1px solid rgba(201, 169, 110, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  text-align: center;
}

.safe-back-icon { font-size: 26px; margin-bottom: 6px; }
.safe-back-label { font-size: 10px; color: #c9a96e; letter-spacing: 1px; text-transform: uppercase; }

.safe-card.disabled { cursor: not-allowed; }
.safe-card.disabled .safe-front {
  opacity: 0.3;
  filter: grayscale(1);
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: linear-gradient(160deg, #1a1a0a, #2a2510);
  border: 1px solid rgba(201, 169, 110, 0.6);
  border-radius: 18px;
  padding: 36px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-emoji {
  font-size: 52px;
  display: block;
  margin-bottom: 16px;
}

.modal-tag {
  font-size: 14px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #c9a96e;
  margin-bottom: 10px;
}

.modal-prize {
  white-space: pre-line;
  font-size: 24px;
  color: #fff;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 24px;
}

.modal-divider {
  height: 1px;
  background: rgba(201,169,110,0.3);
  margin: 0 0 20px;
}

.modal-print {
  background: rgba(255, 220, 50, 0.12);
  border: 2px solid #f5c400;
  border-radius: 12px;
  padding: 16px 18px;
  animation: pulse-border 1.5s ease-in-out infinite;
}

.modal-print .print-big {
  font-size: 36px;
  display: block;
  margin-bottom: 6px;
  animation: shake 1s ease-in-out 1s infinite;
}

.modal-print .print-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffe55c;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-print .print-desc {
  font-size: 14px;
  color: #ddd;
  line-height: 1.5;
}

.modal-print strong { color: #ffe55c; }

.modal-close {
  margin-top: 24px;
  background: transparent;
  border: 1px solid rgba(201,169,110,0.4);
  color: #c9a96e;
  padding: 8px 24px;
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.modal-close:hover { background: rgba(201,169,110,0.1); }

.footer {
  font-size: 10px;
  color: #333;
  letter-spacing: 2px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  opacity: 0;
  animation: confettiFall 2s ease-in forwards;
}

@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse-border {
  0%, 100% { border-color: #f5c400; box-shadow: 0 0 0 0 rgba(245,196,0,0.4); }
  50%       { border-color: #ffe55c; box-shadow: 0 0 0 6px rgba(245,196,0,0); }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20%       { transform: rotate(-12deg); }
  40%       { transform: rotate(12deg); }
  60%       { transform: rotate(-8deg); }
  80%       { transform: rotate(8deg); }
}
