/* OPQ Frontend MVP (Phase 5) - mobile-first */

/* Base wrapper blocks */
.opq-block {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.opq-title {
  font-size: 22px;
  line-height: 1.2;
  margin: 8px 0 14px;
}

.opq-subtitle {
  font-size: 16px;
  margin: 0 0 10px;
}

.opq-muted {
  color: #667085;
  font-size: 13px;
}

.opq-help {
  margin-top: 6px;
}

/* Layout helpers */
.opq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.opq-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Fields */
.opq-field {
  margin: 14px 0;
}

.opq-label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
  color: #1f2937;
}

.opq-input,
.opq-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d0d5dd;
  box-sizing: border-box;
  font-size: 16px;
  outline: none;
  background: #fff;
}

.opq-input:focus,
.opq-select:focus {
  border-color: #98a2b3;
}

/* Buttons */
.opq-btn {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #111827;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

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

.opq-btn--primary {
  border-color: #111827;
  background: #111827;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Pills */
.opq-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.opq-pill {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #d0d5dd;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.opq-pill.is-active {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

/* Cards */
.opq-card {
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  margin-top: 14px;
}

.opq-code {
  font-size: 22px;
  letter-spacing: 2px;
  font-weight: 900;
  margin: 6px 0 10px;
}

/* Alerts */
.opq-alert {
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 12px;
  font-weight: 700;
  font-size: 14px;
}

.opq-alert--error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #7f1d1d;
}

.opq-alert--warn {
  background: #fffaeb;
  border: 1px solid #fedf89;
  color: #7a2e0e;
}

/* Timer */
.opq-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  background: #f2f4f7;
  border: 1px solid #e4e7ec;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Join: avatar grid */
.opq-icons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 480px) {
  .opq-icons {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.opq-icon {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid #e4e7ec;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.opq-icon.is-selected {
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.15);
}

.opq-avatar {
  /* The JS sets size + background color inline.
     You can later override here to use images, e.g.
     background-image: url(...); background-size: cover; */
  border-radius: 999px;
}

/* Play */
.opq-question {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  margin: 12px 0 14px;
  color: #111827;
}

.opq-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.opq-option {
  min-height: 52px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid #d0d5dd;
  background: #fff;
  text-align: left;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}

.opq-option.is-selected {
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.10);
}

.opq-option:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Feedback + explanation */
.opq-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
  font-weight: 800;
}

.opq-explanation {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f2f4f7;
  border: 1px solid #e4e7ec;
  color: #111827;
  font-size: 14px;
  line-height: 1.35;
}

/* Results */
.opq-score {
  font-size: 28px;
  font-weight: 1000;
  letter-spacing: 0.5px;
}

.opq-wordle {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Results list */
.opq-result-row {
  padding: 10px 0;
  border-top: 1px solid #eef2f6;
}

.opq-result-row:first-child {
  border-top: none;
}

.opq-result-q {
  font-weight: 900;
  margin-bottom: 6px;
  color: #111827;
}

.opq-result-meta {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #344054;
  margin-bottom: 6px;
}

.opq-result-exp {
  font-size: 14px;
  line-height: 1.35;
  color: #111827;
  background: #f9fafb;
  border: 1px solid #eef2f6;
  border-radius: 12px;
  padding: 10px 12px;
}

/* Leaderboard */
.opq-lb {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opq-lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #eef2f6;
  border-radius: 14px;
  background: #fff;
}

.opq-lb-row.is-me {
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.08);
}

.opq-lb-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.opq-lb-rank {
  font-weight: 1000;
  width: 40px;
  color: #111827;
}

.opq-lb-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.opq-lb-name {
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.opq-lb-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.opq-lb-score {
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}

.opq-lb-dur {
  font-size: 12px;
  color: #667085;
  font-variant-numeric: tabular-nums;
}

/* Make links look like buttons when using opq-btn--primary on <a> */
a.opq-btn--primary:hover,
a.opq-btn--primary:focus {
  text-decoration: none;
  opacity: 0.96;
}

/* Small tweaks for very small screens */
@media (max-width: 360px) {
  .opq-block { padding: 12px; }
  .opq-title { font-size: 20px; }
  .opq-icons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Estilo del Slider de Duración */
.opq-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 10px;
  outline: none;
  margin: 10px 0;
}

.opq-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--opq-primary, #2563eb);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.opq-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--opq-primary, #2563eb);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}