/* ========================================
   Reset & Base Styles
   ======================================== */

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

body {
  font-family: "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f5f5;
  padding: 20px;
  line-height: 1.6;
  color-scheme: only light;
}

/* ========================================
   Error Container
   ======================================== */

.error-container {
  background-color: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  padding: 16px;
  margin: 0 auto 16px auto;
  max-width: 480px;
}

.error-message {
  color: #c33;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 8px 0;
}

/* ========================================
   Main Container
   ======================================== */

.gift-card-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 30px;
  background: linear-gradient(135deg, #fff8e1, #fffbf0);
  border: 2px solid #ffd54f;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========================================
   Gift Card Image
   ======================================== */

.gift-card-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* ========================================
   Prize Name
   ======================================== */

.prize-name {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: bold;
  text-align: center;
  color: #e65100;
  margin: 0 0 10px 0;
}

/* ========================================
   Barcode Section
   ======================================== */

.barcode-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: #ffffff;
  padding: 20px 10px;
  border-radius: 8px;
}

.barcode-label {
  display: none;
}

.barcode-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.barcode-hint {
  font-size: 0.75rem;
  color: #666;
  text-align: center;
  margin: -10px 0 -10px 0;
  padding: 0px 0 0 0;
}

/* ========================================
   Usage Rules
   ======================================== */

.usage-rules {
  padding: 16px;
  background: transparent;
  border-radius: 8px;
}

.usage-rules-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
}

.usage-rules-content {
  font-size: 0.75rem;
  line-height: 1.5;
  color: #666;
}

.usage-rules-content p {
  margin: 8px 0;
}

.usage-rules-content strong {
  color: #333;
  font-weight: 600;
}

.usage-rules-list {
  margin: 8px 0;
  padding-left: 20px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #666;
  list-style-type: disc;
}

.usage-rules-list li {
  margin-bottom: 6px;
}

.usage-rules-list a {
  color: #1976d2;
  text-decoration: none;
  word-break: break-all;
}

.usage-rules-list a:hover {
  text-decoration: underline;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 374px) {
  .gift-card-container {
    padding: 16px;
    gap: 16px;
  }

  .prize-name {
    font-size: 1.25rem;
  }

  .barcode-section {
    padding: 12px;
  }
}

@media (min-width: 415px) {
  .gift-card-container {
    padding: 32px;
    gap: 24px;
  }
}

/* ========================================
   Barcode Modal
   ======================================== */

.barcode-section {
  cursor: pointer;
}

.barcode-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-barcode-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
  background: #ffffff;
  padding: 50px 20px;
  border-radius: 8px;
  transform: rotate(90deg);
  width: 100vh;
  height: 65vw;
  overflow: hidden;
}

.modal-barcode-container .barcode-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}
