/* Layout: a feed of word posts, edge to edge on phones, with the category circles pinned under the top bar.
   A profile grid for your words.
   Palette "Cassette": cream label paper, charcoal shell, the classic marigold/tangerine/poppy label
   stripes and tape-reel teal. Word squares get J-card ruled lines and a stripe band; questions sit on
   a label-maker strip. Built for 40+ eyes: large type, big tap targets, strong contrast. */
:root {
  --bg: #f2ebdd;          /* label cream */
  --card: #fbf7ee;
  --text: #221e1c;        /* shell charcoal */
  --muted: #5e564e;
  --line: #ddd2bf;
  --soft: #ebe2d0;
  --accent: #221e1c;      /* shell charcoal: main buttons; red is kept for warnings only */
  --accent-text: #fbf7ee;
  --link: #1f6670;
  --good: #2d6e3a;
  --good-bg: #e0eed9;
  --bad: #b23a22;
  --bad-bg: #f8e1d8;
  --heart: #d2492a;
  /* The label stripes, and one colour per category */
  --s-marigold: #f2b53c;
  --s-tangerine: #e8833a;
  --s-poppy: #c8442c;
  --s-teal: #2d727a;
  --stripes: linear-gradient(to bottom,
      var(--s-marigold) 0 33.3%, var(--s-tangerine) 33.3% 66.6%, var(--s-poppy) 66.6% 100%);
  --g-word: var(--s-tangerine);
  --g-acronym: var(--s-poppy);
  --g-emoji: var(--s-marigold);
  --g-meme: var(--s-teal);
  --g-check: #5b3a29;     /* magnetic-tape brown */
  --g-mature: #3a3335;    /* charcoal plum */
  --g-political: #3d5a80; /* slate blue */
  --on-word: #221e1c;
  --on-acronym: #ffffff;
  --on-emoji: #221e1c;
  --on-meme: #ffffff;
  --on-check: #ffffff;
  --on-mature: #f2b53c;
  --on-political: #ffffff;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --bar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161417; --card: #201d21; --text: #f2ebdd; --muted: #b5ab9c; --line: #38323a; --soft: #2b272c;
    --accent: #f2ebdd; --accent-text: #221e1c; --link: #7cc3c9;
    --good: #8fcf8a; --good-bg: #1f2e1d; --bad: #f29680; --bad-bg: #3a211b; --heart: #f07a55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161417; --card: #201d21; --text: #f2ebdd; --muted: #b5ab9c; --line: #38323a; --soft: #2b272c;
  --accent: #f2ebdd; --accent-text: #221e1c; --link: #7cc3c9;
  --good: #8fcf8a; --good-bg: #1f2e1d; --bad: #f29680; --bad-bg: #3a211b; --heart: #f07a55;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* ---------- Top bar ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--card);
}
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 520px; margin: 0 auto; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.logo {
  font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.04em; color: var(--text);
  background: none; border: none; padding: 6px 0; min-height: 44px;
  position: relative; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.info-btn { display: grid; place-items: center; width: 40px; height: 40px; background: none; color: var(--muted); }
.info-btn .icon { width: 24px; height: 24px; }
.logo-dot { color: var(--s-tangerine); }
/* a little strip of label tape */
.beta-tag {
  position: absolute; right: -10px; bottom: -3px; padding: 1px 5px; transform: rotate(-4deg); line-height: 1.4;
  font-family: var(--body); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--s-marigold); color: #221e1c; border-radius: 2px;
}
.about-body .notify { margin-top: 4px; }


/* Outline icons */
.icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

.app {
  max-width: 520px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- Stories (category picker) ---------- */
/* Pinned under the top bar so the categories are always one tap away. */
.stories-wrap {
  position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 4;
  margin: 0 -2px; border-bottom: 1px solid var(--line); background: var(--card);
}
.stories {
  display: flex; gap: 10px; overflow-x: auto; padding: 10px 2px 8px;
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }
/* "There's more this way": a fade and an arrow on the right edge */
.stories-more {
  position: absolute; top: 0; right: 0; bottom: 0; width: 52px; padding: 0 0 18px 14px;
  border: none; font-size: 2rem; font-weight: 700; color: var(--text); cursor: pointer;
  background: linear-gradient(to right, transparent, var(--card) 55%);
}
.stories-more[hidden] { display: none; }
@media (max-width: 559px) {
  .stories-wrap {
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  }
  .stories {
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}
.story {
  flex: 0 0 auto; display: grid; justify-items: center; gap: 4px; min-width: 64px; max-width: 104px;
  background: none; border: none; padding: 0; position: relative;
}
.story-label { font-size: 0.8rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story[aria-pressed="true"] .story-label { color: var(--text); font-weight: 700; }
.story-count {
  position: absolute; top: 0; right: 2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--heart); color: #fff; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--card);
}

.avatar {
  display: grid; place-items: center; border-radius: 50%; flex: 0 0 auto;
  width: 40px; height: 40px; padding: 2px; background: var(--line);
}
.avatar > span {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); border: 2px solid var(--card); font-size: 1.05rem; font-weight: 800;
  font-family: var(--display), var(--emoji); line-height: 1;
}
/* Selected circles get a solid charcoal ring; post avatars get their category colour (set inline). */
.avatar.ring { background: var(--text); }
.avatar-story { width: 54px; height: 54px; padding: 2.5px; }
.avatar-story > span { font-size: 1.2rem; border-width: 2.5px; }
.avatar-lg { width: 86px; height: 86px; padding: 3px; }
.avatar-lg > span { font-size: 2.2rem; border-width: 3px; }
.avatar-btn { position: relative; padding: 0; border: none; background: none; border-radius: 50%; flex: 0 0 auto; }
.avatar-edit {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  padding: 2px 10px; border-radius: 999px; background: var(--text); color: var(--card);
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.icon-svg { display: grid; place-items: center; width: 100%; height: 100%; }
.icon-emoji { font-family: var(--emoji); line-height: 1; }
.avatar-lg .icon-emoji { font-size: 2.4rem; }
.icon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.icon-choice {
  display: grid; justify-items: center; gap: 6px; padding: 10px 4px; min-height: 96px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card);
}
.icon-choice[aria-pressed="true"] { border-color: var(--text); background: var(--soft); }
.icon-choice .icon-emoji { font-size: 2.1rem; }
.icon-choice .icon-svg { width: 48px; height: 40px; }
.icon-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.2; }
.cassette { width: 62%; height: auto; }
.icon-choice .cassette { width: 100%; }
.cassette .c-shell { fill: var(--text); }
.cassette .c-label { fill: var(--card); }
.cassette .c-s1 { fill: var(--s-marigold); }
.cassette .c-s2 { fill: var(--s-tangerine); }
.cassette .c-s3 { fill: var(--s-poppy); }
.cassette .c-window { fill: var(--text); }
.cassette .c-reel { fill: var(--card); }
.cassette .c-base { fill: none; stroke: var(--card); stroke-width: 2; stroke-linejoin: round; opacity: 0.5; }

/* ---------- Feed posts ---------- */
.feed { display: grid; gap: 0; }

.post {
  background: var(--card); border-bottom: 8px solid var(--bg); overflow: hidden;
  display: flex; flex-direction: column; min-width: 0;
  /* Leave room for the top bar and the pinned categories when scrolled into view. */
  scroll-margin-top: calc(56px + 88px + env(safe-area-inset-top, 0px));
}
/* Phones: posts run edge to edge, past the page gutter. */
@media (max-width: 559px) {
  .feed { margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px))); }
  .post-head, .quiz, .after { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}
/* Wider screens: posts sit as cards with breathing room. */
@media (min-width: 560px) {
  .feed { gap: 24px; padding-top: 20px; }
  .post { border: 1px solid var(--line); border-radius: 18px; }
  .feed { padding-bottom: 24px; }
}
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.post-who { display: grid; line-height: 1.25; min-width: 0; }
.post-who strong { font-size: 0.95rem; }
.post-who small { color: var(--muted); font-size: 0.85rem; }
.post-flag {
  margin-left: auto; font-size: 0.8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.post-flag.retry { background: var(--bad-bg); color: var(--bad); }

.media {
  /* Question, word and labels stack in order; the square grows to fit, so nothing overlaps on short screens. */
  position: relative; flex: 0 0 auto; min-height: clamp(220px, 32svh, 380px); max-width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; padding: 14px 20px 64px;
  color: var(--on);
  background:
    var(--stripes) left calc(100% - 22px) / 100% 24px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px),
    var(--g);
}
.media::after {
  /* thin cream gaps between the label stripes */
  content: ""; position: absolute; left: 0; right: 0; bottom: 22px; height: 24px; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 7px, rgb(255 250 240 / 0.85) 7px 8px);
}
.media, .tile { --rule: rgb(255 255 255 / 0.16); }
.media[data-kind="word"], .media[data-kind="emoji"], .tile[data-kind="word"], .tile[data-kind="emoji"] { --rule: rgb(0 0 0 / 0.08); }
.media[data-kind="word"] { --g: var(--g-word); --on: var(--on-word); }
.media[data-kind="acronym"] { --g: var(--g-acronym); --on: var(--on-acronym); }
.media[data-kind="emoji"] { --g: var(--g-emoji); --on: var(--on-emoji); }
.media[data-kind="meme"] { --g: var(--g-meme); --on: var(--on-meme); }
.media[data-kind="check"] { --g: var(--g-check); --on: var(--on-check); }
.media[data-kind="mature"] { --g: var(--g-mature); --on: var(--on-mature); }
.media[data-kind="political"] { --g: var(--g-political); --on: var(--on-political); }
.media-ask {
  /* A label-maker strip: dark tape, raised white capitals, stuck on slightly crooked */
  margin: 0; max-width: 100%; padding: 4px 10px 3px; border-radius: 3px;
  background: #221e1c; color: #f6f1e6;
  font-family: var(--body); font-size: clamp(0.72rem, 3.4vw, 0.85rem); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  white-space: nowrap; /* label tape never wraps */
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 1px 2px rgb(0 0 0 / 0.25);
  transform: rotate(-1deg);
}
.media-term {
  margin: auto 0; /* centered in the space left between the question and the labels */
  font-family: var(--display); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em;
  font-size: clamp(2.6rem, 13vw, 4.2rem); text-wrap: balance; overflow-wrap: anywhere;
  text-shadow: 3px 3px 0 var(--drop, rgb(0 0 0 / 0.25));
}
.media[data-kind="meme"] .media-term,
.media[data-kind="check"] .media-term { font-size: clamp(1.9rem, 8.5vw, 2.8rem); }
/* Check Yourself situations are full sentences: plain, readable text instead of a strip */
.media[data-kind="check"] .media-ask {
  padding: 0; background: none; box-shadow: none; transform: none; color: inherit;
  text-transform: none; letter-spacing: 0; font-weight: 400; font-style: italic; font-size: 1.05rem; line-height: 1.35;
  white-space: normal;
}
.media .media-term.is-emoji { font-family: var(--emoji); font-size: clamp(4rem, 22vw, 6.5rem); letter-spacing: 0; text-shadow: none; }
.media[data-kind="word"] .media-term { --drop: rgb(255 255 255 / 0.4); }
.media[data-kind="emoji"] .media-term { font-family: var(--emoji); font-size: clamp(4rem, 22vw, 6.5rem); letter-spacing: 0; text-shadow: none; }
.media-pills {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
}
.pill {
  background: rgb(0 0 0 / 0.55); color: #fff; padding: 6px 12px; border-radius: 999px;
  font-size: 0.9rem; line-height: 1.3; max-width: 100%;
}

/* The quiz: like a quiz sticker */
.quiz { display: grid; gap: 8px; padding: 14px 12px 4px; }
.option {
  display: flex; align-items: center; gap: 12px; text-align: left; min-height: 54px;
  padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card);
}
.option kbd {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); font-family: var(--display); font-weight: 800; font-size: 0.9rem; color: var(--muted);
}
.option:hover:not(:disabled) { border-color: var(--accent); }
.option:disabled { cursor: default; }
.option.correct { background: var(--good-bg); border-color: var(--good); }
.option.correct kbd { background: var(--good); color: var(--card); }
.option.wrong { background: var(--bad-bg); border-color: var(--bad); }
.option.wrong kbd { background: var(--bad); color: var(--card); }

/* After answering: actions + caption */
.after { display: grid; gap: 8px; padding: 8px 14px 16px; }
.actions { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.like { display: grid; color: var(--muted); }
.like .icon { width: 30px; height: 30px; }
.like.on { color: var(--heart); }
.like.on .icon { fill: currentColor; }
.verdict { font-weight: 700; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.caption { margin: 0; }
.crowd { margin: -4px 0 0; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.quiz-ask { margin: 0 0 2px; font-weight: 700; color: var(--muted); }
.why { margin: 0; }
.instead { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--good-bg); }
.instead strong { color: var(--good); }
.sheet-setup { margin: 0; color: var(--muted); font-style: italic; }
.caption strong { margin-right: 6px; }
.example { margin: 0; color: var(--muted); font-style: italic; }
.example::before { content: "\201C"; }
.example::after { content: "\201D"; }
.tags { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--link); font-weight: 700; font-size: 0.95rem; }
.more summary { cursor: pointer; color: var(--muted); font-weight: 700; list-style: none; min-height: 40px; display: flex; align-items: center; }
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { color: var(--text); }
.info-row { margin-top: 12px; }
.info-row h4 { margin: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.info-row p { margin: 2px 0 0; }

.caught-up { text-align: center; padding: 40px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; }
.goal-card { padding-block: 56px; scroll-margin-top: calc(56px + 88px + env(safe-area-inset-top, 0px)); }
/* This week's 5 */
.post-flag.week { background: var(--s-marigold); color: #221e1c; }
.week-tape {
  display: inline-block; padding: 4px 12px; transform: rotate(-2deg); border-radius: 2px;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--text); color: var(--bg);
}
.week-banner {
  display: grid; justify-items: start; gap: 8px; margin: 14px 0 4px; padding: 16px 18px;
  border-radius: 16px; background: var(--s-marigold); color: #221e1c;
}
.week-banner[hidden] { display: none; }
.week-banner .week-tape { background: #221e1c; color: #f2b53c; }
.week-banner-text { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.2rem; line-height: 1.25; }
.week-banner .btn.primary { background: #221e1c; color: #fbf7ee; border-color: #221e1c; }
.caught-up .week-grid { margin: 4px 0; font-size: 2rem; letter-spacing: 4px; color: inherit; }
.goal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.caught-up .check {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem;
  background: var(--accent); color: var(--accent-text);
}
.caught-up h3 { margin: 0; font-family: var(--display); font-size: 1.4rem; }
.caught-up p { margin: 0; color: var(--muted); }
.done-card { scroll-margin-top: calc(56px + 88px + env(safe-area-inset-top, 0px)); }
.notify { width: 100%; max-width: 420px; margin-top: 14px; padding: 16px; border: 2px dashed var(--line); border-radius: 14px; text-align: left; }
.notify-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.notify-label { font-weight: 700; }
.notify-row { display: flex; gap: 8px; }
.notify-row input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; font: inherit;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
}
.caught-up .notify-note { font-size: 0.85rem; }
.caught-up .notify-done { margin: 0; color: var(--text); font-weight: 700; text-align: center; }

.btn {
  min-height: 48px; padding: 10px 20px; border-radius: 12px; font-weight: 700;
  border: 2px solid var(--line); background: var(--card);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--card); }

.feed-note { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }

/* ---------- Profile ---------- */
/* My words and Me */
.view-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: -0.02em; }
#words-view { display: grid; gap: 14px; padding-top: 18px; }
#words-view .profile-tabs { border-top: none; border-bottom: 1px solid var(--line); }
#words-view .ptab { border-top: none; border-bottom: 3px solid transparent; margin: 0 0 -1px; }
#words-view .ptab[aria-pressed="true"] { border-bottom-color: var(--text); }
.chips-row.scroll-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row .scroll-row .chip-btn { flex: 0 0 auto; }

#me-view { display: grid; gap: 18px; padding-top: 22px; }
.me-head { display: flex; align-items: center; gap: 18px; }
.me-head .hint { margin: 4px 0 0; color: var(--muted); }
.me-name { min-width: 0; flex: 1; }
.name-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 0; border: none; background: none; text-align: left; }
.name-btn .view-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pencil { width: 20px; height: 20px; color: var(--muted); flex: 0 0 auto; }
.name-form { display: flex; gap: 8px; }
.name-form input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; font: inherit; font-weight: 700;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
}
.nav-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.wide { width: 100%; }
.row-btn {
  display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 56px;
  padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  font-weight: 700; text-align: left;
}
.row-btn span { color: var(--muted); font-size: 1.4rem; }

.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 0; }
.profile-stats div { display: flex; flex-direction: column-reverse; }
.profile-stats dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.profile-stats dt { color: var(--muted); font-size: 0.9rem; }
.stat-btn { font: inherit; color: inherit; background: none; border: none; padding: 0 12px; min-height: 40px; cursor: pointer; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
/* First-visit welcome */
.welcome {
  margin: 14px 0 6px; padding: 18px 18px 16px; border-radius: 16px;
  background: var(--card); border: 2px solid var(--text);
}
.welcome h2 { margin: 0 0 6px; font-family: var(--display); font-size: 2rem; line-height: 1.05; letter-spacing: -0.03em; }
.welcome p { margin: 0 0 8px; }
.welcome ul { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; }
.welcome .welcome-points { list-style: none; padding: 0; gap: 8px; font-weight: 700; }
.welcome-points li { display: flex; gap: 10px; align-items: baseline; }
.welcome-points .wp-icon { font-family: var(--emoji); width: 1.4em; flex: none; }
.who-hint { margin: 0 0 8px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.about-body h3 { margin: 18px 0 6px; font-family: var(--display); font-size: 1.1rem; }
.about-body p { margin: 10px 0 0; }
.about-body ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 14px; }

/* Filters look like strips of label-maker tape: square ends, raised capitals, stuck on a bit crooked. */
.chip-btn {
  min-height: 38px; padding: 6px 12px; border: none; border-radius: 2px;
  background: var(--soft); color: var(--text);
  font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 1px 2px rgb(0 0 0 / 0.18);
  transform: rotate(-1deg);
}
.chip-btn:nth-child(even) { transform: rotate(1deg); }
.chip-btn[aria-pressed="true"] { background: var(--text); color: var(--card); }

.profile-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.ptab {
  min-height: 52px; background: none; border: none; border-top: 2px solid transparent; margin-top: -1px;
  color: var(--muted); font-weight: 700; font-size: 0.95rem;
}
.ptab span { font-variant-numeric: tabular-nums; }
.ptab[aria-pressed="true"] { color: var(--text); border-top-color: var(--text); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.tile {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 100%; border: none; border-radius: 4px; padding: 8px;
  display: grid; place-items: center; text-align: center; overflow: hidden;
  background: repeating-linear-gradient(to bottom, transparent 0 19px, var(--rule) 19px 20px), var(--g); color: var(--on);
  font-family: var(--display); font-weight: 800; font-size: clamp(0.85rem, 3.6vw, 1.1rem); line-height: 1.1;
  overflow-wrap: anywhere;
}
.tile[data-kind="word"] { --g: var(--g-word); --on: var(--on-word); }
.tile[data-kind="acronym"] { --g: var(--g-acronym); --on: var(--on-acronym); }
.tile[data-kind="emoji"] { --g: var(--g-emoji); --on: var(--on-emoji); font-family: var(--emoji); font-size: clamp(1.6rem, 8vw, 2.4rem); }
.tile[data-kind="meme"] { --g: var(--g-meme); --on: var(--on-meme); }
.tile[data-kind="check"] { --g: var(--g-check); --on: var(--on-check); font-size: clamp(0.8rem, 3.2vw, 1rem); }
.tile[data-kind="mature"] { --g: var(--g-mature); --on: var(--on-mature); }
.tile[data-kind="political"] { --g: var(--g-political); --on: var(--on-political); }
.heads-up { margin: 10px 0 0; padding: 10px 12px; border-left: 4px solid var(--s-marigold); background: var(--soft); border-radius: 0 10px 10px 0; }
.tile.is-emoji { font-family: var(--emoji); font-size: clamp(1.6rem, 8vw, 2.4rem); }
.tile-badge {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--body); font-size: 0.75rem; font-weight: 700;
  background: var(--card); color: var(--text);
}
.tile-badge.learned { color: var(--good); }
.tile-badge.learning { color: var(--bad); }
.tile-tries {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--card); color: var(--text);
  font-family: var(--body); font-size: 0.7rem; font-weight: 700; letter-spacing: 0;
}

.empty { margin: 16px 0 0; padding: 18px; text-align: center; color: var(--muted); background: var(--soft); border-radius: 14px; }

.reset { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.link-btn { border: none; background: none; color: var(--muted); text-decoration: underline; padding: 8px 0; }
.reset-confirm { display: grid; gap: 10px; }
.reset-confirm p { margin: 0; }
.reset-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Word sheet ---------- */
.sheet {
  border: none; padding: 0; width: min(520px, 100%); max-width: 100%; max-height: 88vh;
  margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--card); color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
.sheet-inner {
  padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-family: var(--display), var(--emoji); font-weight: 800; font-size: 2rem; line-height: 1.1; overflow-wrap: anywhere; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--soft); font-size: 1.1rem; flex: 0 0 auto; }
.sheet-body { display: grid; gap: 8px; margin-top: 10px; }
.tally { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- Sharing ---------- */
.share-btn {
  margin-left: auto; flex: 0 0 auto; min-height: 44px; padding: 6px 12px; border-radius: 999px;
  border: none; background: var(--soft); font-weight: 700; font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.share-btn .icon { width: 20px; height: 20px; }
.share-progress { margin-top: 12px; }
#sheet-share { margin-top: 16px; }
.share-inner { display: grid; gap: 14px; }
.share-preview {
  display: block; justify-self: center; height: min(46vh, 420px); max-width: 100%; aspect-ratio: 9 / 16;
  border-radius: 16px; background: var(--soft); object-fit: contain;
}
.share-who { border: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.share-who legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.who-opt {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px;
  border: 2px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 0.95rem;
}
.who-opt:has(input[type="radio"]:checked) { border-color: var(--accent); background: var(--soft); }
.who-opt input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
#share-age {
  width: 4.5em; min-height: 34px; padding: 4px 8px; font: inherit; font-weight: 700;
  border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
}
.share-actions { display: grid; gap: 8px; }
.share-hint { margin: 0; color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }

/* ---------- Today ---------- */
.today-body { display: grid; gap: 12px; margin-top: 8px; }
.today-summary { margin: 0; }
.today-summary span { color: var(--muted); }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.today-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: left;
}
.today-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.today-mark.right { background: var(--good-bg); color: var(--good); }
.today-mark.wrong { background: var(--bad-bg); color: var(--bad); }
.today-term { font-weight: 700; font-family: var(--display), var(--emoji); overflow-wrap: anywhere; }

.toast {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 12px);
  width: min(480px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: var(--text); color: var(--card); border-radius: 16px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
}
.toast-text { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.toast-text span { font-size: 0.85rem; opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) {
  .toast:not([hidden]) { animation: toast-in 0.3s ease-out; }
  @keyframes toast-in { from { transform: translate(-50%, 20px); opacity: 0; } }
}

/* ---------- Bottom bar ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.navbtn {
  position: relative; height: var(--bar-h); background: none; border: none;
  display: grid; justify-items: center; align-content: center; gap: 0;
  color: var(--muted); font-weight: 700; font-size: 0.85rem;
}
.navbtn[aria-current="page"] { color: var(--text); }
.nav-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--soft); border: 2px solid transparent; font-size: 1rem;
}
.navbtn[aria-current="page"] .nav-avatar { border-color: var(--text); }
.nav-avatar .cassette { width: 80%; }
.navbtn[aria-current="page"] .icon { stroke-width: 2.4; }
.nav-badge {
  position: absolute; top: 8px; left: calc(50% + 10px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--heart); color: #fff; font-size: 0.72rem; display: grid; place-items: center;
}

@media (prefers-reduced-motion: no-preference) {
  .post.new { animation: rise 0.35s ease-out; }
  @keyframes rise { from { transform: translateY(14px); opacity: 0; } }
  .like.on { animation: pop 0.45s ease-out; }
  @keyframes pop { 30% { transform: scale(1.4); } 60% { transform: scale(0.9); } }
  .feed { scroll-behavior: smooth; }
}

/* ---------- Cassette, turned up ----------
   Same colours, more of the screen: a charcoal top bar with the label stripe under it,
   coloured category bubbles and post headers, and hard charcoal outlines with offset shadows.
   Answers and explanations stay on light backgrounds for easy reading. */
:root { --hard: #221e1c; --hard-shadow: #221e1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hard: #4a434c; --hard-shadow: #000; } }
:root[data-theme="dark"] { --hard: #4a434c; --hard-shadow: #000; }

.topbar { background: #221e1c; border-bottom: none; }
.topbar::after { content: ""; display: block; height: 9px; background: var(--stripes); }
.logo { color: #f2ebdd; }
.info-btn { color: #f2ebdd; background: rgba(242, 235, 221, 0.12); border-radius: 50%; }

.stories-wrap { border-bottom: 2px solid var(--hard); }
.stories-wrap { top: calc(56px + 9px + env(safe-area-inset-top, 0px)); }
.story .avatar-story { background: var(--hard); }
.story[data-kind] .avatar-story > span { border-color: var(--card); }
.story[data-kind="all"] .avatar-story > span { background: #221e1c; color: #f2ebdd; }
.story[data-kind="week"] .avatar-story > span { background: var(--s-marigold); color: #221e1c; }
.story[data-kind="word"] .avatar-story > span { background: var(--g-word); color: var(--on-word); }
.story[data-kind="acronym"] .avatar-story > span { background: var(--g-acronym); color: var(--on-acronym); }
.story[data-kind="emoji"] .avatar-story > span { background: var(--g-emoji); color: var(--on-emoji); }
.story[data-kind="meme"] .avatar-story > span { background: var(--g-meme); color: var(--on-meme); }
.story[data-kind="check"] .avatar-story > span { background: var(--g-check); color: var(--on-check); }
.story[data-kind="mature"] .avatar-story > span { background: var(--g-mature); color: var(--on-mature); }
.story[data-kind="political"] .avatar-story > span { background: var(--g-political); color: var(--on-political); }
/* the chosen one gets a thicker ring and a lift */
.story[aria-pressed="true"] .avatar-story { box-shadow: 2px 2px 0 var(--hard-shadow); padding: 3.5px; }

/* posts become printed cards on every screen size */
.feed { gap: 22px; padding: 18px 0 24px; }
@media (max-width: 559px) {
  .feed { margin-left: 0; margin-right: 0; }
  .post-head, .quiz, .after { padding-left: 14px; padding-right: 14px; }
}
.post { border: 2px solid var(--hard); border-radius: 16px; box-shadow: 4px 4px 0 var(--hard-shadow); border-bottom-width: 2px; }
.post-head[data-kind] { background: var(--g); color: var(--on); }
.post-head[data-kind="word"] { --g: var(--g-word); --on: var(--on-word); }
.post-head[data-kind="acronym"] { --g: var(--g-acronym); --on: var(--on-acronym); }
.post-head[data-kind="emoji"] { --g: var(--g-emoji); --on: var(--on-emoji); }
.post-head[data-kind="meme"] { --g: var(--g-meme); --on: var(--on-meme); }
.post-head[data-kind="check"] { --g: var(--g-check); --on: var(--on-check); }
.post-head[data-kind="mature"] { --g: var(--g-mature); --on: var(--on-mature); }
.post-head[data-kind="political"] { --g: var(--g-political); --on: var(--on-political); }
.post-head[data-kind] .post-who small { color: inherit; opacity: 0.85; }
.post-head[data-kind] .avatar { background: currentColor !important; }
.post-head[data-kind] .avatar > span { background: var(--card); color: var(--text); border-color: var(--g); }
.post-head .post-flag { border: 2px solid #221e1c; }
.media { border-top: 2px solid var(--hard); border-bottom: 2px solid var(--hard); }

.option { border-color: var(--hard); }
.btn { border-color: var(--hard); }
.btn.primary { border-color: #221e1c; box-shadow: 3px 3px 0 var(--s-tangerine); }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--s-tangerine); }

.welcome, .week-banner { border: 2px solid var(--hard); box-shadow: 4px 4px 0 var(--hard-shadow); }
.bottombar { border-top: 2px solid var(--hard); }
.post, .goal-card, .done-card { scroll-margin-top: calc(56px + 9px + 92px + env(safe-area-inset-top, 0px)); }
.install { margin-top: 10px; }
.install-tip { margin: 0; padding: 12px 14px; border: 2px dashed var(--hard); border-radius: 12px; background: var(--card); }
