/* ────────────────────────────────────────
   Core layout
   ────────────────────────────────────────*/
#ttd-wrapper {
  max-width: 500px;
  margin: 20px auto;
  font-family: system-ui, Arial, sans-serif;
}
#ttd-filters { margin-bottom: 10px; }

/* ────────────────────────────────────────
   Question box (wrap long text)
   ────────────────────────────────────────*/
#ttd-question-box {
  padding: 10px;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  background: #fafafa;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ────────────────────────────────────────
   Clickable choices
   ────────────────────────────────────────*/
#ttd-choices { margin-bottom: 40px; }
.ttd-choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: none;
  white-space: normal;
  word-break: break-word;
}
@media (hover: hover) {
  .ttd-choice-btn:hover { background: #f3f3f3; }
}
.ttd-choice-btn.correct,
.ttd-choice-btn.incorrect { pointer-events: none; }
.ttd-choice-btn.correct {
  background: var(--e-global-color-secondary)!important;
  border-color: var(--e-global-color-secondary)!important;
  color: #fff!important;
}
.ttd-choice-btn.incorrect {
  background: #ff0000!important;
  border-color: #ff0000!important;
  color: #fff!important;
}

/* ────────────────────────────────────────
   “New Question” button
   ────────────────────────────────────────*/
#ttd-buttons { margin: 10px 0; }
#ttd-buttons.ttd-hidden { display: none; }
#ttd-new { display: block; width: 100%; }

/* ────────────────────────────────────────
   Button base styles
   ────────────────────────────────────────*/
.ttd-button {
  padding: 10px 16px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: inherit;
}
.ttd-button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ────────────────────────────────────────
   Join form (remote only)
   ────────────────────────────────────────*/
#ttd-join-section {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
#ttd-join-section.ttd-hidden { display: none; }
#ttd-join-section input {
  flex: 1;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

/* ────────────────────────────────────────
   Network session layout (grid)
   ────────────────────────────────────────*/
#ttd-game {
  display: grid;
  grid-template-areas:
    "scoreboard"
    "start-session"
    "end-session"
    "network-controls"
    "join-section"
    "leave-session";
  grid-template-columns: 1fr;
  row-gap: 12px;
  margin-top: 20px;
}
#ttd-scoreboard { grid-area: scoreboard; }
#ttd-scoreboard.ttd-hidden { display: none; }
#ttd-start-session { grid-area: start-session; display: block; width: 100%; }
#ttd-start-session.ttd-hidden { display: none; }
#ttd-end-session   { grid-area: end-session;   display: block; width: 100%; }
#ttd-end-session.ttd-hidden { display: none; }
#ttd-network-controls { grid-area: network-controls; }
#ttd-network-controls.ttd-hidden { display: none; }
#ttd-join-section     { grid-area: join-section; }
#ttd-leave-session    { grid-area: leave-session; display: block; width: 100%; }
#ttd-leave-session.ttd-hidden { display: none; }

/* ────────────────────────────────────────
   Score rows
   ────────────────────────────────────────*/
.ttd-score-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ttd-score-value {
  font-weight: bold;
  min-width: 24px;
  text-align: center;
}

/* ────────────────────────────────────────
   Global “hidden” helper
   ────────────────────────────────────────*/
.ttd-hidden {
  display: none !important;
}

/* Hide the category dropdown when JS marks it hidden */
#ttd-filters.ttd-hidden {
  display: none !important;
}

/* ────────────────────────────────────────
   Override category dropdown text color
   ────────────────────────────────────────*/
#ttd-category-select.elementor-field-type-select {
  color: #232323 !important;
  -webkit-text-fill-color: #232323 !important;
}

/* ────────────────────────────────────────
   Session Modal
   ────────────────────────────────────────*/
.ttd-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.ttd-modal {
  background: #333;
  color: #fff;
  padding: 20px;
  border-radius: 4px;
  max-width: 90%;
  width: 300px;
}
.ttd-modal label,
.ttd-modal legend {
  display: block;
  margin-bottom: 8px;
  color: #fff;
}
.ttd-modal input[type="text"] {
  width: 100%;
  padding: 6px;
  margin-top: 4px;
  margin-bottom: 12px;
  border: 1px solid #555;
  border-radius: 3px;
  background: #222;
  color: #fff;
}
.ttd-modal-fieldset {
  margin-bottom: 12px;
  border: 1px solid #555;
  padding: 8px;
  border-radius: 3px;
}
.ttd-modal-fieldset legend {
  padding: 0 4px;
}
.ttd-modal input[type="radio"] {
  margin-right: 6px;
}
.ttd-modal button {
  margin-right: 8px;
}

/* ────────────────────────────────────────
   Session Modal inputs (light background for readability)
   ────────────────────────────────────────*/
.ttd-modal input[type="text"] {
  width: 100%;
  padding: 6px;
  margin: 4px 0 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  color: #000;
}

/* make placeholder text visible on white background */
.ttd-modal input[type="text"]::placeholder {
  color: #888;
}
