:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: rgba(16, 16, 18, 0.82);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #f2f2f2;
  --muted: #999;
  --dim: #5f5f5f;
  --accent: #7fd3ff;
  --correct: #83e6a4;
  --wrong: #ff9d9d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(127, 211, 255, 0.09), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  width: min(58rem, 100%);
  margin: 0 auto;
}

.back-link,
.status-pill {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.82rem;
}

.back-link {
  justify-self: start;
  padding: 0 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.status-pill {
  justify-content: center;
  padding: 0 1rem;
  letter-spacing: 0.01em;
}

.score-pill {
  justify-self: end;
  color: var(--text);
}

.app {
  flex: 1;
  width: min(42rem, 100%);
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: clamp(2rem, 8vh, 6rem) 0;
}

.panel {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 2rem;
  background: var(--panel);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.35);
  padding: clamp(1.4rem, 5vw, 3.5rem);
  text-align: center;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: -0.05em;
}

h1 {
  font-size: clamp(3.6rem, 14vw, 7.5rem);
}

h2 {
  font-size: clamp(2.4rem, 10vw, 4.8rem);
}

.intro-panel h1 {
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  line-height: 0.96;
}

.intro-panel .primary-button {
  margin-top: clamp(1.8rem, 5vw, 2.6rem);
}

.intro-copy,
.feedback-copy,
.grade-copy,
.explanation {
  max-width: 34rem;
  margin: 1.35rem auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.8vw, 1.12rem);
  line-height: 1.7;
}

.riddle-text {
  max-width: 34rem;
  margin: 0;
  color: var(--text);
  font-size: clamp(1.12rem, 2.8vw, 1.45rem);
  font-weight: 520;
  line-height: 1.48;
  letter-spacing: -0.012em;
  text-align: left;
  direction: ltr;
}

.question-panel {
  text-align: left;
}

.question-panel .eyebrow {
  margin-bottom: 1.25rem;
}

.answer-form {
  display: grid;
  gap: 0.85rem;
  width: min(30rem, 100%);
  margin: clamp(1.6rem, 5vw, 2.5rem) 0 0;
}

.answer-input {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 1rem 1.1rem;
  text-align: left;
  outline: none;
}

.answer-input:focus {
  border-color: rgba(127, 211, 255, 0.6);
  box-shadow: 0 0 0 0.25rem rgba(127, 211, 255, 0.12);
}

.primary-button {
  border: 0;
  border-radius: 1.1rem;
  background: var(--text);
  color: #050505;
  padding: 1rem 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.suggest-riddle-link {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.72);
  color: var(--muted);
  padding: 0.72rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.primary-button:hover,
.suggest-riddle-link:hover {
  transform: translateY(-1px);
}

.suggest-riddle-link:hover {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.primary-button:active,
.suggest-riddle-link:active {
  transform: translateY(0);
  opacity: 0.86;
}

.feedback-panel.is-correct .eyebrow {
  color: var(--correct);
}

.feedback-panel.is-wrong .eyebrow {
  color: var(--wrong);
}

.feedback-panel .feedback-copy {
  margin-top: 0;
}

.feedback-panel .explanation {
  margin-top: 0.7rem;
  font-size: 0.96rem;
}

.feedback-panel .primary-button {
  margin-top: 1.5rem;
  min-width: min(14rem, 100%);
}

.results-panel .primary-button {
  margin-top: 1.4rem;
}

.grade-copy {
  margin-top: 0.75rem;
}

.grade-copy strong {
  color: var(--text);
}

.feedback-copy strong {
  color: var(--text);
}

.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;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.75rem;
  }

  .topbar {
    grid-template-columns: 1fr 1fr;
  }

  .back-link {
    display: none;
  }

  .status-pill,
  .score-pill {
    width: 100%;
    justify-self: stretch;
  }

  .panel {
    border-radius: 1.5rem;
  }

  .suggest-riddle-link {
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 0.64rem 0.82rem;
    font-size: 0.76rem;
  }
}
