
:root {
  --ink: #20243a;
  --muted: #6d7285;
  --accent: #6558d3;
  --accent-dark: #5144ba;
  --paper: #ffffff;
  --background: #f4f3fb;
  --border: #e5e3f0;
  --success: #18794e;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #e7e3ff 0, transparent 36%),
    var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.app {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 28px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 22px;
  line-height: 1;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 26px;
  letter-spacing: -0.8px;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 16px 50px rgba(37, 32, 84, 0.07);
}

.welcome {
  padding-top: 56px;
  padding-bottom: 56px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.25;
  letter-spacing: -0.8px;
}

.welcome > p:not(.eyebrow) {
  max-width: 420px;
  margin: 0 auto 26px;
  color: var(--muted);
  line-height: 1.7;
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 13px 22px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s;
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

#start-button {
  width: 100%;
  max-width: 300px;
}

.puzzle-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.category-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #efedff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 800;
}

#question {
  margin-bottom: 28px;
  white-space: pre-line;
  font-size: 15px;
  line-height: 1.7;
  font-weight: 500;
}

#answer-form label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 700;
}

#answer-input {
  width: 100%;
  min-height: 50px;
  margin-bottom: 12px;
  padding: 13px 15px;
  border: 1px solid #d9d7e6;
  border-radius: 12px;
  outline: none;
}

#answer-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(101, 88, 211, 0.12);
}

#submit-button {
  width: 100%;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.text-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.feedback {
  min-height: 22px;
  margin: 18px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.feedback.success {
  color: var(--success);
}

.feedback.error {
  color: var(--error);
}

.hint-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #e8e2bd;
  border-radius: 12px;
  background: #fffbed;
  line-height: 1.6;
}

.hint-box strong {
  font-size: 13px;
}

.hint-box p {
  margin: 6px 0 0;

  /* CHANGED: Preserve line breaks between hints. */
  white-space: pre-line;
}

.completion {
  text-align: center;
}

.completion-icon {
  margin-bottom: 14px;
  font-size: 52px;
}

#completion-message {
  color: var(--muted);
  line-height: 1.7;
}

.result-time {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 26px 0;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #faf9ff;
  text-align: left;
}

.result-time span {
  color: var(--muted);
  font-size: 13px;
}

.result-time strong {
  font-variant-numeric: tabular-nums;
  font-size: 19px;
}

.challenge-result {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #efedff;
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.5;
}

.welcome > p.challenge-banner {
  max-width: 420px;
  margin: 0 auto 22px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #efedff;
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.5;
}

.share-panel {
  margin: 0 0 26px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #faf9ff;
  text-align: left;
}

.share-panel h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.share-choice {
  display: flex;
  gap: 0;
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.share-choice legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.choice {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid var(--accent);
  background: var(--paper);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.choice:first-of-type {
  border-radius: 12px 0 0 12px;
}

.choice:last-of-type {
  margin-left: -1px;
  border-radius: 0 12px 12px 0;
}

/* The radio stays in the page for keyboards and screen readers, but is not drawn. */
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice:has(input:checked) {
  background: var(--accent);
  color: white;
}

.choice:has(input:checked) span::before {
  content: "\2713\00a0";
}

.choice:has(input:focus-visible) {
  outline: 3px solid rgba(101, 88, 211, 0.35);
  outline-offset: 2px;
}

.share-preview {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px dashed #cfcae8;
  border-radius: 12px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
  user-select: text;
}

.share-note {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.share-actions button {
  flex: 1 1 140px;
}

.secondary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 13px 22px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--paper);
  color: var(--accent-dark);
  font-weight: 700;
  transition: background 0.2s;
}

.secondary-button:hover {
  background: #efedff;
}

.share-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--success);
  font-size: 13px;
  font-weight: 650;
}

.share-status.error {
  color: var(--error);
}

.solution {
  padding: 24px;
  border-radius: 16px;
  background: #f8f7fc;
  text-align: left;
}

.solution-question {
  margin-bottom: 22px;
  font-weight: 650;
  line-height: 1.7;
  white-space: pre-line;
}

.answer-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.solution-answer {
  margin-bottom: 20px;
  color: var(--success);
  font-size: 21px;
  font-weight: 800;
}

#completed-explanation {
  margin-bottom: 0;
  line-height: 1.7;
  white-space: pre-line;
}

.closing-note {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.error-message {
  margin: 16px 0 0 !important;
  color: var(--error) !important;
  font-size: 13px;
}

footer {
  padding: 24px 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  body {
    padding: 20px 12px;
  }

  .site-header {
    margin-top: 4px;
  }

  h1 {
    font-size: 23px;
  }

  .panel {
    border-radius: 18px;
  }

  .welcome {
    padding-top: 42px;
    padding-bottom: 42px;
  }

  .solution {
    padding: 18px;
  }

  .share-panel {
    padding: 16px;
  }
}
