/* Colours and sizes borrowed from LEGO CONNECT core tokens (brand colours, major-second type scale).
   Not real CONNECT components: the packages weren't reachable for this prototype. */
:root {
  --bright-red: rgb(221, 26, 34);
  --bright-orange: rgb(244, 125, 32);
  --bright-yellow: rgb(255, 212, 0);
  --bright-green: rgb(0, 175, 77);
  --bright-blue: rgb(0, 108, 183);

  --mood-1: var(--bright-red);
  --mood-2: var(--bright-orange);
  --mood-3: var(--bright-yellow);
  --mood-4: rgb(120, 200, 90); /* in-between green, not a CONNECT token */
  --mood-5: var(--bright-green);
  --mood-none: #d6d6d6;

  --content: #1b1b1b;
  --muted: #5e5e5e;
  --surface: #ffffff;
  --background: #f3f3f3;
  --stroke: #e2e2e2;
  --radius: 12px;

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: var(--content);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; }
h2 { font-size: 20px; margin: 0 0 8px; }
p { margin: 0 0 12px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); border-bottom: 1px solid var(--stroke);
  padding: 12px 16px 0;
}
.brand { font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 12px; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--content); border-bottom-color: var(--bright-blue); }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; border: 1px solid var(--stroke); }
.hero { text-align: center; }
.private { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.streak { font-size: 32px; font-weight: 700; margin-bottom: 4px; }

.btn {
  font: inherit; font-weight: 600; font-size: 16px; padding: 10px 18px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--bright-blue); background: var(--surface); color: var(--bright-blue);
}
.btn.primary { background: var(--bright-blue); color: #fff; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--bright-yellow); outline-offset: 2px; }

input:not([type="checkbox"]) {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #bdbdbd; border-radius: 8px; margin-top: 4px; background: #fff;
}
label { display: block; font-weight: 600; font-size: 14px; }
.stack > * { margin-bottom: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1 1 140px; margin-top: 0; }
.or { text-align: center; color: var(--muted); font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 4px 0 16px; cursor: pointer; }
.msg { min-height: 1.2em; font-size: 14px; color: var(--bright-blue); margin: 8px 0 0; }

/* ---------- the brick wall ---------- */
.wall { display: grid; grid-template-columns: 56px repeat(5, 1fr); gap: 6px; align-items: start; }
.head { font-size: 13px; color: var(--muted); text-align: center; }
.week { font-size: 12px; color: var(--muted); padding-top: 12px; }
.cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brick {
  position: relative; height: 40px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); margin-top: 6px;
}
.brick::before, .brick::after { /* two studs on top */
  content: ""; position: absolute; top: -6px; width: 26%; height: 7px; border-radius: 3px 3px 0 0; background: inherit;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3);
}
.brick::before { left: 14%; }
.brick::after { right: 14%; }
.brick.future { background: transparent; box-shadow: none; border: 2px dashed var(--stroke); }
.brick.future::before, .brick.future::after { display: none; }
.tag {
  font-size: 11px; font-weight: 600; color: #fff; background: var(--content); border-radius: 4px;
  padding: 1px 5px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m1 { background: var(--mood-1); } .m2 { background: var(--mood-2); } .m3 { background: var(--mood-3); }
.m4 { background: var(--mood-4); } .m5 { background: var(--mood-5); } .grey { background: var(--mood-none); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin-top: 16px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.patterns { margin: 0; padding-left: 20px; line-height: 1.5; }
.patterns li { margin-bottom: 6px; }

.bar { position: relative; height: 14px; background: #e8e8e8; border-radius: 7px; margin-bottom: 8px; }
.bar > div { height: 100%; width: 0; background: var(--bright-green); border-radius: 7px; transition: width .6s; }
.bar .target { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--content); border-radius: 2px; }

/* ---------- the surprise ping ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto;
}
.overlay[hidden] { display: none; }
.modal {
  position: relative; width: 100%; max-width: 800px; background: var(--surface); border-radius: 18px; padding: 24px 20px 20px;
  text-align: center; animation: pop .35s ease-out; margin: auto; /* auto margin: centred, but scrollable from the top on tiny screens */
}
.close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.wild { font-weight: 700; color: var(--bright-blue); margin-bottom: 12px; }
.gift {
  height: clamp(200px, calc(100vh - 340px), 420px); border-radius: 12px; background: #eeeeee; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.gift .box { font-size: 150px; animation: wobble 2.4s ease-in-out infinite; }
.gift.opening .box { animation: shake .6s ease-in-out; }
.gift.open { background: #fff4c2; }
.gift img { width: 100%; height: 100%; object-fit: contain; animation: pop .4s ease-out; }
.emoji-meme { font-size: 186px; animation: pop .4s ease-out; }
.cap { font-size: 14px; color: var(--muted); margin: 8px 0 16px; min-height: 1.4em; }
.q { font-weight: 700; font-size: 18px; }
.emo { display: flex; justify-content: space-between; gap: 4px; }
.emo button {
  flex: 1; border: 2px solid transparent; background: none; border-radius: 10px; padding: 6px 0; cursor: pointer; font: inherit;
}
.emo button:hover:not(:disabled) { border-color: var(--stroke); background: #fafafa; }
.emo button:disabled { opacity: .5; cursor: default; }
.emo .e { display: block; font-size: 34px; }
.emo small { font-size: 11px; color: var(--muted); }
.thanks { font-weight: 700; font-size: 18px; }

@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
@keyframes shake { 0% { transform: scale(1); } 30% { transform: scale(1.15) rotate(-10deg); } 60% { transform: scale(1.2) rotate(10deg); } 100% { transform: scale(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 420px) {
  .wall { grid-template-columns: 40px repeat(5, 1fr); gap: 4px; }
  .brick { font-size: 16px; height: 34px; }
}
.footer { text-align: center; margin: 8px 0 24px; }

/* ---------- week rows and clickable bricks ---------- */
.week b { display: block; font-weight: 600; color: var(--content); }
.week small { display: block; font-size: 11px; }
button.brick { border: 0; padding: 0; width: 100%; font: inherit; font-size: 20px; color: inherit; cursor: pointer; }
button.brick:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- one day, up close ---------- */
.modal.day { max-width: 560px; min-width: 0; text-align: left; }
.day-title { font-weight: 700; font-size: 18px; margin: 0 32px 8px 0; }
.day-events { display: flex; flex-wrap: wrap; gap: 6px; }
.day-events .tag { font-size: 12px; padding: 2px 8px; }
.day-avg { display: flex; align-items: baseline; gap: 10px; margin: 12px 0 0; }
.big { font-size: 48px; font-weight: 700; line-height: 1; }
.day h3 { font-size: 16px; margin: 20px 0 8px; }
.mix-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.mix-track { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.mix-bar { height: 20px; border-radius: 0 4px 4px 0; }
.mix-row:hover .mix-bar { filter: brightness(1.08); }
.mix-val { font-variant-numeric: tabular-nums; }
.week-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.week-chart .grid { stroke: var(--stroke); stroke-width: 1; }
.week-chart .tick { font-size: 14px; }
.week-chart .day { font-size: 12px; fill: var(--muted); }
.week-chart .day.sel { fill: var(--content); font-weight: 700; }
.week-chart .line { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.week-chart .dot { stroke: var(--surface); stroke-width: 2; }
.week-chart .hit { fill: transparent; }
.week-chart .pt { cursor: pointer; outline: none; }
.week-chart .pt:hover .dot, .week-chart .pt:focus-visible .dot { stroke: var(--content); }
.week-chart .val { font-size: 13px; font-weight: 700; fill: var(--content); }
.week-table { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.week-table b { color: var(--content); }
@media (max-width: 420px) {
  .wall { grid-template-columns: 48px repeat(5, 1fr); }
  .mix-row { grid-template-columns: 92px minmax(0, 1fr); }
}
