/* Routinetimer (/routine/) – bouwt voort op site.css en klas.css */
body.theme-indigo { --accent: #4f46e5; --accent-2: #8b5cf6; --accent-soft: rgba(79,70,229,.09); --accent-glow: rgba(79,70,229,.22); }
.klas-app.routine-app { position: relative; }
.klas-app.routine-app .klas-topbar { border-bottom-color: var(--accent-soft); }
.info-card, .faq-list details { border-color: var(--accent-soft); }

/* ---------- speelveld ---------- */
.scene { position: relative; height: 310px; overflow: hidden; background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 45%, #fde68a 100%); }
.routine-app[data-mode="avond"] .scene { background: linear-gradient(180deg, #1e1b4b 0%, #3730a3 60%, #7c3aed 100%); }
.orb { position: absolute; left: 8%; top: 46%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: radial-gradient(circle at 38% 36%, #fef9c3, #fbbf24 70%); box-shadow: 0 0 0 12px rgba(253,224,71,.28), 0 0 45px 18px rgba(253,224,71,.5); transition: left 1s linear, top 1s linear; }
.routine-app[data-mode="avond"] .orb { background: transparent; box-shadow: inset -18px -8px 0 0 #fef3c7; filter: drop-shadow(0 0 12px rgba(254,243,199,.75)); }
.sky-stars { display: none; position: absolute; inset: 0 0 35% 0; background-image: radial-gradient(2px 2px at 12% 30%, #fff 98%, transparent), radial-gradient(1.5px 1.5px at 27% 68%, #fff 98%, transparent), radial-gradient(2.5px 2.5px at 41% 20%, #fef3c7 98%, transparent), radial-gradient(1.5px 1.5px at 58% 80%, #fff 98%, transparent), radial-gradient(2px 2px at 69% 38%, #fff 98%, transparent), radial-gradient(2.5px 2.5px at 83% 18%, #fef3c7 98%, transparent), radial-gradient(1.5px 1.5px at 92% 62%, #fff 98%, transparent), radial-gradient(1.5px 1.5px at 6% 78%, #fff 98%, transparent); }
.routine-app[data-mode="avond"] .sky-stars { display: block; animation: twinkle 2.8s ease-in-out infinite alternate; }
@keyframes twinkle { to { opacity: .45; } }
.cloud { position: absolute; width: 96px; height: 30px; border-radius: 30px; background: rgba(255,255,255,.85); animation: drift 14s ease-in-out infinite alternate; }
.cloud::before, .cloud::after { content: ''; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 44px; height: 44px; left: 16px; top: -20px; } .cloud::after { width: 32px; height: 32px; right: 16px; top: -13px; }
.cloud-1 { left: 12%; top: 92px; } .cloud-2 { right: 14%; top: 128px; transform: scale(.7); animation-delay: -7s; }
.routine-app[data-mode="avond"] .cloud { opacity: .18; }
@keyframes drift { to { margin-left: 50px; } }
.scene-message { position: absolute; z-index: 2; top: 14px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); margin: 0; padding: 9px 20px; border-radius: 999px; background: rgba(255,255,255,.95); box-shadow: 0 8px 22px rgba(30,27,75,.16); font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif; font-size: 1.3rem; font-weight: 700; line-height: 1.2; text-align: center; color: #312e81; }
.is-soon .scene-message { background: #fef3c7; color: #92400e; }
.hill { position: absolute; left: -10%; width: 120%; border-radius: 50% 50% 0 0; }
.hill-back { bottom: 20px; height: 112px; background: #86efac; transform: translateX(14%); }
.hill-front { bottom: -34px; height: 126px; background: #4ade80; transform: translateX(-8%); }
.routine-app[data-mode="avond"] .hill-back { background: #166534; }
.routine-app[data-mode="avond"] .hill-front { background: #14532d; }
.road { position: absolute; left: 9%; right: 9%; bottom: 30px; height: 16px; border-radius: 99px; background: #fef3c7; box-shadow: inset 0 2px 4px rgba(120,53,15,.2); }
.road::after { content: ''; position: absolute; left: 10px; right: 10px; top: 7px; border-top: 2px dashed rgba(120,53,15,.28); }
.road span { position: absolute; z-index: 1; left: 0; top: 0; bottom: 0; width: 0; max-width: 100%; border-radius: inherit; background: linear-gradient(90deg, #ec4899, #f59e0b, #34d399, #38bdf8, #8b5cf6); transition: width .8s ease; }
.scene-home, .scene-goal { position: absolute; bottom: 38px; font-size: 3.2rem; line-height: 1; }
.scene-home { left: 1.5%; }
.scene-goal { right: 3%; font-size: 3.8rem; filter: drop-shadow(0 6px 8px rgba(0,0,0,.22)); }
.is-running .scene-goal { animation: wave 2s ease-in-out infinite; }
@keyframes wave { 50% { transform: scale(1.12) rotate(5deg); } }
.buddy { position: absolute; z-index: 3; left: 9%; bottom: 34px; width: 80px; margin-left: -20px; text-align: center; font-size: 4.2rem; line-height: 1; transition: left .9s cubic-bezier(.45,.05,.35,1); }
.buddy span { display: inline-block; filter: drop-shadow(0 6px 5px rgba(0,0,0,.22)); }
.is-running .buddy span { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
.buddy.hop span { animation: hop .8s ease; }
@keyframes hop { 25% { transform: translateY(-38px) rotate(-12deg) scale(1.1); } 50% { transform: translateY(0) scale(1.12,.86); } 72% { transform: translateY(-18px) rotate(9deg); } }

/* ---------- tijdbalk ---------- */
.routine-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--accent-soft); }
.routine-clock { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.routine-clock .klas-time { font-size: 2.8rem; }
.routine-count { font-weight: 900; color: var(--muted); }
.routine-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- kaarten om af te vinken ---------- */
.board { list-style: none; margin: 0; padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.task { position: relative; width: 100%; height: 100%; min-height: 168px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px 12px 14px; border: 3px solid hsl(var(--h) 75% 78%); border-radius: 24px; background: hsl(var(--h) 90% 96%); box-shadow: 0 7px 0 hsl(var(--h) 65% 80%); font: inherit; color: var(--text); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background-color .3s, border-color .3s; }
.board li { padding-bottom: 7px; }
.task:hover { transform: translateY(-3px); box-shadow: 0 10px 0 hsl(var(--h) 65% 80%); }
.task:active { transform: translateY(5px); box-shadow: 0 2px 0 hsl(var(--h) 65% 80%); }
.task-icon { font-size: 3.8rem; line-height: 1.1; transition: transform .3s, opacity .3s; }
.task-name { font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif; font-size: 1.25rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.task-check { position: absolute; top: 9px; right: 9px; width: 36px; height: 36px; }
.task-check svg { width: 100%; height: 100%; overflow: visible; }
.task-check circle { fill: #fff; stroke: hsl(var(--h) 55% 70%); stroke-width: 4; stroke-dasharray: 7 6; }
.task-check path { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; }
.task.is-done { background: #dcfce7; border-color: #22c55e; box-shadow: 0 3px 0 #16a34a; transform: translateY(4px); }
.task.is-done .task-icon { opacity: .75; transform: scale(.88); }
.task.is-done .task-name { color: #166534; }
.task.is-done .task-check { top: 6px; right: 6px; width: 62px; height: 62px; rotate: 8deg; filter: drop-shadow(0 6px 8px rgba(22,101,52,.35)); }
.task.is-done circle { fill: #22c55e; stroke: #fff; stroke-dasharray: none; }
.task.is-done path { stroke-dashoffset: 0; }
.task.just-done { animation: taskPop .75s cubic-bezier(.2,.9,.3,1.2); z-index: 1; }
.task.just-done .task-check { animation: stamp .55s cubic-bezier(.2,.9,.3,1.3); }
.task.just-done path { animation: draw .45s .25s ease both; }
@keyframes taskPop { 0% { transform: scale(1); } 25% { transform: scale(1.09) rotate(-4deg); } 50% { transform: scale(.95) rotate(3deg); } 100% { transform: translateY(4px) scale(1) rotate(0); } }
@keyframes stamp { 0% { transform: scale(3) rotate(-35deg); opacity: 0; } 60% { transform: scale(.85) rotate(6deg); opacity: 1; } 100% { transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }
.board-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); }

/* ---------- effecten ---------- */
.fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 20; }
.fx i { position: absolute; font-style: normal; }
.spark { font-size: 1.5rem; line-height: 1; animation: spark .85s ease-out forwards; }
.spark.dot { width: 11px; height: 11px; border-radius: 50%; }
@keyframes spark { 0% { transform: translate(-50%,-50%) scale(.4); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 25px)) scale(1.15) rotate(140deg); opacity: 0; } }
.flying-star { left: 0; top: 0; margin: -20px 0 0 -18px; font-size: 2.4rem; line-height: 1; }
.rain { top: -24px; width: 10px; height: 18px; border-radius: 3px; animation: rain 2.4s ease-in forwards; }
@keyframes rain { to { top: 105%; transform: rotate(var(--spin)); } }
.finish-party { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 2.4rem; animation: finishPop .7s cubic-bezier(.2,.8,.2,1); }
.finish-buddy { font-size: 5rem; display: inline-block; animation: hop .9s ease .5s 3; }

/* ---------- aanpassen ---------- */
.editor { padding: 22px 20px; max-width: 760px; margin: 0 auto; }
.editor h2 { font-size: 1.8rem; }
.editor h3 { font-size: 1.35rem; margin: 20px 0 10px; }
.editor-help { color: var(--muted); margin: 6px 0 14px; }
.editor fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.editor legend, .editor-minutes { font-weight: 800; }
.editor-minutes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.editor input, .editor select { height: 48px; border: 2px solid rgba(79,70,229,.18); border-radius: 14px; background: #fff; font: inherit; font-weight: 700; color: var(--text); }
.editor input { padding: 0 12px; }
.editor-minutes input { width: 90px; text-align: center; }
.editor select { flex: none; width: 66px; font-size: 1.5rem; text-align: center; cursor: pointer; }
.buddy-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.buddy-choice { width: 58px; height: 58px; border: 3px solid transparent; border-radius: 18px; background: var(--accent-soft); font-size: 2rem; cursor: pointer; }
.buddy-choice[aria-pressed="true"] { border-color: var(--accent); background: #fff; transform: scale(1.1); }
.edit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.edit-row, .add-form { display: flex; align-items: center; gap: 6px; }
.edit-row input, .add-form input { flex: 1; min-width: 0; }
.edit-row button { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 900; font-size: 1.1rem; cursor: pointer; }
.edit-row button:disabled { opacity: .3; cursor: default; }
.add-form { margin-top: 14px; flex-wrap: wrap; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { border: 2px dashed rgba(79,70,229,.3); border-radius: 999px; background: #fff; padding: 8px 14px; font: inherit; font-weight: 800; color: var(--text); cursor: pointer; }
.chip:hover { border-style: solid; }
.editor-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.editor-actions .link-btn { margin: 0; }
.routine-app [hidden] { display: none !important; }

/* ---------- volledig scherm (tablet) ---------- */
.klas-app.routine-app:fullscreen { display: block; overflow: auto; }
.routine-app:fullscreen .scene { height: 34vh; min-height: 270px; }

@media (max-width: 760px) {
  .routine-tabs.klas-tabs { grid-template-columns: repeat(2, 1fr); }
  .routine-tabs .klas-tab { flex-direction: row; gap: 6px; font-size: 1rem; }
  .routine-app .klas-utility .btn { flex: 1 1 30%; padding: 8px; font-size: .85rem; }
  .scene { height: 250px; }
  .scene-message { font-size: 1.05rem; top: 10px; width: calc(100% - 24px); padding: 7px 12px; border-radius: 18px; }
  .orb { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .routine-app[data-mode="avond"] .orb { box-shadow: inset -13px -6px 0 0 #fef3c7; }
  .buddy { font-size: 3.2rem; margin-left: -26px; }
  .scene-home { font-size: 2.2rem; } .scene-goal { font-size: 2.8rem; }
  .routine-bar { padding: 12px 14px; justify-content: center; }
  .routine-actions { width: 100%; } .routine-actions .btn { flex: 1; padding: 12px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; gap: 10px; }
  .task { min-height: 140px; border-radius: 20px; }
  .task-icon { font-size: 3rem; } .task-name { font-size: 1.08rem; }
  .task.is-done .task-check { top: 5px; right: 5px; width: 50px; height: 50px; }
  .editor { padding: 18px 14px; }
  .edit-row { flex-wrap: wrap; justify-content: flex-end; padding-bottom: 8px; border-bottom: 1px solid var(--accent-soft); }
  .edit-row input { flex-basis: calc(100% - 76px); }
  .add-form input { flex-basis: calc(100% - 76px); } .add-form .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .routine-app *, .finish-buddy { animation: none !important; transition: none !important; } .task.is-done path { stroke-dashoffset: 0; } }
