/* ChoreShare. Soft and clean: bathroom-tile teal, soap white, a warm
   sponge yellow for "done", rounded cards that read well on a phone. */

:root {
  --bg: #eef5f6;
  --surface: #ffffff;
  --surface-2: #f4f9fa;
  --ink: #1d3a42;
  --ink-2: #4f6a71;
  --line: #d3e3e6;
  --teal: #2f7d8c;
  --teal-ink: #ffffff;
  --teal-soft: #d9eef2;
  --sponge: #f2c14e;
  --sponge-soft: #fdf1cf;
  --red: #b5473a;
  --red-soft: #f8e2de;
  --shadow: 0 10px 26px -14px rgba(29, 58, 66, 0.35), 0 1px 0 rgba(29, 58, 66, 0.05);
  --radius: 20px;
  --radius-s: 12px;
  --round: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1d21;
    --surface: #17292e;
    --surface-2: #1d343a;
    --ink: #e4f0f2;
    --ink-2: #a3bcc2;
    --line: #2b464d;
    --teal: #5fbccc;
    --teal-ink: #0b1a1e;
    --teal-soft: #1d3c43;
    --sponge: #f2c14e;
    --sponge-soft: #3a3320;
    --red: #ef8c7f;
    --red-soft: #3d2420;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  padding: 0 16px 120px;
}

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top, main, .foot { max-width: 760px; margin: 0 auto; }

.top { padding: 32px 0 12px; }
.top h1 { font: 800 clamp(2rem, 7vw, 2.8rem)/1.05 var(--round); margin: 0; letter-spacing: -0.02em; color: var(--teal); }
.lede { margin: 8px 0 0; color: var(--ink-2); font-size: 1.05rem; max-width: 36rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 16px;
}
.card h2 { font: 700 1.25rem/1.2 var(--round); margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal); font-size: 0.95rem;
}

input, select, button { font: inherit; color: inherit; }
input, select {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, .job:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  background: var(--teal);
  color: var(--teal-ink);
  font-weight: 650;
  cursor: pointer;
}
.btn.ghost { background: var(--teal-soft); color: var(--teal); }
.btn:active { transform: translateY(1px); }
.linkish { background: none; border: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; padding: 0; }

.row-form { display: flex; gap: 8px; }
.row-form input { flex: 1; }

.people { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 4px 4px 14px;
}
.person .name { font-weight: 650; }
.person select { width: auto; min-height: 36px; padding: 4px 8px; border-radius: 999px; font-size: 0.9rem; }
.x {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer; font-size: 1.2rem; line-height: 1;
}
.x:hover { background: var(--red-soft); color: var(--red); }

.hint { color: var(--ink-2); font-size: 0.92rem; margin: 10px 0 0; }
.empty { color: var(--ink-2); margin: 0; }

.chore-head, .chore {
  display: grid; grid-template-columns: 1fr 88px 150px 36px; gap: 8px; align-items: center;
}
.chore-head { font-size: 0.8rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 2px 4px; }
.chores { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.hates { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }
.hates summary { cursor: pointer; font-weight: 650; min-height: 32px; }
.hates-grid { overflow-x: auto; margin-top: 8px; }
.hates-grid table { border-collapse: collapse; font-size: 0.92rem; }
.hates-grid th, .hates-grid td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.hates-grid th:first-child, .hates-grid td:first-child { text-align: left; }
.hates-grid input { width: 22px; height: 22px; min-height: 0; accent-color: var(--red); }

.weeks { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.weeks button {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px;
  padding: 8px 14px; min-height: 40px; cursor: pointer; font-weight: 600;
}
.weeks button[aria-selected="true"] { background: var(--teal); color: var(--teal-ink); border-color: var(--teal); }
.weeks .now { font-size: 0.75rem; font-weight: 700; margin-left: 6px; background: var(--sponge); color: #3b2c06; border-radius: 999px; padding: 1px 7px; }

.balance { margin: 16px 0 6px; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 7rem 1fr 6.5rem; gap: 10px; align-items: center; font-size: 0.92rem; }
.bar-row .who { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { position: relative; height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar span { position: absolute; inset: 0 auto 0 0; background: var(--teal); border-radius: 999px; transition: width .3s ease; }
.bar i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: 0.55; }
.bar-row .mins { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.verdict { font-weight: 650; margin: 2px 0 0; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.col h3 { margin: 0 0 8px; font: 700 1.05rem/1.2 var(--round); display: flex; justify-content: space-between; gap: 8px; }
.col h3 small { color: var(--ink-2); font: 500 0.85rem var(--body); }
.col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.job {
  width: 100%; display: grid; grid-template-columns: 2.6rem 1fr auto; gap: 8px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 44px; cursor: pointer;
}
.job .day { font-weight: 700; color: var(--teal); font-size: 0.85rem; }
.job .m { color: var(--ink-2); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.job.today { border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.job.done { background: var(--sponge-soft); }
.job.done .what { text-decoration: line-through; color: var(--ink-2); }
.job .tag { font-size: 0.72rem; background: var(--teal-soft); color: var(--teal); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.off { color: var(--ink-2); font-style: italic; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); margin: 0; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }

.foot { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 28px 0; color: var(--ink-2); font-size: 0.92rem; }
.foot a { color: inherit; }

dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(92vw, 360px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15, 29, 33, 0.45); }
dialog h3 { margin: 0; font: 700 1.2rem var(--round); }
dialog label { display: block; margin-top: 12px; font-weight: 600; }
.check { display: flex !important; align-items: center; gap: 10px; }
.check input { width: 24px; height: 24px; min-height: 0; accent-color: var(--teal); }

/* Suds */
.suds-dock { position: fixed; right: 16px; bottom: 16px; z-index: 6; display: flex; align-items: flex-end; gap: 6px; }
.suds { width: 86px; height: 86px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.suds svg { width: 100%; height: 100%; overflow: visible; }
.suds .s-white { fill: #fff; stroke: #1d3a42; stroke-width: 2; }
.suds .s-pupil { fill: #1d3a42; transition: transform .08s linear; }
.suds .s-lid { fill: none; stroke: #1d3a42; stroke-width: 3; stroke-linecap: round; display: none; }
.suds .s-cheek { fill: #f6a7a0; opacity: .7; }
.suds .s-mini { fill: #e6f6f9; stroke: #2f7d8c; stroke-width: 2.5; }
.suds .s-mouth { fill: none; stroke: #1d3a42; stroke-width: 3; stroke-linecap: round; display: none; }
.suds .s-mouth.wow { fill: #1d3a42; stroke: none; }
.suds[data-mood="happy"] .s-mouth.happy,
.suds[data-mood="party"] .s-mouth.happy,
.suds[data-mood="worried"] .s-mouth.worried,
.suds[data-mood="wow"] .s-mouth.wow,
.suds[data-mood="sleepy"] .s-mouth.sleepy { display: block; }
.suds[data-mood="sleepy"] .s-white, .suds[data-mood="sleepy"] .s-pupil { display: none; }
.suds[data-mood="sleepy"] .s-lid { display: block; }
.suds.blink .s-white, .suds.blink .s-pupil { transform: scaleY(0.1); transform-box: fill-box; transform-origin: center; }
.suds .s-body { transform-origin: 58px 100px; animation: bob 3.2s ease-in-out infinite; }
.suds .m1 { animation: rise 4s ease-in-out infinite; }
.suds .m2 { animation: rise 4s ease-in-out 1.3s infinite; }
.suds.hop .s-body { animation: hop .5s ease; }
.suds.spin .s-body { animation: spin .8s ease; transform-origin: 58px 62px; }
.suds[data-mood="party"] .s-body { animation: hop .6s ease 2; }
@keyframes bob { 50% { transform: translateY(-4px) scale(1.02, 0.98); } }
@keyframes rise { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-6px); opacity: .7; } }
@keyframes hop { 40% { transform: translateY(-14px) scale(0.95, 1.06); } 70% { transform: translateY(0) scale(1.06, 0.94); } }
@keyframes spin { to { transform: rotate(360deg); } }

.bubble {
  max-width: min(64vw, 260px); background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  box-shadow: var(--shadow); border-radius: 16px 16px 4px 16px; padding: 10px 12px; font-size: 0.92rem; margin-bottom: 52px;
}
.bubble:empty { display: none; }
.bubble.pop { animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.suds-hide {
  position: absolute; right: -6px; top: -6px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 1rem; line-height: 1;
}
.suds-dock.tucked { right: -54px; opacity: .8; }
.suds-dock.tucked .suds-hide, .suds-dock.tucked .bubble { display: none; }
.pop-bubble { position: fixed; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--teal); background: rgba(255,255,255,.6); pointer-events: none; z-index: 7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
  .card { padding: 16px; }
  .chore-head { display: none; }
  .chore { grid-template-columns: 1fr 72px 36px; }
  .chore select { grid-column: 1 / 3; grid-row: 2; }
  .chore .x { grid-row: 1; grid-column: 3; }
  .chores { gap: 14px; }
  .bar-row { grid-template-columns: 5rem 1fr 5.5rem; }
  .suds { width: 70px; height: 70px; }
}

@media print {
  body { background: #fff; color: #000; padding: 0; }
  #step-people, #step-chores, .actions, .hint, .suds-dock, .foot, .weeks, .toast, .skip { display: none !important; }
  .card { box-shadow: none; border: 0; }
  .job { border: 1px solid #999; }
}
