:root {
  --ink: #243044;
  --muted: #64748b;
  --paper: #fffdf7;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(36, 48, 68, 0.14);
  --blue: #2563eb;
  --green: #16a34a;
  --pink: #db2777;
  --yellow: #facc15;
  --orange: #fb923c;
  --red: #ef4444;
  --shadow: 0 18px 45px rgba(30, 41, 59, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(250, 204, 21, 0.42), transparent 24rem),
    radial-gradient(circle at 85% 16%, rgba(45, 212, 191, 0.3), transparent 22rem),
    linear-gradient(180deg, #e0f2fe 0%, #fef3c7 48%, #fce7f3 100%);
  font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.shape {
  position: absolute;
  opacity: 0.28;
  animation: floaty 7s ease-in-out infinite;
}

.star-a {
  top: 9%;
  left: 8%;
  color: var(--yellow);
  font-size: 4rem;
}

.star-b {
  right: 9%;
  top: 32%;
  color: var(--pink);
  font-size: 3rem;
  animation-delay: -2s;
}

.cloud-a {
  top: 16%;
  right: 14%;
  color: white;
  font-size: 6rem;
}

.cloud-b {
  bottom: 9%;
  left: 10%;
  color: white;
  font-size: 5rem;
  animation-delay: -4s;
}

.app-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
  position: relative;
}

.hero {
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 30px;
  color: #172033;
}

.eyebrow,
.mini-label {
  margin: 0;
  color: #475569;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.hero h1 {
  margin: 4px 0 8px;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 520px;
  margin: 0;
  color: #334155;
  font-size: 1.1rem;
  font-weight: 700;
}

.music-button,
.icon-action {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}

.music-button {
  grid-template-rows: auto auto;
  min-width: 86px;
  height: 86px;
  color: #be123c;
}

.music-button.playing {
  background: #ffe4e6;
}

.status-strip,
.dashboard,
.progress-panel,
.mission-board,
.penalty-panel,
.reward-panel,
.manage-panel,
.history-panel {
  background: var(--panel);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.status-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 7px;
  background: var(--orange);
}

.dot.online {
  background: var(--green);
}

.dot.offline {
  background: var(--red);
}

.children-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.child-tab {
  border: 0;
  border-radius: 22px;
  min-height: 88px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.12);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.child-tab.active {
  outline: 5px solid rgba(250, 204, 21, 0.8);
}

.child-tab .face {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent), white 72%);
  font-size: 1.8rem;
  overflow: hidden;
}

.child-tab strong {
  display: block;
  line-height: 1.1;
}

.child-tab span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  padding: 18px;
}

.player-card {
  min-height: 180px;
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--active-color, #2563eb), white 72%), #fff);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
}

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, var(--active-color, #2563eb), var(--active-accent, #facc15));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 -8px 0 rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-photo-large {
  border-radius: 34px;
}

.avatar-photo-mini {
  border-radius: 18px;
}

.avatar[data-avatar="My Melody"] {
  color: #9f1239;
  background:
    radial-gradient(circle at 50% 12%, #fff 0 16%, transparent 17%),
    linear-gradient(135deg, #f9a8d4, #fff1f2);
}

.avatar[data-avatar="Bus Tayo"] {
  background:
    linear-gradient(180deg, #60a5fa 0 58%, #1d4ed8 59% 100%);
}

.player-card h2 {
  margin: 3px 0 8px;
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1;
}

.player-card p {
  margin: 0;
  font-weight: 800;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.score-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
}

.score-card span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.progress-panel {
  margin-top: 18px;
  padding: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-weight: 900;
}

.progress-wrap {
  height: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--orange));
  transition: width 0.25s ease;
}

.mission-board,
.penalty-panel,
.reward-panel,
.history-panel {
  margin-top: 18px;
  padding: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 1.6rem;
}

.section-heading.compact h2 {
  font-size: 1.28rem;
}

.quick-actions {
  display: flex;
  gap: 10px;
}

.icon-action {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  box-shadow: none;
  font-size: 1.4rem;
}

.icon-action.success {
  background: #dcfce7;
  color: #15803d;
}

.icon-action.warn {
  background: #ffedd5;
  color: #c2410c;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.mission-button {
  min-height: 124px;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  padding: 12px 8px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  place-items: center;
  box-shadow: inset 0 -6px 0 rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, background 0.16s ease;
}

.mission-button:hover {
  transform: translateY(-2px);
}

.mission-button.done {
  background: #dcfce7;
  color: #166534;
}

.mission-icon {
  font-size: 2rem;
}

.mission-name {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.mission-points {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.penalty-panel {
  margin-top: 18px;
  padding: 18px;
}

.penalty-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.penalty-button {
  min-height: 86px;
  border: 0;
  border-radius: 20px;
  padding: 10px;
  background: #fff1f2;
  color: #9f1239;
  font-weight: 900;
  box-shadow: inset 0 -5px 0 rgba(159, 18, 57, 0.1);
}

.penalty-button span {
  display: block;
  color: #be123c;
  margin-top: 4px;
}

.penalty-form {
  grid-template-columns: 1fr 150px auto;
  margin-top: 12px;
}

.reward-panel {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 14px;
  align-items: stretch;
}

.gacha-button {
  min-height: 142px;
  border: 0;
  border-radius: 26px;
  background: linear-gradient(135deg, #facc15, #fb7185);
  color: #4a2600;
  display: grid;
  place-items: center;
  box-shadow: inset 0 -8px 0 rgba(120, 53, 15, 0.18);
}

.gacha-button:disabled {
  filter: grayscale(0.35);
  opacity: 0.55;
  cursor: not-allowed;
}

.gacha-button span {
  font-size: 2.6rem;
}

.gacha-button strong {
  font-size: 1.35rem;
}

.gacha-result {
  border-radius: 24px;
  background: #fff7ed;
  border: 2px dashed #fb923c;
  padding: 18px;
  font-weight: 900;
  display: grid;
  align-content: center;
}

.gacha-result[hidden] {
  display: none;
}

.manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.manage-panel {
  padding: 18px;
}

.form {
  display: grid;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  outline: 0;
  font-weight: 800;
}

input:focus,
select:focus {
  border-color: var(--blue);
}

.primary-button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.danger-button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: #e11d48;
  color: #fff;
  font-weight: 900;
}

.list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid var(--line);
}

.list-row.done {
  background: #ecfdf5;
}

.list-title {
  font-weight: 900;
  line-height: 1.2;
}

.list-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 2px;
}

.tiny-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 13px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 900;
}

.tiny-button.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.empty {
  color: var(--muted);
  font-weight: 800;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.daily-card {
  border-radius: 20px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.daily-card.today {
  outline: 4px solid rgba(250, 204, 21, 0.55);
}

.daily-date {
  font-weight: 900;
  margin-bottom: 8px;
}

.daily-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.daily-stats span {
  display: block;
  padding: 8px;
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.daily-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
}

@keyframes floaty {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(18px) rotate(6deg);
  }
}

@media (max-width: 860px) {
  .hero,
  .dashboard,
  .reward-panel,
  .manage-grid,
  .penalty-form {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
  }

  .children-tabs {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 10px;
  }

  .hero {
    min-height: 210px;
    padding: 16px 4px;
  }

  .hero h1 {
    font-size: 3.1rem;
  }

  .status-strip {
    flex-direction: column;
  }

  .dashboard,
  .mission-board,
  .penalty-panel,
  .reward-panel,
  .manage-panel,
  .history-panel,
  .progress-panel {
    border-radius: 20px;
    padding: 13px;
  }

  .player-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .avatar {
    margin: 0 auto;
  }

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

  .mission-button {
    min-height: 116px;
  }

  .form-row,
  .list-row {
    grid-template-columns: 1fr auto;
  }

  .penalty-grid,
  .daily-grid {
    grid-template-columns: 1fr;
  }
}
