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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f8f8f8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

#app {
  max-width: 640px;
  width: 100%;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checkbox-row input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
}

button {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #0066cc;
  color: #fff;
}

button:disabled {
  background: #999;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background: #0052a3;
}

.error {
  color: #cc0000;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.survey-question {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.survey-question p {
  margin-bottom: 0.5rem;
}

.likert-scale {
  display: flex;
  gap: 0;
}

.likert-scale label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.6rem 0.25rem;
  border: 1px solid #ccc;
  margin-left: -1px;
  background: #f8f8f8;
  transition: background 0.15s, color 0.15s;
  min-height: 3rem;
  line-height: 1.2;
}

.likert-scale label:first-of-type {
  border-radius: 4px 0 0 4px;
  margin-left: 0;
}

.likert-scale label:last-of-type {
  border-radius: 0 4px 4px 0;
}

.likert-scale label:hover {
  background: #e8e8e8;
}

.likert-scale label.selected {
  background: #0066cc;
  color: #fff;
  border-color: #0052a3;
  z-index: 1;
}

.likert-scale input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.progress {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
}

.trial-block {
  padding: 1.5rem;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  margin-bottom: 1rem;
}

.trial-text {
  padding: 1rem;
  background: #f0f4f8;
  border-radius: 4px;
  margin-bottom: 1rem;
  line-height: 1.8;
  font-size: 1.1rem;
}

.emotion-label {
  text-transform: capitalize;
  font-weight: 700;
  color: #0066cc;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #cc0000;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.rec-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #cc0000;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Admin page */
.admin-wrapper {
  max-width: 960px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.admin-header h1 {
  margin-bottom: 0;
  width: 100%;
}

.admin-header-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-header-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-archive {
  margin-top: 0.75rem;
  background: #888;
  color: #fff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-archive:hover {
  background: #666;
}

.admin-subject {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.admin-subject-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.admin-subject-header h2 {
  margin-bottom: 0;
}

.admin-subject-meta {
  font-size: 0.85rem;
  color: #666;
}

.admin-traits {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: #333;
}

.admin-download-traits {
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.admin-trials-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.admin-trials-table th,
.admin-trials-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.admin-trials-table th {
  font-weight: 600;
  color: #555;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.admin-video-player {
  margin-top: 0.5rem;
}

.admin-no-trials {
  font-size: 0.9rem;
  color: #999;
  font-style: italic;
}
