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

body {
  font-family: -apple-system, 'Helvetica Neue', 'PingFang TC', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.hidden {
  display: none !important;
}

/* Screens */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 60vh;
  justify-content: center;
  gap: 16px;
}

#main {
  justify-content: flex-start;
  align-items: stretch;
  min-height: auto;
}

/* Header */
header h1 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 16px;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #06c755;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* State icons */
.state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
}

.success-icon {
  background: #e8f5e9;
  color: #06c755;
}

.error-icon {
  background: #fbe9e7;
  color: #d32f2f;
}

/* Student cards */
.student-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.student-card h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

/* Thumbnail grid */
.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.thumbnail-grid img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #e0e0e0;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn + .btn {
  margin-top: 8px;
}

.btn-primary {
  background: #06c755;
  color: #fff;
}

.btn-primary:active {
  background: #05a648;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:active {
  background: #ccc;
}

.btn-large {
  padding: 16px;
  font-size: 18px;
  margin-top: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Batch info text */
.batch-info {
  font-size: 14px;
  color: #888;
}

.batch-hint {
  margin-top: 4px;
  font-size: 13px;
  color: #b45309;
}

/* Share-all container */
#share-all-container {
  position: sticky;
  bottom: 0;
  padding: 12px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: #f5f5f5;
}

#share-all-hint {
  margin-top: 8px;
  text-align: center;
}
