.parent-tools-link {
  display: flex;
  width: fit-content;
  min-height: 44px;
  margin-inline: auto;
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  color: #b5d8d4;
  font-size: .875rem;
  font-weight: 650;
  text-decoration-color: #779e9d;
  text-underline-offset: 4px;
}
.parent-tools-link:hover { color: var(--cream); }
.generate-actions #open-filters { font-size: .83rem; }
.tool-page { padding-block: 12px 16px; }
.tool-page h1 { margin: 6px 0 18px; font-size: clamp(1.85rem, 7vw, 2.35rem); line-height: 1.1; letter-spacing: -.05em; overflow-wrap: anywhere; }
.tool-page h1:focus { outline: none; }
.tool-page h2 { margin: 16px 0 9px; font-size: 1rem; }
.tool-page a.text-button { text-decoration: none; }
.tool-page a.text-button:hover { text-decoration: underline; }
.tool-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool-tile {
  display: grid; grid-template-rows: auto 1fr; align-items: center;
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: var(--panel); color: var(--cream); text-decoration: none; font-weight: 750; line-height: 1.2;
}
.tool-tile:hover { border-color: var(--teal); }
.tool-tile img { width: 100%; height: clamp(86px, 28vw, 130px); padding: 14px; }
.words-tile img { background: #ffc7a2; }
.routines-tile img { background: #bce8de; }
.tool-tile span { padding: 12px; }
.word-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.word-choice { padding: 8px 13px; min-height: 44px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); text-align: left; }
.word-choice[aria-pressed="true"] { color: var(--ink); background: var(--teal); border-color: var(--teal); font-weight: 720; }
.words-card { margin: 18px 0 0; font-size: clamp(1.22rem, 5vw, 1.45rem); line-height: 1.5; }
.routine-list, .routine-overview, .routine-edit-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.routine-list-link, .routine-overview li, .routine-edit-step {
  display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 10px;
  background: var(--panel); border: 1px solid #365463; border-radius: 14px;
}
.routine-list-link { color: var(--cream); text-decoration: none; font-weight: 700; }
.routine-list-link:hover { border-color: var(--teal); }
.routine-list-link img, .routine-overview img, .routine-edit-step img { width: 37px; height: 37px; flex: 0 0 auto; border-radius: 8px; background: #f8e5ca; }
.routine-count { color: var(--muted); font-size: .81rem; margin-inline-start: auto; white-space: nowrap; }
.routine-overview span { overflow-wrap: anywhere; }
.tool-primary { width: 100%; margin-top: 14px; }
.tool-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.tool-status { color: var(--teal); font-size: .88rem; margin-top: 10px; }
.tool-status:empty { display: none; }
.tool-description { color: var(--muted); margin-bottom: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.routine-player {
  display: grid; justify-items: center; align-content: center; min-height: 275px; padding: 18px;
  border-radius: 22px; color: var(--ink); background: var(--cream); text-align: center;
}
.routine-player h1 { margin: 8px 0 0; max-width: 100%; }
.routine-big-art { width: min(100%, 168px); height: auto; }
.routine-progress { font-size: .85rem; font-weight: 750; color: #38606a; }
.tool-field { display: grid; gap: 6px; margin: 12px 0; font-weight: 725; }
.tool-field input, .routine-edit-step input {
  color: inherit; background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; min-height: 44px; padding: 6px 9px; width: 100%; min-width: 0; font-size: 1rem;
}
.routine-edit-step { display: grid; grid-template-columns: 28px 37px minmax(0, 1fr); gap: 6px 8px; }
.step-actions { grid-column: 3; display: flex; flex-wrap: wrap; gap: 4px; }
.step-button { min-height: 44px; min-width: 44px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.step-button:disabled { opacity: .4; cursor: default; }
.remove-step { color: #ffc2bc; }
.drag-handle { display: grid; min-height: 44px; place-items: center; color: var(--muted); cursor: grab; touch-action: none; font-size: 1.3rem; }
.dragging { opacity: .7; }
.drop-target { outline: 2px solid var(--teal); }
.step-picker { margin-top: 10px; padding: 0 10px; background: var(--panel); border-radius: 12px; }
.step-picker summary { min-height: 44px; padding: 12px 0; cursor: pointer; font-weight: 720; }
.step-picker summary span { float: right; color: var(--muted); font-size: .85rem; }
.step-pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-bottom: 10px; }
.step-pick { display: grid; justify-items: center; align-content: start; gap: 5px; padding: 6px 4px; border-radius: 9px; background: var(--bg); font-size: .79rem; overflow-wrap: anywhere; }
.step-pick img { width: 42px; height: 42px; border-radius: 8px; background: #f8e5ca; }

/* Routine setup, playback, rewards and bell share the existing product palette. */
.create-routine { display: flex; align-items: center; justify-content: center; text-decoration: none; min-height: 54px; margin: 8px 0 14px; }
.routine-book-link { margin: 0 0 22px; }
.completed-mark { display: block; margin-top: 4px; color: var(--teal); font-size: .8rem; font-weight: 500; }
.routine-hint { color: var(--muted); font-size: .875rem; line-height: 1.5; margin-bottom: 12px; }
.rename-routine { font-size: .875rem; margin: 0 0 12px; }
.routine-overview .routine-row { display: grid; grid-template-columns: 40px 42px minmax(0, 1fr) 36px; align-items: center; gap: 7px; padding: 7px; border: 1px solid #365463; border-radius: 15px; background: var(--panel); position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.routine-row img { width: 42px; height: 42px; border-radius: 10px; background: #f8e5ca; pointer-events: none; }
.routine-grip { width: 40px; min-height: 48px; background: transparent; color: var(--muted); font-size: 1.4rem; border-radius: 9px; touch-action: none; cursor: grab; }
.step-label-button { background: transparent; min-height: 48px; padding: 3px 0; text-align: left; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; border-radius: 7px; }
.remove-inline { min-height: 44px; background: transparent; border-radius: 8px; color: var(--muted); font-size: 1.4rem; }
.routine-overview .shared-step { grid-template-columns: 42px minmax(0, 1fr); min-height: 61px; }
.shared-step span { overflow-wrap: anywhere; }
.inline-step-input { min-width: 0; width: 100%; min-height: 46px; padding: 6px; border: 1px solid var(--teal); border-radius: 8px; color: var(--cream); background: var(--bg); font: inherit; }
.add-step-button { width: 100%; min-height: 49px; margin-top: 8px; border: 1px dashed var(--line); border-radius: 14px; color: var(--teal); background: transparent; font-size: 1rem; }
.routine-row.dragging { z-index: 2; opacity: 1; background: #214654; box-shadow: 0 10px 25px #0005; transform: translateY(var(--drag-y, 0)); cursor: grabbing; }
.routine-row.drop-target { outline: 2px solid var(--teal); outline-offset: 1px; }
.routine-settings { justify-content: space-between; align-items: center; gap: 10px; }
.celebration-choice { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; }
.celebration-choice select { appearance: none; color: var(--cream); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 28px 9px 10px; min-height: 44px; font: inherit; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23b2cbc9' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 10px 6px; background-position: right 10px center; }
.tool-primary:disabled { opacity: .55; cursor: default; }
.routine-picker-dialog { color: var(--cream); background: #0f2b38; border: 1px solid var(--line); border-radius: 22px; padding: 16px; width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 40px); }
.routine-picker-dialog::backdrop { background: #000a; }
.picker-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.picker-header h2 { margin: 0; font-size: 1.3rem; }
.routine-picker-dialog .step-pick-grid { padding-bottom: 0; }
.routine-picker-dialog .step-pick { min-height: 95px; font-size: .875rem; padding: 8px 5px; }
.routine-picker-dialog .step-pick img { width: 48px; height: 48px; }
.routine-stars { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 7px; min-height: 36px; margin: 5px 0 10px; color: #738e95; font-size: 1.7rem; line-height: 1; }
.routine-stars .earned { color: #ffc968; }
.routine-player { position: relative; overflow: hidden; min-height: clamp(280px, 47svh, 450px); border-radius: 27px; padding: clamp(20px, 5vw, 36px); }
.routine-player .routine-big-art { width: min(58vw, 220px); height: auto; }
.routine-player h1 { font-size: clamp(1.9rem, 6.6vw, 2.7rem); line-height: 1.12; }
.did-it { min-height: 60px; font-size: 1.3rem; }
.step-cheer { min-height: 26px; margin-top: 7px; font-size: 1.1rem; color: #246553; font-weight: 750; }
.step-celebration { position: absolute; inset: 0; pointer-events: none; opacity: 0; color: #be742b; }
.step-celebration span { position: absolute; font-size: 2.5rem; }
.step-celebration span:nth-child(1) { left: 13%; top: 29%; }
.step-celebration span:nth-child(2) { right: 13%; top: 21%; }
.step-celebration span:nth-child(3) { right: 20%; bottom: 20%; }
.step-enter .routine-big-art { animation: step-arrive .36s ease-out both; }
.step-complete .routine-big-art { animation: step-bounce .65s ease-in-out both; }
.step-complete .step-celebration { animation: star-shine .85s ease-out both; }
.step-complete.bright .step-celebration span { animation: star-pop .8s ease-out both; }
.step-complete.calm { box-shadow: inset 0 0 45px #ead49d; transition: box-shadow .5s; }
.routine-intro { min-height: 350px; display: grid; align-content: center; justify-items: center; text-align: center; }
.routine-intro .routine-big-art { width: min(52vw, 210px); animation: routine-welcome 1.05s ease-in-out both; }
.intro-kicker { color: var(--teal); margin-top: 16px; font-size: 1.05rem; }
.routine-intro h1 { margin-bottom: 5px; }
.routine-finished { text-align: center; display: grid; justify-items: center; padding: 15px 12px 6px; border-radius: 27px; color: var(--ink); background: var(--cream); }
.routine-finished .routine-stars { color: #b8893c; }
.routine-finished .tool-description { color: #3d5c60; font-size: 1rem; }
.routine-finished h1 { margin: 2px 0 7px; }
.sticker-name { font-size: 1.18rem; font-weight: 750; margin-bottom: 7px; }
.sticker-reveal { position: relative; width: min(100%, 230px); padding: 8px; }
.reward-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 7px #16303c20); animation: sticker-arrive .8s ease-out both; }
.finish-particles span { position: absolute; color: #315d76; font-size: 1.4rem; opacity: 0; animation: sleepy-drift 2.2s ease-out both; }
.finish-particles span:nth-child(1) { top: 50%; right: 8%; animation-delay: .2s; }
.finish-particles span:nth-child(2) { top: 35%; left: 15%; animation-delay: .5s; }
.finish-particles span:nth-child(3) { top: 17%; right: 23%; animation-delay: .8s; }
.bright-finish .finish-particles span { color: #b05e34; font-size: 2.6rem; animation-name: bright-burst; }
.book-count { color: var(--muted); margin-bottom: 16px; }
.sticker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; gap: 10px; margin: 0; padding: 0; }
.sticker-tile { display: grid; align-content: start; justify-items: center; text-align: center; gap: 5px; border: 1px solid #365463; border-radius: 19px; padding: 12px 8px; background: var(--panel); overflow-wrap: anywhere; min-width: 0; }
.sticker-tile img { width: min(100%, 136px); height: auto; }
.sticker-tile strong { font-size: 1rem; }
.sticker-tile span { color: var(--muted); font-size: .875rem; }
.sticker-tile small { color: var(--muted); font-size: .8rem; }
.book-empty { display: grid; justify-items: center; gap: 12px; text-align: center; color: var(--muted); }
.book-empty img { width: 135px; }
.bell-tile img { background: #e8c998; }
.bell-stage { position: relative; padding: 0 12px 15px; text-align: center; }
.bell-pull { display: grid; justify-items: center; position: relative; width: min(100%, 310px); margin: 0 auto; padding: 0 0 80px; touch-action: none; background: transparent; -webkit-user-select: none; user-select: none; border-radius: 20px; }
.dinner-bell-art { width: 100%; height: auto; transform-origin: 50% 12%; pointer-events: none; z-index: 1; }
.bell-rope { position: absolute; width: 6px; border-radius: 8px; height: calc(95px + var(--pull, 0px)); bottom: calc(20px - var(--pull, 0px)); left: calc(50% - 3px); background: repeating-linear-gradient(45deg, #edc08a 0 4px, #ad7443 4px 6px); pointer-events: none; }
.bell-rope span { display: block; position: absolute; bottom: -8px; left: -11px; width: 28px; height: 28px; border-radius: 50%; background: #eeb174; border: 4px solid #8f5e39; box-shadow: 0 3px 0 #0002; }
.bell-hint { font-size: 1rem; color: var(--muted); margin-top: 5px; }
.bell-sounds { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.bell-page .tool-status { text-align: center; min-height: 24px; font-size: 1rem; }
.ringing .dinner-bell-art { animation: bell-swing 1.5s ease-out both; }
.ringing .bell-rope { animation: rope-swing 1.5s ease-out both; }
@keyframes step-arrive { from { opacity: 0; transform: translateY(12px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes step-bounce { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.08) rotate(-3deg); } 65% { transform: scale(1.03) rotate(2deg); } }
@keyframes star-shine { 0% { opacity: 0; } 30%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes star-pop { from { transform: scale(.3) translateY(12px); } to { transform: scale(1.1) translateY(-15px); } }
@keyframes routine-welcome { 0% { opacity: 0; transform: scale(.75); } 55% { opacity: 1; transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes sticker-arrive { from { opacity: 0; transform: scale(.55) rotate(-12deg); } 65% { opacity: 1; transform: scale(1.06) rotate(3deg); } to { transform: none; } }
@keyframes sleepy-drift { 0% { opacity: 0; transform: translateY(12px) scale(.7); } 30%, 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-44px) scale(1.15); } }
@keyframes bright-burst { 0% { opacity: 0; transform: scale(.2); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(-45px) rotate(35deg) scale(1.3); } }
@keyframes bell-swing { 0% { transform: rotate(0); } 12% { transform: rotate(15deg); } 30% { transform: rotate(-13deg); } 47% { transform: rotate(10deg); } 64% { transform: rotate(-7deg); } 82% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
@keyframes rope-swing { 15% { transform: translateX(-12px); } 35% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 100% { transform: translateX(0); } }
@media (min-width: 700px) {
  .shell:has(.is-playing) { width: min(100%, 760px); }
  .is-playing .routine-player { min-height: min(55svh, 520px); }
  .is-playing .routine-big-art { width: min(30vw, 270px); }
  .is-playing .routine-player h1 { font-size: 2.8rem; }
  .is-playing .did-it { max-width: 540px; display: block; margin-inline: auto; min-height: 67px; }
}
@media (max-width: 360px) {
  .routine-overview .routine-row { grid-template-columns: 33px 35px minmax(0, 1fr) 30px; gap: 5px; }
  .routine-row img { width: 35px; height: 35px; }
  .routine-grip { width: 33px; }
  .routine-overview .shared-step { grid-template-columns: 35px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .step-complete.calm { box-shadow: none; }
  .finish-particles span, .step-celebration { display: none; }
}
.routine-title-button { display: inline; padding: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; overflow-wrap: anywhere; }
.routine-title-button span { font-size: .5em; vertical-align: middle; color: var(--muted); }
.inline-routine-input { display: block; width: 100%; min-width: 0; min-height: 48px; color: var(--cream); background: var(--panel); border: 1px solid var(--teal); border-radius: 10px; padding: 5px 8px; font: inherit; }

.daily-lineup {
  padding: 14px;
  border: 1px solid #4b7979;
  border-radius: 20px;
  background: linear-gradient(155deg, #234449, #192c39);
}
.routines-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.tool-page .routines-section-heading h2 { margin: 0; font-size: 1.16rem; }
.routines-section-heading :is(button, a) { min-height: 44px; }
.routines-section-heading a { display: inline-flex; align-items: center; text-decoration: none; }
.lineup-progress { margin: 0 0 10px; color: var(--muted); font-size: .9rem; }
.lineup-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.lineup-list .routine-list-link { background: #152a35; min-height: 52px; }
.lineup-start, .lineup-done { margin-inline-start: auto; white-space: nowrap; }
.lineup-start { color: var(--cream); }
.lineup-done { color: var(--teal); }
.my-routines { margin-block: 20px 16px; }
.my-routines .routines-section-heading { margin-bottom: 8px; }
.routine-templates { border-block: 1px solid var(--line); }
.routine-templates summary { cursor: pointer; padding-block: 14px; font-weight: 700; }
.routine-templates summary small { margin-inline-start: 8px; color: var(--muted); font-weight: 500; }
.routine-templates[open] { padding-bottom: 12px; }
.routine-footer { justify-content: flex-start; }

.lineup-list > li { display: flex; align-items: center; gap: 6px; }
.lineup-list .routine-list-link { flex: 1; min-width: 0; }
.lineup-list .routine-list-link > span:not([aria-hidden]):not(.routine-emoji) { overflow-wrap: anywhere; }
.lineup-list button { flex: 0 0 auto; min-width: 44px; min-height: 44px; }
.routine-completion-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }

.routine-add-lineup { display: block; width: 100%; margin-top: 8px; }
.words-answer { margin-bottom: 16px; }
.words-answer .words-card { margin-top: 8px; }

.routine-overview-actions { margin-bottom: 14px; }
