:root {
  --pink: #ff5d8f;
  --purple: #9b7bff;
  --blue: #3fa9f5;
  --green: #5fd35f;
  --yellow: #ffd23d;
  --orange: #ff9f43;
  --ink: #3a2c5a;
  --panel: #fffdf7;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: "Baloo 2", "Comic Sans MS", "Segoe UI", system-ui, sans-serif; color: var(--ink); background: linear-gradient(160deg, #fde9ff 0%, #e6f3ff 50%, #e9fff2 100%); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
body { display: flex; flex-direction: column; }
button { font-family: inherit; cursor: pointer; border: none; }
.topbar { position: relative; z-index: 3; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(255,255,255,0.72); backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(120,80,160,0.15); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.topbar::-webkit-scrollbar { display: none; }
.topbar > * { flex: 0 0 auto; }
.topbar-spacer { flex: 1 1 auto; min-width: clamp(60px, 16vw, 200px); }
.site-logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 0.95rem; font-weight: 900; text-decoration: none; }
.site-logo-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid var(--ink); border-radius: 9px; background: var(--green); color: #fff; box-shadow: 3px 3px 0 rgba(58,44,90,0.28); font-size: 0.72rem; letter-spacing: 0; }
.logo { font-size: 1.25rem; font-weight: 800; background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo .star { -webkit-text-fill-color: initial; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border-radius: 999px; padding: 4px 11px; font-weight: 700; font-size: 0.85rem; box-shadow: 0 2px 6px rgba(120,80,160,0.18); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 1.15rem; background: #fff; box-shadow: 0 3px 8px rgba(120,80,160,0.22); display: grid; place-items: center; transition: transform 0.1s; }
.icon-btn:active { transform: scale(0.9); }
.btn { border-radius: 999px; padding: 8px 16px; font-weight: 800; font-size: 0.95rem; color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,0.12); transition: transform 0.08s, box-shadow 0.08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.btn.green { background: var(--green); }
.btn.blue { background: var(--blue); }
.btn.orange { background: var(--orange); }
.progress-wrap { position: relative; z-index: 3; flex: 0 0 auto; height: 10px; background: rgba(255,255,255,0.6); }
.progress-bar { height: 100%; width: 0%; border-radius: 0 999px 999px 0; background: linear-gradient(90deg, var(--green), var(--yellow)); transition: width 0.35s ease; }
.game-area { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 12px; gap: 12px; overflow-y: auto; }
.routine-selector { display: flex; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; justify-content: center; }
.routine-tab { border-radius: 999px; padding: 10px 20px; font-weight: 800; font-size: 1rem; background: #fff; color: var(--ink); box-shadow: 0 3px 8px rgba(120,80,160,0.15); transition: all 0.2s; }
.routine-tab.active { background: var(--purple); color: #fff; }
.timeline { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 8px; }
.timeline-slot { width: clamp(60px, 16vw, 100px); height: clamp(90px, 22vw, 130px); border: 3px dashed var(--purple); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: rgba(255,255,255,0.6); transition: all 0.2s; position: relative; }
.timeline-slot.filled { border-style: solid; border-color: var(--green); background: rgba(95,211,95,0.15); animation: pop-in 0.3s ease; }
.timeline-slot.wrong-slot { border-color: var(--pink); background: rgba(255,93,143,0.12); animation: shake 0.4s ease; }
@keyframes pop-in { 0% { transform: scale(1.1); } 60% { transform: scale(0.95); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.slot-number { font-size: 1.6rem; font-weight: 800; color: var(--purple); opacity: 0.6; }
.timeline-slot.filled .slot-number { opacity: 1; color: var(--green); }
.slot-content { text-align: center; }
.slot-emoji { font-size: clamp(1.5rem, 6vw, 2.2rem); }
.slot-label { font-size: clamp(0.55rem, 2vw, 0.7rem); font-weight: 700; color: var(--ink); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards-area { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 700px; }
.cards-area h2 { text-align: center; font-size: 1.1rem; color: var(--purple); margin: 4px 0 8px; }
.cards-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: flex-start; padding: 8px; }
.action-card { width: clamp(70px, 18vw, 110px); min-height: 100px; border-radius: 18px; padding: 10px; background: #fff; box-shadow: 0 6px 18px rgba(120,80,160,0.2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: grab; touch-action: none; transition: transform 0.12s, box-shadow 0.12s; border: 3px solid var(--yellow); }
.action-card:active { transform: scale(0.96); }
.action-card.placed { opacity: 0.4; cursor: default; pointer-events: none; border-color: var(--green); }
.action-card.dragging { position: fixed; z-index: 9999; cursor: grabbing; transform: scale(1.06); box-shadow: 0 14px 30px rgba(120,80,160,0.35); opacity: 1 !important; pointer-events: auto !important; }
.card-emoji { font-size: clamp(1.6rem, 6vw, 2.5rem); }
.card-label { font-size: clamp(0.6rem, 2.2vw, 0.78rem); font-weight: 700; text-align: center; color: var(--ink); line-height: 1.2; }
.win-area { text-align: center; padding: 20px; display: none; }
.win-area.show { display: block; }
.win-area .trophy { font-size: clamp(4rem, 12vw, 6rem); animation: bounce 0.8s ease infinite alternate; }
@keyframes bounce { to { transform: translateY(-14px); } }
.win-area h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin: 10px 0; color: var(--purple); }
#confetti { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
