:root {
  --verse-ink: #29353d;
  --verse-muted: #746d62;
  --verse-paper: #fffaf1;
  --verse-cream: #f6eddd;
  --verse-sage: #dfe8dd;
  --verse-sage-dark: #526c5a;
  --verse-blue: #314a63;
  --verse-gold: #d6a84f;
  --verse-clay: #a96f54;
}

.put-verse-together-activity-template {
  margin: 0;
  color: var(--verse-ink);
  background: linear-gradient(180deg, var(--verse-paper), var(--verse-cream));
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

.put-verse-together-activity-template * {
  box-sizing: border-box;
}

.put-verse-together-activity-template .inner {
  width: min(100% - 28px, 980px);
  margin-inline: auto;
}

.put-verse-together-activity-template .main {
  padding: 18px 0 54px;
}

.put-verse-together-activity-template .activity-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--verse-muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.put-verse-together-activity-template .activity-breadcrumbs a {
  color: var(--verse-blue);
  text-decoration: none;
}

.put-verse-together-activity-template .kicker {
  margin: 0 0 8px;
  color: #98702e;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.put-verse-together-activity-template .button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 0;
  border-radius: 10px;
  color: #27323a;
  background: #f2c45f;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.put-verse-together-activity-template .button.secondary {
  border: 1px solid rgba(49, 74, 99, 0.2);
  color: var(--verse-blue);
  background: #fff;
}

.verse-activity-shell {
  position: relative;
  overflow: visible;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid rgba(214, 168, 79, 0.3);
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 24px 62px rgba(74, 55, 31, 0.11);
}

.compact-activity-toolbar {
  position: sticky;
  top: var(--activity-toolbar-top, 72px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: calc(clamp(18px, 4vw, 34px) * -1) calc(clamp(18px, 4vw, 34px) * -1) 24px;
  padding: 14px clamp(18px, 4vw, 34px);
  border-bottom: 1px solid rgba(214, 168, 79, 0.28);
  border-radius: 28px 28px 0 0;
  background: rgba(255, 250, 241, 0.97);
  box-shadow: 0 10px 28px rgba(49, 74, 99, 0.08);
  backdrop-filter: blur(10px);
}

.compact-toolbar-title {
  min-width: 0;
  flex: 0 1 auto;
}

.compact-toolbar-title h1 {
  margin: 0;
  color: var(--verse-blue);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.05;
  white-space: nowrap;
}

.compact-toolbar-title span {
  display: block;
  margin-top: 2px;
  color: var(--verse-muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
}

.compact-toolbar-actions {
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-toolbar-actions .button {
  margin: 0;
  min-height: 40px;
  padding: 9px 14px;
  white-space: nowrap;
}

.verse-heading {
  margin-bottom: 18px;
  text-align: center;
}

.verse-heading h1 {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  color: var(--verse-blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5.2vw, 3.35rem);
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}

.verse-heading p:last-child {
  margin: 10px 0 0;
  color: var(--verse-clay);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.12rem, 3vw, 1.45rem);
  font-weight: 700;
}

.verse-reference,
.verse-progress,
.verse-message {
  text-align: center;
}

.verse-reference {
  margin: 0 0 14px;
  color: var(--verse-sage-dark);
  font-weight: 900;
}

.verse-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #ede4d4;
}

.verse-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--verse-gold), #82a37e);
  transition: width 280ms ease;
}

.verse-progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 18px;
  text-align: center;
}

.verse-progress {
  margin: 0;
  color: var(--verse-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2.6vw, 1.18rem);
  font-weight: 800;
  transition: opacity 260ms ease, transform 260ms ease;
}

.verse-progress.is-changing {
  animation: progress-message-fade 360ms ease;
}

.verse-level-choice {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(214, 168, 79, 0.3);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.82);
}

.verse-level-button {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--verse-blue);
  background: transparent;
  font: 900 0.9rem Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.verse-level-button.is-active {
  color: #fffaf1;
  background: var(--verse-blue);
  box-shadow: 0 6px 14px rgba(49, 74, 99, 0.16);
}

.answer-area,
.tile-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
  min-height: 100px;
  padding: 14px;
  border-radius: 18px;
}

.answer-area {
  border: 2px dashed rgba(49, 74, 99, 0.18);
  background: #fff8e9;
  transition: border-color 400ms ease, background 400ms ease, box-shadow 400ms ease, opacity 400ms ease;
}

.answer-area.is-completing .verse-tile,
.tile-bank.is-fading .verse-tile {
  opacity: 0;
  transform: translateY(5px) scale(0.98);
  transition: opacity 400ms ease, transform 400ms ease;
}

.answer-area.is-complete {
  position: relative;
  display: block;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid rgba(214, 168, 79, 0.5);
  background:
    radial-gradient(circle at 50% 8%, rgba(245, 215, 143, 0.26), transparent 58%),
    linear-gradient(180deg, #fffdf8, #fff5df 62%, #f8ebcf);
  box-shadow: 0 0 0 4px rgba(214, 168, 79, 0.08), 0 18px 38px rgba(74, 55, 31, 0.12);
  animation: verse-card-glow 2200ms ease-out;
}

.answer-area.is-complete::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(214, 168, 79, 0.24);
  border-radius: 14px;
  pointer-events: none;
}

.answer-area.is-complete::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 18%, rgba(255, 255, 255, 0.42) 48%, transparent 72%);
  opacity: 0;
  transform: translateX(-120%);
  pointer-events: none;
  animation: verse-shimmer 1800ms ease-out var(--shimmer-delay, 1400ms) 1;
}

.tile-bank {
  margin-top: 18px;
  border: 1px solid rgba(214, 168, 79, 0.24);
  background: rgba(223, 232, 221, 0.42);
}

.verse-activity-shell.is-complete .tile-bank {
  display: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.verse-activity-shell.is-complete .verse-actions {
  display: none;
}

[hidden] {
  display: none !important;
}

.verse-tile {
  min-height: 50px;
  padding: 11px 15px;
  border: 1px solid rgba(49, 74, 99, 0.12);
  border-radius: 999px;
  color: var(--verse-blue);
  background: #fffdf8;
  box-shadow: 0 7px 16px rgba(74, 55, 31, 0.1);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.verse-tile.correct {
  animation: verse-pop 280ms ease;
}

.verse-tile.wrong {
  animation: verse-wiggle 360ms ease;
}

.verse-tile.hint-glow {
  box-shadow: 0 0 0 4px rgba(214, 168, 79, 0.25), 0 0 22px rgba(214, 168, 79, 0.58);
}

.verse-message {
  min-height: 1.5em;
  margin: 15px 0 0;
  color: var(--verse-sage-dark);
  font-weight: 900;
  white-space: pre-line;
}

.verse-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.story-info-panel {
  padding: 58px 0;
  border-top: 1px solid rgba(49, 74, 99, 0.1);
  background: #fffdf8;
}

.story-info-panel h2,
.story-continuation h2 {
  margin: 0;
  color: #17314d;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.05;
}

.story-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.story-info-grid article {
  padding: 18px;
  border: 1px solid rgba(214, 168, 79, 0.28);
  border-radius: 18px;
  background: #fffaf1;
  box-shadow: 0 10px 26px rgba(74, 55, 31, 0.06);
}

.story-info-grid h3 {
  margin: 0 0 6px;
  color: var(--verse-blue);
  font-size: 1.08rem;
}

.story-info-grid p {
  margin: 0;
  color: var(--verse-sage-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.story-continuation {
  padding: 58px 0 64px;
  border-top: 1px solid rgba(214, 168, 79, 0.2);
  background: linear-gradient(180deg, #fffaf1, #f6eddd);
  text-align: center;
}

.story-continuation-copy {
  max-width: 620px;
  margin: 12px auto 0;
  color: var(--verse-sage-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}

.continuation-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  max-width: 940px;
  margin: 24px auto 0;
}

.continuation-card {
  display: grid;
  min-height: 138px;
  place-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid rgba(214, 168, 79, 0.3);
  border-radius: 18px;
  color: var(--verse-blue);
  background: #fffdf8;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(74, 55, 31, 0.07);
}

.continuation-card:first-child {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, 260px);
}

.continuation-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

@media (max-width: 720px) {
  .continuation-links {
    grid-template-columns: 1fr;
  }

  .continuation-card:first-child {
    grid-column: auto;
    width: 100%;
  }
}

.completed-verse {
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
}

.completed-stars {
  margin: 0 0 8px;
  color: var(--verse-gold);
  font-size: 2rem;
}

.completed-verse h2 {
  margin: 0 0 12px;
  color: var(--verse-blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 5vw, 2.4rem);
}

.completed-verse blockquote {
  margin: 0;
  color: #4b3d2f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.28rem, 4vw, 1.9rem);
  line-height: 1.45;
}

.completed-verse cite {
  display: block;
  margin-top: 12px;
  color: var(--verse-clay);
  font-style: normal;
  font-weight: 900;
}

.final-verse-display {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: clamp(22px, 5vw, 38px);
  text-align: center;
}

.final-verse-text {
  margin: 0;
  color: #4b3d2f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 4.4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.42;
}

.final-verse-initial {
  margin-right: 0.02em;
  color: var(--verse-clay);
  font-size: 1.42em;
  line-height: 0.9;
  text-shadow: 0 2px 12px rgba(214, 168, 79, 0.28);
}

.final-verse-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: verse-write-in 420ms ease-out forwards;
  animation-delay: calc(var(--word-index) * 80ms);
}

.final-verse-reference {
  margin: 15px 0 0;
  color: var(--verse-clay);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(5px);
  animation: verse-reference-in 650ms ease-out var(--reference-delay, 900ms) forwards;
}

.completion-heart-note {
  margin: 0;
  color: var(--verse-sage-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.02rem, 3vw, 1.22rem);
  font-weight: 700;
  opacity: 0;
  animation: verse-note-in 800ms ease-out var(--note-delay, 1600ms) forwards;
}

.completion-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

@keyframes verse-card-glow {
  0% { opacity: 0.62; box-shadow: 0 0 0 0 rgba(214, 168, 79, 0), 0 14px 30px rgba(74, 55, 31, 0.08); }
  42% { opacity: 1; box-shadow: 0 0 0 5px rgba(214, 168, 79, 0.12), 0 0 28px rgba(214, 168, 79, 0.22), 0 18px 38px rgba(74, 55, 31, 0.12); }
  100% { opacity: 1; box-shadow: 0 0 0 4px rgba(214, 168, 79, 0.08), 0 18px 38px rgba(74, 55, 31, 0.12); }
}

@keyframes verse-shimmer {
  0% { opacity: 0; transform: translateX(-120%); }
  18% { opacity: 0.75; }
  100% { opacity: 0; transform: translateX(120%); }
}

@keyframes verse-write-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes verse-reference-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes verse-note-in {
  to { opacity: 1; }
}

@keyframes progress-message-fade {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes verse-pop {
  50% { transform: scale(1.08); }
}

@keyframes verse-wiggle {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@media (max-width: 620px) {
  .compact-activity-toolbar {
    position: relative;
    top: auto;
    align-items: flex-start;
    flex-direction: column;
    margin: -14px -10px 18px;
    padding: 13px 10px;
    border-radius: 18px 18px 0 0;
  }

  .compact-toolbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .compact-toolbar-actions .button {
    width: 100%;
  }

  .compact-toolbar-title h1,
  .verse-heading h1 {
    white-space: normal;
  }

  .verse-activity-shell {
    padding: 14px 10px 20px;
    border-radius: 18px;
  }

  .answer-area,
  .tile-bank {
    gap: 8px;
    padding: 10px;
  }

  .verse-progress-row {
    flex-direction: column;
    gap: 8px;
  }

  .verse-tile {
    min-height: 52px;
    padding: 11px 14px;
    font-size: 1rem;
  }

  .story-info-grid {
    grid-template-columns: 1fr;
  }
}
