/* Näkymien asettelu. Mitoitettu vaakatabletille (Galaxy Tab S8 ≈ 1280 × 800 CSS-pikseliä). */

/* ---------- Profiilivalinta ---------- */
.profiles {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 32px;
}
.profiles-header { text-align: center; color: var(--navy); }
.profiles-header h1 { font-size: 48px; margin: 8px 0 0; }
.subtitle { font-size: 30px; margin: 6px 0 0; }

.profiles-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  align-items: center;
  align-content: center;
  justify-content: center;
}

.profile-card {
  font: inherit;
  width: 270px;
  min-height: 340px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, .45);
  background: var(--c);
  border: 6px solid var(--outline);
  box-shadow: var(--bevel), 0 10px 0 rgba(0, 0, 0, .25);
  cursor: pointer;
}
.profile-card:active { transform: translateY(6px); box-shadow: var(--bevel), 0 4px 0 rgba(0, 0, 0, .25); }
.profile-avatar { font-size: 120px; line-height: 1.1; text-shadow: none; filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, .3)); }
.profile-name { font-size: 42px; }
.profile-progress { width: 100%; display: flex; align-items: center; gap: 10px; font-size: 24px; }
.mini-bar { flex: 1; height: 22px; background: rgba(0, 0, 0, .35); border: 3px solid var(--outline); }
.mini-fill { height: 100%; background: var(--gold); }
.profile-status {
  font-size: 30px;
  padding: 6px 14px;
  color: var(--ink);
  text-shadow: none;
  background: var(--gold);
  border: 3px solid var(--outline);
}
.profile-time { font-size: 22px; padding: 4px 10px; background: rgba(0, 0, 0, .35); }
.profile-time[data-level="hurry"] { background: var(--hurry); color: var(--ink); text-shadow: none; }
.profile-time[data-level="late"],
.profile-time[data-level="gone"] { background: var(--late); }

/* Vanhempien salainen nappi: pitkä painallus täyttää renkaan. */
.parent-hotspot {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 80px;
  height: 80px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: transparent;
  border: none;
  opacity: .45;
  touch-action: none;
}
.parent-hotspot .ring { position: absolute; inset: 0; width: 80px; height: 80px; }
.parent-hotspot circle {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-dasharray: 201;
  stroke-dashoffset: 201;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset .15s;
}
.parent-hotspot.pressing { opacity: 1; }
.parent-hotspot.pressing circle { stroke-dashoffset: 0; transition: stroke-dashoffset 2s linear; }

/* ---------- Lapsen näkymä ---------- */
.child-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 18px 10px;
}

.child-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 14px;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, .45);
  background: var(--c);
}
.child-header .back { font-size: 36px; padding: 0; }
.child-avatar { font-size: 56px; text-shadow: none; }
.child-name { flex: 1; margin: 0; font-size: 40px; }
.child-count { font-size: 32px; padding: 6px 16px; background: rgba(0, 0, 0, .3); }

.timebar-wrap { display: flex; align-items: center; gap: 12px; }
.timebar {
  position: relative;
  flex: 1;
  height: 72px;
  overflow: hidden;
  background: var(--dirt-dark);
  box-shadow: inset 0 6px 0 rgba(0, 0, 0, .35);
}
.timebar-fill {
  height: 100%;
  background: var(--ok);
  box-shadow: var(--bevel);
  transition: width 1s linear, background-color .6s;
}
.timebar[data-level="hurry"] .timebar-fill { background: var(--hurry); }
.timebar[data-level="late"] .timebar-fill { background: var(--late); }
.timebar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #fff;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000;
}
.timebar[data-level="late"] .timebar-label,
.timebar[data-level="gone"] .timebar-label { animation: throb 1s ease-in-out infinite; }
.timebar[data-level="gone"] { background: var(--late); }
.timebar-door { font-size: 60px; line-height: 1; }

@keyframes throb { 50% { transform: scale(1.08); } }

.child-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px 1fr 230px;
  gap: 16px;
}
.next-slot { display: flex; min-height: 0; padding: 14px; }
.next-slot > .task-wrap { flex: 1; }

/* Kortti ja 🔊-nappi rinnakkain samassa kääreessä. */
.task-wrap { position: relative; display: flex; min-height: 0; }
.task-wrap > .task-card { flex: 1; }
.speak-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  width: 64px;
  height: 64px;
  padding: 0;
  font-size: 30px;
  background: rgba(255, 255, 255, .9);
  border: 3px solid var(--outline);
  cursor: pointer;
}
.speak-btn:active { transform: translateY(2px); background: var(--gold); }
.next-slot .speak-btn { width: 80px; height: 80px; font-size: 40px; }
/* Pienissä korteissa kuva siirtyy vasemmalle, ettei 🔊-nappi peitä sitä. */
.todo-grid .has-speaker .task-emoji { margin-right: 44px; }

.task-card {
  font: inherit;
  position: relative;
  min-height: 160px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--ink);
  background: var(--plank);
  border: 4px solid var(--outline);
  box-shadow: var(--bevel);
  cursor: pointer;
}
.task-card:active { transform: translateY(3px); }
.task-emoji { font-size: 72px; line-height: 1; }
.task-label { font-size: 24px; line-height: 1.15; }

.task-card.next {
  flex: 1;
  background: #fff2c4;
  border-width: 6px;
  animation: glow 1.4s ease-in-out infinite;
}
.task-card.next .task-emoji { font-size: 150px; }
.task-card.next .task-label { font-size: 40px; }
.task-card.all-done { background: var(--gold); animation: none; }
.next-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  padding: 4px 14px;
  font-size: 26px;
  background: var(--gold);
  border: 4px solid var(--outline);
}

@keyframes glow {
  0%, 100% { box-shadow: var(--bevel), 0 0 0 5px var(--gold); }
  50% { box-shadow: var(--bevel), 0 0 0 13px var(--gold); }
}

.todo-grid {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  grid-auto-rows: 170px;
  gap: 14px;
  align-content: start;
  padding: 14px 4px;
}

.done-col {
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  background: rgba(30, 20, 8, .35);
  box-shadow: none;
}
.done-col h2 { margin: 0 0 8px; font-size: 26px; color: #fff; text-shadow: 2px 2px 0 #000; }
.done-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.done-item {
  font: inherit;
  min-height: 64px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, .8);
  border: 3px solid var(--outline);
  opacity: .6;
  cursor: pointer;
}
.done-label { text-decoration: line-through; }
.done-emoji { font-size: 34px; }
.done-item::after { content: "✔"; margin-left: auto; font-size: 28px; color: var(--grass-dark); }

/* Kuittausanimaatio: kortti "hajoaa" ja palat lentävät. */
.task-card.breaking { animation: break .42s ease-in forwards; pointer-events: none; }
@keyframes break {
  30% { transform: scale(1.08) rotate(-2deg); }
  100% { transform: scale(.2) rotate(8deg); opacity: 0; }
}
.particle {
  position: fixed;
  z-index: 40;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(0, 0, 0, .5);
  pointer-events: none;
  animation: fly .7s cubic-bezier(.2, .7, .4, 1) forwards;
}
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

.undo-bar { position: fixed; left: 50%; bottom: 44px; z-index: 30; transform: translateX(-50%); }
.undo-btn { position: relative; overflow: hidden; min-height: 88px; padding: 0 32px; font-size: 32px; background: #2d5fa8; }
.undo-what { font-size: 24px; }
.undo-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 8px;
  background: var(--gold);
  transform-origin: left;
  animation: shrink linear forwards;
}
@keyframes shrink { to { transform: scaleX(0); } }

/* ---------- Palkintoruutu ---------- */
.reward {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #fff6c9 0, var(--gold) 35%, var(--c) 100%);
}
.reward-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; }
.reward h1 { margin: 8px 0 0; font-size: 72px; color: #fff; text-shadow: 4px 4px 0 var(--outline), -2px -2px 0 var(--outline); }
.reward-sub { margin: 6px 0 14px; font-size: 32px; }
.gems { margin-bottom: 18px; padding: 8px 20px; font-size: 34px; color: #fff; background: rgba(0, 0, 0, .4); border: 4px solid var(--outline); }
.gems small { font-size: 24px; }
.reward-actions { display: flex; gap: 16px; align-items: center; }
.undo-small { background: #2d5fa8; }

.chest { position: relative; width: 220px; height: 170px; margin-top: 70px; }
.chest-base, .chest-lid { position: absolute; left: 0; right: 0; z-index: 2; border: 6px solid #2b1a0b; }
.chest-base {
  bottom: 0;
  height: 110px;
  background: repeating-linear-gradient(90deg, #8c5a2b 0 36px, #7a4c22 36px 72px);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .25);
}
.chest-lid {
  bottom: 104px;
  height: 66px;
  background: repeating-linear-gradient(90deg, #a0682f 0 36px, #8f5c28 36px 72px);
  transform-origin: 0 100%;
  animation: lid .6s .3s ease-out forwards;
}
.chest-lock {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 36px;
  height: 44px;
  margin-left: -18px;
  background: #d9d9d9;
  border: 4px solid #2b1a0b;
}
.chest-loot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 60px;
}
.chest-loot span { opacity: 0; animation: loot .8s ease-out forwards; }
.chest-loot span:nth-child(1) { animation-delay: .7s; }
.chest-loot span:nth-child(2) { animation-delay: .85s; }
.chest-loot span:nth-child(3) { animation-delay: 1s; }

@keyframes lid { to { transform: translateY(-12px) rotate(-30deg); } }
@keyframes loot {
  from { transform: translateY(60px) scale(.3); opacity: 0; }
  to { transform: translateY(-30px) scale(1); opacity: 1; }
}

.confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -30px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, .4);
  animation: fall var(--d) linear var(--delay) 3 both;
}
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

/* ---------- PIN ---------- */
.pin-view { height: 100%; display: flex; align-items: center; justify-content: center; }
.pin-box { padding: 24px 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; background: var(--plank); }
.pin-box h1 { margin: 0; font-size: 32px; }
.pin-dots { display: flex; gap: 18px; }
.pin-dot { width: 28px; height: 28px; background: #fff; border: 4px solid var(--outline); }
.pin-dot.filled { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 96px); gap: 12px; }
.keypad .btn { min-height: 80px; padding: 0; font-size: 34px; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-12px); } 75% { transform: translateX(12px); } }

/* ---------- Vanhempien asetukset ---------- */
.parent {
  height: 100%;
  overflow-y: auto;
  font-weight: 600;
  background: #ece4d6;
}
.parent-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--stone-dark);
  border-bottom: 4px solid var(--outline);
}
.parent-top h1 { margin: 0; font-size: 28px; color: #fff; }
.version-btn { margin-right: auto; }
.tabs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.tab.selected { background: var(--grass-dark); }
.parent-body { max-width: 1200px; margin: 0 auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.parent-body > .btn { align-self: flex-start; }

.panel { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; background: #fffaf0; border: 4px solid var(--outline); }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.push-right { margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 18px; }
.label { margin-top: 4px; font-size: 20px; }
.hint { margin: 0; font-size: 18px; font-weight: 500; color: #444; }
.hint.warn { color: #9a2b1f; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 64px; height: 64px; border: 3px solid var(--outline); cursor: pointer; }
.swatch.selected { outline: 5px solid var(--ink); outline-offset: 3px; }
.big-avatar { width: 88px; height: 88px; display: grid; place-items: center; font-size: 56px; border: 4px solid var(--outline); }

.task-rows { display: flex; flex-direction: column; gap: 10px; }
.task-row {
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: #fffaf0;
  border: 3px solid var(--outline);
}
.label-input { flex: 1; min-width: 220px; }
.emoji-btn { width: 72px; height: 72px; padding: 0; font-size: 40px; background: #fff; border: 3px solid var(--outline); cursor: pointer; }
.days { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.days-hint { font-size: 16px; font-weight: 500; color: #555; }
.task-row.past { opacity: .55; }
.holiday-now { padding: 4px 12px; font-size: 18px; background: var(--gold); border: 3px solid var(--outline); }
.row-actions { display: flex; gap: 6px; }

.setting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 2px dashed #cbbfa8;
}
.setting:last-child { border-bottom: none; }
.setting-label { font-size: 22px; }
.pin-input { width: 180px; }

/* ---------- Versiohistoria ---------- */
.badge-new {
  padding: 2px 10px;
  font-size: 18px;
  color: var(--ink);
  text-shadow: none;
  background: var(--gold);
  border: 3px solid var(--outline);
  animation: throb 1.2s ease-in-out infinite;
}
.dialog.changelog { max-height: calc(100dvh - 48px); display: flex; flex-direction: column; }
.dialog.changelog .dialog-text { margin-bottom: 16px; }
.cl-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 4px 20px;
  background: #fffaf0;
  border: 3px solid var(--outline);
  user-select: text;
  -webkit-user-select: text;
}
.cl-entry { padding: 12px 0; }
.cl-entry + .cl-entry { border-top: 2px dashed #cbbfa8; }
.cl-entry h3 { margin: 0 0 6px; font-size: 24px; }
.cl-date { margin-left: 12px; font-size: 18px; font-weight: 500; color: #555; }
.cl-entry h4 { margin: 10px 0 4px; font-size: 20px; }
.cl-entry p, .cl-entry li { font-size: 20px; font-weight: 500; line-height: 1.4; }
.cl-entry p { margin: 4px 0; }
.cl-entry ul { margin: 0; padding-left: 26px; }
.cl-entry code { font-size: .9em; padding: 0 4px; background: #ece4d6; }
.link-btn {
  font: inherit;
  min-height: 64px;
  margin-right: auto;
  padding: 0;
  font-size: 22px;
  color: #0d3a8a;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}
