:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  --outer: #09090b;
  --surface: #030304;
  --text: #f6f5f7;
  --secondary: #aaa8b2;
  --side: clamp(22px, 7.1vw, 40px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--outer); }
button, textarea { color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, #thread:focus-visible { outline: 2px solid #d7d1f6; outline-offset: -2px; }

.shell {
  isolation: isolate;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
  height: 100vh;
  height: var(--visible-h, 100dvh);
  margin: auto;
  overflow: hidden;
  background: var(--surface);
}
#wave-canvas, #rim-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#conversation { display: contents; }
.bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  min-height: calc(53px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--side) 0;
  font-size: 12px;
  color: var(--secondary);
}
.bar button { min-height: 44px; min-width: 44px; padding: 0; text-align: right; }
#pair { position: relative; margin: auto var(--side); }
#pair h1 { margin: 0; font-size: clamp(28px, 8vw, 40px); letter-spacing: -.035em; }
#pair p { max-width: 24em; color: var(--secondary); line-height: 1.6; }

.utterance {
  position: relative;
  display: grid;
  flex: 0 0 73%;
  place-items: center;
  min-height: 0;
  pointer-events: none;
  transition: flex-basis 480ms cubic-bezier(.22,.72,.17,1);
}
.type-origin {
  font-size: clamp(36px, 13vw, 68px);
  font-weight: 560;
  letter-spacing: -.067em;
  line-height: 1.19;
  white-space: nowrap;
  transition: font-size 440ms cubic-bezier(.22,.72,.17,1);
}
#prompt { margin: 0; font: inherit; letter-spacing: inherit; color: #f5f4f7; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  #prompt {
    background-image: linear-gradient(109deg, #faf9fb 0%, #f7f8fb 19%, #dde9fc 26%, #9ccaff 31%, #aea5fc 36%, #e5addd 41%, #ffe6e3 45%, #fffaf6 49%, #f7f6f8 62%, #f4f5fb 72%, #acc9f8 77%, #b2aaf3 81%, #ebc1dc 85%, #f8e7e8 89%, #f8f6f8 93%, #faf9fb 100%);
    background-size: 200% 100%;
    background-position: 65% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: ink-drift 12.5s linear infinite;
  }
}
@keyframes ink-drift { from { background-position: 65% 50%; } to { background-position: 265% 50%; } }
.has-thread .utterance { flex-basis: 19%; }
.has-thread .type-origin { font-size: clamp(26px, 7.8vw, 37px); }
.talk {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  margin-inline: var(--side);
}
.stream { width: 100%; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; padding-inline: 1px; scrollbar-width: thin; }
.turn { padding: 8px 0; max-width: 94%; }
.turn.mine { margin-left: auto; width: fit-content; text-align: right; }
.meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.meta b { font-weight: 500; }
.mine .meta { justify-content: flex-end; }
.body { margin: 4px 0 0; white-space: pre-wrap; font-size: 16px; line-height: 1.5; }
.mine .body { color: var(--secondary); }
.receipt { margin: 8px 0; font-size: 14px; line-height: 1.55; color: #c7c6cf; white-space: pre-wrap; }
.receipt span { display: block; }
#thread button, #reply button { min-height: 44px; padding-inline: 2px; font-size: 13px; color: #e5e2ed; }
#older { display: block; margin-inline: auto; }
.tray {
  position: relative;
  z-index: 2;
  flex: none;
  margin-inline: var(--side);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.context { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--secondary); }
.context span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.context button { flex: none; }
.tray form { position: relative; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #49484f; }
.tray form:focus-within { border-color: #bab9c5; }
.tray textarea {
  flex: 1;
  min-width: 0;
  height: 49px;
  padding: 11px 0 12px;
  resize: none;
  white-space: pre;
  overflow: auto;
  scrollbar-width: none;
  border: 0;
  border-radius: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: #eeedf0;
  font-size: 17px;
  line-height: 1.5;
}
.tray textarea::placeholder { color: var(--secondary); }
.action, .send { display: flex; flex: none; align-items: center; justify-content: center; }
.send { min-width: 44px; min-height: 44px; padding: 0; }
.send:disabled { opacity: .42; }
#notice {
  position: absolute;
  z-index: 4;
  left: var(--side);
  right: var(--side);
  top: calc(env(safe-area-inset-top, 0px) + 50px);
  padding: 8px 14px;
  border-radius: 10px;
  background: #1a1a20;
  color: #ecebf0;
  font-size: 13px;
  line-height: 1.5;
}
[data-landing-copy] {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  width: max-content;
  white-space: pre;
  pointer-events: none;
  user-select: none;
  transform-origin: left center;
  will-change: transform;
}
[data-landing-seat] > .body { opacity: 0; }
[data-input].landing-departing::placeholder { opacity: 0; }
@media (max-height: 640px) {
  .bar { min-height: calc(44px + env(safe-area-inset-top, 0px)); }
  .utterance { flex-basis: 55%; }
  .has-thread .utterance { flex-basis: 13%; }
  .turn { padding-block: 5px; }
  .tray { padding-bottom: max(7px, env(safe-area-inset-bottom)); }
  .tray textarea { height: 44px; padding-block: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  #prompt { color: CanvasText; background: none; -webkit-text-fill-color: CanvasText; }
}

#mobile-nav {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: none;
  margin: -3px var(--side) 0;
  border-bottom: 1px solid #25242a;
}
#mobile-nav button {
  display: flex;
  min-width: 0;
  min-height: 45px;
  padding: 2px;
  align-items: center;
  justify-content: center;
  flex-direction:column;
  gap:1px;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 500;
}
#mobile-nav button[aria-current] { color: var(--text); box-shadow: inset 0 -2px #c1b9e1; }
.open-count {
  color: #b6b1c3;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
#board { display:flex; flex:1; flex-direction:column; min-height:0; position:relative; margin-inline:var(--side); }
.board-head { flex:none; padding:clamp(13px,3vh,28px) 0 9px; }
#board-title { margin:0; font-size:clamp(26px,8vw,39px); font-weight:550; letter-spacing:-.04em; }
#board-sync, #board-status, .board-meta { color:var(--secondary); font-size:13px; line-height:1.5; }
#board-sync { margin:5px 0 0; }
#board-filters { display:flex; flex-wrap:wrap; gap:2px 6px; margin:10px 0 0; }
#board-filters button { min-height:44px; padding:4px 10px; border-radius:7px; color:var(--secondary); font-size:14px; }
#board-filters button[aria-pressed="true"] { background:#25232d; color:#f3effa; }
#board-filters .group-count { margin-left:4px; font-size:12px; font-variant-numeric:tabular-nums; }
#board-scroll { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; padding:0 1px max(20px,env(safe-area-inset-bottom)); outline-offset:-2px; }
.board-item { border-top:1px solid #2c2b31; }
.board-row-head { position:relative; }
.board-disclosure { display:flex; align-items:center; gap:9px; width:100%; min-height:64px; padding:12px 1px 12px 0; text-align:left; }
.board-disclosure::after { content:'›'; flex:none; color:#bbb7c7; font-size:18px; line-height:1.3; }
.board-disclosure[aria-expanded="true"]::after { transform:rotate(90deg); }
.board-summary { min-width:0; flex:1; overflow-wrap:anywhere; }
.board-item-name { display:block; font-size:16px; line-height:1.45; font-weight:550; }
.board-meta { display:block; margin:3px 0 0; }
.board-label { max-width:36%; overflow-wrap:anywhere; color:#c9c5d4; font-size:12px; line-height:1.55; padding:2px 0; }
#swipe-hint { margin:6px 0 0; color:var(--secondary); font-size:12px; line-height:1.5; }
.swipe-header { --slot:clamp(80px,23vw,104px); --reveal:0px; --status-alpha:1; overflow:hidden; }
.swipe-header .board-disclosure { display:grid; grid-template-columns:minmax(0,1fr) calc(var(--slot) - 26px) 8px;
  column-gap:9px; min-height:72px; touch-action:pan-y pinch-zoom; user-select:none; -webkit-user-select:none; }
.swipe-header .board-item-name { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.swipe-header .board-disclosure[aria-expanded="true"] .board-item-name { display:block; overflow:visible; }
.swipe-header .board-label { max-width:none; text-align:right; }
.swipe-header .board-label, .swipe-header .board-disclosure::after { opacity:var(--status-alpha); transition:opacity .19s; }
.swipe-header.dragging .board-label, .swipe-header.dragging .board-disclosure::after { transition:none; }
.swipe-action { --tone:#33304e; --light:#686287; --glow:#628baf; --tint:#b782ab;
  position:absolute; z-index:1; inset:0 0 0 auto; isolation:isolate; overflow:hidden; width:var(--slot); height:100%;
  display:flex; align-items:center; justify-content:center; gap:5px; padding:0 3px;
  border:0; border-radius:0; appearance:none; background:var(--tone); color:#fff; font-size:15px; font-weight:600;
  clip-path:inset(0 0 0 calc(100% - var(--reveal))); transition:clip-path .28s cubic-bezier(.2,.8,.23,1); }
.swipe-header.dragging .swipe-action { transition:none; }
.swipe-header[data-operation="delete"] .swipe-action { --tone:#702535; --light:#ad4e60; --glow:#c56a69; --tint:#be567e; }
.swipe-action svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.swipe-action::before, .swipe-action::after { content:''; position:absolute; pointer-events:none; z-index:-1; }
.swipe-action::before { inset:-70%; opacity:.83; background:
  radial-gradient(ellipse at 27% 27%,var(--glow) 0%,transparent 46%),
  radial-gradient(ellipse at 76% 58%,var(--tint) 0%,transparent 47%),
  linear-gradient(123deg,var(--tone) 15%,var(--light) 52%,var(--tone) 94%); }
.swipe-action::after { inset:-70%; opacity:.65; background:linear-gradient(112deg,transparent 22%,#fff1 38%,#fff4 49%,transparent 60%);
  mix-blend-mode:screen; }
.swipe-header.in-view.showing-swipe .swipe-action::before { animation:swipe-color-current 4.8s ease-in-out infinite alternate; }
.swipe-header.in-view.showing-swipe .swipe-action::after { animation:swipe-light-current 3.4s ease-in-out infinite alternate; }
@keyframes swipe-color-current {
  from { transform:translate(-14%,-10%) rotate(-18deg); }
  to { transform:translate(16%,10%) rotate(21deg); }
}
@keyframes swipe-light-current {
  from { transform:translate(-20%,4%) rotate(5deg); }
  to { transform:translate(20%,-8%) rotate(-8deg); }
}
body.board-asleep .swipe-action::before, body.board-asleep .swipe-action::after { animation-play-state:paused !important; }
.swipe-action:focus-visible { outline-offset:-3px; }
#calendar-delete { width:min(100%,480px); max-height:85dvh; margin:auto auto 0; padding:22px max(22px,var(--side)) max(22px,env(safe-area-inset-bottom));
  overflow:auto; color:var(--text); background:#19171d; border:1px solid #37333a; border-radius:18px 18px 0 0; }
#calendar-delete::backdrop { background:rgb(0 0 0 / .68); }
#calendar-delete h2 { font-size:20px; margin:0 0 16px; }
#calendar-delete p { margin:5px 0; overflow-wrap:anywhere; }
#calendar-delete-time, #calendar-delete-scope { color:#c9c5cf; font-size:14px; }
#calendar-delete form { display:flex; gap:10px; margin-top:18px; }
#calendar-delete button { flex:1; min-height:46px; background:#322f39; border-radius:8px; }
#calendar-delete button[value="delete"] { background:#793144; color:white; }
.board-detail { padding:0 0 12px; overflow-wrap:anywhere; }
.board-detail p { margin:0 0 5px; color:#d1cfd8; white-space:pre-wrap; font-size:14px; line-height:1.6; }
.board-controls { display:flex; flex-wrap:wrap; gap:2px 12px; }
.board-controls button, #board-more { min-height:44px; color:#e2dbf4; padding:5px 2px; font-size:14px; }
.board-controls button[disabled] { color:var(--secondary); }
#board-more { display:block; margin:0 auto; }
#board-status:empty { display:none; }
body[data-view="personal"] #notice, body[data-view="work"] #notice { top:auto; bottom:max(12px,env(safe-area-inset-bottom)); }
@media(max-width:385px) {
  #board-filters { gap:2px; }
  #board-filters button { padding-inline:5px; font-size:13px; }
  #board-filters .group-count { font-size:11px; margin-left:3px; }
}
@media(max-height:500px) {
  .utterance {flex-basis:39%;}
  .has-thread .utterance {flex-basis:8%;}
  .board-head {padding-top:6px;}
  #board-filters {margin-top:2px;}
}
@media(forced-colors:active) {
  #mobile-nav button[aria-current], #board-filters button[aria-pressed="true"] { outline:2px solid Highlight; outline-offset:-3px; }
}
