/* Grammaticality Judgment RWL — static web version */

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Hiragino Sans', sans-serif;
  overflow: hidden;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen.hidden { display: none; }

.container {
  max-width: 720px;
  padding: 2rem;
  text-align: center;
}

.container.left {
  text-align: left;
}

h1, h2, h3 { font-weight: 300; }

h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; color: #ccc; }

p { line-height: 1.6; color: #ddd; }

label {
  display: block;
  text-align: left;
  margin: 1rem 0;
  color: #ddd;
}

input, select {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.8rem;
  background: #222;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  font-size: 1rem;
}

input:focus, select:focus {
  outline: none;
  border-color: #4a9eff;
}

details {
  margin-top: 1.5rem;
  text-align: left;
}

details summary {
  cursor: pointer;
  padding: 0.6rem;
  background: #1a1a1a;
  border-radius: 4px;
  user-select: none;
}

button {
  padding: 0.8rem 1.6rem;
  background: #333;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  margin: 0.4rem;
  transition: background 0.2s ease;
}

button:hover {
  background: #444;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: #4a9eff;
  color: #000;
  font-weight: 600;
  border-color: #4a9eff;
}

button.primary:hover {
  background: #6db1ff;
}

button.secondary {
  background: #444;
}

button.response {
  font-size: 1.2rem;
  padding: 1rem 2rem;
  min-width: 200px;
}

.caption {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: #aaa;
}

.warning {
  background: #332b00;
  color: #ffd970;
  padding: 0.8rem;
  border-radius: 4px;
  border-left: 3px solid #ffd970;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #222;
  border: 1px solid #555;
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.95em;
}

/* ============================== */
/* Trial display */
/* ============================== */

#trial-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  min-height: 4rem;
  font-weight: 300;
  letter-spacing: 0.02em;
}

#trial-display.target {
  color: #ffd700;
}

#trial-display.fixation {
  font-size: 5rem;
}

.response-buttons {
  position: fixed;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
}

.response-buttons.hidden {
  display: none;
}

/* ============================== */
/* Response progress bar */
/* ============================== */

.response-progress {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  max-width: 600px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.response-progress.hidden {
  display: none;
}

#response-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right, #4caf50 0%, #ffc107 70%, #f44336 100%);
  border-radius: 3px;
  transform-origin: left center;
  transform: scaleX(1);
}

#response-progress-fill.active {
  transform: scaleX(0);
}

/* ============================== */
/* Form hint (auto-assigned form) */
/* ============================== */

.form-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #4a9eff;
  min-height: 1rem;
}

/* ============================== */
/* Practice feedback */
/* ============================== */

.practice-feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(20, 20, 20, 0.92);
  padding: 1.5rem 3rem;
  border-radius: 10px;
  min-width: 360px;
  max-width: 720px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.practice-feedback.hidden {
  display: none;
}

.practice-feedback .feedback-icon {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.practice-feedback .feedback-label {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  letter-spacing: 0.05em;
}

.practice-feedback .feedback-explanation {
  font-size: 1rem;
  color: #ddd;
  line-height: 1.5;
  max-width: 540px;
}

/* ============================== */
/* Cursor hidden in running phase */
/* ============================== */

body.cursor-hidden,
body.cursor-hidden * {
  cursor: none !important;
}

/* ============================== */
/* Keymap indicator (during runs) */
/* ============================== */

.keymap-indicator {
  position: fixed;
  bottom: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: #888;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  white-space: nowrap;
}

.keymap-indicator.hidden { display: none; }

.keymap-indicator .keymap-yes,
.keymap-indicator .keymap-no {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.keymap-indicator .keymap-yes { color: #6db1ff; }
.keymap-indicator .keymap-no { color: #ff9eb1; }

/* ============================== */
/* Instructions key-mapping box */
/* ============================== */

.instructions-keymap-box {
  background: rgba(74, 158, 255, 0.12);
  border-left: 3px solid #4a9eff;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  font-size: 1.05rem;
}

/* ============================== */
/* Email instruction (complete screen) */
/* ============================== */

.email-instruction {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.4);
  border-radius: 8px;
  padding: 1.2rem 1.6rem;
  margin: 1.5rem auto;
  max-width: 640px;
  text-align: left;
}

.email-instruction h3 {
  margin-top: 0;
  color: #4caf50;
  text-align: center;
}

.email-address {
  text-align: center;
  font-size: 1.2rem;
  margin: 1rem 0;
  font-weight: 600;
}

.email-address a {
  color: #6db1ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.email-address a:hover {
  color: #a4ccff;
}

code {
  background: #1a1a1a;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
}

/* ============================== */
/* Task overview (setup screen) */
/* ============================== */

.task-overview {
  background: rgba(74, 158, 255, 0.06);
  border: 1px solid rgba(74, 158, 255, 0.3);
  border-radius: 8px;
  padding: 1.2rem 1.6rem;
  margin: 1.5rem 0;
  text-align: left;
}

.task-overview h3 {
  margin-top: 0;
  color: #4a9eff;
  font-size: 1.1rem;
}

.task-steps {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.task-steps li {
  padding: 0.4rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  color: #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-steps li:last-child {
  border-bottom: none;
}

.step-time {
  color: #888;
  font-size: 0.85em;
}

.total-time {
  margin-top: 0.8rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

/* ============================== */
/* Run progress (inter-run-rest) */
/* ============================== */

.run-progress {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.run-progress-step {
  width: 90px;
  height: 38px;
  background: #2a2a2a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #444;
}

.run-progress-step.done {
  background: linear-gradient(135deg, #43a047, #2e7d32);
  color: white;
  border-color: #4caf50;
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.25);
}

.run-progress-step.current {
  background: linear-gradient(135deg, #1e88e5, #1565c0);
  color: white;
  border-color: #4a9eff;
  animation: pulse-blue 1.5s ease-in-out infinite;
}

@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 6px rgba(74, 158, 255, 0.4); }
  50% { box-shadow: 0 0 18px rgba(74, 158, 255, 0.8); }
}

.run-summary {
  font-size: 1rem;
  color: #aaa;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  display: inline-block;
}

/* ============================== */
/* Response progress overrun (untimed) */
/* ============================== */

#response-progress-fill.overrun {
  background: linear-gradient(to right, #f44336, #ff6b6b) !important;
  animation: pulse-overrun 0.7s ease-in-out infinite alternate;
  transform: scaleX(0.05) !important;
  transition: none !important;
}

@keyframes pulse-overrun {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ============================== */
/* Results display */
/* ============================== */

#summary-table table,
#results-preview table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#summary-table th, #summary-table td,
#results-preview th, #results-preview td {
  padding: 0.5rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid #333;
}

#summary-table th, #results-preview th {
  background: #1a1a1a;
  color: #4a9eff;
}

#results-preview {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #333;
  border-radius: 4px;
}

.actions {
  margin: 1.5rem 0;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
