:root {
  --ink: #141414;
  --paper: #fffaf0;
  --white: #ffffff;
  --cream: #fff1c7;
  --line: #f0e6d0;
  --yellow: #ffd23f;
  --blue: #4d8bff;
  --coral: #ff6b4a;
  --mint: #3dd68c;
  --lilac: #b69cff;
  --pink: #ff8fc7;
  --cyan: #5ad1e6;
  --rec: #e0352b;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Onest', system-ui, sans-serif;
}

/* The site keeps its own palette even when the phone uses a dark theme. */
:root { color-scheme: only light; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; overflow-x: hidden; }
a { color: var(--ink); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3, .display { font-family: var(--display); font-weight: 900; letter-spacing: -0.04em; line-height: 1; margin: 0; }
.h1 { font-size: clamp(32px, 4.5vw, 56px); }
.h2 { font-size: clamp(36px, 5.5vw, 76px); }
.h3 { font-size: 26px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* motion */
@keyframes rs-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes rs-pop { from { opacity: 0; transform: scale(.85) rotate(var(--r, 0deg)); } to { opacity: 1; transform: scale(1) rotate(var(--r, 0deg)); } }
@keyframes rs-bob { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-12px) rotate(var(--r, 0deg)); } }
@keyframes rs-spin { to { transform: rotate(360deg); } }
@keyframes rs-marquee { to { transform: translateX(-50%); } }
@keyframes rs-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.in { animation: rs-in .7s var(--ease) both; }
.in-1 { animation-delay: .08s; } .in-2 { animation-delay: .16s; } .in-3 { animation-delay: .24s; }
.swap { animation: rs-in .5s var(--ease) both; }
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.shown { opacity: 1; transform: none; }
.pulse { animation: rs-pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px; border: 3px solid var(--ink); background: var(--white); font-family: var(--display); font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform .4s var(--ease), box-shadow .4s var(--ease), background-color .45s ease, color .45s ease; }
.btn:hover { transform: translate(-2px, -2px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ink { background: var(--ink); color: var(--white); }
.btn-ink:hover { color: var(--white); }
.btn-coral { background: var(--coral); box-shadow: 5px 5px 0 var(--ink); }
.btn-yellow { background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); }
.btn-coral:hover, .btn-yellow:hover { box-shadow: 7px 7px 0 var(--ink); }
.btn-lg { min-height: 64px; padding: 0 32px; font-size: 17px; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 13px; border-width: 2.5px; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--white); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .4s var(--ease), background-color .45s ease; }
.icon-btn:hover { transform: translate(-2px, -2px); }

/* pills / segmented */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--white); }
.seg button { min-width: 48px; height: 38px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font-family: var(--display); font-weight: 700; font-size: 12px; cursor: pointer; transition: background-color .45s var(--ease); }
.seg button[aria-pressed="true"] { background: var(--yellow); }
.tabs button { height: 44px; padding: 0 18px; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--white); font-size: 13px; font-weight: 600; }
.chip-mint { background: var(--mint); } .chip-coral { background: var(--coral); } .chip-yellow { background: var(--yellow); } .chip-cream { background: var(--cream); }

/* cards */
.card { background: var(--white); border: 3px solid var(--ink); border-radius: 32px; padding: 28px; }
.card-tight { border-radius: 24px; padding: 18px; }
.shadow { box-shadow: 6px 6px 0 var(--ink); }
.lift { transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.lift:hover { transform: translate(-3px, -5px); }
.bg-yellow { background: var(--yellow); } .bg-blue { background: var(--blue); } .bg-coral { background: var(--coral); }
.bg-mint { background: var(--mint); } .bg-lilac { background: var(--lilac); } .bg-pink { background: var(--pink); } .bg-cyan { background: var(--cyan); }
.bg-cream { background: var(--cream); } .bg-paper { background: var(--paper); }

.stat-num { font-family: var(--display); font-weight: 900; font-size: clamp(56px, 6vw, 96px); line-height: 1; letter-spacing: -0.05em; }
.stat-num small { font-size: .45em; }
.stat-label { margin-top: 12px; font-size: 17px; font-weight: 600; }

.grid { display: grid; gap: 20px; }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-fill { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: #4a4a4a; }

.item { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 14px; border-radius: 20px; background: var(--paper); }
.badge-day { width: 56px; height: 56px; border-radius: 16px; border: 2.5px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 13px; flex: none; text-align: center; line-height: 1.1; }
.mark { width: 54px; height: 54px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--yellow); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 900; font-size: 19px; flex: none; }
.avatar { width: 48px; height: 48px; border-radius: 50%; border: 2.5px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 900; font-size: 14px; flex: none; }

/* forms */
.field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 15px; }
.input { height: 56px; border: 2.5px solid var(--ink); border-radius: 18px; padding: 0 18px; background: var(--white); font-size: 17px; width: 100%; }
select.input { padding: 0 14px; }
textarea.input { height: auto; min-height: 96px; padding: 14px 18px; resize: vertical; }
.form-error { color: #b3261e; font-weight: 600; min-height: 1.5em; }

/* switch */
.switch { width: 64px; height: 36px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--white); position: relative; cursor: pointer; padding: 0; flex: none; transition: background-color .45s ease; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 25px; height: 25px; border-radius: 50%; background: var(--ink); transition: transform .45s var(--spring); }
.switch[aria-checked="true"] { background: var(--mint); }
.switch[aria-checked="true"]::after { transform: translateX(28px); }

/* header */
.topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand img { width: 52px; height: 48px; object-fit: contain; }

/* table-ish */
.table { background: var(--white); border: 3px solid var(--ink); border-radius: 28px; padding: 10px; overflow-x: auto; }
.table .tr { display: grid; gap: 12px; align-items: center; padding: 12px 14px; border-top: 2px solid var(--line); min-width: 720px; }
.table .tr:first-child { border-top: 0; }
.table .th { font-size: 13px; font-weight: 700; }

/* chat */
.chat { border: 3px solid var(--ink); border-radius: 32px; background: var(--white); display: flex; flex-direction: column; height: 620px; overflow: hidden; }
.chat-head { padding: 18px 24px; border-bottom: 3px solid var(--ink); background: var(--cream); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 72%; padding: 12px 18px; border-radius: 22px; border: 2.5px solid var(--ink); background: var(--white); animation: rs-in .4s var(--ease) both; word-wrap: break-word; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--blue); }
.msg .meta { font-size: 12px; font-weight: 600; margin-top: 6px; }
.chat-form { padding: 14px; border-top: 3px solid var(--ink); display: flex; gap: 10px; }
.thread { text-align: left; padding: 18px; border-radius: 24px; border: 3px solid var(--ink); background: var(--white); cursor: pointer; transition: transform .4s var(--ease), background-color .45s ease, box-shadow .4s var(--ease); width: 100%; }
.thread[aria-pressed="true"] { background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); }

/* recordings */
.rec-card { text-decoration: none; background: var(--white); border: 3px solid var(--ink); border-radius: 28px; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; text-align: left; padding: 0; }
.rec-thumb { aspect-ratio: 16 / 9; border-bottom: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; }
.play { width: 64px; height: 64px; border-radius: 50%; background: var(--ink); display: flex; align-items: center; justify-content: center; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(20, 20, 20, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: rs-in .3s var(--ease) both; }
.modal-box { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--white); border: 3px solid var(--ink); border-radius: 32px; padding: 28px; box-shadow: 8px 8px 0 var(--ink); }
.modal-box video { width: 100%; border-radius: 18px; background: var(--ink); }

.empty { padding: 28px; border-radius: 24px; border: 3px dashed var(--ink); background: var(--white); font-weight: 600; }
.toast { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); bottom: 24px; background: var(--ink); color: var(--white); padding: 14px 22px; border-radius: 999px; font-weight: 600; z-index: 60; animation: rs-in .4s var(--ease) both; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .h1 { font-size: clamp(26px, 8vw, 40px); }
  .h2 { font-size: clamp(30px, 9vw, 44px); }
  .card { padding: 20px; border-radius: 26px; }
  .card-tight { padding: 16px; border-radius: 22px; }
  .shadow { box-shadow: 4px 4px 0 var(--ink); }
  .btn { min-height: 50px; padding: 0 22px; }
  .btn-lg { min-height: 58px; padding: 0 26px; font-size: 16px; }
  .stat-num { font-size: clamp(44px, 14vw, 64px); }
  .stat-label { font-size: 15px; margin-top: 8px; }
  .grid { gap: 14px; }
  .input { height: 52px; font-size: 16px; }
  .item { padding: 12px; gap: 10px; }
  .badge-day { width: 50px; height: 50px; font-size: 12px; }
  .mark { width: 46px; height: 46px; font-size: 17px; }

  /* header: everything wraps, nothing scrolls sideways */
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .brand { font-size: 16px; gap: 8px; white-space: nowrap; }
  .brand img { width: 42px; height: 40px; }
  .top-actions { gap: 8px !important; flex-wrap: nowrap; grid-row: 1; grid-column: 2; }
  .top-actions .seg button { min-width: 0; height: 34px; padding: 0 10px; font-size: 11px; }
  .top-actions .btn { min-height: 44px; padding: 0 16px; font-size: 13px; }
  .top-actions .icon-btn { width: 44px; height: 44px; }
  .top-who { display: none !important; }
  /* landing: brand + login, then section links, then language */
  .top-actions:has(> .btn) { display: contents; }
  .top-actions:has(> .btn) > .btn { grid-row: 1; grid-column: 2; justify-self: end; }
  .top-actions:has(> .btn) > .seg { grid-row: 3; grid-column: 1 / -1; justify-self: start; }
  .top-nav { grid-row: 2; grid-column: 1 / -1; display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px !important; }
  .top-nav a { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px 6px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white); font-size: 13px; font-weight: 600; line-height: 1.1; text-align: center; }
  /* cabinet: section buttons as a tidy grid */
  .topbar .tabs { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); border-radius: 24px; }
  .topbar .tabs button { min-width: 0; height: 40px; padding: 0 6px; font-size: 11px; }
  .seg { border-radius: 24px; }

  /* lists that are tables on desktop become stacked cards */
  .table { padding: 6px; border-radius: 24px; }
  .table .tr { display: flex; flex-wrap: wrap; gap: 6px 12px; min-width: 0 !important; padding: 14px 12px; }
  .table .tr > * { min-width: 0; }
  .table .tr.th { display: none; }

  .chat { height: calc(100dvh - 190px); min-height: 420px; border-radius: 26px; }
  .chat-head { padding: 14px 16px; }
  .chat-body { padding: 14px; }
  .msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; }
  .chat-form { padding: 10px; }
  .thread { padding: 14px; border-radius: 20px; }

  .modal { align-items: flex-end; padding: 0; }
  .modal-box { width: 100%; max-height: 92dvh; border-radius: 28px 28px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: none; }
  .empty { padding: 20px; }
  .toast { width: auto; left: 16px; right: 16px; text-align: center; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
