*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f2f2f7;
  color: #1c1c1e;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
}

.logo {
  font-weight: 700;
  font-size: 1.4rem;
  color: #1a1a1a;
}

.logo span {
  color: #28a745;
}

.balance {
  background-color: #28a745;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 16px;
}

.progress-container {
  padding: 20px;
  max-width: 450px;
  margin: 0 auto;
}

.progress-bar {
  width: 100%;
  background-color: #e5e5ea;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-inner {
  width: 0%;
  height: 100%;
  background-color: #28a745;
  border-radius: 10px;
  transition: width 0.4s ease;
}

.progress-container span {
  display: block;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: #636366;
  margin-top: 8px;
}

#app-container {
  max-width: 450px;
  margin: 0 auto;
  padding: 0 16px 20px 16px;
  overflow: hidden;
}

.view-container {
  display: none;
  animation: fadeIn 0.5s ease;
}

.view-container.active {
  display: block;
}

#code-view {
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.code-card {
  background-color: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.reward-amount {
  background-color: #28a745;
  color: white;
  font-size: 1.8rem;
  font-weight: 700;
  padding: 20px;
  display: block;
  text-align: center;
}

.code-card h2 {
  font-size: 1.37rem;
  font-weight: 600;
  color: #1c1c1e;
  margin: 24px 0;
  text-align: center;
}

.code-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.code-display span {
  width: 50px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f2f2f7;
  border-radius: 12px;
  font-size: 1.8rem;
  font-weight: 600;
  color: #333;
}

.input-prompt {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1c1c1e;
  margin-top: 24px;
  margin-bottom: 16px;
  text-align: center;
}

.code-input-group {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.code-input {
  width: 50px;
  height: 60px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 600;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
  outline: none;
  transition: all 0.2s ease;
  text-transform: uppercase;
  background-color: #ffffff;
}

.code-input:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
}

.code-input-group.success .code-input {
  border-color: #28a745;
}

.code-input-group.error .code-input {
  border-color: #ff3b30;
}

.code-message-bar {
  border-radius: 12px;
  padding: 12px;
  margin-top: 16px;
  font-weight: 500;
  display: none;
  animation: fadeIn 0.3s ease;
  width: 100%;
}

.code-message-bar.active {
  display: block;
}

.code-message-bar.success {
  background-color: #e9f7ea;
  color: #28a745;
}

.code-message-bar.error {
  background-color: #ffeded;
  color: #ff3b30;
}

#evaluation-view h3 {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.product-card {
  background-color: #ffffff;
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  color: #1c1c1e;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.product-card img {
  max-width: 80%;
  height: auto;
  margin-bottom: 12px;
}

.product-info p {
  font-size: 0.9rem;
  color: #636366;
  margin-bottom: 4px;
}

.product-info h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.store-tag {
  background-color: #e9f7ea;
  color: #28a745;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  display: inline-block;
}

.evaluation-buttons {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.85;
}

.btn:active {
  transform: scale(0.98);
}

.btn.btn-like {
  background-color: #28a745;
  color: white;
}

.btn.btn-dislike {
  background-color: #e5e5ea;
  color: #1c1c1e;
}

.btn.btn-never {
  background-color: #ff3b30;
  color: white;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 22px;
  text-align: center;
  width: 90%;
  max-width: 350px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px auto;
}

.modal-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.modal-content p {
  font-size: 1rem;
  color: #555;
  margin-bottom: 4px;
}

.modal-reward-amount {
  font-size: 2rem;
  font-weight: 700;
  color: #28a745;
}

#loading-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
}

#loading-view.active {
  display: flex;
}

.loading-text {
  font-weight: 600;
  color: #333;
  font-size: 1.1rem;
  margin-top: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e5ea;
  border-top: 4px solid #28a745;
  border-radius: 50%;
}

#loading-view.active .loading-spinner {
  -webkit-animation: spin 1s linear infinite;
  animation: spin 1s linear infinite;
}

.modal-content .modal-instructions {
  font-size: 1rem;
  color: #555;
  margin: 16px 0 24px 0;
  line-height: 1.5;
}

.modal-content #final-balance {
  color: #28a745;
  font-weight: 700;
}

.modal-content .btn-like {
  display: block;
  text-decoration: none;
  text-align: center;
}

footer {
  padding: 30px 20px 20px 20px;
  text-align: center;
  border-top: 1px solid #e5e5ea;
  margin-top: 30px;
}

footer p {
  font-size: 0.75rem;
  color: #8a8a8e;
  margin: 0 0 8px 0;
  line-height: 1.5;
}

footer p:last-child {
  margin-bottom: 0;
}

.terms-link {
  color: #28a745;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2rem;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
}

.terms-content {
  max-height: 300px;
  overflow-y: auto;
  text-align: left;
  border-top: 1px solid #eee;
  margin-top: 15px;
  padding-top: 15px;
}

.terms-content p {
  font-size: 0.85rem;
  margin-bottom: 10px;
}

@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}