.dashboard-band {
  min-height: calc(100vh - 8rem);
  background:
    linear-gradient(180deg, #f4f8f7 0%, #fffdf8 58%),
    #f4f8f7;
}

.dashboard-console {
  display: grid;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) 0 clamp(2rem, 5vw, 4rem);
}

.console-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.console-top h1,
.console-top p,
.panel-title-row h2,
.panel-title-row p {
  margin: 0;
}

.console-top h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.console-top p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.console-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-strip div {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--line);
}

.summary-strip div:last-child {
  border-right: 0;
}

.summary-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-strip strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.console-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  width: fit-content;
  max-width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.console-tabs a {
  padding: 0.55rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-weight: 800;
}

.console-tabs a:hover,
.console-tabs a:focus-visible,
.console-tabs a[aria-current="page"] {
  background: var(--mint);
  color: var(--teal-dark);
}

.dashboard-ajax-shell {
  min-height: 24rem;
}

.dashboard-live-status {
  width: 100%;
  margin: 0 0 0.85rem;
}

.dashboard-ajax-panel {
  transition: opacity 160ms ease, transform 160ms ease;
}

.dashboard-ajax-panel.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

.dashboard-ajax-panel.is-entering {
  animation: dashboard-panel-in 180ms ease both;
}

@keyframes dashboard-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 1rem;
  align-items: start;
}

.console-panel {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.35rem);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.panel-title-row h2 {
  font-size: 1.35rem;
}

.panel-title-row > span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.empty-console {
  display: grid;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--cloud);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty-console span {
  color: var(--muted);
}

.account-table-wrap {
  overflow-x: auto;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.account-table th,
.account-table td {
  padding: 0.78rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.account-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.account-table td {
  color: var(--muted);
  font-size: 0.92rem;
}

.account-table td strong {
  color: var(--ink);
}

.child-form {
  display: grid;
  gap: 0.9rem;
}

.form-row-3,
.form-row-2 {
  display: grid;
  gap: 0.8rem;
}

.form-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.topic-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.topic-strip legend {
  width: 100%;
  margin-bottom: 0.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.topic-strip label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: auto;
  min-height: 2.15rem;
  padding: 0.45rem 0.65rem;
  background: var(--cloud);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.topic-strip input {
  width: 0.95rem;
  min-width: 0.95rem;
  height: 0.95rem;
}

.form-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.2rem;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.72rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: rgba(14, 126, 120, 0.45);
  color: var(--teal-dark);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.billing-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.billing-overview > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--cloud);
}

.billing-overview > div:last-child {
  border-right: 0;
}

.billing-overview span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.billing-overview strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.billing-actions form {
  margin: 0;
}

.activity-review-list {
  display: grid;
  gap: 0.85rem;
}

.activity-roadmap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
  background: var(--mint);
}

.activity-roadmap strong {
  color: var(--teal-dark);
}

.activity-roadmap span {
  color: var(--teal-dark);
  font-size: 0.9rem;
}

.activity-review-child {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  overflow: hidden;
}

.activity-review-child > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  background: var(--cloud);
  cursor: pointer;
}

.activity-review-child > summary span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.activity-review-child > summary strong {
  color: var(--ink);
}

.activity-learning-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.65fr);
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.activity-learning-summary section {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.activity-learning-summary h3,
.activity-learning-summary p {
  margin: 0;
}

.activity-learning-summary p {
  color: var(--muted);
}

.course-progress-list {
  display: grid;
  gap: 0.45rem;
}

.course-progress-item {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 0.8fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid rgba(15, 118, 110, 0.13);
  border-radius: calc(var(--radius) - 2px);
  background: var(--cloud);
}

.course-progress-item > div:first-child {
  display: grid;
  gap: 0.15rem;
}

.course-progress-item span,
.course-progress-item em,
.learning-meta span {
  color: var(--muted);
  font-size: 0.84rem;
}

.course-progress-item em {
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.mini-progress-bar {
  height: 0.58rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
}

.mini-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.mini-progress-bar.progress-20 span { width: 20%; }
.mini-progress-bar.progress-33 span { width: 33%; }
.mini-progress-bar.progress-40 span { width: 40%; }
.mini-progress-bar.progress-17 span { width: 17%; }
.mini-progress-bar.progress-50 span { width: 50%; }
.mini-progress-bar.progress-60 span { width: 60%; }
.mini-progress-bar.progress-67 span { width: 67%; }
.mini-progress-bar.progress-80 span { width: 80%; }
.mini-progress-bar.progress-83 span { width: 83%; }
.mini-progress-bar.progress-100 span { width: 100%; }

.parent-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.parent-badge-row span {
  padding: 0.34rem 0.52rem;
  border-radius: 999px;
  background: #fff7d8;
  color: #7a560d;
  font-size: 0.8rem;
  font-weight: 900;
}

.mini-pager-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding-top: 0.15rem;
}

.mini-pager-controls span {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.mini-pager-controls .icon-page-button {
  width: 1.95rem;
  height: 1.95rem;
  font-size: 1.15rem;
}

.mini-pager-controls .icon-page-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.learning-meta {
  display: grid;
  gap: 0.15rem;
  padding-top: 0.3rem;
}

.activity-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.memory-panel,
.parent-chat-reader {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  min-width: 0;
}

.memory-panel h3,
.memory-panel p,
.parent-chat-reader h3,
.parent-chat-reader p,
.parent-chat-message p {
  margin: 0;
}

.memory-panel > div:first-child p,
.parent-chat-reader header p,
.memory-summary p {
  color: var(--muted);
}

.memory-summary {
  display: grid;
  gap: 0.42rem;
  min-width: 0;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.memory-summary span {
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-review-list {
  display: grid;
  gap: 0.4rem;
}

.memory-add-form {
  display: grid;
  grid-template-columns: minmax(8rem, 0.65fr) minmax(12rem, 1fr) auto;
  gap: 0.42rem;
  align-items: end;
  min-width: 0;
  padding: 0.48rem;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
}

.memory-add-form label {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.memory-add-form label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.memory-add-form input,
.memory-add-form select {
  min-height: 2.25rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.memory-add-form input {
  padding: 0.5rem 0.62rem;
}

.memory-add-form select {
  padding: 0.48rem 0.55rem;
}

.memory-add-form .secondary-button {
  min-height: 2.25rem;
  padding: 0.45rem 0.68rem;
  white-space: nowrap;
}

.memory-review-item {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.48rem;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
}

.memory-review-item.approved {
  border-color: rgba(35, 99, 77, 0.2);
  background: #f8fffb;
}

.memory-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.memory-pill-wrap {
  position: relative;
}

.memory-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  max-width: min(26rem, 100%);
  min-height: 2rem;
  padding: 0.34rem 0.58rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #eefbf7);
  color: var(--ink);
  box-shadow: 0 0.25rem 0.7rem rgba(12, 74, 68, 0.06);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.memory-pill:hover,
.memory-pill:focus-visible,
.memory-pill[aria-expanded="true"] {
  border-color: rgba(15, 118, 110, 0.45);
  background: #ffffff;
}

.memory-pill > span {
  flex: 0 0 auto;
  padding: 0.1rem 0.34rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal-dark);
  font-size: 0.66rem;
  line-height: 1.2;
  text-transform: uppercase;
}

.memory-pill-popover {
  position: absolute;
  z-index: 12;
  top: calc(100% + 0.35rem);
  left: 0;
  width: min(22rem, calc(100vw - 2.5rem));
  padding: 0.52rem;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1rem 2.4rem rgba(15, 23, 42, 0.16);
}

.memory-pill-popover::before {
  content: "";
  position: absolute;
  top: -0.42rem;
  left: 1rem;
  width: 0.72rem;
  height: 0.72rem;
  border-top: 1px solid rgba(15, 118, 110, 0.24);
  border-left: 1px solid rgba(15, 118, 110, 0.24);
  background: #fff;
  transform: rotate(45deg);
}

.memory-pill-edit {
  display: grid;
  gap: 0.4rem;
}

.memory-pill-edit label {
  display: grid;
  gap: 0.2rem;
}

.memory-pill-edit label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.memory-pill-edit input {
  min-height: 2.25rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.5rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.memory-review-item label {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.memory-review-item label span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.memory-review-item input {
  min-height: 2.25rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.9rem;
}

.memory-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.memory-review-actions .secondary-button,
.memory-review-actions .danger-button {
  min-height: 2.05rem;
  padding: 0.38rem 0.62rem;
  font-size: 0.8rem;
}

.history-toggle-form {
  display: grid;
  gap: 0.25rem;
}

.history-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  background:
    radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.14), transparent 35%),
    #fff;
  color: var(--ink);
  cursor: pointer;
}

.history-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.history-switch > span {
  position: relative;
  flex: 0 0 auto;
  width: 3.25rem;
  height: 1.7rem;
  border: 1px solid rgba(71, 85, 105, 0.22);
  border-radius: 999px;
  background: #dbe4e8;
  box-shadow: inset 0 0.1rem 0.35rem rgba(15, 23, 42, 0.16);
  transition: background 160ms ease, border-color 160ms ease;
}

.history-switch > span::after {
  content: "";
  position: absolute;
  top: 0.19rem;
  left: 0.2rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.18rem 0.48rem rgba(15, 23, 42, 0.22);
  transition: transform 160ms ease;
}

.history-switch input:checked + span {
  border-color: rgba(15, 118, 110, 0.45);
  background: linear-gradient(135deg, var(--teal), #22c55e);
}

.history-switch input:checked + span::after {
  transform: translateX(1.55rem);
}

.history-switch input:focus-visible + span {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 3px;
}

.history-switch strong {
  flex: 1;
  font-size: 0.9rem;
}

.history-danger-setting.clear-history-confirm {
  justify-self: stretch;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.history-danger-setting summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(141, 47, 28, 0.22);
  border-radius: 999px;
  background:
    radial-gradient(circle at 15% 50%, rgba(239, 68, 68, 0.12), transparent 35%),
    #fff;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}

.history-danger-setting summary::-webkit-details-marker {
  display: none;
}

.history-danger-setting summary > span {
  position: relative;
  flex: 0 0 auto;
  width: 3.25rem;
  height: 1.7rem;
  border: 1px solid rgba(141, 47, 28, 0.28);
  border-radius: 999px;
  background: #fee2e2;
  box-shadow: inset 0 0.1rem 0.35rem rgba(127, 29, 29, 0.12);
}

.history-danger-setting summary > span::before,
.history-danger-setting summary > span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.9rem;
  height: 0.12rem;
  border-radius: 999px;
  background: #991b1b;
}

.history-danger-setting summary > span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.history-danger-setting summary > span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.history-danger-setting summary strong {
  flex: 1;
  color: var(--ink);
  font-size: 0.9rem;
}

.history-danger-setting form {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.45rem;
  padding: 0.65rem;
  border: 1px solid rgba(141, 47, 28, 0.18);
  border-radius: var(--radius);
  background: #fff8f6;
}

.history-danger-setting form p {
  margin: 0;
  color: #7f1d1d;
  font-size: 0.86rem;
}

.history-danger-setting .danger-button {
  justify-self: start;
  min-height: 2.1rem;
  padding: 0.42rem 0.7rem;
  font-size: 0.82rem;
}

.parent-chat-reader header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-end;
}

.activity-actions span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.icon-page-button {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--teal-dark);
  font-size: 1.45rem;
  font-weight: 900;
}

.icon-page-button:hover,
.icon-page-button:focus-visible {
  border-color: rgba(15, 118, 110, 0.44);
  background: var(--mint);
  color: var(--teal-dark);
}

.icon-page-button.is-disabled {
  pointer-events: none;
  opacity: 0.35;
}

.parent-chat-window {
  display: grid;
  gap: 0.7rem;
  max-height: 30rem;
  padding: 0.85rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(243, 248, 251, 0.76), rgba(255, 255, 255, 1)),
    white;
}

.parent-chat-message {
  display: grid;
  gap: 0.35rem;
  width: min(88%, 34rem);
  padding: 0.72rem 0.82rem;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(37, 51, 73, 0.08);
}

.parent-chat-message.child {
  justify-self: end;
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.parent-chat-message.assistant {
  justify-self: start;
}

.parent-chat-message div {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: inherit;
}

.parent-chat-message span {
  opacity: 0.72;
  font-size: 0.76rem;
  white-space: nowrap;
}

.parent-chat-message small {
  width: fit-content;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: var(--cloud);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.parent-chat-message.child small {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.86);
}

.parent-chat-message em {
  width: fit-content;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #fff0ed;
  color: #9b2c1f;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.clear-history-confirm {
  justify-self: end;
  width: min(100%, 24rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.clear-history-confirm summary {
  padding: 0.7rem 0.85rem;
  color: #9b2c1f;
  font-weight: 900;
  cursor: pointer;
}

.clear-history-confirm form {
  display: grid;
  gap: 0.65rem;
  padding: 0 0.85rem 0.85rem;
}

.clear-history-confirm span {
  color: var(--muted);
  font-size: 0.9rem;
}

.seat-purchase {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.seat-purchase > div:first-child {
  display: grid;
  gap: 0.15rem;
}

.seat-purchase > div:first-child span {
  color: var(--muted);
}

.seat-purchase-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.seat-purchase-actions form {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  margin: 0;
}

.seat-purchase-actions label {
  max-width: 5.5rem;
}

.seat-purchase-actions input {
  min-height: 2.8rem;
}

.control-stack {
  display: grid;
}

.control-stack > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.control-stack > div:last-child {
  border-bottom: 0;
}

.control-stack span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.control-stack strong {
  color: var(--ink);
}

.control-stack a {
  width: fit-content;
  margin-top: 0.2rem;
  color: var(--teal-dark);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.compact-stack > div {
  padding: 0.65rem 0;
}

.settings-grid {
  display: grid;
  gap: 1rem;
}

.settings-form {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.settings-form h3 {
  margin-bottom: 0.2rem;
  font-size: 1.05rem;
}

.settings-form p {
  color: var(--muted);
}

.settings-form .primary-button,
.account-delete-confirm .danger-button {
  width: fit-content;
}

.account-delete-confirm {
  padding: 1rem;
  border: 1px solid rgba(161, 56, 37, 0.2);
  border-radius: var(--radius);
  background: #fffaf8;
}

.account-delete-confirm summary {
  color: #a13825;
  font-weight: 900;
  cursor: pointer;
}

.account-delete-confirm form {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.account-delete-confirm p {
  color: var(--muted);
}

.child-edit-list {
  display: grid;
  gap: 0.75rem;
}

.seat-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(14, 126, 120, 0.22);
  border-radius: var(--radius);
  background: #f1fbf8;
}

.seat-notice strong {
  color: var(--ink);
}

.seat-notice span {
  flex: 1;
  color: var(--muted);
}

.child-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.child-editor > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
}

.child-editor > summary::-webkit-details-marker {
  display: none;
}

.child-editor > summary span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.child-editor .child-form {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.seat-assign-form {
  display: flex;
  justify-content: flex-end;
  padding: 0 1rem 1rem;
}

.delete-child-confirm {
  margin: 0 1rem 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.delete-child-confirm summary {
  display: inline-flex;
  width: auto;
  padding: 0;
  color: #a13825;
  font-weight: 900;
  cursor: pointer;
}

.delete-child-confirm form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.delete-child-confirm span {
  color: var(--muted);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.68rem 0.95rem;
  border: 1px solid rgba(161, 56, 37, 0.35);
  border-radius: 0.7rem;
  background: #fff5f2;
  color: #8f2f1f;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.child-form.compact {
  margin-top: 0;
  padding-top: 1rem;
}

.kid-room-band {
  min-height: calc(100vh - 8rem);
  background:
    linear-gradient(180deg, rgba(223, 246, 234, 0.72), rgba(255, 253, 248, 1)),
    #fffdf8;
}

.kid-room-shell {
  display: grid;
  gap: 1rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) 0;
}

.kid-hero,
.kid-today,
.kid-section,
.helper-onboarding {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kid-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.kid-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.kid-hero h1,
.kid-hero p,
.kid-today p,
.kid-section p,
.helper-onboarding p {
  margin: 0;
}

.kid-hero p,
.kid-topic-grid p,
.kid-room-limit span,
.kid-today p,
.kid-section p,
.helper-onboarding p {
  color: var(--muted);
}

.kid-room-limit {
  display: grid;
  gap: 0.2rem;
  min-width: 9rem;
  padding: 0.85rem;
  background: var(--mint);
  border-radius: var(--radius);
  text-align: center;
}

.kid-room-limit strong {
  color: var(--teal-dark);
  font-size: 1.35rem;
}

.helper-choice-form {
  display: grid;
  gap: 1rem;
}

.helper-picker {
  position: relative;
  max-width: 100%;
  overflow: hidden;
}

.helper-choice-scroll {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.helper-card {
  position: relative;
  display: grid;
  gap: 0.45rem;
  align-content: start;
  min-height: 20rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
  cursor: pointer;
}

.helper-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.helper-card.is-selected {
  border-color: var(--helper-color);
  box-shadow: inset 0 0 0 2px var(--helper-color);
  background: #fff;
}

.helper-portrait {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: #fff;
}

.helper-card em,
.helper-card span:last-child,
.helper-mini span,
.helper-panel header span {
  color: var(--muted);
  font-style: normal;
}

.helper-beep { --helper-color: #0e7e78; }
.helper-nova { --helper-color: #4257b2; }
.helper-pip { --helper-color: #b6467a; }
.helper-milo { --helper-color: #d07322; }
.helper-luma { --helper-color: #4f8f45; }

.helper-scroll-button {
  display: none;
}

.helper-choice-form .primary-button {
  width: fit-content;
}

.kid-today {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.today-main {
  display: grid;
  gap: 0.7rem;
}

.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding-top: 0.25rem;
}

.today-helper {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  min-width: min(100%, 20rem);
  padding: 0.9rem 0.9rem 2.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.today-helper > div {
  display: grid;
  align-content: center;
  gap: 0.15rem;
}

.today-helper span {
  color: var(--muted);
}

.helper-portrait-small {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border: 3px solid var(--helper-color, var(--teal));
  border-radius: 999px;
  background: #fff;
}

.helper-mini {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 14rem;
  padding: 0.8rem 0.8rem 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.helper-change-link {
  position: absolute;
  right: 0.8rem;
  bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
}

.helper-change-link:hover,
.helper-change-link:focus-visible {
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.helper-thumb {
  width: 3.2rem;
  height: 3.2rem;
  object-fit: cover;
  border: 3px solid var(--helper-color, var(--teal));
  border-radius: 999px;
  background: #fff;
}

.kid-section-head {
  display: grid;
  gap: 0.2rem;
}

.kid-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.kid-topic-grid article {
  display: grid;
  gap: 0.55rem;
  min-height: 11rem;
  padding: 1rem;
  background: var(--cloud);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kid-topic-grid span {
  color: var(--teal-dark);
  font-weight: 900;
}

.kid-topic-grid strong {
  font-size: 1.2rem;
}

.progress-panel {
  gap: 0.85rem;
}

.badge-shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.badge-progress-meter {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 0.45rem;
  width: fit-content;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: var(--mint);
}

.badge-progress-meter strong {
  color: var(--teal-dark);
  font-size: 1.35rem;
}

.badge-progress-meter span {
  color: var(--teal-dark);
  font-weight: 900;
}

.badge-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-content: start;
}

.kid-badge {
  --badge-a: #0e7e78;
  --badge-b: #dff6ea;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  min-height: 7.4rem;
  padding: 0.85rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--badge-a), white 72%);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--badge-b), white 16%), #fff 72%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.kid-badge[hidden] {
  display: none !important;
}

.kid-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 15%, color-mix(in srgb, var(--badge-a), transparent 78%), transparent 30%),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  opacity: 0.52;
}

.kid-badge:hover,
.kid-badge:focus-within {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--badge-a), white 42%);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.1);
}

.kid-badge > * {
  position: relative;
}

.kid-badge-medal {
  display: grid;
  place-items: center;
  width: 3.8rem;
  height: 3.8rem;
  border: 0.22rem solid color-mix(in srgb, var(--badge-a), white 34%);
  border-radius: 999px;
  background:
    linear-gradient(145deg, #fff, color-mix(in srgb, var(--badge-b), white 12%));
  box-shadow:
    inset 0 0 0 0.28rem rgba(255, 255, 255, 0.7),
    0 0.5rem 1rem color-mix(in srgb, var(--badge-a), transparent 80%);
}

.kid-badge-medal span {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: var(--badge-a);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 950;
}

.kid-badge div {
  display: grid;
  align-content: center;
  gap: 0.22rem;
}

.kid-badge div > span {
  color: var(--badge-a);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.kid-badge strong {
  color: var(--ink);
  font-size: 1rem;
}

.kid-badge p {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.badge-shelf-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.badge-shelf-controls[hidden] {
  display: none;
}

.badge-shelf-controls span {
  min-width: 4.5rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
}

.kid-badge.is-locked {
  filter: saturate(0.66);
  opacity: 0.74;
}

.kid-badge.is-locked .kid-badge-medal {
  border-style: dashed;
}

.kid-badge.is-locked .kid-badge-medal span {
  background: #64748b;
}

.badge-theme-ai { --badge-a: #4257b2; --badge-b: #e8edff; }
.badge-theme-shield { --badge-a: #0e7e78; --badge-b: #dff6ea; }
.badge-theme-prompt { --badge-a: #b6467a; --badge-b: #ffe7f1; }
.badge-theme-word { --badge-a: #4f8f45; --badge-b: #e9f8df; }
.badge-theme-first { --badge-a: #be891b; --badge-b: #fff1bf; }
.badge-theme-clap { --badge-a: #d07322; --badge-b: #ffe6c7; }
.badge-theme-sentence { --badge-a: #2563a8; --badge-b: #dff0ff; }
.badge-theme-scout { --badge-a: #7c3f98; --badge-b: #f1e5ff; }
.badge-theme-rhythm { --badge-a: #9b3a2f; --badge-b: #ffe0dc; }
.badge-theme-number { --badge-a: #166995; --badge-b: #dff5ff; }
.badge-theme-science { --badge-a: #327750; --badge-b: #ddf7e8; }
.badge-theme-story { --badge-a: #8f4b1f; --badge-b: #ffe5cf; }
.badge-theme-creative { --badge-a: #b6467a; --badge-b: #ffe7f1; }
.badge-theme-custom { --badge-a: #334155; --badge-b: #e2e8f0; }

.course-hero,
.course-progress-panel,
.course-steps {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.course-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.course-hero h1,
.course-hero p,
.course-step h2,
.course-step p,
.course-tip p {
  margin: 0;
}

.course-hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 1;
}

.course-hero p,
.course-progress-panel span,
.course-step > div p,
.course-tip p {
  color: var(--muted);
}

.course-badge {
  display: grid;
  gap: 0.2rem;
  min-width: 10rem;
  padding: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: var(--mint);
  text-align: center;
}

.course-badge span {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.course-badge strong {
  color: var(--teal-dark);
  font-size: 1.25rem;
}

.course-badge.earned {
  background: #fff7d8;
  border-color: rgba(190, 137, 27, 0.3);
}

.course-progress-panel {
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  align-items: center;
}

.course-progress-panel strong {
  color: var(--ink);
  font-size: 1.5rem;
}

.course-progress-bar {
  height: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cloud);
  border: 1px solid var(--line);
}

.course-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--teal);
}

.course-progress-bar.progress-20 span { width: 20%; }
.course-progress-bar.progress-33 span { width: 33%; }
.course-progress-bar.progress-40 span { width: 40%; }
.course-progress-bar.progress-60 span { width: 60%; }
.course-progress-bar.progress-67 span { width: 67%; }
.course-progress-bar.progress-80 span { width: 80%; }
.course-progress-bar.progress-100 span { width: 100%; }

.course-step {
  display: grid;
  grid-template-columns: minmax(7rem, 8rem) minmax(0, 1fr) minmax(12rem, 18rem) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.course-step.is-complete {
  border-color: rgba(15, 118, 110, 0.3);
  background: #f3fbf8;
}

.course-step.is-locked {
  opacity: 0.68;
}

.course-status {
  display: grid;
  gap: 0.2rem;
}

.course-status span {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.course-status strong {
  color: var(--ink);
}

.course-step h2 {
  font-size: 1.1rem;
}

.course-tip {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: calc(var(--radius) - 2px);
  background: white;
}

.course-tip strong {
  color: var(--teal-dark);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.course-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.word-game-band {
  min-height: calc(100vh - 8rem);
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 216, 92, 0.28), transparent 24rem),
    radial-gradient(circle at 84% 16%, rgba(56, 189, 248, 0.2), transparent 22rem),
    linear-gradient(180deg, #f6fbff 0%, #fffdf7 58%, #f4fbf7 100%);
}

.word-game-shell {
  display: grid;
  gap: 1rem;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.6rem) 0 clamp(2rem, 4vw, 3rem);
}

.word-game-hero,
.word-game-topbar,
.word-mode-tabs,
.word-game-stage,
.word-map,
.word-game-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.06);
}

.word-game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: clamp(1rem, 3vw, 1.5rem);
  overflow: hidden;
}

.word-game-hero h1,
.word-game-hero p,
.word-panel-head h2,
.word-panel-head p,
.word-helper-card p,
.word-selected-card p {
  margin: 0;
}

.word-game-hero h1 {
  font-size: clamp(2.4rem, 6vw, 5.6rem);
  line-height: 0.95;
}

.word-game-hero p,
.word-panel-head p,
.word-helper-card p,
.word-selected-card p {
  color: var(--muted);
}

.word-score-card {
  display: grid;
  gap: 0.18rem;
  min-width: 11rem;
  padding: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff7d8, #f0fbf7);
  text-align: center;
}

.word-score-card span,
.word-score-card em,
.word-game-topbar span,
.word-selected-card > span,
.word-achievements > span,
.word-panel-head > span,
.word-explorer-grid article > span {
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

.word-score-card strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.word-game-topbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.word-game-topbar div {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--line);
}

.word-game-topbar div:last-child {
  border-right: 0;
}

.word-game-topbar strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.word-mode-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
}

.word-mode-tabs button {
  min-height: 2.55rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.word-mode-tabs button:hover,
.word-mode-tabs button:focus-visible,
.word-mode-tabs button[aria-current="true"] {
  background: var(--mint);
  color: var(--teal-dark);
}

.word-game-stage {
  display: grid;
  grid-template-columns: minmax(15rem, 0.32fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 38rem;
  padding: 1rem;
}

.word-side-panel,
.word-mode-panel {
  min-width: 0;
}

.word-side-panel {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.word-helper-card,
.word-selected-card,
.word-achievements {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.word-helper-card {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.word-selected-card strong {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1;
}

.word-selected-card div,
.word-achievements div,
.word-explorer-grid article div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.word-selected-card div span,
.word-achievements em,
.word-explorer-grid article div span {
  padding: 0.28rem 0.48rem;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.word-mode-panel {
  display: none;
  align-content: start;
  gap: 1rem;
  padding: clamp(0.85rem, 2.2vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.word-mode-panel.is-active {
  display: grid;
}

.word-panel-head {
  display: grid;
  gap: 0.24rem;
}

.word-panel-head h2 {
  font-size: clamp(1.5rem, 3.8vw, 2.6rem);
  line-height: 1;
}

.word-filter-row,
.sentence-helper,
.word-game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.word-filter-row button,
.sentence-helper button {
  min-height: 2.2rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

.word-filter-row button[aria-current="true"],
.word-filter-row button:hover,
.sentence-helper button:hover,
.sentence-helper button:focus-visible {
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--mint);
  color: var(--teal-dark);
}

.word-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.word-card {
  display: grid;
  gap: 0.4rem;
  min-height: 8.5rem;
  padding: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(240, 251, 247, 0.78)),
    #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.word-card:hover,
.word-card:focus-visible,
.word-card.is-selected {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0.75rem 1.6rem rgba(15, 118, 110, 0.12);
  transform: translateY(-2px);
}

.word-card span {
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.word-card strong {
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

.word-card em {
  align-self: end;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
}

.clap-pad {
  display: grid;
  place-items: center;
  gap: 0.2rem;
  justify-self: center;
  width: min(18rem, 72vw);
  aspect-ratio: 1;
  border: 0.45rem solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.9), transparent 35%),
    linear-gradient(145deg, #fff7d8, #9ee7d7);
  color: var(--teal-dark);
  box-shadow: 0 1.2rem 2.4rem rgba(15, 118, 110, 0.18);
  cursor: pointer;
}

.clap-pad strong {
  font-size: clamp(3rem, 10vw, 5rem);
  line-height: 0.85;
}

.clap-pad span {
  font-size: 1.05rem;
  font-weight: 950;
}

.clap-beats,
.tile-bank,
.word-build-lane,
.meaning-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.clap-beats span {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border: 2px dashed rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  background: var(--cloud);
  color: var(--teal-dark);
  font-weight: 950;
}

.clap-beats span.is-hit {
  border-style: solid;
  background: #fff7d8;
}

.tile-bank button,
.word-build-lane span {
  min-height: 3rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 14px;
  background: var(--mint);
  color: var(--teal-dark);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 950;
}

.tile-bank button {
  cursor: pointer;
}

.tile-bank button:disabled {
  opacity: 0.38;
}

.word-build-lane {
  min-height: 4.2rem;
  padding: 0.65rem;
  border: 1px dashed rgba(15, 118, 110, 0.32);
  border-radius: var(--radius);
  background: var(--cloud);
}

.meaning-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meaning-options button {
  min-height: 7rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.meaning-options button.is-correct {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--mint);
  color: var(--teal-dark);
}

.meaning-options button.is-wrong {
  border-color: rgba(155, 44, 31, 0.25);
  background: #fff0ed;
  color: #8d2f1c;
}

.word-mode-panel textarea {
  width: 100%;
  min-height: 10rem;
  resize: vertical;
  padding: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.45;
}

.word-explorer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.word-explorer-grid article {
  display: grid;
  gap: 0.45rem;
  min-height: 8rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.word-explorer-grid article p {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
}

.word-map {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.65rem;
}

.word-map div {
  display: grid;
  gap: 0.24rem;
  min-height: 4.3rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--cloud);
}

.word-map div.is-complete {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--mint);
}

.word-map span {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 950;
}

.word-map strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.word-game-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
}

.word-adventure-shell {
  display: grid;
  gap: 1rem;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.6rem) 0 clamp(2rem, 4vw, 3rem);
}

.word-adventure-hero,
.word-adventure-stats,
.word-adventure-grid,
.word-adventure-progress,
.word-game-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.06);
}

.word-adventure-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.word-adventure-hero h1,
.word-adventure-hero p,
.word-start-panel p,
.challenge-top h2,
.challenge-top p,
.round-complete-card h2,
.round-complete-card p {
  margin: 0;
}

.word-adventure-hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 5rem);
  line-height: 0.96;
}

.word-adventure-hero p,
.word-start-panel p,
.challenge-top p,
.round-complete-card p,
.word-round-card p,
.word-adventure-helper p {
  color: var(--muted);
}

.word-adventure-badge {
  display: grid;
  gap: 0.18rem;
  min-width: 11rem;
  padding: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff7d8, #f0fbf7);
  text-align: center;
}

.word-adventure-badge span,
.word-adventure-badge em,
.word-adventure-stats span,
.word-round-card > span,
.word-adventure-achievements > span,
.challenge-top span,
.challenge-word span,
.round-complete-card > span {
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

.word-adventure-badge strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.word-adventure-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.word-adventure-stats div {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--line);
}

.word-adventure-stats div:last-child {
  border-right: 0;
}

.word-adventure-stats strong {
  color: var(--ink);
  font-size: 1.22rem;
}

.word-adventure-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 0.32fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 40rem;
  padding: 1rem;
}

.word-mobile-exit {
  display: none;
}

.word-adventure-side {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
}

.word-adventure-helper,
.word-round-card,
.word-world-map,
.word-adventure-achievements {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.word-adventure-helper {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.word-round-card strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 3.5vw, 2.3rem);
}

.word-round-card [data-round-stars],
.round-complete-stars {
  display: flex;
  gap: 0.25rem;
  color: #cbd5e1;
  font-size: 1.35rem;
}

.word-round-card [data-round-stars] span.is-earned,
.round-complete-stars span.is-earned {
  color: #f5b301;
}

.word-world-map button {
  display: grid;
  gap: 0.18rem;
  padding: 0.65rem;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.word-world-map button:hover,
.word-world-map button:focus-visible,
.word-world-map button[aria-current="true"] {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--mint);
}

.word-world-map span {
  color: var(--muted);
  font-size: 0.82rem;
}

.word-world-map em {
  width: fit-content;
  padding: 0.16rem 0.45rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  color: var(--teal);
  background: rgba(15, 118, 110, 0.07);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.word-adventure-achievements div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.word-adventure-achievements em {
  padding: 0.28rem 0.48rem;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.word-adventure-stage {
  min-width: 0;
  padding: clamp(0.85rem, 2.2vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.word-adventure-scene {
  display: grid;
  gap: 1rem;
}

.word-adventure-scene[hidden],
.word-adventure-bank[hidden] {
  display: none !important;
}

.word-start-panel,
.round-complete-card {
  display: grid;
  gap: 1rem;
  min-height: 28rem;
  align-content: center;
  justify-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 216, 92, 0.32), transparent 15rem),
    radial-gradient(circle at 82% 22%, rgba(34, 197, 94, 0.18), transparent 14rem),
    var(--cloud);
  text-align: center;
}

.word-machine {
  display: flex;
  gap: 0.45rem;
}

.word-machine span {
  display: grid;
  place-items: center;
  width: clamp(3rem, 9vw, 5rem);
  aspect-ratio: 1;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 18px;
  background: #fff;
  color: var(--teal-dark);
  font-size: clamp(1.4rem, 4vw, 2.5rem);
  font-weight: 950;
  box-shadow: 0 0.8rem 1.6rem rgba(15, 118, 110, 0.1);
}

.challenge-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
}

.challenge-top h2 {
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1;
}

.challenge-word {
  display: grid;
  gap: 0.12rem;
  min-width: 10rem;
  padding: 0.75rem;
  border: 2px solid rgba(15, 118, 110, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #e5fbef, #ffffff);
  text-align: center;
  box-shadow: inset 0 0.28rem 0 rgba(15, 118, 110, 0.12);
}

.challenge-word strong {
  color: var(--teal-dark);
  font-size: 1.45rem;
}

.challenge-word.is-masked {
  background: #f7fafc;
}

.challenge-word.is-masked strong {
  color: var(--ink);
}

.challenge-playfield {
  min-height: 22rem;
  display: grid;
  align-content: center;
  gap: 1rem;
  padding: clamp(0.85rem, 2.5vw, 1.35rem);
  border: 2px solid rgba(15, 118, 110, 0.16);
  border-radius: var(--radius);
  background: #f8fbfd;
}

.adventure-hint-panel {
  align-self: start;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(66, 87, 178, 0.2);
  border-left: 0.28rem solid #4257b2;
  border-radius: var(--radius);
  background: #f4f7ff;
  color: #24345d;
  font-weight: 800;
}

.adventure-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: #ffffff;
}

.adventure-options.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 32rem;
  width: 100%;
  margin-inline: auto;
}

.adventure-answer,
.adventure-tile-bank button {
  min-height: 4.2rem;
  padding: 0.85rem;
  border: 2px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: #f7fffb;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.adventure-answer:hover,
.adventure-answer:focus-visible,
.adventure-tile-bank button:hover,
.adventure-tile-bank button:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  transform: translateY(-1px);
}

.adventure-answer.is-correct {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--mint);
  color: var(--teal-dark);
}

.adventure-answer.is-wrong {
  border-color: rgba(155, 44, 31, 0.28);
  background: #fff0ed;
  color: #8d2f1c;
}

.adventure-bubbles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.adventure-bubbles .adventure-answer {
  display: grid;
  place-items: center;
  width: min(8.5rem, 42vw);
  aspect-ratio: 1;
  border-radius: 999px;
}

.adventure-tile-bank,
.adventure-build-lane {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.adventure-tile-bank button {
  min-height: 3.2rem;
  min-width: 5rem;
  color: var(--teal-dark);
}

.adventure-tile-bank button:disabled {
  opacity: 0.38;
}

.adventure-build-lane {
  min-height: 4.4rem;
  padding: 0.75rem;
  border: 1px dashed rgba(15, 118, 110, 0.34);
  border-radius: var(--radius);
  background: #fff;
}

.adventure-build-lane span,
.mystery-clue strong {
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 1.15rem;
  font-weight: 950;
}

.letter-lock-card {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  width: min(100%, 38rem);
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.letter-lock-card strong {
  color: var(--teal-dark);
  font-size: clamp(1.8rem, 6vw, 3.4rem);
  line-height: 1;
}

.letter-lock-card span {
  color: var(--muted);
  font-weight: 850;
}

.mystery-clue {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  text-align: center;
}

.mystery-clue span {
  color: var(--muted);
  font-weight: 850;
}

.mystery-clue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mystery-clue-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: var(--radius);
  background: #fff;
}

.adventure-full-clue {
  width: min(100%, 42rem);
  margin-inline: auto;
}

.mystery-clue-card span {
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mystery-clue-card strong {
  color: var(--ink);
}

.challenge-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.word-adventure-progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.65rem;
}

.word-adventure-progress div {
  display: grid;
  gap: 0.24rem;
  min-height: 4.3rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--cloud);
}

.word-adventure-progress div.is-complete {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--mint);
}

.word-adventure-progress span {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 950;
}

.word-adventure-progress strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.number-quest-band {
  min-height: calc(100vh - 8rem);
  background:
    linear-gradient(135deg, rgba(238, 247, 255, 0.96), rgba(255, 252, 239, 0.96) 48%, rgba(241, 250, 246, 0.98)),
    repeating-linear-gradient(90deg, rgba(15, 118, 110, 0.04) 0 1px, transparent 1px 4.5rem);
}

.number-quest-shell {
  display: grid;
  gap: 1rem;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.6rem) 0 clamp(2rem, 4vw, 3rem);
}

.number-quest-hero,
.number-quest-stats,
.number-quest-grid,
.number-quest-progress,
.number-quest-shell .word-game-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.06);
}

.number-quest-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.number-quest-hero h1,
.number-quest-hero p,
.number-start-panel p,
.number-challenge-top h2,
.number-challenge-top p,
.number-complete-card h2,
.number-complete-card p,
.number-strategy-panel p {
  margin: 0;
}

.number-quest-hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 5rem);
  line-height: 0.96;
}

.number-quest-hero p,
.number-start-panel p,
.number-challenge-top p,
.number-complete-card p,
.number-round-card p,
.number-quest-helper p,
.number-strategy-panel p {
  color: var(--muted);
}

.number-quest-badge {
  display: grid;
  gap: 0.18rem;
  min-width: 11rem;
  padding: 0.9rem;
  border: 1px solid rgba(66, 87, 178, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #edf4ff, #fff7d8);
  text-align: center;
}

.number-quest-badge.earned {
  border-color: rgba(15, 118, 110, 0.35);
  background: linear-gradient(180deg, #e5fbef, #fff7d8);
}

.number-quest-badge span,
.number-quest-badge em,
.number-quest-stats span,
.number-round-card > span,
.number-quest-achievements > span,
.number-challenge-top span,
.number-question-card span,
.number-complete-card > span,
.number-panel-head span {
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

.number-quest-badge strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.number-quest-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.number-quest-stats div {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--line);
}

.number-quest-stats div:last-child {
  border-right: 0;
}

.number-quest-stats strong {
  color: var(--ink);
  font-size: 1.22rem;
}

.number-quest-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 0.32fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 40rem;
  padding: 1rem;
}

.number-mobile-exit {
  display: none;
}

.fact-mobile-exit {
  display: none;
}

.number-quest-side {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
}

.number-quest-helper,
.number-round-card,
.number-world-map,
.number-quest-achievements {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.number-quest-helper {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.number-round-card strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 3.5vw, 2.3rem);
}

.number-round-card [data-number-round-stars],
.number-complete-stars {
  display: flex;
  gap: 0.25rem;
  color: #cbd5e1;
  font-size: 1.35rem;
}

.number-round-card [data-number-round-stars] span.is-earned,
.number-complete-stars span.is-earned {
  color: #f5b301;
}

.number-world-map {
  grid-template-columns: 1fr;
  padding: 0.5rem;
}

.number-world-map button {
  display: grid;
  gap: 0.18rem;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.number-world-map button[aria-current="true"] {
  border-color: rgba(66, 87, 178, 0.38);
  background: #eef4ff;
}

.number-world-map button.is-locked {
  cursor: not-allowed;
  opacity: 0.58;
}

.number-world-map button.is-locked em {
  border-color: rgba(100, 116, 139, 0.2);
  background: rgba(100, 116, 139, 0.08);
  color: #64748b;
}

.number-world-map span {
  color: var(--muted);
  font-size: 0.82rem;
}

.number-world-map em,
.number-quest-achievements em {
  width: fit-content;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  font-style: normal;
  font-weight: 900;
}

.number-world-map em {
  border: 1px solid rgba(66, 87, 178, 0.18);
  background: rgba(66, 87, 178, 0.08);
  color: #31458f;
  font-size: 0.72rem;
}

.number-quest-achievements div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.number-quest-achievements em {
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
}

.number-quest-achievements em.is-earned {
  background: var(--mint);
}

.number-quest-stage {
  min-width: 0;
  padding: clamp(0.85rem, 2.2vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.number-quest-scene {
  display: grid;
  gap: 1rem;
}

.number-quest-scene[hidden] {
  display: none !important;
}

.number-start-panel,
.number-complete-card {
  display: grid;
  gap: 1rem;
  min-height: 28rem;
  align-content: center;
  justify-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid rgba(66, 87, 178, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(238, 244, 255, 0.78), rgba(255, 255, 255, 0.94) 52%, rgba(229, 251, 239, 0.82));
  text-align: center;
}

.number-panel-head {
  display: grid;
  gap: 0.2rem;
}

.number-panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.number-panel-head p {
  margin: 0;
  color: var(--muted);
}

.number-machine {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.number-machine span {
  display: grid;
  place-items: center;
  width: clamp(3.6rem, 9vw, 5.2rem);
  aspect-ratio: 1;
  border: 1px solid rgba(66, 87, 178, 0.2);
  border-radius: 1.1rem;
  background: #fff;
  color: #31458f;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 950;
  box-shadow: inset 0 -0.35rem 0 rgba(66, 87, 178, 0.08);
}

.number-challenge-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, 0.22fr);
  gap: 1rem;
  align-items: start;
}

.number-challenge-top h2 {
  color: var(--ink);
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 0.98;
}

.number-question-card {
  display: grid;
  gap: 0.25rem;
  min-width: 10rem;
  padding: 0.85rem;
  border: 2px solid rgba(66, 87, 178, 0.36);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #e8efff, #ffffff);
  text-align: center;
  box-shadow: inset 0 0.28rem 0 rgba(66, 87, 178, 0.13);
}

.number-question-card strong {
  color: #23316f;
  font-size: clamp(1.15rem, 3vw, 2rem);
  overflow-wrap: anywhere;
}

.number-playfield {
  min-height: 22rem;
  display: grid;
  align-content: center;
  gap: 1rem;
  padding: clamp(0.85rem, 2.5vw, 1.35rem);
  border: 2px solid rgba(66, 87, 178, 0.16);
  border-radius: var(--radius);
  background: #f8fbfd;
}

.number-visual {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  width: min(100%, 42rem);
  margin-inline: auto;
  padding: 1rem;
  border: 1px solid rgba(15, 118, 110, 0.13);
  border-radius: var(--radius);
  background: #fff;
}

.number-visual-dots span,
.number-dot-group span {
  width: 1.25rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: #f5b301;
  box-shadow: inset 0 -0.18rem 0 rgba(128, 82, 0, 0.18);
}

.number-visual-groups {
  align-items: stretch;
}

.number-dot-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  max-width: 7rem;
  padding: 0.55rem;
  border: 1px dashed rgba(66, 87, 178, 0.24);
  border-radius: 0.8rem;
  background: #f7faff;
}

.number-visual-tiles strong {
  padding: 0.65rem 0.85rem;
  border-radius: 0.9rem;
  background: #eef4ff;
  color: #23316f;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 950;
}

.number-visual-fraction {
  display: grid;
  grid-template-columns: repeat(var(--fraction-parts), minmax(2.5rem, 1fr));
  max-width: 32rem;
  gap: 0.25rem;
}

.number-visual-fraction span {
  min-height: 4.2rem;
  border: 1px solid rgba(66, 87, 178, 0.22);
  background: #fff;
}

.number-visual-fraction span.is-filled {
  background: #91e6bd;
}

.number-visual-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(1.4rem, 1fr));
  max-width: 30rem;
  gap: 0.22rem;
}

.number-visual-grid span {
  aspect-ratio: 1;
  border: 1px solid rgba(66, 87, 178, 0.16);
  border-radius: 0.28rem;
  background: #dbeafe;
}

.number-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(66, 87, 178, 0.18);
  border-radius: var(--radius);
  background: #ffffff;
}

.number-answer,
.number-strategy-panel button {
  min-height: 4.2rem;
  padding: 0.85rem;
  border: 2px solid rgba(66, 87, 178, 0.22);
  border-radius: var(--radius);
  background: #f8faff;
  color: var(--ink);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.number-answer:hover,
.number-answer:focus-visible,
.number-strategy-panel button:hover,
.number-strategy-panel button:focus-visible {
  border-color: rgba(66, 87, 178, 0.42);
  transform: translateY(-1px);
}

.number-answer.is-correct {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--mint);
  color: var(--teal-dark);
}

.number-answer.is-wrong {
  border-color: rgba(155, 44, 31, 0.28);
  background: #fff0ed;
  color: #8d2f1c;
}

.number-strategy-panel {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-left: 0.3rem solid var(--teal);
  border-radius: var(--radius);
  background: #f3fbf7;
}

.number-strategy-panel[hidden] {
  display: none !important;
}

.number-strategy-panel > strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.number-strategy-panel div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.number-strategy-panel button {
  min-height: 2.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  color: var(--teal-dark);
}

.number-strategy-panel button.is-selected {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--mint);
}

.number-strategy-panel button.is-wrong {
  border-color: rgba(155, 44, 31, 0.28);
  background: #fff0ed;
  color: #8d2f1c;
}

.number-challenge-actions,
.number-game-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.number-challenge-actions button[hidden],
.number-challenge-actions button.is-hidden {
  display: none !important;
}

.number-quest-progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.65rem;
}

.number-quest-progress div {
  display: grid;
  gap: 0.24rem;
  min-height: 4.3rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--cloud);
}

.number-quest-progress div.is-complete {
  border-color: rgba(66, 87, 178, 0.34);
  background: #eef4ff;
}

.number-quest-progress span {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #fff;
  color: #31458f;
  font-size: 0.78rem;
  font-weight: 950;
}

.number-quest-progress strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.fact-lab-band {
  min-height: calc(100vh - 8rem);
  background:
    linear-gradient(135deg, rgba(241, 250, 246, 0.98), rgba(238, 244, 255, 0.94) 48%, rgba(255, 247, 216, 0.88)),
    repeating-linear-gradient(90deg, rgba(15, 118, 110, 0.035) 0 1px, transparent 1px 4.25rem);
}

.fact-lab-shell {
  display: grid;
  gap: 1rem;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.6rem) 0 clamp(2rem, 4vw, 3rem);
}

.fact-lab-hero,
.fact-lab-stats,
.fact-lab-grid,
.fact-lab-progress,
.fact-lab-shell .word-game-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.06);
}

.fact-lab-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.fact-lab-hero h1,
.fact-lab-hero p,
.fact-start-panel p,
.fact-challenge-top h2,
.fact-challenge-top p,
.fact-complete-card h2,
.fact-complete-card p,
.fact-research-card p,
.fact-fact-card p,
.fact-explain-card p {
  margin: 0;
}

.fact-lab-hero h1 {
  font-size: clamp(2.25rem, 5.5vw, 5rem);
  line-height: 0.96;
}

.fact-lab-hero p,
.fact-start-panel p,
.fact-challenge-top p,
.fact-complete-card p,
.fact-lab-helper p,
.fact-lab-round-card p,
.fact-world-map span,
.fact-research-card p,
.fact-fact-card p,
.fact-explain-card p {
  color: var(--muted);
}

.fact-lab-badge {
  display: grid;
  gap: 0.18rem;
  min-width: 11rem;
  padding: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #e5fbef, #eef4ff);
  text-align: center;
}

.fact-lab-badge.earned {
  border-color: rgba(208, 115, 34, 0.36);
  background: linear-gradient(180deg, #fff7d8, #e5fbef);
}

.fact-lab-badge span,
.fact-lab-badge em,
.fact-lab-stats span,
.fact-lab-round-card > span,
.fact-lab-achievements > span,
.fact-challenge-top span,
.fact-question-card span,
.fact-research-card span,
.fact-fact-card span,
.fact-explain-card span,
.fact-complete-card > span,
.fact-panel-head span {
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

.fact-lab-badge strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.fact-lab-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.fact-lab-stats div {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--line);
}

.fact-lab-stats div:last-child {
  border-right: 0;
}

.fact-lab-stats strong {
  color: var(--ink);
  font-size: 1.22rem;
}

.fact-lab-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 0.32fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 40rem;
  padding: 1rem;
}

.fact-lab-side {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
}

.fact-lab-helper,
.fact-lab-round-card,
.fact-world-map,
.fact-lab-achievements {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.fact-lab-helper {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.fact-lab-round-card strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 3.5vw, 2.3rem);
}

.fact-lab-round-card [data-fact-round-stars],
.fact-complete-stars {
  display: flex;
  gap: 0.25rem;
  color: #cbd5e1;
  font-size: 1.35rem;
}

.fact-lab-round-card [data-fact-round-stars] span.is-earned,
.fact-complete-stars span.is-earned {
  color: #f5b301;
}

.fact-world-map {
  grid-template-columns: 1fr;
  max-height: 23rem;
  overflow-y: auto;
  padding: 0.5rem;
}

.fact-world-map button {
  display: grid;
  gap: 0.18rem;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.fact-world-map button[aria-current="true"] {
  border-color: rgba(15, 118, 110, 0.34);
  background: #e9fbf3;
}

.fact-world-map em,
.fact-lab-achievements em {
  width: fit-content;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  font-style: normal;
  font-weight: 900;
}

.fact-world-map em {
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.08);
  color: var(--teal-dark);
  font-size: 0.72rem;
}

.fact-lab-achievements div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fact-lab-achievements em {
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
}

.fact-lab-achievements em.is-earned {
  background: var(--mint);
}

.fact-lab-stage {
  min-width: 0;
  padding: clamp(0.85rem, 2.2vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.fact-lab-scene {
  display: grid;
  gap: 1rem;
}

.fact-lab-scene[hidden] {
  display: none !important;
}

.fact-start-panel,
.fact-complete-card {
  display: grid;
  gap: 1rem;
  min-height: 28rem;
  align-content: center;
  justify-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(229, 251, 239, 0.82), rgba(255, 255, 255, 0.94) 54%, rgba(238, 244, 255, 0.8));
  text-align: center;
}

.fact-panel-head {
  display: grid;
  gap: 0.2rem;
}

.fact-panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.fact-panel-head p {
  margin: 0;
  color: var(--muted);
}

.fact-lab-machine {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.fact-lab-machine span {
  display: grid;
  place-items: center;
  min-width: clamp(3.8rem, 9vw, 5.6rem);
  min-height: clamp(3.6rem, 8vw, 4.8rem);
  padding: 0.35rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 1rem;
  background: #fff;
  color: var(--teal-dark);
  font-size: clamp(1rem, 3vw, 1.45rem);
  font-weight: 950;
  box-shadow: inset 0 -0.35rem 0 rgba(15, 118, 110, 0.08);
}

.fact-challenge-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.fact-challenge-top h2 {
  color: var(--ink);
  font-size: clamp(2.1rem, 4.7vw, 4.2rem);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.fact-question-card,
.fact-research-card,
.fact-fact-card,
.fact-explain-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: var(--radius);
  background: var(--cloud);
}

.fact-research-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 12rem;
  padding: clamp(1rem, 3vw, 1.4rem);
  background:
    linear-gradient(135deg, rgba(255, 247, 216, 0.78), rgba(255, 255, 255, 0.96) 48%, rgba(229, 251, 239, 0.8));
}

.fact-research-card span,
.fact-research-card p {
  grid-column: 1;
}

.fact-research-card button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.fact-research-card p {
  max-width: 54rem;
  color: var(--ink);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 850;
  line-height: 1.35;
}

.fact-fact-card {
  border-left: 0.3rem solid #f5b301;
  background: #fffdf2;
}

.fact-question-card strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  line-height: 1.2;
}

.fact-question-card {
  border: 2px solid rgba(15, 118, 110, 0.34);
  background: linear-gradient(180deg, #e5fbef, #ffffff);
  box-shadow: inset 0 0.28rem 0 rgba(15, 118, 110, 0.12);
}

.fact-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: #ffffff;
}

.fact-choice-grid button {
  min-height: 4.6rem;
  padding: 0.85rem;
  border: 2px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius);
  background: #f7fffb;
  color: var(--ink);
  font: inherit;
  font-weight: 950;
  line-height: 1.25;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.fact-choice-grid button:hover,
.fact-choice-grid button:focus-visible {
  border-color: rgba(15, 118, 110, 0.38);
  transform: translateY(-1px);
}

.fact-choice-grid button.is-correct {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--mint);
  color: var(--teal-dark);
}

.fact-choice-grid button.is-wrong {
  border-color: rgba(155, 44, 31, 0.28);
  background: #fff0ed;
  color: #8d2f1c;
}

.fact-explain-card {
  border-left: 0.3rem solid var(--teal);
  background: #f3fbf7;
}

.fact-lab-actions,
.fact-game-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.fact-lab-actions button[hidden],
.fact-game-actions button[hidden] {
  display: none !important;
}

.fact-lab-progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.65rem;
}

.fact-lab-progress div {
  display: grid;
  gap: 0.24rem;
  min-height: 4.3rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--cloud);
}

.fact-lab-progress div.is-complete {
  border-color: rgba(15, 118, 110, 0.34);
  background: #e9fbf3;
}

.fact-lab-progress span {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 950;
}

.fact-lab-progress strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.activity-ai-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid rgba(66, 87, 178, 0.18);
  border-left: 0.3rem solid #4257b2;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(238, 244, 255, 0.92), rgba(255, 255, 255, 0.96) 58%, rgba(229, 251, 239, 0.78));
}

.activity-ai-panel span {
  display: block;
  color: #31458f;
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.activity-ai-panel p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.activity-ai-panel > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.activity-ai-panel .secondary-button {
  min-height: 2.35rem;
  padding: 0.48rem 0.68rem;
  white-space: nowrap;
}

.helper-dock {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
}

.helper-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border: 0;
  border-radius: 999px;
  background: white;
  box-shadow: 0 18px 45px rgba(13, 34, 52, 0.22);
  cursor: pointer;
}

.helper-bubble .helper-thumb {
  width: 3.2rem;
  height: 3.2rem;
  border-width: 0;
}

.helper-panel {
  position: absolute;
  right: 0;
  bottom: 4.75rem;
  display: none;
  width: min(22rem, calc(100vw - 2rem));
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(13, 34, 52, 0.22);
}

.helper-dock.is-open .helper-panel {
  display: grid;
}

.helper-panel header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.helper-panel header div {
  display: grid;
  flex: 1;
}

.helper-panel header button {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 900;
  cursor: pointer;
}

.helper-messages {
  display: grid;
  gap: 0.65rem;
  max-height: min(24rem, 52vh);
  padding: 0.85rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.helper-messages p {
  margin: 0;
  padding: 0.7rem;
  border-radius: var(--radius);
  background: var(--cloud);
  color: var(--ink);
}

.helper-message.child {
  justify-self: end;
  max-width: 88%;
  background: var(--teal);
  color: white;
}

.helper-message.assistant {
  justify-self: start;
  max-width: 92%;
}

.helper-message.assistant.is-quiz {
  border: 1px solid rgba(66, 87, 178, 0.22);
  background: #f4f7ff;
  box-shadow: inset 0.22rem 0 0 #4257b2;
  white-space: pre-line;
}

.helper-message.is-waiting {
  color: var(--muted);
}

.helper-message.is-error {
  background: #fff0ed;
  color: #9b2c1f;
}

.helper-suggestion-card {
  display: grid;
  gap: 0.48rem;
  justify-self: stretch;
  max-width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(66, 87, 178, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f7f9ff, #ffffff);
  box-shadow: inset 0.22rem 0 0 #4257b2;
}

.helper-suggestion-card strong {
  font-size: 0.98rem;
}

.helper-suggestion-card p {
  display: grid;
  gap: 0.08rem;
  margin: 0;
  padding: 0.48rem 0.55rem;
  border: 1px solid rgba(37, 51, 73, 0.08);
  border-radius: 0.72rem;
  background: #fbfdff;
  color: var(--ink);
}

.helper-suggestion-card p span {
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.helper-suggestion-card button {
  min-height: 2.35rem;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.confetti-burst {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
}

.confetti-burst span {
  position: absolute;
  top: -1.4rem;
  left: 50%;
  width: 0.58rem;
  height: 0.95rem;
  border-radius: 0.15rem;
  background: var(--teal);
  animation: confetti-fall 3.2s linear forwards;
}

.confetti-burst span:nth-child(2n) { background: #f2b84b; }
.confetti-burst span:nth-child(3n) { background: #e66b5b; }
.confetti-burst span:nth-child(4n) { background: #4257b2; }
.confetti-burst span:nth-child(5n) { background: #4f8f45; }
.confetti-burst span:nth-child(6n) {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
}
.confetti-burst span:nth-child(7n) {
  width: 0.82rem;
  height: 0.42rem;
}
.confetti-burst span:nth-child(8n) {
  opacity: 0.78;
}
.confetti-burst span:nth-child(1) { left: 3%; animation-delay: 0.02s; }
.confetti-burst span:nth-child(2) { left: 12%; animation-delay: 0.22s; }
.confetti-burst span:nth-child(3) { left: 7%; animation-delay: 0.48s; }
.confetti-burst span:nth-child(4) { left: 19%; animation-delay: 0.11s; }
.confetti-burst span:nth-child(5) { left: 28%; animation-delay: 0.36s; }
.confetti-burst span:nth-child(6) { left: 23%; animation-delay: 0.64s; }
.confetti-burst span:nth-child(7) { left: 36%; animation-delay: 0.16s; }
.confetti-burst span:nth-child(8) { left: 45%; animation-delay: 0.52s; }
.confetti-burst span:nth-child(9) { left: 39%; animation-delay: 0.74s; }
.confetti-burst span:nth-child(10) { left: 55%; animation-delay: 0.08s; }
.confetti-burst span:nth-child(11) { left: 62%; animation-delay: 0.31s; }
.confetti-burst span:nth-child(12) { left: 50%; animation-delay: 0.58s; }
.confetti-burst span:nth-child(13) { left: 70%; animation-delay: 0.17s; }
.confetti-burst span:nth-child(14) { left: 78%; animation-delay: 0.43s; }
.confetti-burst span:nth-child(15) { left: 66%; animation-delay: 0.81s; }
.confetti-burst span:nth-child(16) { left: 86%; animation-delay: 0.1s; }
.confetti-burst span:nth-child(17) { left: 94%; animation-delay: 0.34s; }
.confetti-burst span:nth-child(18) { left: 90%; animation-delay: 0.69s; }
.confetti-burst span:nth-child(n+19):nth-child(-n+36) { top: -3rem; animation-delay: 0.08s; }
.confetti-burst span:nth-child(n+37):nth-child(-n+54) { top: -6rem; animation-delay: 0.16s; }
.confetti-burst span:nth-child(n+55):nth-child(-n+72) { top: -9rem; animation-delay: 0.24s; }
.confetti-burst span:nth-child(n+73) { top: -12rem; animation-delay: 0.32s; }
.confetti-burst span:nth-child(18n+1) { left: 5%; }
.confetti-burst span:nth-child(18n+2) { left: 14%; }
.confetti-burst span:nth-child(18n+3) { left: 9%; }
.confetti-burst span:nth-child(18n+4) { left: 21%; }
.confetti-burst span:nth-child(18n+5) { left: 31%; }
.confetti-burst span:nth-child(18n+6) { left: 26%; }
.confetti-burst span:nth-child(18n+7) { left: 38%; }
.confetti-burst span:nth-child(18n+8) { left: 47%; }
.confetti-burst span:nth-child(18n+9) { left: 42%; }
.confetti-burst span:nth-child(18n+10) { left: 54%; }
.confetti-burst span:nth-child(18n+11) { left: 63%; }
.confetti-burst span:nth-child(18n+12) { left: 58%; }
.confetti-burst span:nth-child(18n+13) { left: 71%; }
.confetti-burst span:nth-child(18n+14) { left: 80%; }
.confetti-burst span:nth-child(18n+15) { left: 75%; }
.confetti-burst span:nth-child(18n+16) { left: 87%; }
.confetti-burst span:nth-child(18n+17) { left: 96%; }
.confetti-burst span:nth-child(18n+18) { left: 91%; }

@keyframes confetti-fall {
  0% {
    transform: translateY(-2rem) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(112vh) rotate(540deg);
    opacity: 1;
  }
}

@keyframes doodely-spin {
  to {
    transform: rotate(360deg);
  }
}

.helper-complete-card {
  display: grid;
  gap: 0.45rem;
  justify-self: stretch;
  padding: 0.8rem;
  border: 1px solid rgba(190, 137, 27, 0.32);
  border-radius: var(--radius);
  background: #fff7d8;
  color: #7a560d;
}

.helper-complete-card strong {
  color: #7a560d;
}

.helper-complete-card span {
  color: rgba(122, 86, 13, 0.8);
  font-size: 0.88rem;
}

.helper-complete-card button {
  width: fit-content;
  min-height: 2.35rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(122, 86, 13, 0.25);
  border-radius: 0.65rem;
  background: white;
  color: #7a560d;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.helper-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  padding: 0.85rem;
  border-top: 1px solid var(--line);
}

.coach-workspace-band {
  height: calc(100svh - 7.25rem);
  height: calc(100dvh - 7.25rem);
  min-height: 34rem;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(223, 246, 234, 0.72), rgba(255, 253, 248, 1)),
    #fffdf8;
}

.coach-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.75rem;
  width: min(1180px, calc(100% - 2rem));
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.25rem) 0;
  box-sizing: border-box;
}

.coach-workspace:has(.coach-header[hidden]) {
  grid-template-rows: minmax(0, 1fr);
}

.coach-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.coach-header[hidden] {
  display: none;
}

.coach-header h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.6rem);
  line-height: 1;
}

.coach-header p {
  margin: 0;
  color: var(--muted);
}

.coach-helper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 13rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cloud);
}

.coach-helper div {
  display: grid;
  gap: 0.15rem;
}

.coach-helper span {
  color: var(--muted);
}

.coach-dismiss {
  min-height: 2.4rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 900;
  cursor: pointer;
}

.coach-dismiss:hover,
.coach-dismiss:focus-visible {
  color: var(--teal-dark);
  border-color: rgba(14, 126, 120, 0.35);
}

.coach-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.coach-chat-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.coach-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--cloud);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.coach-tool-button:hover,
.coach-tool-button:focus-visible {
  border-color: rgba(14, 126, 120, 0.45);
  color: var(--teal-dark);
}

.coach-chat-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: calc(100svh - 13.25rem);
  height: calc(100dvh - 13.25rem);
  min-height: 0;
  overflow: hidden;
}

.coach-workspace:has(.coach-header[hidden]) .coach-chat-shell {
  height: calc(100svh - 8.75rem);
  height: calc(100dvh - 8.75rem);
}

.coach-messages {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  padding: clamp(0.85rem, 2vw, 1.2rem);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background:
    linear-gradient(180deg, rgba(243, 248, 251, 0.85), rgba(255, 255, 255, 1)),
    white;
}

.coach-message {
  display: grid;
  gap: 0.55rem;
  width: min(88%, 42rem);
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 8px 22px rgba(37, 51, 73, 0.08);
}

.coach-message p {
  margin: 0;
}

.coach-message.child {
  justify-self: end;
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.coach-message.assistant {
  justify-self: start;
}

.coach-message.is-quiz {
  border: 1px solid rgba(66, 87, 178, 0.22);
  background: #f4f7ff;
  box-shadow: inset 0.22rem 0 0 #4257b2;
}

.coach-message.is-quiz p {
  white-space: pre-line;
}

.coach-message.is-waiting {
  color: var(--muted);
}

.coach-message.is-error {
  background: #fff0ed;
  border-color: rgba(155, 44, 31, 0.22);
  color: #9b2c1f;
}

.coach-input {
  position: relative;
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border-top: 1px solid rgba(14, 126, 120, 0.16);
  background: #edf7f4;
  box-shadow: 0 -12px 30px rgba(37, 51, 73, 0.08);
}

.coach-input.is-image-mode {
  border-top-color: rgba(66, 87, 178, 0.45);
  background: #eef2ff;
}

.coach-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.52rem 0.65rem;
  border: 1px solid rgba(66, 87, 178, 0.25);
  border-radius: 0.7rem;
  background: #eef2ff;
  color: #273b8f;
  font-weight: 900;
}

.coach-mode-row[hidden] {
  display: none;
}

.coach-mode-row button {
  border: 0;
  background: transparent;
  color: #273b8f;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

.coach-more-panel {
  position: absolute;
  right: 6.8rem;
  bottom: calc(100% - 0.2rem);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: max-content;
  max-width: min(25rem, calc(100vw - 2rem));
  padding: 0.7rem;
  border: 2px solid rgba(29, 36, 51, 0.14);
  border-radius: 1.15rem;
  background: white;
  box-shadow: 0 18px 42px rgba(37, 51, 73, 0.18);
}

.coach-more-panel[hidden] {
  display: none;
}

.coach-more-panel::after {
  content: "";
  position: absolute;
  right: 1.45rem;
  bottom: -0.58rem;
  width: 1rem;
  height: 1rem;
  background: white;
  border-right: 2px solid rgba(29, 36, 51, 0.14);
  border-bottom: 2px solid rgba(29, 36, 51, 0.14);
  transform: rotate(45deg);
}

.coach-more-panel button,
.coach-more-panel label,
.coach-more-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.55rem;
  padding: 0.58rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
}

.coach-more-panel span {
  color: var(--muted);
  font-size: 0.78rem;
}

.coach-more-panel button:hover,
.coach-more-panel button:focus-visible,
.coach-more-panel label:hover,
.coach-more-panel label:focus-visible,
.coach-more-button:hover,
.coach-more-button:focus-visible {
  border-color: rgba(14, 126, 120, 0.45);
  color: var(--teal-dark);
}

.coach-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 0.7rem;
  background: var(--mint);
  color: var(--teal-dark);
  font-weight: 850;
}

.coach-attachment[hidden] {
  display: none;
}

.coach-attachment button {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.coach-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem;
  border: 2px solid rgba(15, 118, 110, 0.24);
  border-radius: 1rem;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75), 0 8px 22px rgba(37, 51, 73, 0.08);
}

.coach-input.is-image-mode .coach-input-row {
  border-color: rgba(66, 87, 178, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75), 0 8px 24px rgba(66, 87, 178, 0.13);
}

.coach-input textarea {
  min-height: 3rem;
  max-height: 7rem;
  padding: 0.65rem 0.7rem;
  border: 0;
  outline: 0;
  background: transparent;
  resize: vertical;
}

.coach-input textarea::placeholder {
  color: #7a8797;
}

.coach-tool-button input,
.coach-more-panel input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.coach-generated-image {
  position: relative;
  width: min(100%, 28rem);
}

.coach-generated-image img {
  display: block;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--line);
}

.coach-generated-image a {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  min-height: 2.2rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--teal-dark);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(37, 51, 73, 0.16);
}

.story-starter-band {
  min-height: calc(100svh - 5.8rem);
  background:
    radial-gradient(circle at 15% 0%, rgba(251, 191, 36, 0.2), transparent 25rem),
    linear-gradient(180deg, rgba(246, 250, 252, 1), rgba(255, 253, 248, 1));
}

.story-starter-shell {
  display: grid;
  gap: 1rem;
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 2.4vw, 1.45rem) 0 1.6rem;
}

.story-hero,
.story-stats,
.story-workspace,
.story-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(37, 51, 73, 0.08);
}

.story-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: clamp(1rem, 2vw, 1.3rem);
}

.story-hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.5rem);
  line-height: 0.95;
}

.story-hero p {
  margin: 0.4rem 0 0;
  max-width: 58rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.story-hero-badge {
  display: grid;
  gap: 0.25rem;
  min-width: 13.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(182, 70, 122, 0.22);
  border-radius: var(--radius);
  background: #fff0f7;
}

.story-hero-badge.earned {
  background: var(--mint);
  border-color: rgba(14, 126, 120, 0.25);
}

.story-hero-badge span,
.story-hero-badge em,
.story-stats span,
.story-panel-head .eyebrow,
.story-editor-top .eyebrow,
.story-question-card span {
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.story-hero-badge strong {
  font-size: 1.2rem;
}

.story-hero-badge em {
  color: var(--muted);
  font-style: normal;
  text-transform: none;
}

.story-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.story-stats div {
  display: grid;
  gap: 0.2rem;
  padding: 0.82rem 1rem;
  border-right: 1px solid var(--line);
}

.story-stats div:last-child {
  border-right: 0;
}

.story-stats strong {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.story-workspace {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: 0;
  min-height: 42rem;
  overflow: hidden;
}

.story-library,
.story-editor {
  min-width: 0;
  padding: 1rem;
}

.story-library {
  position: relative;
  background: #f8fbfd;
}

.story-library {
  border-right: 1px solid var(--line);
}

.story-panel-head,
.story-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.story-panel-head h2,
.story-editor-top h2 {
  margin: 0;
  font-size: 1.2rem;
}

.story-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
  max-height: 31rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.story-list-item {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: white;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.story-list-item[aria-current="true"] {
  border-color: rgba(182, 70, 122, 0.42);
  background: #fff0f7;
  box-shadow: inset 0.25rem 0 0 #b6467a;
}

.story-list-item span,
.story-list-item em,
.story-empty span,
.story-save-state span {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: normal;
}

.story-list-item em {
  color: var(--teal-dark);
  font-weight: 900;
}

.story-limit-note {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.story-limit-note[data-state="full"] {
  color: #9b2c1f;
}

.story-empty {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.85rem;
  padding: 0.8rem;
  border: 1px dashed rgba(29, 36, 51, 0.2);
  border-radius: 0.8rem;
  background: white;
}

.story-empty[hidden] {
  display: none;
}

.story-editor {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.9rem;
  background: white;
}

.story-save-state {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.story-save-state .secondary-button {
  border-color: rgba(14, 126, 120, 0.38);
  background: linear-gradient(180deg, #ffffff, #e9fbf5);
  color: var(--teal-dark);
  box-shadow: 0 10px 24px rgba(14, 126, 120, 0.14);
}

.story-save-state .secondary-button:hover,
.story-save-state .secondary-button:focus-visible {
  border-color: rgba(14, 126, 120, 0.62);
  background: var(--teal);
  color: white;
}

.story-save-state span[data-state="busy"],
.story-save-state span[data-state="dirty"] {
  color: #9a5c00;
}

.story-save-state span[data-state="saved"] {
  color: var(--teal-dark);
}

.story-save-state span[data-state="error"] {
  color: #9b2c1f;
}

.story-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.38rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #f5f8fb;
}

.story-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.65rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.story-stepper button[aria-current="step"] {
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(37, 51, 73, 0.1);
}

.story-stepper span {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 0.82rem;
}

.story-form,
.story-step-panel {
  min-height: 0;
}

.story-step-panel {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  height: 100%;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.story-step-panel[hidden] {
  display: none;
}

.story-question-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem;
  border: 2px solid rgba(182, 70, 122, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 240, 247, 0.92), rgba(255, 255, 255, 1)),
    white;
  box-shadow: inset 0 0.28rem 0 rgba(182, 70, 122, 0.08);
}

.story-question-card strong {
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
}

.story-question-card p {
  margin: 0;
  color: var(--muted);
}

.story-field-grid,
.story-outline-grid,
.story-finish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.story-outline-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.story-field-grid label,
.story-outline-grid label,
.story-cover-card label {
  display: grid;
  gap: 0.35rem;
  color: #526174;
  font-weight: 900;
}

.story-wide {
  grid-column: 1 / -1;
}

.story-field-grid input,
.story-field-grid select,
.story-outline-grid textarea,
.story-chapter-editor input,
.story-chapter-editor textarea,
.story-cover-card textarea {
  width: 100%;
  min-width: 0;
  border: 2px solid rgba(37, 51, 73, 0.12);
  border-radius: 0.85rem;
  background: #fbfdff;
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}

.story-field-grid input,
.story-field-grid select,
.story-chapter-editor input {
  min-height: 3rem;
  padding: 0.68rem 0.78rem;
}

.story-outline-grid textarea,
.story-chapter-editor textarea,
.story-cover-card textarea {
  padding: 0.75rem 0.85rem;
  resize: vertical;
}

.story-field-grid input:focus,
.story-field-grid select:focus,
.story-outline-grid textarea:focus,
.story-chapter-editor input:focus,
.story-chapter-editor textarea:focus,
.story-cover-card textarea:focus {
  border-color: rgba(14, 126, 120, 0.52);
  outline: 0;
  background: white;
  box-shadow: 0 0 0 4px rgba(14, 126, 120, 0.1);
}

.story-prompt-row,
.story-chapter-actions,
.story-export-actions,
.story-continue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.story-continue-row {
  justify-content: flex-end;
}

.story-draft-tools,
.story-revision-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
  padding: 0.75rem;
  border: 1px solid rgba(66, 87, 178, 0.18);
  border-radius: var(--radius);
  background: #f6f8ff;
}

.story-draft-tools label {
  display: grid;
  gap: 0.35rem;
  color: #526174;
  font-weight: 900;
}

.story-draft-tools select,
.story-revision-tool input {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.62rem 0.72rem;
  border: 2px solid rgba(37, 51, 73, 0.12);
  border-radius: 0.85rem;
  background: white;
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}

.story-draft-tools select:focus,
.story-revision-tool input:focus {
  border-color: rgba(66, 87, 178, 0.48);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(66, 87, 178, 0.1);
}

.story-chapter-shell {
  position: relative;
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: 0.75rem;
  min-height: 25rem;
}

.story-chapter-list {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
  overflow-y: auto;
}

.story-chapter-list button {
  display: grid;
  gap: 0.15rem;
  padding: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: white;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.story-chapter-list button[aria-current="true"] {
  border-color: rgba(66, 87, 178, 0.35);
  background: #eef2ff;
}

.story-chapter-list span {
  color: var(--muted);
  font-size: 0.82rem;
}

.story-chapter-editor {
  display: grid;
  grid-template-rows: auto minmax(18rem, 1fr) auto auto;
  gap: 0.65rem;
  min-width: 0;
}

.story-cover-card,
.story-export-card {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
}

.story-cover-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 18rem;
  overflow: hidden;
  border: 2px dashed rgba(182, 70, 122, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 240, 247, 0.85), rgba(239, 247, 255, 0.95)),
    white;
  color: var(--muted);
  font-weight: 950;
}

.story-cover-controls {
  display: grid;
  gap: 0.75rem;
}

.story-cover-controls[hidden],
.story-draft-tools[hidden] {
  display: none;
}

.story-cover-edit-button {
  justify-self: start;
}

.story-cover-preview img {
  width: 100%;
  height: 100%;
  max-height: 26rem;
  object-fit: cover;
}

.story-cover-preview.is-loading {
  border-style: solid;
  background: #f6f8ff;
  color: #4257b2;
}

.story-cover-preview.is-loading span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.story-cover-preview.is-loading span::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 0.18rem solid rgba(66, 87, 178, 0.2);
  border-top-color: #4257b2;
  border-radius: 999px;
  animation: doodely-spin 0.8s linear infinite;
}

.story-cover-preview a {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--teal-dark);
  font-weight: 950;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(37, 51, 73, 0.16);
}

.story-export-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.story-export-card p,
.story-delete-box p {
  margin: 0;
  color: var(--muted);
}

.story-export-actions a[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: auto;
}

.story-delete-box {
  padding: 0.75rem;
  border: 1px solid rgba(155, 44, 31, 0.18);
  border-radius: 0.85rem;
  background: #fff8f6;
}

.story-delete-box summary {
  color: #9b2c1f;
  font-weight: 950;
  cursor: pointer;
}

.story-footer {
  padding: 0.8rem;
}

.story-print-band {
  background: #f5f7f9;
  padding: 1.5rem 0;
}

.story-print-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  width: min(820px, calc(100% - 2rem));
  margin: 0 auto 0.85rem;
}

.story-print-page {
  width: min(820px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 18px 42px rgba(37, 51, 73, 0.08);
}

.story-print-page h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.story-print-page header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.story-print-page h2 {
  margin: 2rem 0 0.75rem;
  color: var(--teal-dark);
}

.story-print-page p {
  line-height: 1.75;
}

.story-print-page section {
  break-inside: avoid;
}

.story-print-credit {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.story-print-cover {
  display: block;
  width: min(100%, 32rem);
  margin: 0 auto 1.5rem;
  border-radius: var(--radius);
}

.idea-studio-band {
  min-height: calc(100vh - 8rem);
  background:
    linear-gradient(180deg, #f6f9fb 0%, #fffdf8 52%, #f8fbfd 100%),
    #f8fbfd;
}

.idea-studio-shell {
  display: grid;
  gap: 1rem;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) 0 clamp(2rem, 5vw, 4rem);
}

.idea-hero,
.idea-stats,
.idea-workspace,
.idea-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.idea-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  overflow: hidden;
  padding: clamp(1rem, 3vw, 1.5rem);
  background:
    linear-gradient(135deg, rgba(255, 231, 241, 0.76), rgba(255, 255, 255, 0.94) 48%, rgba(223, 246, 234, 0.78)),
    white;
}

.idea-hero h1,
.idea-hero p,
.idea-panel-head h2,
.idea-editor-top h2,
.idea-preview-card h3,
.idea-preview-card p {
  margin: 0;
}

.idea-hero h1 {
  font-size: clamp(2.25rem, 5vw, 4.9rem);
  line-height: 0.95;
}

.idea-hero p {
  max-width: 58rem;
  color: var(--muted);
}

.idea-badge {
  display: grid;
  gap: 0.16rem;
  min-width: 14rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(182, 70, 122, 0.18);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(37, 51, 73, 0.08);
}

.idea-badge.earned {
  border-color: rgba(14, 126, 120, 0.28);
  background: #e9fbf5;
}

.idea-badge span,
.idea-badge em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.idea-badge strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.idea-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
}

.idea-stats div {
  display: grid;
  gap: 0.22rem;
  padding: 0.82rem 1rem;
  border-right: 1px solid var(--line);
}

.idea-stats div:last-child {
  border-right: 0;
}

.idea-stats span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.idea-stats strong {
  color: var(--ink);
  font-size: clamp(1.08rem, 2vw, 1.45rem);
}

.idea-workspace {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  min-height: 44rem;
  overflow: hidden;
}

.idea-gallery {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.8rem;
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: #f8fbfd;
}

.idea-panel-head,
.idea-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.idea-panel-head h2,
.idea-editor-top h2 {
  font-size: 1.2rem;
}

.idea-gallery-list {
  display: grid;
  gap: 0.55rem;
  max-height: 35rem;
  overflow-y: auto;
  padding-right: 0.18rem;
}

.idea-gallery-item {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: white;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.idea-gallery-item:hover,
.idea-gallery-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(182, 70, 122, 0.28);
  outline: 0;
  box-shadow: 0 12px 22px rgba(37, 51, 73, 0.08);
}

.idea-gallery-item[aria-current="true"] {
  border-color: rgba(182, 70, 122, 0.42);
  background: #fff0f7;
  box-shadow: inset 0.25rem 0 0 #b6467a;
}

.idea-gallery-item span,
.idea-gallery-item em,
.idea-empty span,
.idea-save-state span {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: normal;
}

.idea-gallery-item em {
  color: var(--teal-dark);
  font-weight: 900;
}

.idea-empty {
  display: grid;
  gap: 0.24rem;
  padding: 0.8rem;
  border: 1px dashed rgba(29, 36, 51, 0.2);
  border-radius: 0.85rem;
  background: white;
}

.idea-empty[hidden] {
  display: none;
}

.idea-editor {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.9rem;
  padding: 1rem;
  min-width: 0;
  background: white;
}

.idea-save-state {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.idea-save-state .secondary-button {
  border-color: rgba(14, 126, 120, 0.38);
  background: linear-gradient(180deg, #ffffff, #e9fbf5);
  color: var(--teal-dark);
  box-shadow: 0 10px 24px rgba(14, 126, 120, 0.14);
}

.idea-save-state .secondary-button:hover,
.idea-save-state .secondary-button:focus-visible {
  border-color: rgba(14, 126, 120, 0.62);
  background: var(--teal);
  color: white;
}

.idea-save-state span[data-state="busy"],
.idea-save-state span[data-state="dirty"] {
  color: #9a5c00;
}

.idea-save-state span[data-state="saved"] {
  color: var(--teal-dark);
}

.idea-save-state span[data-state="error"] {
  color: #9b2c1f;
}

.idea-mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.38rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #f5f8fb;
}

.idea-mode-tabs button {
  min-height: 2.7rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.idea-mode-tabs button[aria-current] {
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(37, 51, 73, 0.1);
}

.idea-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 23rem);
  gap: 0.9rem;
  min-height: 0;
}

.idea-card-builder {
  display: grid;
  gap: 0.82rem;
  align-content: start;
  min-width: 0;
}

.idea-field-grid,
.idea-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.idea-field-grid label,
.idea-detail-grid label,
.idea-polish-box,
.idea-settings-drawer label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: #526174;
  font-weight: 900;
}

.idea-field-grid input,
.idea-detail-grid input,
.idea-polish-box textarea,
.idea-settings-drawer textarea {
  width: 100%;
  min-width: 0;
  border: 2px solid rgba(37, 51, 73, 0.12);
  border-radius: 0.85rem;
  background: #fbfdff;
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}

.idea-field-grid input,
.idea-detail-grid input {
  min-height: 2.9rem;
  padding: 0.64rem 0.76rem;
}

.idea-polish-box textarea,
.idea-settings-drawer textarea {
  padding: 0.72rem 0.84rem;
  resize: vertical;
}

.idea-field-grid input:focus,
.idea-detail-grid input:focus,
.idea-polish-box textarea:focus,
.idea-settings-drawer textarea:focus {
  border-color: rgba(182, 70, 122, 0.45);
  outline: 0;
  background: white;
  box-shadow: 0 0 0 4px rgba(182, 70, 122, 0.09);
}

.idea-mode-panel {
  display: grid;
  gap: 0.7rem;
  padding: 0.78rem;
  border: 1px solid rgba(182, 70, 122, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 240, 247, 0.86), rgba(255, 255, 255, 0.96)),
    white;
}

.idea-mode-panel[hidden] {
  display: none;
}

.idea-mode-intro {
  display: grid;
  gap: 0.2rem;
}

.idea-mode-intro strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.idea-mode-intro span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.idea-action-row,
.idea-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.idea-settings-drawer {
  display: grid;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid rgba(66, 87, 178, 0.16);
  border-radius: var(--radius);
  background: #f6f8ff;
}

.idea-settings-drawer summary {
  color: #31458f;
  font-weight: 950;
  cursor: pointer;
}

.idea-settings-drawer[open] {
  gap: 0.75rem;
}

.idea-export-actions a[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: auto;
}

.idea-action-row a[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.badge-theme-calm { --badge-a: #4f8f45; --badge-b: #e8f7df; }

.quiet-corner-band {
  min-height: calc(100vh - 4.5rem);
  padding: clamp(0.75rem, 2vw, 1.25rem);
  background:
    linear-gradient(135deg, rgba(223, 246, 234, 0.95), rgba(232, 237, 255, 0.86)),
    #f8fbfd;
}

.quiet-corner-shell {
  display: grid;
  gap: 0.85rem;
  max-width: 1180px;
  margin: 0 auto;
}

.quiet-hero,
.quiet-stats,
.quiet-layout {
  border: 1px solid rgba(37, 51, 73, 0.1);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px rgba(37, 51, 73, 0.08);
}

.quiet-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: clamp(1rem, 2vw, 1.35rem);
  border-radius: var(--radius);
}

.quiet-hero h1 {
  max-width: 760px;
  font-size: clamp(2.15rem, 5vw, 4.4rem);
  line-height: 0.96;
}

.quiet-hero p {
  max-width: 680px;
  color: #526174;
  line-height: 1.45;
}

.quiet-badge {
  display: grid;
  gap: 0.25rem;
  min-width: 10rem;
  padding: 0.85rem;
  border: 1px solid rgba(79, 143, 69, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f2fbeb, #ffffff);
  color: #285f29;
}

.quiet-badge span,
.quiet-stats span,
.quiet-panel-head span,
.quiet-mode-list span {
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
  color: #4f6b63;
}

.quiet-badge strong,
.quiet-stats strong {
  color: var(--ink);
}

.quiet-badge.earned {
  border-color: rgba(190, 137, 27, 0.4);
  background: linear-gradient(135deg, #fff4c8, #ffffff);
}

.quiet-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.55rem;
  border-radius: 1rem;
}

.quiet-stats div {
  display: grid;
  gap: 0.08rem;
  padding: 0.62rem 0.72rem;
  border-radius: 0.8rem;
  background: #f8fbfd;
}

.quiet-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
  gap: 0.85rem;
  padding: 0.85rem;
  border-radius: var(--radius);
}

.quiet-side,
.quiet-stage {
  min-width: 0;
}

.quiet-side {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.quiet-helper {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid rgba(79, 143, 69, 0.22);
  border-radius: var(--radius);
  background: #f1faee;
}

.quiet-helper span {
  display: block;
  color: #526174;
  line-height: 1.35;
}

.quiet-mode-list {
  display: grid;
  gap: 0.48rem;
}

.quiet-mode-list button {
  display: grid;
  gap: 0.12rem;
  padding: 0.76rem;
  border: 2px solid rgba(37, 51, 73, 0.08);
  border-radius: 0.9rem;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.quiet-mode-list button[aria-current] {
  border-color: rgba(79, 143, 69, 0.72);
  background: linear-gradient(135deg, #e8f7df, #ffffff);
  box-shadow: 0 10px 24px rgba(79, 143, 69, 0.16);
}

.quiet-mode-list button.is-complete strong::after {
  content: " done";
  margin-left: 0.35rem;
  color: #0e7e78;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.quiet-stage {
  display: grid;
  gap: 0.7rem;
}

.quiet-panel {
  display: grid;
  gap: 0.78rem;
  min-height: 29rem;
  padding: clamp(0.9rem, 2vw, 1.2rem);
  border: 1px solid rgba(37, 51, 73, 0.09);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
}

.quiet-panel[hidden] {
  display: none !important;
}

.quiet-panel-head {
  display: grid;
  gap: 0.18rem;
}

.quiet-panel-head h2 {
  font-size: clamp(1.65rem, 4vw, 3rem);
  line-height: 1;
}

.quiet-panel-head p {
  margin: 0;
  color: #526174;
}

.breathing-card {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: 1rem;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 42%, rgba(79, 143, 69, 0.18), transparent 38%),
    #eff8f3;
}

.breathing-card[hidden] {
  display: none !important;
}

.breathing-orb {
  display: grid;
  place-items: center;
  width: min(46vw, 12.5rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(145deg, #dff6ea, #9fd3a0);
  box-shadow:
    inset 0 -1.2rem 2.2rem rgba(79, 143, 69, 0.2),
    0 1.2rem 2.6rem rgba(79, 143, 69, 0.22);
  color: #174b2e;
  font-size: 1.3rem;
  font-weight: 950;
  transform: scale(0.82);
  transition: transform 3.4s ease-in-out, filter 0.5s ease;
}

.breathing-orb[data-phase="in"] {
  transform: scale(1);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(145deg, #dff6ea, #8fd8b0);
}

.breathing-orb[data-phase="hold"] {
  transform: scale(1);
  filter: saturate(1.15);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(145deg, #e8edff, #a8b7ff);
}

.breathing-orb[data-phase="out"],
.breathing-orb[data-phase="rest"] {
  transform: scale(0.82);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(145deg, #fff0e6, #f2b280);
}

.breathing-orb[data-phase="done"] {
  transform: scale(0.86);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(145deg, #fff4c8, #d9b54c);
}

.quiet-choice-row,
.quiet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quiet-choice-row button {
  min-height: 2.45rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid rgba(79, 143, 69, 0.25);
  border-radius: 999px;
  background: #ffffff;
  color: #285f29;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.quiet-choice-row button.is-selected {
  background: #4f8f45;
  color: white;
}

.quiet-field,
.quiet-field-grid label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: #526174;
  font-weight: 900;
}

.quiet-field input,
.quiet-field textarea,
.quiet-field-grid input,
.quiet-field-grid select {
  width: 100%;
  min-width: 0;
  border: 2px solid rgba(37, 51, 73, 0.12);
  border-radius: 0.8rem;
  background: white;
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}

.quiet-field input,
.quiet-field-grid input,
.quiet-field-grid select {
  min-height: 2.8rem;
  padding: 0.62rem 0.72rem;
}

.quiet-field textarea {
  padding: 0.7rem 0.78rem;
  resize: vertical;
}

.quiet-field input:focus,
.quiet-field textarea:focus,
.quiet-field-grid input:focus,
.quiet-field-grid select:focus {
  border-color: rgba(79, 143, 69, 0.52);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(79, 143, 69, 0.11);
}

.quiet-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.quiet-reset-list {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border: 1px solid rgba(37, 51, 73, 0.08);
  border-radius: 0.9rem;
  background: #f7fafc;
}

.quiet-reset-list label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 850;
}

.quiet-plan-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.quiet-plan-list label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: #526174;
  font-weight: 900;
}

.quiet-plan-list input {
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: 0.56rem 0.68rem;
  border: 2px solid rgba(37, 51, 73, 0.12);
  border-radius: 0.8rem;
  background: white;
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}

.quiet-plan-list input:focus {
  border-color: rgba(79, 143, 69, 0.52);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(79, 143, 69, 0.11);
}

.quiet-journal-preview,
.quiet-plan-preview {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
  border: 1px solid rgba(37, 51, 73, 0.08);
  border-radius: 0.9rem;
  background: #f8fbfd;
}

.quiet-journal-preview header,
.quiet-plan-preview header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.quiet-journal-preview header a,
.quiet-plan-preview header a {
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 950;
}

.quiet-journal-preview > div,
.quiet-plan-preview > div {
  display: grid;
  gap: 0.5rem;
  max-height: 17rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.quiet-journal-preview article,
.quiet-plan-preview article {
  display: grid;
  gap: 0.25rem;
  padding: 0.62rem;
  border: 1px solid rgba(79, 143, 69, 0.14);
  border-radius: 0.78rem;
  background: white;
}

.quiet-journal-preview time,
.quiet-plan-preview time,
.quiet-journal-timeline time,
.quiet-plan-print-list time {
  color: #526174;
  font-size: 0.78rem;
  font-weight: 900;
}

.quiet-journal-preview article span,
.quiet-plan-preview article span {
  width: fit-content;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #e8f7df;
  color: #285f29;
  font-size: 0.78rem;
  font-weight: 950;
}

.quiet-journal-preview p,
.quiet-journal-preview em,
.quiet-plan-preview p,
.quiet-plan-preview ol {
  margin: 0;
}

.quiet-plan-preview ol {
  padding-left: 1.1rem;
  color: #253349;
  font-size: 0.92rem;
  font-weight: 750;
}

.quiet-journal-preview em {
  color: #526174;
  font-style: normal;
  font-weight: 850;
}

.quiet-empty-journal {
  color: #526174;
  font-weight: 850;
}

.quiet-journal-band {
  min-height: calc(100vh - 4.5rem);
  padding: clamp(0.75rem, 2vw, 1.25rem);
  background: #f8fbfd;
}

.quiet-journal-page {
  display: grid;
  gap: 1rem;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid rgba(37, 51, 73, 0.1);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 16px 34px rgba(37, 51, 73, 0.08);
}

.quiet-journal-page h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.96;
}

.quiet-journal-timeline {
  display: grid;
  gap: 0.65rem;
}

.quiet-journal-timeline article {
  display: grid;
  gap: 0.3rem;
  padding: 0.82rem;
  border-left: 0.28rem solid #4f8f45;
  border-radius: 0.8rem;
  background: #f8fbfd;
}

.quiet-journal-timeline p {
  margin: 0;
  line-height: 1.5;
}

.quiet-journal-timeline em {
  color: #526174;
  font-style: normal;
  font-weight: 850;
}

.quiet-plan-page h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.quiet-plan-print-list {
  display: grid;
  gap: 0.85rem;
}

.quiet-plan-print-list article {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem;
  border: 1px solid rgba(37, 51, 73, 0.1);
  border-left: 0.32rem solid #315fed;
  border-radius: 0.9rem;
  background: #f8fbfd;
  break-inside: avoid;
}

.quiet-plan-print-list article > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.quiet-plan-print-list h2 {
  margin: 0.12rem 0 0;
  font-size: 1.35rem;
}

.quiet-plan-print-list article > header span {
  flex: 0 0 auto;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: #e8edff;
  color: #17357b;
  font-size: 0.82rem;
  font-weight: 950;
}

.quiet-plan-print-list ol {
  display: grid;
  gap: 0.42rem;
  margin: 0;
  padding-left: 1.35rem;
}

.quiet-plan-print-list li {
  line-height: 1.45;
}

.quiet-result {
  padding: 0.75rem 0.85rem;
  border-radius: 0.9rem;
  background: #e8f7df;
  color: #285f29;
  font-weight: 900;
}

.quiet-result[data-state="busy"] {
  background: #e8edff;
  color: #31458f;
}

.quiet-result[data-state="error"],
.quiet-result[data-state="notice"] {
  background: #fff0e6;
  color: #8b351f;
}

.quiet-footer {
  padding: 0.2rem 0 0;
}

@media (max-width: 860px) {
  .quiet-corner-band {
    padding: 0.55rem;
  }

  .quiet-corner-shell {
    gap: 0.62rem;
  }

  .quiet-hero {
    display: grid;
    gap: 0.75rem;
    padding: 0.82rem;
  }

  .quiet-hero h1 {
    font-size: clamp(2rem, 10vw, 3.1rem);
  }

  .quiet-badge {
    min-width: 0;
  }

  .quiet-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0.38rem;
  }

  .quiet-stats div {
    padding: 0.48rem;
  }

  .quiet-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.62rem;
    padding: 0.55rem;
  }

  .quiet-helper {
    padding: 0.62rem;
  }

  .quiet-mode-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .quiet-mode-list button {
    min-height: 4.1rem;
    padding: 0.48rem 0.42rem;
    text-align: center;
  }

  .quiet-mode-list span {
    font-size: 0.64rem;
  }

  .quiet-mode-list strong {
    font-size: 0.82rem;
    line-height: 1.05;
  }

  .quiet-panel {
    min-height: 0;
    padding: 0.72rem;
  }

  .quiet-panel-head h2 {
    font-size: clamp(1.7rem, 8vw, 2.45rem);
  }

  .breathing-card {
    padding: 0.7rem;
  }

  .breathing-orb {
    width: min(58vw, 10.5rem);
  }

  .quiet-field-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .quiet-plan-list {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .quiet-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quiet-choice-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.32rem;
  }

  .quiet-choice-row button {
    min-height: 2.35rem;
    padding: 0.38rem 0.32rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 520px) {
  .quiet-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quiet-stats span {
    font-size: 0.62rem;
  }

  .quiet-stats strong {
    font-size: 0.92rem;
  }

  .quiet-mode-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quiet-mode-list button {
    min-height: 3.7rem;
  }
}

.idea-preview {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  min-width: 0;
}

.idea-image-preview {
  display: grid;
  place-items: center;
  min-height: 17rem;
  overflow: hidden;
  border: 2px dashed rgba(182, 70, 122, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 240, 247, 0.8), rgba(239, 247, 255, 0.95)),
    white;
  color: var(--muted);
  font-weight: 950;
  text-align: center;
}

.idea-image-preview img {
  width: 100%;
  height: 100%;
  max-height: 26rem;
  object-fit: cover;
}

.idea-image-preview.is-loading {
  border-style: solid;
  background: #f6f8ff;
  color: #4257b2;
}

.idea-image-preview.is-loading span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.idea-image-preview.is-loading span::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 0.18rem solid rgba(66, 87, 178, 0.2);
  border-top-color: #4257b2;
  border-radius: 999px;
  animation: doodely-spin 0.8s linear infinite;
}

.idea-preview-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: inset 0 0.3rem 0 rgba(14, 126, 120, 0.08);
}

.idea-preview-card > span {
  width: fit-content;
  padding: 0.25rem 0.48rem;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.idea-preview-card h3 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.04;
}

.idea-preview-card p {
  color: var(--ink);
  line-height: 1.5;
}

.idea-preview-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.idea-preview-card div span {
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(29, 36, 51, 0.08);
  border-radius: 999px;
  background: white;
  color: #526174;
  font-size: 0.8rem;
  font-weight: 850;
}

.idea-footer {
  padding: 0.8rem;
}

.idea-print-band {
  background: #f5f7f9;
  padding: 1.5rem 0;
}

.idea-print-card {
  display: grid;
  gap: 0.82rem;
  width: min(680px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(0.9rem, 2.4vw, 1.45rem);
  border: 0.16rem solid #24314b;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 248, 252, 0.98)),
    white;
  box-shadow: 0 18px 42px rgba(37, 51, 73, 0.12);
  break-inside: avoid;
  page-break-inside: avoid;
}

.idea-print-card img {
  width: min(100%, 34rem);
  max-height: 27rem;
  margin: 0 auto;
  border: 0.12rem solid rgba(36, 49, 75, 0.18);
  border-radius: 0.85rem;
  object-fit: cover;
}

.idea-print-card header {
  display: grid;
  gap: 0.25rem;
  text-align: center;
}

.idea-print-card header span {
  color: var(--teal-dark);
  font-weight: 950;
  text-transform: uppercase;
}

.idea-print-card h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.4vw, 3.3rem);
  line-height: 1;
}

.idea-print-card p {
  margin: 0;
}

.idea-print-text {
  padding: 0.72rem;
  border: 1px solid rgba(36, 49, 75, 0.14);
  border-radius: 0.8rem;
  background: #fffdf8;
  line-height: 1.45;
}

.idea-print-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0;
}

.idea-print-card dl div {
  padding: 0.55rem;
  border: 1px solid rgba(36, 49, 75, 0.12);
  border-radius: 0.72rem;
  background: #f8fbfd;
}

.idea-print-card dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.idea-print-card dd {
  margin: 0.18rem 0 0;
  color: var(--ink);
  font-weight: 850;
}

.mode-character { --idea-a: #b6467a; --idea-b: #fff0f7; --idea-c: #67183e; }
.mode-drawing { --idea-a: #2563a8; --idea-b: #e5f2ff; --idea-c: #173a64; }
.mode-invention { --idea-a: #0e7e78; --idea-b: #dff6ea; --idea-c: #094a46; }
.mode-mashup { --idea-a: #7c3f98; --idea-b: #f2e7ff; --idea-c: #44205a; }

.idea-editor[hidden],
.idea-home[hidden],
.idea-step-panel[hidden] {
  display: none !important;
}

.idea-home {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1rem;
  background: white;
}

.idea-home-head {
  display: grid;
  gap: 0.25rem;
  max-width: 52rem;
}

.idea-home-head h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
}

.idea-home-head p,
.idea-home-note span {
  margin: 0;
  color: var(--muted);
}

.idea-mode-launcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.idea-mode-launch {
  position: relative;
  display: grid;
  gap: 0.32rem;
  min-height: 14rem;
  padding: 1rem;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--idea-a), white 58%);
  border-radius: var(--radius);
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--idea-b), white 8%), white 68%),
    white;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(37, 51, 73, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.idea-mode-launch::after {
  content: "";
  position: absolute;
  right: -2rem;
  bottom: -2.2rem;
  width: 8rem;
  height: 8rem;
  border: 1.6rem solid color-mix(in srgb, var(--idea-a), transparent 76%);
  border-radius: 999px;
}

.idea-mode-launch:hover,
.idea-mode-launch:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--idea-a), white 18%);
  outline: 0;
  box-shadow: 0 22px 42px rgba(37, 51, 73, 0.14);
}

.idea-mode-launch span {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  background: var(--idea-a);
  color: white;
  font-size: 0.92rem;
  font-weight: 950;
}

.idea-mode-launch strong {
  color: var(--idea-c);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.05;
}

.idea-mode-launch em {
  color: var(--idea-a);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

.idea-mode-launch small {
  color: #526174;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.idea-home-note {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  border: 1px solid rgba(14, 126, 120, 0.18);
  border-radius: var(--radius);
  background: #f0fbf6;
}

.idea-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.42rem;
  border: 1px solid rgba(36, 49, 75, 0.12);
  border-radius: 1rem;
  background: linear-gradient(180deg, #f8fbfd, #eef5f8);
}

.idea-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.7rem;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.idea-stepper button[aria-current] {
  border-color: rgba(14, 126, 120, 0.76);
  background: linear-gradient(180deg, #ffffff, #dff6ea);
  color: #082d2b;
  box-shadow: 0 12px 26px rgba(14, 126, 120, 0.24);
  transform: translateY(-1px);
}

.idea-stepper button[data-step-state="done"] {
  background: rgba(255, 255, 255, 0.74);
  color: #31458f;
}

.idea-stepper button[data-step-state="done"] span {
  background: #dfe8ff;
  color: #31458f;
}

.idea-stepper span {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 0.82rem;
}

.idea-stepper button[aria-current] span {
  background: var(--teal);
  color: white;
  box-shadow: 0 0 0 0.22rem rgba(14, 126, 120, 0.14);
}

.idea-step-panel {
  display: grid;
  gap: 0.82rem;
  align-content: start;
}

.idea-workshop-banner,
.idea-question-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  border: 2px solid color-mix(in srgb, var(--idea-a, #b6467a), white 64%);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--idea-b, #fff0f7), white 10%), white 72%),
    white;
}

.idea-workshop-banner > span,
.idea-question-card > span {
  display: grid;
  place-items: center;
  align-self: start;
  min-width: 3rem;
  min-height: 3rem;
  padding: 5px;
  border-radius: 0.9rem;
  background: var(--idea-a, #b6467a);
  color: white;
  font-weight: 950;
  line-height: 1.08;
  text-align: center;
  box-sizing: border-box;
}

.idea-workshop-banner strong,
.idea-question-card strong {
  min-width: 0;
  color: var(--idea-c, var(--ink));
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.idea-workshop-banner p,
.idea-question-card p {
  min-width: 0;
  margin: 0.16rem 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.idea-question-card {
  grid-template-columns: auto minmax(0, 1fr);
}

.idea-question-card > span {
  grid-row: 1 / span 2;
}

.idea-question-card > strong,
.idea-question-card > p {
  grid-column: 2;
}

.idea-inline-spark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.68rem;
  border: 1px solid rgba(66, 87, 178, 0.16);
  border-left: 0.3rem solid #4257b2;
  border-radius: var(--radius);
  background: #f6f8ff;
}

.idea-inline-spark span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
  line-height: 1.3;
}

.idea-mode-panel {
  border-width: 2px;
  border-color: color-mix(in srgb, var(--idea-a), white 66%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--idea-b), white 18%), rgba(255, 255, 255, 0.98)),
    white;
}

.idea-mode-intro strong {
  color: var(--idea-c);
}

.idea-gallery-item {
  border-left: 0.35rem solid var(--idea-a, #b6467a);
}

.idea-gallery-item[aria-current="true"] {
  border-color: color-mix(in srgb, var(--idea-a, #b6467a), white 36%);
  background: color-mix(in srgb, var(--idea-b, #fff0f7), white 12%);
  box-shadow: inset 0.25rem 0 0 var(--idea-a, #b6467a);
}

.idea-preview-card {
  position: sticky;
  top: 1rem;
  gap: 0;
  overflow: hidden;
  padding: 0.5rem;
  border: 0.28rem solid var(--idea-a, #b6467a);
  border-radius: 1.05rem;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--idea-a, #b6467a), white 18%), color-mix(in srgb, var(--idea-b, #fff0f7), white 8%));
  box-shadow:
    0 20px 38px rgba(37, 51, 73, 0.14),
    inset 0 0 0 0.14rem rgba(255, 255, 255, 0.72);
}

.idea-card-art {
  display: grid;
  place-items: center;
  min-height: 18rem;
  overflow: hidden;
  border: 0.18rem solid rgba(255, 255, 255, 0.78);
  border-radius: 0.82rem 0.82rem 0.32rem 0.32rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), color-mix(in srgb, var(--idea-b, #fff0f7), white 16%)),
    white;
  color: var(--idea-c, var(--muted));
  font-weight: 950;
  text-align: center;
}

.idea-card-art img {
  width: 100%;
  height: 100%;
  max-height: 27rem;
  object-fit: cover;
}

.idea-card-art.is-loading {
  background: #f6f8ff;
  color: #4257b2;
}

.idea-card-art.is-loading span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.idea-card-art.is-loading span::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 0.18rem solid rgba(66, 87, 178, 0.2);
  border-top-color: #4257b2;
  border-radius: 999px;
  animation: doodely-spin 0.8s linear infinite;
}

.idea-card-face {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border-radius: 0.32rem 0.32rem 0.82rem 0.82rem;
  background: rgba(255, 255, 255, 0.92);
}

.idea-card-face > span {
  width: fit-content;
  padding: 0.25rem 0.48rem;
  border-radius: 999px;
  background: var(--idea-a, #b6467a);
  color: white;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.idea-card-face h3 {
  margin: 0;
  color: var(--idea-c, var(--ink));
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.04;
}

.idea-card-face p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.idea-card-face div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.idea-card-face div span {
  padding: 0.35rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--idea-a, #b6467a), white 78%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--idea-b, #fff0f7), white 35%);
  color: var(--idea-c, #526174);
  font-size: 0.8rem;
  font-weight: 850;
}

.login-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 440px));
  gap: 1rem;
  align-items: stretch;
  justify-content: center;
  width: min(100%, 960px);
}

.login-split .auth-card {
  width: 100%;
}

.child-login-card {
  background:
    linear-gradient(180deg, rgba(223, 246, 234, 0.62), rgba(255, 255, 255, 1) 42%),
    white;
}

@media (max-width: 860px) {
  .console-grid,
  .form-row-3,
  .form-row-2,
  .login-split {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-strip div:nth-child(2) {
    border-right: 0;
  }

  .summary-strip div:nth-child(1),
  .summary-strip div:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .console-top,
  .kid-hero,
  .kid-today,
  .coach-header,
  .coach-grid,
  .story-hero,
  .story-workspace,
  .story-field-grid,
  .story-outline-grid,
  .story-finish-grid,
  .story-chapter-shell,
  .course-hero,
  .course-progress-panel,
  .progress-panel,
  .form-actions-row,
  .panel-title-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .console-actions {
    justify-content: stretch;
  }

  .progress-panel {
    overflow: hidden;
  }

  .badge-shelf-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .badge-preview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0;
    overflow: visible;
  }

  .kid-badge {
    min-height: 8.4rem;
  }

  .badge-shelf-controls {
    justify-content: center;
  }

  .console-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: visible;
  }

  .console-tabs a {
    min-width: 0;
    padding: 0.52rem 0.25rem;
    text-align: center;
    font-size: clamp(0.72rem, 2.8vw, 0.9rem);
    white-space: nowrap;
  }

  .billing-overview {
    grid-template-columns: 1fr;
  }

  .billing-overview > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .billing-overview > div:last-child {
    border-bottom: 0;
  }

  .billing-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .billing-actions button {
    width: 100%;
  }

  .activity-review-child > summary,
  .activity-learning-summary,
  .activity-review-grid,
  .memory-add-form,
  .parent-chat-reader header {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .memory-pill-popover {
    left: 50%;
    width: min(22rem, calc(100vw - 2rem));
    transform: translateX(-50%);
  }

  .memory-pill-popover::before {
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
  }

  .course-progress-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .course-progress-item em {
    text-align: left;
  }

  .parent-chat-message {
    width: min(94%, 34rem);
  }

  .seat-purchase-actions,
  .seat-purchase-actions form,
  .delete-child-confirm form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .seat-purchase-actions label {
    max-width: none;
  }

  .settings-form .primary-button,
  .account-delete-confirm .danger-button {
    width: 100%;
  }

  .seat-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .child-editor > summary {
    align-items: stretch;
    flex-direction: column;
  }

  .kid-topic-grid {
    grid-template-columns: 1fr;
  }

  .today-actions,
  .today-actions .primary-button,
  .today-actions .secondary-button {
    width: 100%;
  }

  .today-helper {
    width: 100%;
  }

  .coach-helper {
    min-width: 0;
  }

  .coach-chat-shell {
    min-height: 0;
  }

  .coach-message {
    width: min(94%, 42rem);
  }

  .coach-input-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .coach-input-row textarea {
    grid-column: 1 / -1;
    order: -1;
  }

  .coach-input-row .primary-button {
    min-width: 5.5rem;
  }

  .coach-more-button {
    min-width: 4.8rem;
  }

  .coach-more-panel {
    left: 0.85rem;
    right: 0.85rem;
    bottom: calc(100% - 0.15rem);
    display: flex;
    width: auto;
    max-width: none;
  }

  .coach-more-panel::after {
    right: 7.3rem;
  }

  .coach-more-panel button,
  .coach-more-panel label {
    width: auto;
  }

  .course-step {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .course-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .course-actions .primary-button,
  .course-actions .secondary-button {
    width: 100%;
  }

  .word-game-hero,
  .word-adventure-hero,
  .word-game-stage,
  .word-adventure-grid,
  .challenge-top,
  .word-explorer-grid,
  .word-game-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .word-score-card {
    width: 100%;
  }

  .word-adventure-badge {
    width: 100%;
  }

  .word-game-topbar,
  .word-adventure-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .word-game-topbar div:nth-child(2),
  .word-adventure-stats div:nth-child(2) {
    border-right: 0;
  }

  .word-game-topbar div:nth-child(1),
  .word-game-topbar div:nth-child(2),
  .word-adventure-stats div:nth-child(1),
  .word-adventure-stats div:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .word-mode-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .word-mode-tabs button {
    min-height: 2.35rem;
    padding: 0.35rem 0.2rem;
    font-size: clamp(0.72rem, 2.7vw, 0.9rem);
  }

  .word-game-stage {
    min-height: 0;
    padding: 0.75rem;
  }

  .word-adventure-grid {
    min-height: 0;
    padding: 0.75rem;
  }

  body.word-adventure-active {
    overflow: hidden;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-grid {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
    padding: 0.65rem 0.65rem 4.85rem;
    overflow: hidden;
    border-radius: 0;
    background: #fffdf8;
  }

  .word-adventure-shell.is-mobile-playing .word-mobile-exit {
    position: fixed;
    right: 0.75rem;
    top: 0.72rem;
    z-index: 48;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background: white;
    color: var(--teal-dark);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 950;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    min-height: 0;
    padding-right: 4.8rem;
  }

  .word-adventure-shell.is-mobile-playing .word-world-map,
  .word-adventure-shell.is-mobile-playing .word-round-card,
  .word-adventure-shell.is-mobile-playing .word-adventure-achievements,
  .word-adventure-shell.is-mobile-playing .word-adventure-progress {
    display: none !important;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-helper {
    display: grid;
    gap: 0.45rem;
    min-height: 0;
    padding: 0.55rem 0.65rem;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-helper .helper-portrait-small {
    width: 2.5rem;
    height: 2.5rem;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-helper strong {
    font-size: 0.95rem;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-helper p {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-stage {
    min-height: 0;
    overflow-y: auto;
    padding: 0.65rem;
  }

  .word-adventure-shell.is-mobile-playing .word-start-panel,
  .word-adventure-shell.is-mobile-playing .round-complete-card {
    min-height: min(58dvh, 24rem);
    padding: 1rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-top {
    gap: 0.55rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-top h2 {
    font-size: clamp(1.55rem, 8vw, 2.45rem);
  }

  .word-adventure-shell.is-mobile-playing .challenge-word {
    padding: 0.55rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-playfield {
    min-height: min(46dvh, 20rem);
    padding: 0.75rem;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-stats {
    position: fixed;
    left: 0.55rem;
    right: 0.55rem;
    bottom: 0.55rem;
    z-index: 47;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-radius: 0.9rem;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-stats div {
    padding: 0.45rem 0.35rem;
    border-bottom: 0;
    text-align: center;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-stats span {
    font-size: 0.62rem;
  }

  .word-adventure-shell.is-mobile-playing .word-adventure-stats strong {
    font-size: 0.95rem;
  }

  body.word-adventure-active .helper-dock,
  body.number-quest-active .helper-dock,
  body.fact-lab-active .helper-dock {
    right: 0.75rem;
    bottom: 4.9rem;
    z-index: 70;
  }

  body.word-adventure-active .helper-panel,
  body.number-quest-active .helper-panel,
  body.fact-lab-active .helper-panel {
    bottom: 4.35rem;
    max-height: calc(100dvh - 10rem);
  }

  .word-world-map {
    grid-template-columns: 1fr;
  }

  .word-start-panel,
  .round-complete-card {
    min-height: 22rem;
  }

  .challenge-word {
    width: 100%;
  }

  .challenge-playfield {
    min-height: 18rem;
  }

  .adventure-options {
    grid-template-columns: 1fr;
  }

  .adventure-options.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mystery-clue-grid {
    grid-template-columns: 1fr;
  }

  .adventure-answer {
    min-height: 3.6rem;
  }

  .word-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .word-card {
    min-height: 7.25rem;
    padding: 0.7rem;
  }

  .meaning-options {
    grid-template-columns: 1fr;
  }

  .meaning-options button {
    min-height: 4.4rem;
  }

  .clap-beats span {
    width: 3.25rem;
    height: 3.25rem;
  }

  .word-map,
  .word-adventure-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .word-game-footer .primary-button,
  .word-game-footer .secondary-button {
    width: 100%;
  }

  .helper-choice-scroll {
    display: flex;
    gap: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
  }

  .helper-choice-scroll::-webkit-scrollbar {
    display: none;
  }

  .helper-card {
    flex: 0 0 100%;
    min-width: 0;
    max-width: 100%;
    scroll-snap-align: center;
    min-height: auto;
    padding: 0.85rem 3rem;
    text-align: center;
  }

  .helper-portrait {
    width: min(11rem, 58vw);
    justify-self: center;
  }

  .helper-card strong,
  .helper-card em,
  .helper-card span {
    overflow-wrap: anywhere;
  }

  .helper-scroll-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 4.8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--teal-dark);
    font-size: 2.2rem;
    font-weight: 900;
    transform: translateY(-50%);
    box-shadow: 0 12px 28px rgba(13, 34, 52, 0.14);
  }

  .helper-scroll-button.previous {
    left: 0.35rem;
  }

  .helper-scroll-button.next {
    right: 0.35rem;
  }

  .helper-choice-form .primary-button,
  .helper-mini {
    width: 100%;
  }

  .helper-dock {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}

@media (max-width: 860px) {
  .number-quest-hero,
  .number-quest-grid,
  .number-challenge-top,
  .number-game-actions,
  .number-challenge-actions,
  .number-quest-shell .word-game-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .number-quest-badge {
    width: 100%;
  }

  .number-quest-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .number-quest-stats div:nth-child(2) {
    border-right: 0;
  }

  .number-quest-stats div:nth-child(1),
  .number-quest-stats div:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .number-quest-grid {
    min-height: 0;
    padding: 0.75rem;
  }

  body.number-quest-active {
    overflow: hidden;
  }

  .number-quest-shell.is-mobile-playing .number-quest-grid {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
    padding: 0.65rem 0.65rem 4.85rem;
    overflow: hidden;
    border-radius: 0;
    background: #fffdf8;
  }

  .number-quest-shell.is-mobile-playing .number-mobile-exit {
    position: fixed;
    right: 0.75rem;
    top: 0.72rem;
    z-index: 48;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(66, 87, 178, 0.22);
    border-radius: 999px;
    background: white;
    color: #31458f;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 950;
  }

  .number-quest-shell.is-mobile-playing .number-quest-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    min-height: 0;
    padding-right: 4.8rem;
  }

  .number-quest-shell.is-mobile-playing .number-world-map,
  .number-quest-shell.is-mobile-playing .number-round-card,
  .number-quest-shell.is-mobile-playing .number-quest-achievements,
  .number-quest-shell.is-mobile-playing .number-quest-progress {
    display: none !important;
  }

  .number-quest-shell.is-mobile-playing .number-quest-helper {
    display: grid;
    gap: 0.45rem;
    min-height: 0;
    padding: 0.55rem 0.65rem;
  }

  .number-quest-shell.is-mobile-playing .number-quest-helper .helper-portrait-small {
    width: 2.5rem;
    height: 2.5rem;
  }

  .number-quest-shell.is-mobile-playing .number-quest-helper strong {
    font-size: 0.95rem;
  }

  .number-quest-shell.is-mobile-playing .number-quest-helper p {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .number-quest-shell.is-mobile-playing .number-quest-stage {
    min-height: 0;
    overflow-y: auto;
    padding: 0.65rem;
  }

  .number-quest-shell.is-mobile-playing .number-start-panel,
  .number-quest-shell.is-mobile-playing .number-complete-card {
    min-height: min(58dvh, 24rem);
    padding: 1rem;
  }

  .number-quest-shell.is-mobile-playing .number-challenge-top {
    gap: 0.55rem;
  }

  .number-quest-shell.is-mobile-playing .number-challenge-top h2 {
    font-size: clamp(1.55rem, 8vw, 2.45rem);
  }

  .number-quest-shell.is-mobile-playing .number-question-card {
    padding: 0.55rem;
  }

  .number-quest-shell.is-mobile-playing .number-playfield {
    min-height: min(42dvh, 19rem);
    padding: 0.75rem;
  }

  .number-quest-shell.is-mobile-playing .number-quest-stats {
    position: fixed;
    left: 0.55rem;
    right: 0.55rem;
    bottom: 0.55rem;
    z-index: 47;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-radius: 0.9rem;
  }

  .number-quest-shell.is-mobile-playing .number-quest-stats div {
    padding: 0.45rem 0.35rem;
    border-bottom: 0;
    text-align: center;
  }

  .number-quest-shell.is-mobile-playing .number-quest-stats span {
    font-size: 0.62rem;
  }

  .number-quest-shell.is-mobile-playing .number-quest-stats strong {
    font-size: 0.95rem;
  }

  .number-question-card {
    width: 100%;
  }

  .number-playfield {
    min-height: 18rem;
  }

  .number-answer-grid {
    grid-template-columns: 1fr;
  }

  .activity-ai-panel {
    grid-template-columns: 1fr;
  }

  .activity-ai-panel > div:last-child {
    justify-content: stretch;
  }

  .activity-ai-panel .secondary-button {
    flex: 1 1 100%;
    width: 100%;
    white-space: normal;
  }

  .number-answer {
    min-height: 3.6rem;
  }

  .number-visual {
    padding: 0.75rem;
  }

  .number-visual-fraction span {
    min-height: 3.2rem;
  }

  .number-quest-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .number-quest-shell .word-game-footer .primary-button,
  .number-quest-shell .word-game-footer .secondary-button {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .fact-lab-hero,
  .fact-lab-grid,
  .fact-challenge-top,
  .fact-lab-actions,
  .fact-game-actions,
  .fact-lab-shell .word-game-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .fact-lab-badge {
    width: 100%;
  }

  .fact-lab-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .fact-lab-stats div:nth-child(2) {
    border-right: 0;
  }

  .fact-lab-stats div:nth-child(1),
  .fact-lab-stats div:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .fact-lab-grid {
    min-height: 0;
    padding: 0.75rem;
  }

  .fact-world-map {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  body.fact-lab-active {
    overflow: hidden;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-grid {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
    padding: 0.65rem 0.65rem 4.85rem;
    overflow: hidden;
    border-radius: 0;
    background: #fffdf8;
  }

  .fact-lab-shell.is-mobile-playing .fact-mobile-exit {
    position: fixed;
    right: 0.75rem;
    top: 0.72rem;
    z-index: 48;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background: white;
    color: var(--teal-dark);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 950;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    min-height: 0;
    padding-right: 4.8rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-world-map,
  .fact-lab-shell.is-mobile-playing .fact-lab-round-card,
  .fact-lab-shell.is-mobile-playing .fact-lab-achievements,
  .fact-lab-shell.is-mobile-playing .fact-lab-progress {
    display: none !important;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-helper {
    display: grid;
    gap: 0.45rem;
    min-height: 0;
    padding: 0.55rem 0.65rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-helper .helper-portrait-small {
    width: 2.5rem;
    height: 2.5rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-helper strong {
    font-size: 0.95rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-helper p {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-stage {
    min-height: 0;
    overflow-y: auto;
    padding: 0.65rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-stats {
    position: fixed;
    left: 0.55rem;
    right: 0.55rem;
    bottom: 0.55rem;
    z-index: 47;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-radius: 0.9rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-stats div {
    padding: 0.45rem 0.35rem;
    border-bottom: 0;
    text-align: center;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-stats span {
    font-size: 0.62rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-lab-stats strong {
    font-size: 0.95rem;
  }

  .fact-start-panel,
  .fact-complete-card {
    min-height: 20rem;
    padding: 1rem;
  }

  .fact-research-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .fact-research-card span,
  .fact-research-card p,
  .fact-research-card button {
    grid-column: auto;
    grid-row: auto;
  }

  .fact-choice-grid {
    grid-template-columns: 1fr;
  }

  .fact-choice-grid button {
    min-height: 3.8rem;
  }

  .fact-lab-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fact-lab-shell .word-game-footer .primary-button,
  .fact-lab-shell .word-game-footer .secondary-button,
  .fact-lab-actions .primary-button,
  .fact-lab-actions .secondary-button,
  .fact-game-actions .primary-button,
  .fact-game-actions .secondary-button {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .word-adventure-shell.is-mobile-playing .challenge-top,
  .number-quest-shell.is-mobile-playing .number-challenge-top,
  .fact-lab-shell.is-mobile-playing .fact-challenge-top {
    gap: 0.45rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-top h2,
  .number-quest-shell.is-mobile-playing .number-challenge-top h2,
  .fact-lab-shell.is-mobile-playing .fact-challenge-top h2 {
    font-size: clamp(1.35rem, 6.5vw, 2rem);
    line-height: 1;
  }

  .word-adventure-shell.is-mobile-playing .challenge-top p,
  .number-quest-shell.is-mobile-playing .number-challenge-top p,
  .fact-lab-shell.is-mobile-playing .fact-challenge-top p {
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .word-adventure-shell.is-mobile-playing .challenge-word,
  .number-quest-shell.is-mobile-playing .number-question-card,
  .fact-lab-shell.is-mobile-playing .fact-question-card {
    padding: 0.5rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-word strong,
  .number-quest-shell.is-mobile-playing .number-question-card strong,
  .fact-lab-shell.is-mobile-playing .fact-question-card strong {
    font-size: clamp(1rem, 4.5vw, 1.35rem);
    line-height: 1.12;
  }

  .word-adventure-shell.is-mobile-playing .challenge-playfield,
  .number-quest-shell.is-mobile-playing .number-playfield {
    min-height: 0;
    padding: 0.55rem;
    gap: 0.55rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-research-card,
  .fact-lab-shell.is-mobile-playing .fact-fact-card,
  .fact-lab-shell.is-mobile-playing .fact-question-card,
  .fact-lab-shell.is-mobile-playing .fact-explain-card {
    padding: 0.6rem;
  }

  .fact-lab-shell.is-mobile-playing .fact-research-card p {
    font-size: 0.98rem;
  }

  .word-adventure-shell.is-mobile-playing .adventure-options,
  .word-adventure-shell.is-mobile-playing .adventure-bubbles,
  .number-quest-shell.is-mobile-playing .number-answer-grid,
  .fact-lab-shell.is-mobile-playing .fact-choice-grid {
    gap: 0.45rem;
    padding: 0.45rem;
  }

  .word-adventure-shell.is-mobile-playing .adventure-answer,
  .number-quest-shell.is-mobile-playing .number-answer,
  .fact-lab-shell.is-mobile-playing .fact-choice-grid button {
    min-height: 3rem;
    padding: 0.55rem;
    font-size: 0.92rem;
    line-height: 1.18;
  }

  .word-adventure-shell.is-mobile-playing .activity-ai-panel,
  .number-quest-shell.is-mobile-playing .activity-ai-panel,
  .fact-lab-shell.is-mobile-playing .activity-ai-panel {
    gap: 0.45rem;
    padding: 0.55rem;
  }

  .word-adventure-shell.is-mobile-playing .activity-ai-panel p,
  .number-quest-shell.is-mobile-playing .activity-ai-panel p,
  .fact-lab-shell.is-mobile-playing .activity-ai-panel p {
    display: none;
  }

  .word-adventure-shell.is-mobile-playing .activity-ai-panel > div:last-child,
  .number-quest-shell.is-mobile-playing .activity-ai-panel > div:last-child,
  .fact-lab-shell.is-mobile-playing .activity-ai-panel > div:last-child {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .word-adventure-shell.is-mobile-playing .activity-ai-panel .secondary-button,
  .number-quest-shell.is-mobile-playing .activity-ai-panel .secondary-button,
  .fact-lab-shell.is-mobile-playing .activity-ai-panel .secondary-button {
    min-height: 2.15rem;
    width: auto;
    padding: 0.4rem 0.28rem;
    font-size: 0.72rem;
    line-height: 1.1;
    white-space: normal;
  }

  .word-adventure-shell.is-mobile-playing .challenge-actions,
  .number-quest-shell.is-mobile-playing .number-challenge-actions,
  .fact-lab-shell.is-mobile-playing .fact-lab-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-actions .primary-button,
  .word-adventure-shell.is-mobile-playing .challenge-actions .secondary-button,
  .number-quest-shell.is-mobile-playing .number-challenge-actions .primary-button,
  .number-quest-shell.is-mobile-playing .number-challenge-actions .secondary-button,
  .fact-lab-shell.is-mobile-playing .fact-lab-actions .primary-button,
  .fact-lab-shell.is-mobile-playing .fact-lab-actions .secondary-button {
    width: 100%;
    min-height: 2.45rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.86rem;
  }

  .word-adventure-shell.is-mobile-playing .challenge-actions .primary-button,
  .number-quest-shell.is-mobile-playing .number-challenge-actions .primary-button,
  .fact-lab-shell.is-mobile-playing .fact-lab-actions .primary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .story-starter-shell {
    width: min(100% - 0.85rem, 48rem);
    gap: 0.65rem;
    padding-top: 0.55rem;
  }

  .story-hero,
  .story-stats,
  .story-workspace,
  .story-footer {
    border-radius: 0.85rem;
  }

  .story-hero {
    padding: 0.8rem;
  }

  .story-hero h1 {
    font-size: clamp(2rem, 12vw, 3.2rem);
  }

  .story-hero p {
    font-size: 0.94rem;
    line-height: 1.35;
  }

  .story-hero-badge {
    min-width: 0;
  }

  .story-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .story-stats div {
    min-width: 0;
    padding: 0.58rem 0.35rem;
    text-align: center;
  }

  .story-stats span {
    font-size: 0.62rem;
  }

  .story-stats strong {
    font-size: clamp(1rem, 5vw, 1.35rem);
  }

  .story-workspace {
    min-height: 0;
  }

  .story-library,
  .story-editor {
    padding: 0.75rem;
    border-left: 0;
    border-right: 0;
  }

  .story-library {
    border-bottom: 1px solid var(--line);
  }

  .story-editor {
    min-height: 0;
  }

  .story-panel-head,
  .story-editor-top {
    align-items: stretch;
    flex-direction: column;
  }

  .story-panel-head .primary-button,
  .story-save-state .secondary-button {
    width: 100%;
  }

  .story-list {
    display: flex;
    gap: 0.55rem;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.1rem 0 0.35rem;
    scroll-snap-type: x mandatory;
  }

  .story-library[data-scroll-hint="true"]::after {
    content: "Swipe stories \2192";
    position: absolute;
    right: 0.85rem;
    top: 4.85rem;
    z-index: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(14, 126, 120, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--teal-dark);
    font-size: 0.72rem;
    font-weight: 950;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(37, 51, 73, 0.1);
  }

  .story-list-item {
    flex: 0 0 min(76vw, 19rem);
    scroll-snap-align: start;
  }

  .story-stepper {
    gap: 0.25rem;
    padding: 0.28rem;
  }

  .story-stepper button {
    min-height: 2.35rem;
    gap: 0.2rem;
    padding: 0.3rem 0.2rem;
    font-size: clamp(0.68rem, 2.9vw, 0.84rem);
  }

  .story-stepper span {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.7rem;
  }

  .story-step-panel {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .story-question-card {
    padding: 0.68rem;
  }

  .story-question-card strong {
    font-size: clamp(1.05rem, 5.4vw, 1.45rem);
    line-height: 1.1;
  }

  .story-question-card p {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .story-field-grid,
  .story-outline-grid,
  .story-finish-grid {
    grid-template-columns: 1fr;
  }

  .story-field-grid input,
  .story-field-grid select,
  .story-chapter-editor input {
    min-height: 2.7rem;
  }

  .story-outline-grid textarea {
    min-height: 6rem;
  }

  .story-prompt-row,
  .story-chapter-actions,
  .story-export-actions,
  .story-continue-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .story-draft-tools,
  .story-revision-tool {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.6rem;
  }

  .story-prompt-row .secondary-button,
  .story-chapter-actions .secondary-button,
  .story-export-actions .secondary-button,
  .story-cover-card .secondary-button,
  .story-export-card .primary-button,
  .story-continue-row .primary-button,
  .story-draft-tools .primary-button,
  .story-revision-tool .secondary-button {
    width: 100%;
    min-height: 2.45rem;
    padding: 0.48rem 0.5rem;
    font-size: 0.84rem;
    white-space: normal;
  }

  .story-chapter-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .story-chapter-shell::after {
    content: "Swipe chapters \2192";
    position: absolute;
    right: 0.85rem;
    top: 0.75rem;
    z-index: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(66, 87, 178, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #4257b2;
    font-size: 0.72rem;
    font-weight: 950;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(37, 51, 73, 0.1);
  }

  .story-chapter-list {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.45rem;
  }

  .story-chapter-list button {
    flex: 0 0 9.5rem;
  }

  .story-chapter-editor {
    grid-template-rows: auto minmax(16rem, 42vh) auto auto;
  }

  .story-cover-preview {
    min-height: 15rem;
  }

}

@media (max-width: 860px) {
  .idea-mode-launcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .idea-mode-launch {
    min-height: 10.5rem;
    padding: 0.75rem;
  }

  .idea-mode-launch span {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 0.72rem;
    font-size: 0.78rem;
  }

  .idea-mode-launch strong {
    font-size: clamp(1rem, 4.8vw, 1.22rem);
  }

  .idea-mode-launch small {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .idea-studio-shell {
    width: min(100% - 0.85rem, 48rem);
    gap: 0.65rem;
    padding-top: 0.55rem;
  }

  .idea-hero,
  .idea-workspace,
  .idea-footer {
    border-radius: 0.85rem;
  }

  .idea-hero,
  .idea-workspace,
  .idea-form,
  .idea-field-grid,
  .idea-detail-grid {
    grid-template-columns: 1fr;
  }

  .idea-hero {
    padding: 0.82rem;
  }

  .idea-hero h1 {
    font-size: clamp(2rem, 12vw, 3.25rem);
  }

  .idea-hero p {
    font-size: 0.94rem;
    line-height: 1.35;
  }

  .idea-badge {
    min-width: 0;
  }

  .idea-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-radius: 0.85rem;
  }

  .idea-stats div {
    min-width: 0;
    padding: 0.55rem 0.25rem;
    text-align: center;
  }

  .idea-stats span {
    font-size: 0.56rem;
  }

  .idea-stats strong {
    font-size: clamp(0.95rem, 4.5vw, 1.28rem);
  }

  .idea-gallery,
  .idea-home,
  .idea-editor {
    padding: 0.75rem;
    border-left: 0;
    border-right: 0;
  }

  .idea-gallery {
    border-bottom: 1px solid var(--line);
  }

  .idea-panel-head,
  .idea-editor-top {
    align-items: stretch;
    flex-direction: column;
  }

  .idea-panel-head .primary-button,
  .idea-save-state .secondary-button,
  .idea-save-state .danger-button {
    width: 100%;
  }

  .idea-save-state {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .idea-save-state span {
    grid-column: 1 / -1;
  }

  .idea-gallery-list {
    display: flex;
    gap: 0.55rem;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.1rem 0 0.35rem;
    scroll-snap-type: x mandatory;
  }

  .idea-gallery[data-scroll-hint="true"]::after {
    content: "Swipe gallery \2192";
    position: absolute;
    right: 0.85rem;
    top: 4.85rem;
    z-index: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(182, 70, 122, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #b6467a;
    font-size: 0.72rem;
    font-weight: 950;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(37, 51, 73, 0.1);
  }

  .idea-gallery-item {
    flex: 0 0 min(76vw, 19rem);
    scroll-snap-align: start;
  }

  .idea-stepper {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.32rem;
    padding: 0.3rem;
  }

  .idea-stepper button {
    min-height: 2.35rem;
    padding: 0.35rem 0.25rem;
    font-size: clamp(0.72rem, 2.9vw, 0.88rem);
  }

  .idea-stepper span {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.7rem;
  }

  .idea-mode-panel,
  .idea-workshop-banner,
  .idea-question-card,
  .idea-preview-card,
  .idea-settings-drawer {
    padding: 0.68rem;
  }

  .idea-workshop-banner,
  .idea-question-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem;
  }

  .idea-workshop-banner > span,
  .idea-question-card > span {
    min-width: 2.65rem;
    min-height: 2.45rem;
    padding: 5px;
    border-radius: 0.72rem;
    font-size: 0.76rem;
  }

  .idea-workshop-banner strong,
  .idea-question-card strong {
    font-size: clamp(1rem, 5vw, 1.28rem);
  }

  .idea-workshop-banner p,
  .idea-question-card p {
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .idea-inline-spark {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.6rem;
  }

  .idea-inline-spark .primary-button {
    width: 100%;
  }

  .idea-inline-spark span {
    font-size: 0.8rem;
  }

  .idea-mode-intro span,
  .idea-gallery-item span,
  .idea-gallery-item em {
    font-size: 0.82rem;
  }

  .idea-field-grid input,
  .idea-detail-grid input {
    min-height: 2.65rem;
  }

  .idea-action-row,
  .idea-export-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .idea-action-row .primary-button,
  .idea-action-row .secondary-button,
  .idea-export-actions .primary-button,
  .idea-export-actions .secondary-button,
  .idea-export-actions .danger-button {
    width: 100%;
    min-height: 2.45rem;
    padding: 0.48rem 0.5rem;
    font-size: 0.84rem;
    white-space: normal;
  }

  .idea-action-row .primary-button {
    grid-column: 1 / -1;
  }

  .idea-polish-box textarea {
    min-height: 8rem;
  }

  .idea-preview-card {
    position: static;
    padding: 0.42rem;
  }

  .idea-card-art {
    min-height: 14rem;
  }

  .idea-card-face h3 {
    font-size: clamp(1.25rem, 7vw, 1.8rem);
  }

  .idea-card-face div span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .idea-print-card {
    width: min(100% - 1rem, 42rem);
    padding: 0.9rem;
  }

  .idea-print-card dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .idea-mode-launcher {
    grid-template-columns: 1fr;
  }

  .idea-mode-launch {
    min-height: auto;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .idea-mode-launch small {
    grid-column: 1 / -1;
  }
}

@media print {
  @page {
    size: Letter portrait;
    margin: 0.35in;
  }

  .topbar,
  .footer,
  .flash,
  .skip-link,
  .story-print-actions {
    display: none !important;
  }

  .story-print-band,
  .idea-print-band {
    padding: 0;
    background: white;
  }

  .story-print-page,
  .idea-print-card {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .quiet-journal-band {
    padding: 0;
    background: white;
  }

  .quiet-journal-page {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .quiet-journal-timeline article,
  .quiet-plan-print-list article {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .idea-print-card {
    box-sizing: border-box;
    display: grid;
    gap: 0.08in;
    width: 5.45in;
    max-height: 10.1in;
    margin: 0 auto;
    padding: 0.18in;
    overflow: hidden;
    border: 0.05in solid #24314b;
    border-radius: 0.16in;
    background: white;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .idea-print-card img {
    width: 100%;
    max-height: 3.45in;
    border-radius: 0.1in;
    object-fit: cover;
  }

  .idea-print-card header {
    gap: 0.03in;
  }

  .idea-print-card header span {
    font-size: 8.5pt;
  }

  .idea-print-card h1 {
    font-size: 23pt;
    line-height: 0.96;
  }

  .idea-print-card header p,
  .idea-print-card p,
  .idea-print-card dd {
    font-size: 9.2pt;
  }

  .idea-print-text {
    max-height: 1.45in;
    padding: 0.08in;
    overflow: hidden;
    line-height: 1.22;
  }

  .idea-print-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.05in;
  }

  .idea-print-card dl div {
    padding: 0.06in;
    border-radius: 0.08in;
  }

  .idea-print-card dt {
    font-size: 6.8pt;
  }

  .idea-print-card footer {
    font-size: 7.5pt;
  }
}
