/* Riddlio controls and riddle surface */
.mode-toggle-btn {
  width: 88px;
  min-height: 43px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #8293b4;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(125, 149, 205, 0.24);
  border-radius: 10px;
  background: #020817;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.mode-toggle-btn:hover {
  color: #dbe5ff;
  border-color: rgba(116, 177, 235, 0.46);
  background: #06122d;
  box-shadow: none;
}

.mode-toggle-btn.is-active {
  color: #e6f1ff;
  border-color: rgba(116, 177, 235, 0.58);
  background: #020817;
  box-shadow: inset 0 0 14px rgba(70, 148, 255, 0.12);
}

input[type="text"] {
  min-height: 46px;
  padding: 0 18px;
  font-size: 18px;
  border-radius: 10px;
  border: 1px solid rgba(130, 151, 202, 0.46);
  background: #020817;
  color: var(--riddlio-text);
  outline: none;
  box-shadow: inset 0 0 24px rgba(57, 111, 225, 0.05);
}

input[type="text"]::placeholder {
  color: rgba(216, 224, 252, 0.58);
}

#riddle-question-container {
  position: relative;
  min-height: 278px;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  border: 1px solid var(--riddlio-line);
  border-radius: 15px;
  background: #020817;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.riddle-art-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 0;
  padding: 0;
  border-right: 0;
  background: transparent;
}

.riddle-orb {
  width: 56px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #78bdff;
  border-radius: 50%;
  border: 1px solid rgba(106, 190, 255, 0.68);
  background: #071637;
  box-shadow: 0 0 14px rgba(63, 164, 255, 0.22), inset 0 0 16px rgba(143, 204, 255, 0.14);
}

.riddle-orb-search-icon {
  width: 37px;
  height: 37px;
  filter: drop-shadow(0 0 6px rgba(114, 190, 255, 0.34));
}

.riddle-copy-panel {
  min-width: 0;
  padding: 34px 24px 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.hint-prompt-icon {
  width: 28px;
  height: 28px;
}

#riddle-question {
  margin: 0;
  color: var(--riddlio-text);
  max-width: 440px;
  font-size: clamp(19px, 2.7vw, 22px);
  line-height: 1.34;
  font-weight: 520;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
}

#riddle-prompt {
  min-height: 30px;
  margin: 10px 0 0;
  color: var(--riddlio-text);
  font-size: 22px;
  line-height: 1.3;
  font-weight: 560;
  letter-spacing: 0;
}

#riddle-prompt:empty {
  visibility: hidden;
}

#riddle-aux-button-row {
  margin-top: auto;
  margin-left: -6px;
  margin-right: -6px;
  padding-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
  align-items: center;
  gap: 1px;
  border-top: 1px solid rgba(139, 160, 213, 0.22);
}

.hint-prompt {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #dce5ff;
  min-width: 0;
}

.hint-prompt-icon {
  flex: 0 0 auto;
  color: #a8b7ff;
  filter: drop-shadow(0 0 10px rgba(124, 143, 255, 0.58));
}

.hint-prompt-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.hint-prompt-copy strong {
  font-size: 14px;
  font-weight: 620;
  line-height: 1;
}

.hint-prompt-copy small {
  color: #aeb8d9;
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
}

#riddle-hints-group {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
}

#riddle-hint1-btn,
#riddle-hint2-btn,
#riddle-hint3-btn,
#riddle-next-btn,
#riddle-submit-answer-btn {
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #5a739b;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(125, 149, 205, 0.24);
  border-radius: 9px;
  background: #071637;
  box-shadow: none;
}

#riddle-hint1-btn,
#riddle-hint2-btn,
#riddle-hint3-btn {
  width: calc(100% - 4px);
  padding-left: 6px;
  padding-right: 6px;
  justify-self: center;
}

#riddle-next-btn:hover,
#riddle-submit-answer-btn:hover {
  border-color: rgba(116, 177, 235, 0.46);
  background: #06122d;
  box-shadow: inset 0 0 12px rgba(70, 148, 255, 0.1);
}

.hint-sparkles {
  display: inline-flex;
  color: currentColor;
}

.hint-sparkle-icon {
  width: 20px;
  height: 20px;
  fill: transparent;
  filter: drop-shadow(0 0 4px rgba(132, 150, 255, 0.28));
}

.hint-used .hint-sparkle-icon {
  fill: currentColor;
  filter: drop-shadow(0 0 7px rgba(132, 150, 255, 0.46));
}

.hint-used {
  color: #98bdff !important;
  border-color: rgba(65, 135, 255, 0.72) !important;
  background: #071637 !important;
}

#riddle-hint1-btn:not(.hint-locked):hover .hint-sparkle-icon,
#riddle-hint2-btn:not(.hint-locked):hover .hint-sparkle-icon,
#riddle-hint3-btn:not(.hint-locked):hover .hint-sparkle-icon {
  fill: currentColor;
  filter: drop-shadow(0 0 10px rgba(132, 150, 255, 0.68));
}

#riddle-hint1-btn:not(.hint-locked):hover,
#riddle-hint2-btn:not(.hint-locked):hover,
#riddle-hint3-btn:not(.hint-locked):hover {
  color: #98bdff;
  border-color: rgba(126, 168, 255, 0.84);
  box-shadow: inset 0 0 12px rgba(102, 144, 255, 0.12);
}

.hint-locked {
  opacity: 0.45 !important;
  cursor: default !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(125, 149, 205, 0.25) !important;
}

.hint-locked .hint-sparkle-icon {
  fill: transparent;
  filter: none;
}

#riddle-answer-reveal {
  color: #c9d7ff;
  font-size: 1.1rem;
  font-weight: 700;
}

#riddle-feedback-container {
  min-height: 24px;
  margin-top: -3px;
}

#riddle-feedback-message {
  font-size: 14px;
}

.feedback-correct #riddle-feedback-message {
  color: #8effb3;
}

.feedback-wrong #riddle-feedback-message {
  color: #ff9f9f;
}

.feedback-info #riddle-feedback-message {
  color: #a9c8ff;
}

#riddle-answer-row {
  margin-top: -3px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 12px;
}

#riddle-answer-input {
  width: 100%;
  min-height: 50px;
}

#riddle-submit-answer-btn {
  min-height: 50px;
  color: #eef6ff;
  font-size: 15px;
  border-color: rgba(95, 163, 255, 0.58);
  background: #020817;
  box-shadow: none;
}

#riddle-answer-input:not(:placeholder-shown) + #riddle-submit-answer-btn {
  border-color: rgba(116, 177, 235, 0.5);
  background: #06122d;
  box-shadow: inset 0 0 12px rgba(70, 148, 255, 0.1);
}

/* Debug grid: activated by shared footer Toggle Grid */
body.debugHeaderGrid #riddle-question-container,
body.debugHeaderGrid .riddle-copy-panel,
body.debugHeaderGrid #riddle-question,
body.debugHeaderGrid .riddle-art-panel,
body.debugHeaderGrid .riddle-orb,
body.debugHeaderGrid #riddle-aux-button-row,
body.debugHeaderGrid .hint-prompt,
body.debugHeaderGrid #riddle-hints-group,
body.debugHeaderGrid #riddle-hint1-btn,
body.debugHeaderGrid #riddle-hint2-btn,
body.debugHeaderGrid #riddle-hint3-btn,
body.debugHeaderGrid #riddle-next-btn,
body.debugHeaderGrid #riddle-answer-row,
body.debugHeaderGrid #riddle-answer-input,
body.debugHeaderGrid #riddle-submit-answer-btn,
body.debugHeaderGrid #riddle-feedback-container {
  outline: 3px solid var(--riddlio-grid-line);
  outline-offset: 0;
}

body.debugHeaderGrid #riddle-question-container::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  border-radius: 15px;
  background:
    linear-gradient(90deg, transparent calc(82% - 2px), var(--riddlio-grid-line) calc(82% - 2px) calc(82% + 2px), transparent calc(82% + 2px)),
    linear-gradient(transparent calc(50% - 2px), var(--riddlio-grid-line) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px));
}

body.debugHeaderGrid #riddle-aux-button-row::before,
body.debugHeaderGrid #riddle-answer-row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: linear-gradient(90deg, transparent calc(78% - 2px), var(--riddlio-grid-line) calc(78% - 2px) calc(78% + 2px), transparent calc(78% + 2px));
}

body.debugHeaderGrid #riddle-aux-button-row,
body.debugHeaderGrid #riddle-answer-row {
  position: relative;
}
