main.content:has(#ttq-app) {
  min-width: 0;
}

.ttq-container {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: #1a1a1a;
}

.ttq-container [hidden] {
  display: none !important;
}

.ttq-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ttq-card {
  box-sizing: border-box;
  background: #f8f9fa;
  border: 1px solid #e1e4e8;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.ttq-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e1e4e8;
  padding-bottom: 0.65rem;
}

.ttq-config-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #2d3436;
}

.ttq-lock-badge {
  background: #ffeaa7;
  color: #2d3436;
  border: 1px solid #fdcb6e;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.ttq-fieldset {
  border: none;
  margin: 0 0 1rem 0;
  padding: 0;
}

.ttq-fieldset legend {
  font-weight: 600;
  font-size: 0.92rem;
  color: #2d3436;
  margin-bottom: 0.5rem;
}

.ttq-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ttq-choice-btn,
.ttq-preset-btn,
.ttq-helper-btn,
.ttq-table-btn {
  appearance: none;
  background: #fff;
  border: 1px solid #cfd4da;
  color: #2d3436;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.ttq-choice-btn:hover:not(:disabled),
.ttq-preset-btn:hover:not(:disabled),
.ttq-helper-btn:hover:not(:disabled),
.ttq-table-btn:hover:not(:disabled) {
  border-color: #00cec9;
  background: #e6fffe;
}

.ttq-choice-btn.is-selected,
.ttq-preset-btn.is-selected,
.ttq-table-btn.is-selected {
  background: #2d3436;
  border-color: #2d3436;
  color: #fff;
}

.ttq-choice-btn:disabled,
.ttq-preset-btn:disabled,
.ttq-helper-btn:disabled,
.ttq-table-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ttq-table-helpers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.ttq-helper-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.84rem;
  background: #f1f2f6;
}

.ttq-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 0.45rem;
}

.ttq-table-btn {
  padding: 0.5rem 0.25rem;
  text-align: center;
}

.ttq-muted-note {
  margin: 0.45rem 0 0 0;
  font-size: 0.85rem;
  color: #636e72;
}

.ttq-error-msg {
  margin: 0.6rem 0 0 0;
  padding: 0.55rem 0.75rem;
  background: #fff0f0;
  border: 1px solid #ff7675;
  border-radius: 6px;
  color: #c0392b;
  font-size: 0.9rem;
  font-weight: 600;
}

.ttq-start-row {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ttq-primary-btn {
  appearance: none;
  background: #00b894;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.6rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.ttq-primary-btn:hover:not(:disabled) {
  background: #00997a;
}

.ttq-primary-btn:disabled {
  background: #b2bec3;
  cursor: not-allowed;
}

.ttq-secondary-btn {
  appearance: none;
  background: #fff;
  color: #2d3436;
  border: 1px solid #cfd4da;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.ttq-secondary-btn:hover:not(:disabled) {
  border-color: #2d3436;
  background: #f1f2f6;
}

.ttq-stage {
  background: #fff;
  border: 1px solid #e1e4e8;
}

.ttq-idle-panel p {
  margin: 0;
  color: #636e72;
  text-align: center;
  padding: 0.5rem 0;
}

.ttq-countdown-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem;
  text-align: center;
}

.ttq-countdown-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #636e72;
}

.ttq-countdown-value {
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
  color: #2d3436;
  font-variant-numeric: tabular-nums;
}

.ttq-countdown-actions {
  margin-top: 0.5rem;
}

.ttq-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e1e4e8;
  margin-bottom: 1.25rem;
}

.ttq-hud-stat {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.ttq-hud-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #636e72;
  font-weight: 600;
}

.ttq-hud-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #2d3436;
  font-variant-numeric: tabular-nums;
}

.ttq-quit-btn {
  appearance: none;
  background: #fff;
  color: #d63031;
  border: 1px solid #ff7675;
  border-radius: 6px;
  padding: 0.45rem 0.95rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.ttq-quit-btn:hover {
  background: #fff0f0;
}

.ttq-question-box {
  text-align: center;
  padding: 1rem 0 1.25rem 0;
}

.ttq-question-text {
  font-size: 2.6rem;
  font-weight: 800;
  color: #2d3436;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.ttq-feedback {
  margin: 0 auto 1rem auto;
  max-width: 420px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.ttq-feedback.is-correct {
  background: #e6fff8;
  border: 1px solid #00b894;
  color: #007a60;
}

.ttq-feedback.is-incorrect,
.ttq-feedback.is-retry {
  background: #fff2f0;
  border: 1px solid #ff7675;
  color: #b71c1c;
}

.ttq-entry-area {
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ttq-answer-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid #cfd4da;
  border-radius: 8px;
  color: #2d3436;
  background: #f8f9fa;
  font-variant-numeric: tabular-nums;
}

.ttq-answer-input:focus {
  outline: none;
  border-color: #00cec9;
  background: #fff;
}

.ttq-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.ttq-key-btn {
  appearance: none;
  background: #f1f2f6;
  border: 1px solid #d5d9df;
  border-radius: 8px;
  color: #2d3436;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  min-height: 52px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s, transform 0.08s;
}

.ttq-key-btn:hover {
  background: #e2e6ec;
}

.ttq-key-btn:active {
  transform: scale(0.97);
}

.ttq-key-action {
  background: #e9ecef;
  color: #495057;
}

.ttq-enter-btn {
  grid-column: 1 / -1;
  min-height: 60px;
  background: #00b894;
  border-color: #00a383;
  color: #fff;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
}

.ttq-enter-btn:hover {
  background: #00997a;
}

.ttq-summary-panel {
  text-align: center;
}

.ttq-summary-panel h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  color: #2d3436;
}

.ttq-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1.15rem 0;
}

.ttq-summary-stat {
  background: #f8f9fa;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 0.75rem;
}

.ttq-summary-stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: #2d3436;
  font-variant-numeric: tabular-nums;
}

.ttq-summary-stat-label {
  display: block;
  font-size: 0.78rem;
  color: #636e72;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ttq-summary-actions {
  margin-top: 0.75rem;
}

.ttq-history-section {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ttq-history-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ttq-history-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #2d3436;
}

.ttq-history-card {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  background: #fff;
}

.ttq-history-card h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.05rem;
  color: #2d3436;
}

.ttq-leaderboards-grid {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.ttq-table-wrap {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.ttq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ttq-table th,
.ttq-table td {
  text-align: left;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid #e1e4e8;
  white-space: nowrap;
}

.ttq-table th {
  color: #636e72;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}

.ttq-empty-msg {
  margin: 0;
  color: #636e72;
  font-size: 0.9rem;
}

.ttq-container button:focus-visible,
.ttq-container input:focus-visible {
  outline: 3px solid #00cec9;
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .ttq-leaderboards-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .ttq-card {
    padding: 1rem;
  }

  .ttq-question-text {
    font-size: 2.1rem;
  }

  .ttq-key-btn {
    min-height: 48px;
    font-size: 1.2rem;
  }

  .ttq-enter-btn {
    min-height: 56px;
  }
}
