/* =========================================================
   Half Sugar app
   Main colour: cream, like milk tea. Accent: one orange, used everywhere.
   Radius rule: buttons are pills, cards 20px, inputs 12px.
   ========================================================= */

:root {
  --bg: #f3eee3;
  --surface: #faf7f0;
  --sunk: #eae3d4;
  --ink: #2a1d16; /* dark brown, like tapioca */
  --pearl: #3b2518; /* tapioca pearls */
  --milk: #d9be97; /* milk tea */
  --muted: #6a6257;
  --line: #dcd3c3;
  --orange: #e25c14;
  --orange-deep: #b4460b; /* for small text, passes contrast */
  --orange-soft: #f6dcc8;
  --danger: #a3260f;

  --r-card: 20px;
  --r-input: 12px;
  --r-pill: 999px;

  --font: "Outfit", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 0 rgb(255 255 255 / 0.7) inset, 0 20px 40px -24px rgb(92 64 30 / 0.28);

  --side-w: 232px;
  --tab-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain. Fixed to the screen so it does not repaint on scroll. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.3;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.36 0 0 0 0 0.25 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
fieldset {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

fieldset {
  min-width: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--orange-deep);
  outline-offset: 2px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.logo__mark {
  flex: none;
  width: 22px;
  height: 26px;
  color: var(--ink);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn--sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

.btn--primary {
  background: var(--orange);
}

.btn--primary:hover {
  background: #ec6a22;
}

.btn--dark {
  background: var(--ink);
  color: var(--bg);
}

.btn--dark:hover {
  background: #46301f;
}

.btn--ghost {
  border-color: #b9ad98;
}

.btn--ghost:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.btn--danger {
  background: var(--danger);
  color: #fff8f2;
}

.btn[disabled] {
  background: var(--sunk);
  color: var(--muted);
  cursor: default;
}

.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btnrow--center {
  justify-content: center;
}

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100dvh;
  padding: 28px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.side .logo {
  padding-left: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: var(--r-input);
  color: var(--muted);
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.nav a i {
  font-size: 1.375rem;
}

.nav a:hover {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  background: var(--sunk);
  color: var(--ink);
}

.nav a[aria-current="page"] i {
  color: var(--orange-deep);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
}

.main {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding: 40px clamp(16px, 4vw, 40px) 72px;
}

.main > * + * {
  margin-top: 16px;
}

.main--chat {
  height: 100dvh;
  padding-bottom: 20px;
}

/* ---------- Page header ---------- */

.head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

h1 {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.sub {
  margin-top: 6px;
  color: var(--orange-deep);
  font-weight: 500;
}

.lead {
  max-width: 34em;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.0625rem;
}

.meta,
.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Cards and panels ---------- */

.card,
.panel {
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.card {
  box-shadow: var(--shadow);
  animation: rise 0.5s var(--ease) both;
}

.card > * + * {
  margin-top: 14px;
}

.card--mine {
  border-color: var(--orange);
  background: #fbf1e6;
  box-shadow: none;
}

.mine > * + * {
  margin-top: 12px;
}

.mine h2 {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

.thought {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.post-title {
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
}

.byline {
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.35;
}

.byline small {
  color: var(--muted);
  font-size: 0.875rem;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sunk);
  color: var(--muted);
  font-weight: 600;
}

.avatar--on {
  background: var(--orange);
  color: var(--ink);
}

.brief {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.brief > div {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr);
  gap: 12px;
}

.brief dt {
  color: var(--muted);
}

.brief--locked {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #b9ad98;
}

.locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.locked i {
  color: var(--orange-deep);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.chips span {
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 0.875rem;
}

.responses {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid #ecc9ad;
}

.responses li > * + * {
  margin-top: 10px;
}

.quote {
  padding-left: 14px;
  border-left: 2px solid var(--orange);
}

.waiting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.empty {
  padding: 40px 20px;
  border: 1px dashed #b9ad98;
  border-radius: var(--r-card);
  color: var(--muted);
  text-align: center;
}

.empty > * + * {
  margin-top: 16px;
}

.note > * + * {
  margin-top: 12px;
}

.note p {
  color: var(--muted);
}

/* ---------- Forms ---------- */

.stack {
  display: grid;
  gap: 16px;
}

.row2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field label,
legend {
  font-size: 0.9375rem;
  font-weight: 500;
}

fieldset.panel {
  display: grid;
  gap: 16px;
}

legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: var(--orange-deep);
}

.panel--locked {
  border-style: dashed;
  border-color: #b9ad98;
  background: var(--sunk);
}

.panel--locked legend {
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #b9ad98;
  border-radius: var(--r-input);
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

::placeholder {
  color: #7a7064;
  opacity: 1;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.error {
  color: var(--danger);
  font-size: 0.9375rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.filters select {
  min-height: 40px;
  padding: 6px 10px;
  border-color: var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.9375rem;
}

.reply {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ---------- Onboarding ---------- */

.onboard {
  max-width: 640px;
  margin-inline: auto;
  padding: 48px clamp(16px, 4vw, 40px) 72px;
}

.onboard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.onboard h1 {
  margin-top: 28px;
}

.onboard form {
  margin-top: 32px;
}

/* ---------- Drop ---------- */

.drop-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 5vw, 48px);
  padding: clamp(24px, 5vw, 44px);
  border-radius: var(--r-card);
  background: var(--orange);
}

.drop-card__label {
  font-weight: 500;
}

.drop-card__time {
  margin-block: 4px 8px;
  font-size: clamp(2.5rem, 8vw, 4.25rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.drop-card .btn {
  margin-top: 22px;
}

.rules {
  display: grid;
  gap: 18px;
  padding: 12px 4px;
}

.rules li {
  display: flex;
  gap: 14px;
}

.rules i {
  flex: none;
  margin-top: 2px;
  color: var(--orange);
  font-size: 1.5rem;
}

.rules p {
  color: var(--muted);
}

.drop-stage {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding-block: clamp(48px, 14vh, 140px);
  text-align: center;
}

.drop-stage .sub {
  max-width: 30em;
  color: var(--muted);
  font-weight: 400;
}

.drop-stage .btnrow,
.drop-stage .waiting {
  margin-top: 16px;
}

/* ---------- Boba pieces ---------- */

.cup {
  display: block;
  width: 24px;
  height: 28px;
  color: var(--ink);
  overflow: visible;
}

.cup--lg {
  width: 72px;
  height: 84px;
}

.cup--hero {
  width: clamp(88px, 16vw, 128px);
  height: auto;
  aspect-ratio: 24 / 28;
  animation: float 3.2s ease-in-out infinite alternate;
}

.cup--mystery {
  width: clamp(92px, 18vw, 136px);
  height: auto;
  aspect-ratio: 24 / 28;
  animation: float 3.2s ease-in-out infinite alternate;
}

@keyframes float {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-8px) rotate(3deg); }
}

.avatar--cup {
  background: var(--surface);
  border: 1px solid var(--line);
}

.avatar--cup .cup {
  width: 20px;
  height: 24px;
}

.flavor {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 10px;
  border-radius: var(--r-pill);
  background: var(--flavor);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 500;
  vertical-align: 2px;
}

.onboard__hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 28px;
}

.onboard__hero h1 {
  margin-top: 0;
}

.receipt {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  border: 1px dashed #b9ad98;
  border-radius: var(--r-card);
  background:
    radial-gradient(circle at 0 50%, var(--bg) 10px, transparent 11px),
    radial-gradient(circle at 100% 50%, var(--bg) 10px, transparent 11px),
    var(--surface);
  margin-bottom: 20px;
}

.receipt__label {
  color: var(--muted);
  font-size: 0.8125rem;
}

.receipt__item {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.receipt__meta {
  color: var(--muted);
}

/* The printed seal film on top of a cup, until both people pop it */
.brief--locked.is-sealed {
  padding: 14px;
  border: 0;
  border-radius: var(--r-input);
  background: repeating-linear-gradient(135deg, var(--orange-soft) 0 10px, #fbeadb 10px 20px);
}

.shake {
  animation: shake 0.5s ease-in-out infinite alternate;
}

@keyframes shake {
  from { transform: rotate(-12deg); }
  to { transform: rotate(12deg); }
}

/* Three tapioca pearls bouncing while we shake your cup */
.pearls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.pearls span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  animation: bounce 0.8s var(--ease) infinite alternate;
}

.pearls span:nth-child(2) {
  background: var(--orange);
  animation-delay: 0.15s;
}

.pearls span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  from { transform: translateY(8px); }
  to { transform: translateY(-12px); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
}

/* ---------- Chat list ---------- */

.threads {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
}

.threads li + li {
  border-top: 1px solid var(--line);
}

.threads a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  transition: background-color 0.2s;
}

.threads a:hover {
  background: #fffdf8;
}

.threads__body {
  display: grid;
  min-width: 0;
  line-height: 1.4;
}

.threads__body small {
  color: var(--orange-deep);
  font-size: 0.8125rem;
}

.threads__last {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9375rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Chat ---------- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.chat__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.chat__head h1 {
  font-size: 1.5rem;
}

.chat__head .sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.chat__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.25rem;
}

.timer {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.who {
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.who summary {
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.who[open] summary {
  margin-bottom: 14px;
}

.booking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--r-input);
  background: var(--orange-soft);
  font-size: 0.9375rem;
  font-weight: 500;
}

.booking i {
  font-size: 1.25rem;
}

.log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow-y: auto;
}

.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.msg--me {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--ink);
  color: var(--bg);
}

.msg--them {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--sunk);
}

.msg--sys {
  align-self: center;
  max-width: 92%;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.msg--typing {
  display: flex;
  gap: 4px;
  padding: 14px;
}

.msg--typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pearl);
  animation: blink 1s infinite alternate;
}

.msg--typing span:nth-child(2) { animation-delay: 0.2s; }
.msg--typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  from { opacity: 0.25; }
  to { opacity: 1; }
}

.composer {
  display: flex;
  gap: 8px;
}

.composer input {
  min-height: 48px;
  border-radius: var(--r-pill);
  padding-inline: 20px;
}

.composer .btn {
  flex: none;
  width: 48px;
  padding: 0;
  font-size: 1.25rem;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9375rem;
  transform: translateX(-50%);
  animation: rise 0.4s var(--ease) both;
}

/* ---------- Phones ---------- */

@media (max-width: 820px) {
  .app {
    display: block;
  }

  .side {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    display: block;
    height: auto;
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .side .logo {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
  }

  .nav a {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: var(--tab-h);
    padding: 0;
    font-size: 0.75rem;
  }

  .nav a[aria-current="page"] {
    background: none;
  }

  .nav .badge {
    position: absolute;
    top: 8px;
    left: calc(50% + 6px);
    margin: 0;
  }

  .main {
    padding: 24px 16px calc(var(--tab-h) + 40px);
  }

  .main--chat {
    height: calc(100dvh - var(--tab-h) - env(safe-area-inset-bottom, 0px));
    padding: 16px 16px 12px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toast {
    bottom: calc(var(--tab-h) + 20px);
  }
}

@media (max-width: 520px) {
  .row2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .brief > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .msg {
    max-width: 88%;
  }

  .chat__tools {
    width: 100%;
    margin-left: 0;
  }
}

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

/* ---------- Boba pieces on small screens ---------- */

.empty .cup {
  margin-inline: auto;
}

@media (max-width: 520px) {
  .drop-card {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }

  .onboard__hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .onboard__hero .cup--hero {
    display: none;
  }
}

/* ---------- Small explanations for the boba words ---------- */

.explain {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 40em;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.explain i {
  flex: none;
  margin-top: 2px;
  color: var(--orange-deep);
}

.explain a,
.onboard__about a {
  color: var(--orange-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.onboard__about {
  margin-top: 16px;
  font-size: 0.9375rem;
}

.nav__text {
  display: grid;
  line-height: 1.25;
}

.nav__text small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.side__about {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 10px 12px;
  border-radius: var(--r-input);
  color: var(--muted);
  font-size: 0.875rem;
}

.side__about:hover,
.side__about[aria-current="page"] {
  background: var(--sunk);
  color: var(--ink);
}

/* ---------- About page ---------- */

.about-page {
  max-width: 760px;
  margin-inline: auto;
  padding: 40px clamp(16px, 4vw, 40px) 72px;
}

.about > * + * {
  margin-top: clamp(40px, 6vw, 64px);
}

.about h2 {
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.about p {
  max-width: 40em;
}

.about__hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.about__hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
}

.about__block > * + * {
  margin-top: 12px;
}

.about__block > p {
  color: var(--muted);
  font-size: 1.0625rem;
}

.about__pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.about__card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.about__card p {
  margin-top: 10px;
  color: var(--muted);
}

.about__card--sugar {
  border-color: transparent;
  background: linear-gradient(to top, var(--milk) 50%, var(--surface) 50%);
}

.about__card--sugar p {
  color: var(--ink);
}

.steps {
  display: grid;
  gap: 14px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 48px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pearl);
  color: var(--bg);
  font-weight: 600;
}

.about__hint {
  color: var(--muted);
}

.glossary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.glossary > div {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.glossary dt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.glossary dt i {
  color: var(--orange-deep);
  font-size: 1.125rem;
}

.glossary dd {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.flavors__title {
  margin-top: 24px;
  font-size: 1rem;
  font-weight: 600;
}

.flavors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 0.9375rem;
}

.flavors li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flavors .flavor {
  margin-left: 0;
  vertical-align: 0;
}

.about__belief {
  padding: clamp(28px, 5vw, 48px);
  border-radius: var(--r-card);
  background: var(--pearl);
  color: var(--bg);
  text-align: center;
}

.about__belief p {
  max-width: none;
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.about__belief .accent {
  color: var(--orange);
}

.about__belief .btnrow {
  margin-top: 24px;
}

@media (max-width: 820px) {
  .nav__text small,
  .side__about {
    display: none;
  }
}

@media (max-width: 600px) {
  .about__pair,
  .glossary {
    grid-template-columns: minmax(0, 1fr);
  }

  .about__hero .cup--hero {
    display: none;
  }
}

/* ---------- Sugar level chip (set per thought, brew or Mystery Cup) ---------- */

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.sugar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 8px;
  border-radius: var(--r-pill);
  background: var(--sunk);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
}

.cup--chip {
  width: 14px;
  height: 17px;
}

.drop-card__sugar {
  display: grid;
  gap: 6px;
  max-width: 280px;
  margin-top: 18px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.drop-card__sugar select {
  min-height: 42px;
  border-color: var(--ink);
  border-radius: var(--r-pill);
}

@media (max-width: 520px) {
  .drop-card__sugar {
    margin-inline: auto;
  }
}

/* ---------- Chat time limit ---------- */

.expiry {
  color: var(--muted);
  font-size: 0.8125rem;
}

.chat__head .meta-row {
  margin-top: 6px;
}

.cold {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1px dashed #b9ad98;
  border-radius: var(--r-card);
  color: var(--muted);
}

.cold i {
  color: var(--orange-deep);
  font-size: 1.25rem;
}

.threads .is-cold a {
  opacity: 0.55;
}

/* Development-only buttons */
.devrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.devrow .btn {
  min-height: 32px;
  border-style: dashed;
  font-size: 0.8125rem;
}

/* ---------- Language switch ---------- */

.side__foot {
  display: grid;
  gap: 6px;
  margin-top: auto;
}

.side__foot .side__about {
  margin-top: 0;
}

.lang {
  justify-self: start;
  min-height: 36px;
  font-size: 0.875rem;
}

.lang i {
  font-size: 1.0625rem;
}

@media (max-width: 820px) {
  .side__foot {
    display: none;
  }
}

/* ---------- About: why chats go cold ---------- */

.about__cold {
  display: flex;
  gap: 18px;
  padding: clamp(22px, 4vw, 32px);
  border: 1px dashed #b9ad98;
  border-radius: var(--r-card);
  background: var(--surface);
}

.about__cold > i {
  flex: none;
  color: var(--orange-deep);
  font-size: 1.75rem;
}

.about__cold > div > * + * {
  margin-top: 10px;
}

.about__cold p {
  color: var(--muted);
}

.about__cold .about__hint {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Traditional Chinese typography ----------
   Chinese characters are square and dense, so they need more room
   between letters and lines than Latin text. English slogans inside
   the Chinese page are marked lang="en" and keep their tight spacing. */

html:lang(zh-Hant) body {
  line-height: 1.85;
  letter-spacing: 0.04em;
  text-autospace: normal; /* adds a small gap between Chinese and Latin where supported */
}

html:lang(zh-Hant) :is(h1, h2, h3, .receipt__item, .sub, .lead, .drop-card__label, .glossary dt, .nav__text > span, .about__belief p) {
  letter-spacing: 0.06em;
}

html:lang(zh-Hant) :is(h1, h2, h3, .post-title, .receipt__item) {
  font-weight: 600;
}

html:lang(zh-Hant) h1 {
  line-height: 1.35;
}

html:lang(zh-Hant) :is(.thought, .post-title, .lead) {
  line-height: 1.65;
}

html:lang(zh-Hant) :is(.brief, .explain, .byline, .msg, .hint, .quote, .glossary dd, .about__card p, .about__cold p, .steps li, .threads__body, .receipt__meta) {
  line-height: 1.75;
}

html:lang(zh-Hant) .nav__text {
  gap: 2px;
  line-height: 1.45;
}

html:lang(zh-Hant) .brief > div {
  gap: 16px;
}

html:lang(zh-Hant) .btn {
  letter-spacing: 0.08em;
}

html:lang(zh-Hant) .steps {
  gap: 18px;
}

/* English slogans on the Chinese page */
html:lang(zh-Hant) [lang="en"] {
  letter-spacing: -0.01em;
}

html:lang(zh-Hant) h1[lang="en"] {
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* What people write can be English or Chinese, so it gets a middle value */
html:lang(zh-Hant) :is(.thought, .post-title, .msg, .quote, .threads__last, .brief dd, .byline small, .chips span) {
  letter-spacing: 0.015em;
}

/* ---------- Matching: today's picks, looking for, sent brews ---------- */

.picks__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.picks__head h2 {
  font-size: 1.25rem;
}

.pick__thought {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--r-input);
  background: var(--bg);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.pick__thought span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.why {
  padding: 12px 16px;
  border-radius: var(--r-input);
  background: var(--orange-soft);
}

.why__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.why ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 6px;
  font-size: 0.9375rem;
}

.why--inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.why i {
  color: var(--orange-deep);
}

.nudge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border: 1px dashed var(--orange);
  border-radius: var(--r-card);
  font-size: 0.9375rem;
}

.nudge i {
  margin-top: 3px;
  color: var(--orange-deep);
}

.nudge a {
  color: var(--orange-deep);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.field__label {
  font-size: 0.9375rem;
  font-weight: 500;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check {
  position: relative;
  cursor: pointer;
}

.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #b9ad98;
  border-radius: var(--r-pill);
  background: #fffdf8;
  font-size: 0.9375rem;
  transition: background-color 0.2s, border-color 0.2s;
}

.check input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.check input:focus-visible + span {
  outline: 2px solid var(--orange-deep);
  outline-offset: 2px;
}

.sent {
  padding-top: 12px;
  border-top: 1px solid #ecc9ad;
}

.sent .meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sent__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
  font-size: 0.875rem;
}

.sent__list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sent__list .avatar {
  width: 30px;
  height: 30px;
}

.sent__list .avatar .cup {
  width: 15px;
  height: 18px;
}

/* ---------- Onboarding questions ---------- */

.progress {
  height: 6px;
  margin-top: 28px;
  border-radius: var(--r-pill);
  background: var(--sunk);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 0.4s var(--ease);
}

.quiz {
  margin-top: 28px;
}

.quiz > * + * {
  margin-top: 14px;
}

.quiz__q {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.quiz__hint {
  color: var(--muted);
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
}

.option:hover {
  border-color: var(--ink);
}

.option:active {
  transform: scale(0.98);
}

.option.is-on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.option.is-on .cup {
  color: var(--bg);
}

.options--flavors {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.cup--option {
  width: 26px;
  height: 30px;
  flex: none;
}

.options--chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option--chip {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--r-pill);
}

.quiz .field {
  margin-top: 22px;
}

.quiz__nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

@media (max-width: 520px) {
  .options {
    grid-template-columns: minmax(0, 1fr);
  }

  .options--flavors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Two-flavor cups ---------- */

.flavor {
  background: linear-gradient(90deg, var(--flavor) 50%, var(--flavor2, var(--flavor)) 50%);
}

.option small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.75;
}

.quiz__preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  padding: 14px 18px;
  border: 1px dashed #b9ad98;
  border-radius: var(--r-card);
  font-size: 1.125rem;
  font-weight: 600;
}

.quiz__preview .cup--lg {
  width: 48px;
  height: 56px;
}

/* ---------- Algorithm panel in My order ---------- */

.algo > * + * {
  margin-top: 12px;
}

.algo h3 {
  margin-top: 20px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.algo__weights,
.algo__funnel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 24px;
}

.algo__weights li,
.algo__funnel li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 6px;
  border-bottom: 1px dashed var(--line);
  font-size: 0.9375rem;
}

.algo__weights strong,
.algo__funnel strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .algo__weights,
  .algo__funnel {
    grid-template-columns: minmax(0, 1fr);
  }
}
