/* ShinyPlum — "Porcelain plum".
   Warm porcelain surfaces, deep plum for brand and actions, the logo's olive leaf for finished
   work and a bronze accent for thanks. The iOS Theme uses the same values. */
:root {
  color-scheme: light;
  --paper: #f7f3ee;
  --paper-2: #efe8e1;
  --card: #fffdfa;
  --ink: #2b1f2e;
  --muted: #6b5f6e;
  --plum: #6d3d7b;
  --plum-deep: #3f2249;
  --plum-soft: #efe4f1;
  --plum-tint: #f7f1f7;
  --leaf: #66733a;
  --leaf-soft: #e9ecd8;
  --bronze: #985636;
  --peach: #f7e6db;
  --line: #e6dde0;
  --line-strong: #d3c6cc;
  /* Older names used by markup and inline styles. */
  --forest: var(--plum);
  --sage: var(--plum-soft);
  --coral: var(--bronze);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Avenir Next', Avenir, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgb(43 31 46 / 0.05), 0 6px 18px rgb(43 31 46 / 0.05);
  --shadow-md: 0 2px 6px rgb(43 31 46 / 0.06), 0 16px 40px rgb(43 31 46 / 0.09);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* {
  box-sizing: border-box;
}
html {
  background: var(--paper);
}
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 520px at 85% -120px, rgb(109 61 123 / 0.07), transparent 70%),
    radial-gradient(900px 420px at -10% 0, rgb(102 115 58 / 0.06), transparent 70%),
    var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
button[data-action][aria-busy='true'],
form[aria-busy='true'] button[type='submit'],
form[aria-busy='true'] button:not([type]) {
  opacity: 0.55;
  pointer-events: none;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(109 61 123 / 0.45);
  outline-offset: 2px;
}
button:focus:not(:focus-visible) {
  outline: none;
}
a {
  color: inherit;
}
svg,
img {
  vertical-align: middle;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
.brand,
.big-score,
.stat-total,
.quiz-card strong {
  font-family: var(--serif);
  font-weight: 500;
}
h1 {
  font-size: clamp(2rem, 3.6vw, 3.2rem);
  letter-spacing: -0.045em;
  line-height: 1.04;
}
h2 {
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  letter-spacing: -0.03em;
  line-height: 1.18;
}
h3 {
  font-size: 1.02rem;
  line-height: 1.3;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.4rem 0;
}
small {
  font-size: 0.86rem;
}
p + form,
p + .button,
p + .text-button {
  margin-top: 1.25rem;
}
.stack {
  display: grid;
  gap: 1.05rem;
}
.muted,
.lead,
.hint {
  color: var(--muted);
}
.lead {
  font-size: 1.08rem;
  max-width: 46rem;
  margin-top: 0.8rem;
}
.pre-wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--plum);
  margin-bottom: 0.65rem;
}
.skip {
  position: fixed;
  z-index: 50;
  left: 1rem;
  top: 0.4rem;
  transform: translateY(-160%);
  background: var(--card);
  padding: 0.8rem;
  border-radius: 8px;
}
.skip:focus {
  transform: none;
}
.loading {
  min-height: 70vh;
  display: grid;
  place-content: center;
  gap: 1rem;
  justify-items: center;
  color: var(--muted);
}
.loading img {
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  animation: breathe 1.6s var(--ease) infinite alternate;
}
@keyframes breathe {
  to {
    transform: scale(1.06);
  }
}

/* ——— Header and navigation ——— */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(247 243 238 / 0.82);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgb(211 198 204 / 0.6);
}
.head-inner {
  max-width: 1320px;
  padding: 0 clamp(1rem, 4.5vw, 4rem);
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: auto;
}
.brand-link {
  text-decoration: none;
  border-radius: 12px;
}
.brand {
  color: var(--plum-deep);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 600;
}
.brand img {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgb(63 34 73 / 0.18);
}
.main-nav {
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease);
}
.nav-link:hover {
  color: var(--plum-deep);
  background: rgb(109 61 123 / 0.07);
}
.nav-link.active {
  color: var(--card);
  background: var(--plum-deep);
  box-shadow: 0 4px 14px rgb(63 34 73 / 0.25);
}
.guest-head {
  justify-content: space-between;
}
.account,
.icon-button,
.text-button,
.add-line,
.thank,
.undo {
  border: 0;
  background: transparent;
}
.account {
  padding: 0.2rem;
  border-radius: 50%;
  line-height: 1;
  transition: box-shadow 0.2s var(--ease);
}
.account:hover {
  box-shadow: 0 0 0 3px var(--plum-soft);
}

/* ——— Avatars ——— */
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(140deg, #f1e3f3, #e0cbe5);
  color: var(--plum-deep);
  font: 600 1.03rem var(--serif);
  box-shadow: inset 0 0 0 1px rgb(63 34 73 / 0.06);
}
.avatar.peach {
  background: linear-gradient(140deg, #fbeee4, #f1d6c4);
  color: #7d4529;
}
.avatar.small {
  width: 34px;
  height: 34px;
  font-size: 0.95rem;
}
.avatar.large {
  width: 84px;
  height: 84px;
  font-size: 2.2rem;
  box-shadow: 0 0 0 4px var(--card), var(--shadow-md);
}
.avatar img {
  position: absolute;
  height: 100%;
  width: 100%;
  inset: 0;
  object-fit: cover;
}

/* ——— Buttons ——— */
.button,
.text-button,
.icon-button,
.add-line,
.thank,
.undo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.button {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  padding: 0.6rem 1.15rem;
  font-weight: 650;
  font-size: 0.93rem;
  transition:
    background 0.18s var(--ease),
    transform 0.12s var(--ease),
    box-shadow 0.18s var(--ease);
}
.button:hover {
  background: var(--plum-tint);
}
.button:active {
  transform: scale(0.98);
}
.button.primary {
  background: linear-gradient(180deg, #7a4689, var(--plum));
  color: #fff;
  border-color: var(--plum);
  box-shadow: 0 6px 16px rgb(109 61 123 / 0.25);
}
.button.primary:hover {
  background: linear-gradient(180deg, #6d3d7b, var(--plum-deep));
}
.button.secondary {
  background: rgb(255 253 250 / 0.6);
}
.button.secondary:hover {
  background: var(--plum-soft);
}
.text-button,
.add-line,
.undo {
  color: var(--plum);
  font-size: 0.91rem;
  font-weight: 650;
  padding: 0.24rem 0;
  text-decoration: none;
}
.text-button:hover,
.add-line:hover,
.undo:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  flex: none;
  transition: background 0.18s var(--ease);
}
.icon-button:hover {
  background: var(--plum-soft);
  color: var(--plum-deep);
}
button.wide {
  width: 100%;
}

/* ——— Surfaces ——— */
.panel,
.room {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.pad {
  padding: clamp(1rem, 1.8vw, 1.4rem);
}

/* ——— Sign in ——— */
.auth-shell {
  max-width: 1240px;
  margin: clamp(1.4rem, 4vw, 3.6rem) auto;
  padding: 0 clamp(1.2rem, 5vw, 4.5rem);
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(2.5rem, 6.5vw, 7rem);
}
.welcome-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 560px;
  height: clamp(520px, 70vh, 740px);
  border-radius: 28px;
  background: var(--plum-deep);
  box-shadow: var(--shadow-md);
}
.welcome-picture,
.week-hero-img {
  background-image: url('./living-room.jpg');
  background-color: #8a7a83;
  background-size: cover;
  background-position: center;
}
.welcome-picture {
  position: absolute;
  inset: 0;
  z-index: -2;
  animation: slow-zoom 24s ease-out both;
}
@keyframes slow-zoom {
  from {
    transform: scale(1.08);
  }
}
.welcome-panel:after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgb(43 21 50 / 0) 30%,
    rgb(52 24 60 / 0.35) 55%,
    rgb(38 18 45 / 0.92)
  );
}
.welcome-text {
  position: absolute;
  inset: auto clamp(1.6rem, 3vw, 3rem) clamp(1.6rem, 3vw, 3rem);
  color: #fff8f2;
}
.welcome-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-content: center;
  margin-bottom: 1.1rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.35);
}
.welcome-text h1 {
  font-size: clamp(3.4rem, 5.6vw, 5.6rem);
  letter-spacing: -0.05em;
  line-height: 0.98;
  font-weight: 500;
}
.welcome-text em {
  font-weight: 400;
  color: #efd9f2;
}
.welcome-text p {
  max-width: 28rem;
  color: #f3e8ee;
  font-size: 1.02rem;
  margin-top: 1.1rem;
}
.auth-box {
  max-width: 420px;
  width: 100%;
  padding: 0.5rem 0;
}
.auth-box h2 {
  font-size: clamp(2.5rem, 3.6vw, 3.4rem);
  letter-spacing: -0.045em;
  margin-bottom: 0.6rem;
}
.auth-box .eyebrow {
  margin-bottom: 1rem;
}
.auth-box > p {
  max-width: 35ch;
}
.auth-box .form {
  margin-top: 1.7rem;
}
.switch {
  border-top: 1px solid var(--line);
  padding-top: 1.05rem;
  margin-top: 1.25rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.switch .text-button {
  padding-left: 0.15rem;
}

/* ——— Forms ——— */
.form label:not(.choice):not(.check-label) {
  display: grid;
  gap: 0.4rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
}
input:not([type='checkbox'], [type='radio']),
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 450;
  line-height: 1.4;
  transition:
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}
input::placeholder,
textarea::placeholder {
  color: #8a7d8c;
  opacity: 1;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--plum);
  box-shadow: 0 0 0 4px rgb(109 61 123 / 0.12);
  outline: none;
}
input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--plum);
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
}
textarea {
  resize: vertical;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236d3d7b' stroke-width='1.6'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 16px;
  padding-right: 2.4rem;
}
input[type='file'] {
  font-size: 0.9rem;
}
input::file-selector-button {
  margin-right: 0.6rem;
  border: 0;
  background: var(--plum-soft);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  color: var(--plum-deep);
  font-weight: 600;
}
.form label small {
  font-weight: 400;
  color: var(--muted);
}
.forgot {
  justify-self: end;
  margin-top: -0.5rem;
}
.feedback {
  background: #fbe9e3;
  color: #8a3a2a;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  border: 1px solid #f1cfc2;
}
.setup,
.workspace {
  max-width: 1320px;
  padding: clamp(1.1rem, 2.4vw, 2.2rem) clamp(1rem, 4.5vw, 4rem) 3rem;
  margin: auto;
}
.workspace.enter,
.setup,
.auth-shell {
  animation: rise 0.45s var(--ease) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.setup {
  max-width: 1120px;
}
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.8fr);
  align-items: start;
  gap: 1.5rem;
  margin-top: 1.75rem;
}
.setup-grid h2 + .form,
.join-panel p + .form {
  margin-top: 1rem;
}
.join-panel .round-icon {
  margin-bottom: 0.72rem;
}
.form fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-inline-size: 0;
}
.form legend {
  font-weight: 650;
  margin-bottom: 0.45rem;
}
.setup-rooms {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.setup-room + details {
  border-top: 1px solid var(--line);
}
.setup-room summary {
  cursor: pointer;
  display: list-item;
  list-style-position: inside;
  padding: 0.8rem;
  font-weight: 650;
}
.setup-room summary svg {
  margin: 0 0.45rem 0 0.2rem;
  color: var(--plum);
}
.setup-room > .check-label,
.setup-tasks {
  margin: 0 0.8rem 0.75rem 1.5rem;
}
.setup-tasks {
  display: grid;
  gap: 0.5rem;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
  font-size: 0.93rem;
}
.setup-tasks label:has(input:disabled) {
  opacity: 0.5;
}

/* ——— Page intro ——— */
.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(0.9rem, 1.8vw, 1.4rem);
}
.page-intro > div {
  min-width: 0;
}
.home-title {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  letter-spacing: -0.045em;
  line-height: 1.08;
}
.home-title span {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.55em;
  letter-spacing: -0.01em;
  font-family: var(--sans);
  font-weight: 500;
  vertical-align: 0.35em;
}

/* ——— Weekly hero ——— */
.week-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.25fr);
  border-radius: 26px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  margin-bottom: clamp(0.9rem, 1.8vw, 1.4rem);
}
.week-hero-img {
  min-height: 160px;
  background-position: center 45%;
}
.week-hero-goal {
  position: relative;
  padding: clamp(1rem, 1.8vw, 1.4rem) clamp(1.1rem, 2vw, 1.6rem);
  color: #fff8f2;
  background:
    radial-gradient(120% 90% at 100% 0, rgb(170 112 186 / 0.45), transparent 60%),
    linear-gradient(160deg, #5a2f68, var(--plum-deep) 70%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.week-hero-goal .eyebrow {
  color: #e9cfee;
  margin-bottom: 0.3rem;
}
.big-score {
  font-size: clamp(2.6rem, 3.6vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.06em;
  font-variant-numeric: lining-nums;
}
.big-score span {
  color: rgb(255 248 242 / 0.6);
  font-size: 0.55em;
  margin-left: 0.2em;
}
.hero-caption {
  font-size: 0.92rem;
  color: rgb(255 248 242 / 0.78);
}
progress {
  width: 100%;
  height: 6px;
  display: block;
  appearance: none;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--plum-soft);
  margin-top: 0.7rem;
}
progress::-webkit-progress-bar {
  background: var(--plum-soft);
}
progress::-webkit-progress-value {
  background: linear-gradient(90deg, #8c9a4c, var(--leaf));
  border-radius: 20px;
  transition: width 0.6s var(--ease);
}
progress::-moz-progress-bar {
  background: var(--leaf);
}
.week-hero-goal progress,
.week-hero-goal progress::-webkit-progress-bar {
  background: rgb(255 255 255 / 0.16);
}
.week-hero-goal progress::-webkit-progress-value {
  background: linear-gradient(90deg, #c7d08a, #e2e7b4);
}
.week-hero-goal progress::-moz-progress-bar {
  background: #d4dc9c;
}
.today-summary {
  padding: clamp(0.9rem, 1.6vw, 1.3rem) clamp(1.1rem, 2vw, 1.6rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}
.today-summary h2 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.today-person {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    'avatar name total'
    'avatar bar bar';
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  padding: 0.4rem 0;
}
.today-person + .today-person {
  border-top: 1px solid var(--line);
}
.today-person .avatar {
  grid-area: avatar;
}
.person-name {
  grid-area: name;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.week-total {
  grid-area: total;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.week-total strong {
  font-variant-numeric: tabular-nums;
}
.week-total small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 5.2em;
  text-align: right;
}
.person-bar {
  grid-area: bar;
  height: 5px;
  border-radius: 9px;
  background: var(--paper-2);
  overflow: hidden;
}
.person-bar i {
  display: block;
  height: 100%;
  border-radius: 9px;
  background: var(--plum);
  transition: width 0.6s var(--ease);
}
.tone-bar-1 i {
  background: #c98463;
}

/* ——— Rooms and tasks ——— */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(260px, 0.75fr);
  gap: clamp(1.25rem, 2.4vw, 2.2rem);
  align-items: start;
}
.room-stack,
.side-stack {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}
.side-stack {
  position: sticky;
  top: 96px;
}
.room {
  padding: 0 clamp(0.85rem, 1.4vw, 1.2rem);
  transition:
    box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.room:hover {
  border-color: var(--line-strong);
}
.room[open] {
  box-shadow: var(--shadow-md);
}
.room-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}
.room-head::-webkit-details-marker {
  display: none;
}
.room-head h2 {
  font-size: clamp(1.1rem, 1.4vw, 1.3rem);
  min-width: 0;
  overflow-wrap: anywhere;
}
.room-progress {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--sans);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-variant-numeric: tabular-nums;
}
.room-chevron {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--plum);
  background: var(--plum-tint);
  transform: rotate(90deg);
  transition: transform 0.25s var(--ease);
}
.room[open] .room-chevron {
  transform: rotate(-90deg);
}
.room:not([open]) .room-head {
  border-bottom: 0;
}
/* The room's edit button sits in the header row beside the chevron instead of a row of its own. */
.room {
  position: relative;
}
.room-actions {
  position: absolute;
  top: 10px;
  right: calc(clamp(0.85rem, 1.4vw, 1.2rem) + 34px);
}
.room[open] .room-head h2 {
  margin-right: 0;
}
.room[open] .room-chevron {
  margin-left: auto;
}
.room[open] .room-head .room-progress {
  margin-right: 46px;
}
.room-head > .icon-button {
  margin-left: auto;
}
.room-symbol,
.round-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  color: var(--plum);
  background: var(--plum-soft);
}
.round-icon {
  border-radius: 50%;
}
.tone-1 {
  background: var(--peach);
  color: #8a4b2d;
}
.tone-2 {
  background: var(--leaf-soft);
  color: #56622c;
}
.tone-3 {
  background: #e6ecef;
  color: #3f5c68;
}
.task-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 52px;
  padding: 0.35rem 0;
  border-bottom: 1px solid #efe8ea;
}
.task-row:last-child {
  border-bottom: 0;
}
.task-check {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #c8b8cc;
  border-radius: 50%;
  background: #fff;
  flex: none;
  padding: 0;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    transform 0.12s var(--ease);
}
.task-check:hover:not(:disabled) {
  background: var(--plum-tint);
  border-color: var(--plum);
}
.task-check:active:not(:disabled) {
  transform: scale(0.9);
}
.task-check.checked {
  background: var(--leaf);
  border-color: var(--leaf);
  color: white;
}
.task-check.checked:hover:not(:disabled) {
  background: #56622f;
  border-color: #56622f;
}
.task-check[data-action='split'] {
  background: #fff;
  border: 2px dashed var(--leaf);
  color: var(--leaf);
}
.task-check[data-action='leave-split'] {
  box-shadow: 0 0 0 3px var(--leaf-soft);
}
.task-check:disabled {
  opacity: 0.85;
}
.task-title {
  flex: 1;
  min-width: 0;
}
.task-title strong,
.task-title > span {
  display: block;
  overflow-wrap: anywhere;
}
.task-title strong {
  font-weight: 620;
  font-size: 0.95rem;
}
.task-title > span {
  color: var(--muted);
  font-size: 0.8rem;
}
.task-title span b {
  font-weight: 400;
  padding: 0 0.15rem;
}
.task-row.done .task-title strong {
  color: var(--muted);
}
.counter {
  background: var(--paper-2);
  border-radius: 999px;
  min-width: 44px;
  text-align: center;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  color: var(--muted);
}
.task-row.done .counter {
  color: #4f5b26;
  background: var(--leaf-soft);
}
.add-line {
  min-height: 42px;
}
.room-empty {
  padding: 0.8rem 0;
  color: var(--muted);
}

/* ——— Side cards and activity ——— */
.summary-content,
.feed {
  padding: 1rem 1.2rem;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.section-title > svg {
  color: var(--plum);
}
.feed .section-title h2,
.invite-card h2 {
  font-size: 1.2rem;
}
.invite-card {
  background:
    radial-gradient(120% 100% at 100% 0, var(--plum-soft), transparent 60%),
    var(--card);
}
.invite-card .round-icon {
  margin-bottom: 0.7rem;
}
.invite-card p,
.empty p {
  font-size: 0.94rem;
  color: var(--muted);
  margin-top: 0.45rem;
}
.event {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.event:last-of-type {
  border-bottom: 0;
}
.event > div {
  min-width: 0;
}
.event p {
  font-size: 0.92rem;
  color: var(--muted);
}
.event p strong {
  color: var(--ink);
}
.event-name {
  display: block;
  font-weight: 650;
  font-size: 1rem;
  margin: 0.08rem 0;
}
.event small,
.stat-person small {
  display: block;
  color: var(--muted);
}
.event small {
  font-size: 0.79rem;
}
.event-list {
  max-width: 760px;
  padding-block: 0.4rem;
}
.feed > a,
.profile-grid a {
  margin-top: 0.75rem;
}
.empty {
  padding: 0.8rem 0;
}
.empty .round-icon {
  height: 34px;
  width: 34px;
  color: var(--bronze);
  background: var(--peach);
}
.thank,
.thanked {
  color: var(--bronze);
  font-weight: 650;
  font-size: 0.84rem;
}
.thank {
  background: var(--peach);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin-top: 0.45rem;
  transition:
    background 0.18s var(--ease),
    transform 0.12s var(--ease);
}
.thank:hover {
  background: #f2d6c5;
}
.thank:active {
  transform: scale(0.96);
}
.thanked {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.thanked svg {
  fill: #d98a68;
  stroke: #d98a68;
}
.undo {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
  font-weight: 500;
}

/* ——— Pills ——— */
.filters,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.filters {
  margin: 0 0 1.3rem;
}
.filters button,
.segmented button {
  background: rgb(255 253 250 / 0.7);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease);
}
.filters button:hover,
.segmented button:hover {
  color: var(--plum-deep);
  background: var(--plum-tint);
}
.filters [aria-pressed='true'],
.segmented [aria-pressed='true'],
.filters [aria-pressed='true']:hover,
.segmented [aria-pressed='true']:hover {
  color: #fff;
  background: var(--plum-deep);
  border-color: var(--plum-deep);
}

/* ——— Statistics ——— */
.stats-panel {
  max-width: 760px;
}
.stat-total {
  margin-top: 1.6rem;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--muted);
}
.stat-total strong {
  font-size: clamp(2.8rem, 5vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  color: var(--plum-deep);
}
.split-bar {
  display: flex;
  overflow: hidden;
  height: 16px;
  background: var(--paper-2);
  border-radius: 14px;
  margin: 1.3rem 0 0.6rem;
  gap: 3px;
}
.split-bar i {
  transition: width 0.6s var(--ease);
}
.fill-0 {
  background: linear-gradient(90deg, #8b54a0, var(--plum));
  border-radius: 14px;
}
.fill-1 {
  background: linear-gradient(90deg, #d99777, #c47a57);
  border-radius: 14px;
}
.stat-person {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.stat-person:last-child {
  border-bottom: 0;
}
.stat-person > b {
  margin-left: auto;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.hint {
  font-size: 0.89rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 0.85rem;
}
.hint svg {
  margin-right: 0.25rem;
  color: var(--plum);
}

/* ——— Quizzes ——— */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 0.7rem;
}
.quiz-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.05rem;
  min-height: 148px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: left;
  overflow: hidden;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.quiz-card::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--plum-tint);
  z-index: 0;
  transition: transform 0.35s var(--ease);
}
.quiz-card > * {
  position: relative;
  z-index: 1;
}
.quiz-card:has(.tone-1)::after {
  background: #fbf0e8;
}
.quiz-card:has(.tone-2)::after {
  background: #f2f4e6;
}
.quiz-card:has(.tone-3)::after {
  background: #eef3f5;
}
.quiz-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.quiz-card:hover::after {
  transform: scale(1.25);
}
.answer-link:hover {
  background: var(--plum-tint);
}
.quiz-category {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.35rem;
}
.quiz-card strong {
  font-size: 1.22rem;
  letter-spacing: -0.035em;
  line-height: 1.12;
}
.quiz-card small {
  color: var(--muted);
}
.quiz-progress {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: auto;
}
.quiz-meter {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: var(--paper-2);
  overflow: hidden;
  margin-bottom: 0.45rem;
}
.quiz-meter i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--plum);
}
.quiz-card.complete .quiz-meter i {
  background: var(--leaf);
}
.quiz-card.complete .quiz-progress > small:first-of-type {
  color: #56622c;
  font-weight: 650;
}
.quiz-card small.quiz-other {
  color: var(--plum);
  font-weight: 650;
}
.others-answers {
  margin-top: 0.8rem;
  padding: 0.75rem 0.95rem;
  background: var(--plum-tint);
  border: 1px solid var(--plum-soft);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  animation: rise 0.3s var(--ease) both;
}
.others-answers strong {
  color: var(--plum-deep);
}
.others-answers p + p {
  margin-top: 0.35rem;
}
.others-locked {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.others-locked::before {
  content: '';
  width: 14px;
  height: 14px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='4' y='10' width='16' height='11' rx='3'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='4' y='10' width='16' height='11' rx='3'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.housemate-answers {
  margin-bottom: 1.4rem;
  padding: 0 1.3rem;
  background:
    linear-gradient(100deg, var(--plum-tint), transparent 55%),
    var(--card);
}
.housemate-answers > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--plum-deep);
}
.housemate-answers > summary::-webkit-details-marker {
  display: none;
}
.housemate-answers > summary span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.housemate-answers > summary small {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.housemate-body {
  padding-bottom: 0.6rem;
}
.answer-group {
  border-top: 1px solid var(--line);
}
.answer-group summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.8rem 0;
  cursor: pointer;
}
.answer-group summary small {
  color: var(--muted);
}
.answer-group[open] summary {
  margin-bottom: 0.4rem;
}

/* ——— Profiles ——— */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.4fr);
  gap: 1.25rem;
  align-items: start;
  max-width: 1040px;
}
.profile-card {
  text-align: center;
  background:
    linear-gradient(180deg, var(--plum-soft) 0, var(--plum-soft) 70px, var(--card) 70px);
}
.profile-card .avatar.large {
  margin-top: 0.6rem;
}
.profile-card hr {
  margin: 1.2rem 0;
}
.profile-card h3,
.profile-card .pre-wrap {
  text-align: left;
}
.profile-card h2 {
  margin: 0.7rem 0 0.1rem;
}
.profile-card h3 {
  margin-bottom: 0.5rem;
}
.friend,
.answer-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0.75rem 0.4rem;
  width: 100%;
  text-align: left;
  border-radius: 8px;
}
.friend:last-child,
.answer-link:last-child {
  border-bottom: 0;
}
.friend p {
  color: var(--muted);
  font-size: 0.94rem;
}
.answer-link {
  font-size: 0.95rem;
  font-weight: 550;
}
.answer-link svg {
  color: var(--plum);
}

/* ——— Sheets ——— */
dialog {
  padding: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 24px;
  max-width: min(580px, calc(100vw - 1.5rem));
  width: 100%;
  max-height: 88dvh;
  color: var(--ink);
  box-shadow: 0 30px 80px rgb(43 31 46 / 0.3);
}
dialog[open] {
  animation: sheet-in 0.32s var(--ease);
}
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}
dialog::backdrop {
  background: rgb(36 20 42 / 0.55);
  backdrop-filter: blur(3px);
}
.sheet-top {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  justify-content: space-between;
  background: rgb(255 253 250 / 0.92);
  backdrop-filter: blur(10px);
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--line);
}
.sheet-top h2 {
  font-size: 1.6rem;
  overflow-wrap: anywhere;
}
.sheet-body {
  padding: 1.25rem 1.4rem 1.5rem;
}
.form-footer,
.form-split {
  display: flex;
  gap: 0.7rem;
}
.form-footer {
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.5rem;
}
.form-split > label {
  flex: 1;
  min-width: 0;
}
.action-stack {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.manage-group {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.manage-group .section-title {
  margin: 0;
}
.manage-group h3 small {
  color: var(--muted);
  font-weight: 400;
}
.invite-code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--plum-deep);
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, rgb(109 61 123 / 0.04) 10px 20px),
    var(--plum-tint);
  border: 1.5px dashed #cdb4d3;
  border-radius: 16px;
  text-align: center;
  margin: 1.15rem 0;
  padding: 1rem;
}
.account-detail {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.danger {
  color: var(--bronze);
}
.quiz-form fieldset,
.readonly-answer {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.15rem;
  padding-bottom: 1.15rem;
}
.quiz-form legend {
  font-size: 1rem;
}
.question-index {
  color: var(--plum);
}
.choice-options,
.image-options {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.45rem;
}
.image-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    transform 0.12s var(--ease);
}
.choice:hover {
  border-color: var(--line-strong);
}
.choice:active {
  transform: scale(0.99);
}
.choice:has(:checked) {
  border-color: var(--plum);
  background: var(--plum-tint);
  box-shadow: 0 0 0 3px rgb(109 61 123 / 0.1);
}
.image-options .choice {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}
.image-options img {
  width: 100%;
  aspect-ratio: 1.4;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.image-options .choice:hover img {
  transform: scale(1.03);
}
.image-options input {
  position: absolute;
  z-index: 1;
  top: 0.55rem;
  left: 0.55rem;
  box-shadow: 0 0 0 3px white;
  border-radius: 50%;
}
.image-options .choice span {
  padding: 0.55rem 0.7rem;
  font-weight: 550;
}
.readonly-answer > p {
  margin-top: 0.35rem;
  color: var(--muted);
}

/* ——— Toast ——— */
#notice {
  position: fixed;
  z-index: 99;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 1rem);
  padding: 0.8rem 1.15rem;
  border-radius: 999px;
  background: var(--plum-deep);
  color: white;
  width: max-content;
  max-width: calc(100% - 2rem);
  font-size: 0.94rem;
  font-weight: 550;
  box-shadow: 0 12px 30px rgb(43 31 46 / 0.3);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.22s var(--ease),
    transform 0.22s var(--ease);
}
#notice.shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ——— Tablet ——— */
@media (max-width: 1080px) {
  .week-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  }
  .week-hero-img {
    display: none;
  }
}
@media (max-width: 940px) {
  .head-inner {
    padding-inline: 1.5rem;
  }
  .nav-link {
    padding: 0.5rem 0.7rem;
  }
  .auth-shell {
    gap: 2.5rem;
    padding-inline: 1.5rem;
  }
  .welcome-panel {
    min-height: 500px;
  }
  .workspace {
    padding-inline: 1.5rem;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .side-stack {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

/* ——— Phone: app-like bottom tab bar ——— */
@media (max-width: 740px) {
  body {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
  /* A backdrop filter here would make the header the containing block of the fixed tab bar. */
  .top {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgb(247 243 238 / 0.97);
  }
  .head-inner {
    padding: 0 1rem;
    min-height: 60px;
    gap: 0;
    justify-content: space-between;
  }
  .brand {
    font-size: 1.55rem;
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .main-nav {
    position: fixed;
    z-index: 30;
    left: 0.6rem;
    right: 0.6rem;
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
    justify-content: space-around;
    gap: 0;
    padding: 0.35rem;
    border-radius: 24px;
    background: rgb(255 253 250 / 0.88);
    backdrop-filter: saturate(1.5) blur(18px);
    -webkit-backdrop-filter: saturate(1.5) blur(18px);
    border: 1px solid rgb(211 198 204 / 0.7);
    box-shadow: 0 10px 34px rgb(43 31 46 / 0.16);
  }
  .nav-link {
    flex: 1;
    flex-direction: column;
    gap: 0.12rem;
    min-height: 54px;
    padding: 0.35rem 0.2rem;
    font-size: 0.7rem;
    border-radius: 18px;
  }
  .nav-link svg {
    width: 21px;
    height: 21px;
  }
  .nav-link.active {
    color: var(--plum-deep);
    background: var(--plum-soft);
    box-shadow: none;
  }
  #notice {
    bottom: calc(5.6rem + env(safe-area-inset-bottom));
  }
  .auth-shell {
    padding: 0 1rem 2rem;
    gap: 1.6rem;
    grid-template-columns: 1fr;
    margin: 1rem auto;
    max-width: 560px;
  }
  .welcome-panel {
    min-height: 240px;
    height: clamp(240px, 36vh, 340px);
    border-radius: 22px;
  }
  .welcome-text {
    inset: auto 1.25rem 1.15rem;
  }
  .welcome-text h1 {
    font-size: clamp(2.5rem, 10vw, 3.4rem);
  }
  .welcome-text h1 br {
    display: none;
  }
  .welcome-text h1 em:before {
    content: ' ';
  }
  .welcome-mark {
    display: none;
  }
  .welcome-text p {
    margin-top: 0.42rem;
    max-width: 31ch;
    font-size: 0.9rem;
  }
  .auth-box {
    max-width: none;
  }
  .auth-box .eyebrow {
    display: none;
  }
  .auth-box h2 {
    font-size: 2.4rem;
  }
  .auth-box .form {
    margin-top: 1.1rem;
  }
  .workspace,
  .setup {
    padding: 0.9rem 0.8rem 1.5rem;
  }
  .page-intro {
    align-items: flex-end;
    gap: 0.6rem;
  }
  .page-intro .eyebrow {
    margin-bottom: 0.3rem;
  }
  .page-intro > button {
    flex: none;
    font-size: 0.8rem;
    min-height: 34px;
    padding: 0.35rem 0.75rem;
  }
  .page-intro > button svg {
    width: 15px;
  }
  .week-hero {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }
  .week-hero-goal {
    padding: 0.85rem 1rem 0.95rem;
  }
  .big-score {
    font-size: 2.5rem;
  }
  .today-summary {
    padding: 0.7rem 1rem 0.75rem;
  }
  .today-summary h2 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
  }
  .home-grid,
  .setup-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .side-stack {
    grid-template-columns: 1fr;
  }
  .room-head {
    min-height: 50px;
  }
  .page-intro {
    margin-bottom: 0.8rem;
  }
  .task-row {
    gap: 0.65rem;
  }
  .setup-grid {
    gap: 1rem;
  }
  .form-split {
    flex-wrap: wrap;
  }
  .form-split > label {
    min-width: 120px;
  }
  /* Sheets rise from the bottom edge like native sheets. */
  dialog {
    margin: auto 0 0;
    max-width: 100vw;
    width: 100vw;
    max-height: 92dvh;
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog[open] {
    animation: sheet-up 0.36s var(--ease);
  }
  @keyframes sheet-up {
    from {
      transform: translateY(40%);
      opacity: 0.4;
    }
  }
  .sheet-top::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 4px;
    background: var(--line-strong);
  }
}
@media (max-width: 460px) {
  .page-intro {
    flex-wrap: wrap;
  }
  .task-row {
    gap: 0.5rem;
  }
  .task-title strong {
    font-size: 0.95rem;
  }
  .task-title > span {
    font-size: 0.8rem;
  }
  .task-row > .icon-button {
    width: 30px;
  }
  .quiz-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .quiz-card {
    padding: 0.8rem;
    min-height: 136px;
  }
  .quiz-card strong {
    font-size: 1.08rem;
  }
  .room-progress {
    padding: 0.12rem 0.45rem;
  }
  .sheet-body,
  .sheet-top {
    padding-inline: 1.1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ——— Läheiset map (web/circle.mjs), after Compass's Map canvas ——— */
.close-people .close-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0 1rem;
}
.close-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--plum-tint);
  border: 1px solid var(--plum-soft);
  font-size: 0.88rem;
  color: var(--muted);
}
.close-group b {
  color: var(--plum-deep);
  font-weight: 650;
}
body.circle-open {
  overflow: hidden;
}
.cv {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  background-color: var(--paper);
  background-image: radial-gradient(circle, rgb(109 61 123 / 0.22) 1px, transparent 1.3px);
  animation: rise 0.3s var(--ease) both;
}
.cv.is-panning,
.cv.is-dragging {
  cursor: grabbing;
}
.cv-world {
  position: absolute;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}
.cv-lines {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.cv-edge path {
  fill: none;
  stroke-linecap: round;
}
.cv-edge-base {
  stroke: color-mix(in srgb, var(--branch) 34%, var(--line));
  stroke-width: 2.4;
}
.cv-edge-flow {
  stroke: color-mix(in srgb, var(--branch) 75%, white);
  stroke-width: 2.2;
  stroke-dasharray: 2 14;
  animation: cv-flow 1.6s linear infinite;
  opacity: 0.9;
}
.cv-edge.is-child .cv-edge-base {
  stroke-dasharray: 5 6;
}
.cv-edge-end {
  fill: var(--card);
  stroke: color-mix(in srgb, var(--branch) 60%, var(--line));
  stroke-width: 2;
}
.cv-edge.is-lit .cv-edge-base {
  stroke: var(--branch);
  stroke-width: 3;
}
@keyframes cv-flow {
  to {
    stroke-dashoffset: -32;
  }
}
.cv-card {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--branch) 22%, var(--line));
  box-shadow: 0 1px 2px rgb(43 31 46 / 0.05), 0 8px 22px rgb(43 31 46 / 0.07);
  cursor: grab;
  outline: none;
  transition:
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}
.cv-card-inner {
  padding: 0.75rem 0.9rem;
}
/* Cards pop in only when the map opens, not on every redraw. */
.cv.is-entering .cv-card-inner {
  animation: cv-in 0.4s var(--ease) both;
  animation-delay: calc(var(--order) * 18ms);
}
@keyframes cv-in {
  from {
    opacity: 0;
    scale: 0.94;
  }
}
.cv-card:hover {
  border-color: color-mix(in srgb, var(--branch) 50%, var(--line));
}
.cv-card:focus-visible,
.cv-card.is-selected {
  border-color: var(--branch);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--branch) 22%, transparent),
    0 12px 30px rgb(43 31 46 / 0.12);
}
.cv-card.is-dragging {
  cursor: grabbing;
  box-shadow: 0 18px 40px rgb(43 31 46 / 0.2);
  z-index: 2;
}
.cv-card.is-faded {
  opacity: 0.3;
}
.cv-card.is-focused {
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--branch) 35%, transparent),
    0 12px 30px rgb(43 31 46 / 0.14);
}
.cv-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.cv-text {
  min-width: 0;
}
.cv-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font: 600 1.05rem var(--serif);
  color: var(--branch);
  background: color-mix(in srgb, var(--branch) 14%, white);
}
.cv-kind {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--branch) 80%, var(--muted));
}
.cv-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.cv-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.cv-mark {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--branch);
}
.cv-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.15rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0;
  background: color-mix(in srgb, var(--branch) 12%, white);
  color: var(--branch);
}
.k-root {
  background: linear-gradient(160deg, #5a2f68, var(--plum-deep));
  border-color: transparent;
  color: #fff8f2;
}
.k-root .cv-kind,
.k-root .cv-meta {
  color: rgb(255 248 242 / 0.75);
}
.k-root .cv-avatar {
  background: rgb(255 255 255 / 0.16);
  color: #fff8f2;
}
.k-root .cv-name {
  font-size: 1.3rem;
}
.k-group {
  background: color-mix(in srgb, var(--branch) 7%, var(--card));
}
.k-group .cv-name {
  font-size: 1.25rem;
}
.k-child .cv-card-inner {
  padding: 0.55rem 0.75rem;
}
.k-child .cv-avatar {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}
.k-child .cv-name {
  font-size: 1rem;
}
.cv-fold {
  position: absolute;
  right: -13px;
  top: 50%;
  translate: 0 -50%;
  min-width: 26px;
  height: 26px;
  padding: 0 0.35rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--branch) 35%, var(--line));
  background: var(--card);
  color: var(--branch);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgb(43 31 46 / 0.1);
}
.cv-fold.is-folded {
  background: var(--branch);
  color: white;
}
.cv-top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: max(0.9rem, env(safe-area-inset-top)) 1.1rem 1rem;
  background: linear-gradient(180deg, var(--paper) 55%, rgb(247 243 238 / 0));
  pointer-events: none;
  cursor: default;
}
.cv-top > * {
  pointer-events: auto;
}
.cv-title-block .eyebrow {
  margin-bottom: 0.2rem;
}
.cv-title-block h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}
.cv-counts {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 0.15rem;
}
.cv-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
}
.cv-search {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  height: 38px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--muted);
}
.cv-search input {
  border: 0;
  padding: 0;
  width: 9rem;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
}
.cv-search input:focus {
  box-shadow: none;
}
.cv-search-count {
  font-size: 0.75rem;
  white-space: nowrap;
}
.cv-group {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  overflow: hidden;
}
.cv-group button,
.cv-button,
.cv-close {
  height: 36px;
  min-width: 36px;
  border: 0;
  background: transparent;
  font-weight: 650;
  font-size: 0.86rem;
  color: var(--plum-deep);
}
.cv-group button:hover,
.cv-button:hover,
.cv-close:hover {
  background: var(--plum-tint);
}
.cv-zoom-label {
  min-width: 52px !important;
  font-variant-numeric: tabular-nums;
}
.cv-button {
  padding: 0 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
}
.cv-close {
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  height: 38px;
  width: 38px;
}
.cv-hint {
  position: absolute;
  left: 50%;
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  translate: -50% 0;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgb(255 253 250 / 0.85);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}
.cv-panel {
  position: absolute;
  top: 4.4rem;
  right: 0.8rem;
  bottom: 0.8rem;
  width: min(380px, calc(100vw - 1.6rem));
  overflow-y: auto;
  padding: 1rem 1.2rem 1.3rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--branch);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgb(43 31 46 / 0.2);
  cursor: default;
  user-select: text;
  -webkit-user-select: text;
  touch-action: pan-y;
  animation: cv-panel-in 0.28s var(--ease);
}
@keyframes cv-panel-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
.cv.has-panel .cv-hint {
  display: none;
}
.cv-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.cv-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.cv-crumbs .cv-chip {
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
}
.cv-panel-kind {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--branch);
}
.cv-panel-title {
  font-size: 1.9rem;
  margin-bottom: 0.7rem;
  overflow-wrap: anywhere;
}
.cv-facts {
  margin: 0;
  display: grid;
  gap: 0;
}
.cv-facts > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}
.cv-facts dt {
  font-size: 0.82rem;
  color: var(--muted);
}
.cv-facts dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.95rem;
}
.cv-chip {
  border: 1px solid color-mix(in srgb, var(--branch) 30%, var(--line));
  background: color-mix(in srgb, var(--branch) 7%, white);
  color: var(--plum-deep);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.86rem;
  font-weight: 600;
}
.cv-chip:hover {
  border-color: var(--branch);
}
.cv-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.1rem;
}
.cv-actions .button {
  min-height: 38px;
  padding: 0.4rem 0.85rem;
  font-size: 0.86rem;
}
.cv-actions .text-button {
  margin-left: auto;
}
.danger-fill {
  background: var(--bronze) !important;
  border-color: var(--bronze) !important;
}
.cv-confirm {
  margin-top: 1rem;
  font-weight: 600;
}
.cv-form {
  margin-top: 0.6rem;
  gap: 0.8rem;
}
.cv-pick {
  display: grid;
  gap: 0.35rem;
  max-height: 9.5rem;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
@media (max-width: 740px) {
  .cv-top {
    flex-direction: column;
    gap: 0.5rem;
    padding: max(0.7rem, env(safe-area-inset-top)) 0.8rem 0.8rem;
  }
  .cv-title-block h1 {
    font-size: 1.45rem;
  }
  .cv-tools {
    justify-content: flex-start;
  }
  .cv-search input {
    width: 6.5rem;
  }
  .cv-close {
    position: absolute;
    top: max(0.7rem, env(safe-area-inset-top));
    right: 0.8rem;
  }
  .cv-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 72dvh;
    border-radius: 24px 24px 0 0;
    padding-bottom: max(1.3rem, env(safe-area-inset-bottom));
    animation: sheet-up 0.32s var(--ease);
  }
  .cv-facts > div {
    grid-template-columns: 7rem 1fr;
  }
  .cv-hint {
    white-space: normal;
    width: max-content;
    max-width: calc(100% - 2rem);
    text-align: center;
  }
}
