:root {
  --bg1: #bfe6ff; --bg2: #fff4d6; --ink: #2b2a3a; --card: rgba(255,255,255,.75);
  --accent: #ff8a5c; --muted: #6b6a80;
}
body.evening { --bg1: #1d2350; --bg2: #3b2d6b; --ink: #f3f1ff; --card: rgba(255,255,255,.10); --accent: #ffd36b; --muted: #b8b4d8; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Varela Round", system-ui, sans-serif; color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2)); background-attachment: fixed;
  transition: background .6s, color .6s; min-height: 100vh;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--card); backdrop-filter: blur(10px); border-radius: 28px; padding: 36px 28px; text-align: center; max-width: 340px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.12); }
.login-emoji { font-size: 64px; }
.login-card h1 { margin: 8px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.google-btn { display: inline-flex; gap: 10px; align-items: center; border: 0; border-radius: 999px; padding: 12px 22px; background: #fff; color: #333; font-size: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.login-error { color: #d23; min-height: 1em; margin-top: 14px !important; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top)); }
.date { font-size: 15px; color: var(--muted); min-width: 120px; }
.top-actions { display: flex; align-items: center; gap: 8px; min-width: 120px; justify-content: flex-end; }
.demo-badge { font-size: 12px; background: var(--accent); color: #222; padding: 3px 10px; border-radius: 999px; }
.icon-btn { border: 0; background: var(--card); color: var(--ink); width: 38px; height: 38px; border-radius: 50%; font-size: 18px; }

.mode-switch { position: relative; display: flex; border: 0; padding: 4px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.mode-switch .opt { position: relative; z-index: 1; padding: 9px 16px; font-size: 16px; color: var(--ink); transition: color .3s; white-space: nowrap; }
.mode-switch .knob { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); right: 4px; border-radius: 999px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: right .35s cubic-bezier(.5,1.6,.4,1), background .4s; }
body.evening .mode-switch .knob { right: 50%; background: #5a4fb0; }

/* wheels */
.wheels { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; padding: 8px 14px 40px; }
.wheel-card { background: var(--card); backdrop-filter: blur(8px); border-radius: 30px; padding: 14px 14px 18px; width: min(460px, 100%); box-shadow: 0 8px 30px rgba(0,0,0,.08); position: relative; }
.wheel-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 6px; }
.wheel-head h2 { margin: 0; font-size: 26px; }
.progress-txt { color: var(--muted); font-size: 15px; }
.wheel-svg { width: 100%; height: auto; display: block; user-select: none; touch-action: manipulation; }
.slice { cursor: pointer; transition: transform .25s ease, filter .2s; transform-origin: 200px 200px; }
.slice:hover { filter: brightness(1.04); }
.slice:active { transform: scale(.97); }
.slice path { transition: fill .35s; stroke: rgba(255,255,255,.9); stroke-width: 3; }
body.evening .slice path { stroke: rgba(30,30,70,.6); }
.slice .icon { font-size: 42px; dominant-baseline: central; text-anchor: middle; pointer-events: none; }
.slice .label { font-size: 15px; font-weight: bold; text-anchor: middle; dominant-baseline: central; pointer-events: none; fill: #2b2a3a; transition: fill .3s; }
.slice.done .label { fill: #fff; }
.slice .check { pointer-events: none; opacity: 0; transition: opacity .3s, transform .3s; }
.slice.done .check { opacity: 1; }
.slice.pop { animation: pop .45s ease; }
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.06)} 100%{transform:scale(1)} }
.hub-circle { fill: #fff; }
body.evening .hub-circle { fill: #2a2d5e; }
.hub-big { font-size: 34px; font-weight: bold; text-anchor: middle; dominant-baseline: central; fill: var(--ink); }
.hub-small { font-size: 14px; text-anchor: middle; fill: var(--muted); }
.wheel-head h2 { flex: 1; }
.progress-txt { margin-inline-end: 10px; }
.all-done .hub-circle { fill: #ffe27a; }
body.evening .all-done .hub-circle { fill: #ffd36b; }
.all-done .hub-big, .all-done .hub-small { fill: #3a2b00; }

/* sheets */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10,10,30,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { background: #fff; color: #2b2a3a; width: min(560px, 100%); max-height: 92vh; overflow: auto; border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 24px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet .icon-btn { background: #f1f0f7; color: #333; }
.field { display: block; margin: 14px 0; font-size: 14px; color: #6b6a80; }
.field input { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 17px; padding: 10px 12px; border: 1px solid #ddd; border-radius: 12px; color: #2b2a3a; }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.pal { border: 2px solid transparent; border-radius: 14px; padding: 6px; background: #f6f5fb; text-align: right; font-size: 13px; color: #444; }
.pal.sel { border-color: #5a4fb0; background: #eeeaff; }
.pal .sw { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin-bottom: 4px; }
.pal .sw i { flex: 1; }
.seg { display: flex; background: #f1f0f7; border-radius: 12px; padding: 3px; margin: 8px 0 10px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 10px; font-size: 15px; color: #444; }
.seg button.sel { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task-row { display: flex; gap: 8px; align-items: center; }
.task-row .ico { width: 48px; height: 48px; font-size: 26px; border: 0; border-radius: 12px; flex: none; }
.task-row input { flex: 1; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid #ddd; border-radius: 12px; min-width: 0; }
.task-row .mini { border: 0; background: #f1f0f7; width: 34px; height: 34px; border-radius: 10px; font-size: 15px; color: #555; flex: none; }
.add-btn { width: 100%; margin-top: 10px; border: 2px dashed #ccc; background: transparent; padding: 11px; border-radius: 12px; font-size: 15px; color: #555; }
.add-btn:disabled { opacity: .4; }
.sheet-foot { display: flex; justify-content: space-between; margin-top: 18px; gap: 10px; }
.primary-btn { border: 0; background: #5a4fb0; color: #fff; padding: 12px 28px; border-radius: 999px; font-size: 16px; }
.ghost-btn { border: 0; background: #f1f0f7; color: #555; padding: 12px 18px; border-radius: 999px; font-size: 15px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; margin-top: 12px; }
.emoji-grid button { font-size: 30px; height: 54px; border: 0; background: #f6f5fb; border-radius: 12px; }
.emoji-grid button:hover { background: #e7e3ff; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; width: 100%; height: 100%; }

.new-day-btn { border: 0; background: var(--card); color: var(--ink); padding: 9px 14px; border-radius: 999px; font-size: 15px; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.new-day-btn.confirm { background: #ff6b6b; color: #fff; }

/* phones: stack; small topbar */
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .date { order: 1; min-width: 0; }
  .top-actions { order: 2; min-width: 0; }
  .mode-switch { order: 3; width: 100%; justify-content: space-around; }
  .mode-switch .opt { flex: 1; text-align: center; }
}
/* tablets & up: two wheels side by side, sized to fit the screen without scrolling */
@media (min-width: 700px) {
  .wheels { flex-wrap: nowrap; align-items: flex-start; gap: 24px; padding: 8px 20px 24px; }
  .wheel-card { width: min(calc((100vw - 64px) / 2), calc(100vh - 150px), 560px); }
  .wheel-head h2 { font-size: 30px; }
}
/* tablet portrait: stack the two wheels, each as big as half the screen height allows */
@media (min-width: 700px) and (orientation: portrait) {
  .wheels { flex-direction: column; align-items: center; gap: 18px; }
  .wheel-card { width: min(calc(100vw - 40px), calc((100vh - 120px) / 2 - 70px), 620px); }
}
