:root {
  color-scheme: dark;
  --bg: #101010; --surface: #191919; --raised: #242424; --rule: #424242;
  --text: #f5f5f5; --muted: #b4b4b4; --sans: Barlow, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 42px);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); font: 16px/1.45 var(--sans); overflow-wrap: anywhere; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 2px solid white; outline-offset: 3px; }
h1, h2, h3, p, ul, ol { margin: 0; }
p:empty, [hidden] { display: none !important; }
.app {
  width: min(100%, 800px); margin: auto; min-height: 100svh;
  padding: max(0px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.brandbar { display: flex; min-height: 68px; justify-content: space-between; align-items: center; gap: 14px; border-bottom: 1px solid var(--rule); }
.brand { display: flex; gap: 11px; align-items: center; font-size: 20px; font-weight: 750; letter-spacing: -.055em; }
.logo { display: block; width: 48px; height: 30px; object-fit: contain; }
.connection { display: flex; align-items: center; gap: 6px; font: 11px/1.4 var(--mono); color: var(--muted); }
.connection i { width: 8px; height: 8px; border: 1px solid #999; border-radius: 50%; }
.connection[data-state="ready"] i { background: var(--text); border-color: var(--text); }
.boot { display: grid; justify-items: start; gap: 16px; padding: 45px 0; color: var(--muted); }
.pair-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(22px, 6vw, 65px); padding: clamp(45px, 11vh, 110px) 0; }
.pair-intro h1 { font-size: clamp(40px, 6vw, 62px); line-height: .99; font-weight: 650; letter-spacing: -.065em; margin: 0 0 17px; }
.pair-intro p, .helper, .sub, .empty { color: var(--muted); font-size: 14px; }
.pair-card { display: grid; gap: 13px; border: 1px solid var(--rule); border-radius: 10px; padding: 22px; background: var(--surface); }
.pair-card label, .composer label { font-size: 14px; font-weight: 620; }
.pair-card input, .composer textarea { background: #111; border: 1px solid var(--rule); border-radius: 5px; padding: 10px 12px; width: 100%; min-width: 0; font-size: 16px; }
.pair-card input { min-height: 46px; }
.primary, .secondary, .text-button { min-height: 44px; border-radius: 5px; border: 0; padding: 8px 14px; font-size: 14px; font-weight: 650; }
.primary { background: var(--text); color: #101010; }
.primary:not(:disabled):hover { background: #d4d4d4; }
.secondary { background: transparent; border: 1px solid var(--rule); }
.secondary:hover, .text-button:hover, .tabs button:hover { background: #282828; }
.text-button { background: transparent; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.notice:not(:empty) { padding: 9px 12px; border-left: 2px solid #bbb; background: var(--raised); color: #dedede; font-size: 14px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-bottom: 1px solid var(--rule); }
.tabs button { min-width: 0; min-height: 47px; padding: 7px 3px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 570; }
.tabs button[aria-current="page"] { color: white; border-bottom-color: white; }
.panel { padding: 0 0 15px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 20px; }
.panel-heading h1 { font-size: clamp(34px, 6vw, 48px); font-weight: 650; line-height: .99; letter-spacing: -.07em; }
.sub { margin-top: 6px; }
.data-body { display: grid; gap: 21px; }
.group-heading, .section-label h2 { font: 600 14px/1.4 var(--sans); color: #c9c9c9; }
#goal-list { margin-top: 6px; }
.goal-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--rule); }
.goal-type, .meta, .data-stamp, .chat-byline, .tag { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.goal-card h3 { font-size: clamp(17px, 3.8vw, 23px); line-height: 1.17; margin-top: 2px; font-weight: 620; letter-spacing: -.035em; }
.countdown { display: grid; justify-items: end; gap: 0; font-size: 12px; color: var(--muted); }
.countdown b { font-size: clamp(25px, 5vw, 35px); font-variant-numeric: tabular-nums; font-weight: 620; letter-spacing: -.05em; line-height: 1; color: var(--text); }
.goal-card[data-role="main"] .countdown b { font-size: 21px; }
.session { border: 1px solid var(--rule); background: var(--surface); border-radius: 9px; padding: 17px 19px; display: grid; gap: 7px; }
.section-label { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--rule); border-radius: 20px; padding: 2px 7px; }
.tag:empty { display: none; }
.session h3 { font-size: clamp(23px, 4vw, 32px); line-height: 1.14; font-weight: 620; letter-spacing: -.045em; }
.session p { color: #d8d8d8; }
.data-stamp { font-size: 11px; }
.week-list, .plain-list { list-style: none; padding: 0; }
.week-list li, .plain-list li { padding: 12px 0; border-top: 1px solid var(--rule); }
.week-list li { display: grid; grid-template-columns: 80px 1fr; gap: 3px 11px; }
.week-list time { grid-row: span 2; color: var(--muted); font: 12px var(--mono); margin-top: 4px; }
.week-list strong { font-weight: 620; }
.week-list p, .activity-line span { font-size: 14px; color: var(--muted); }
.activity-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.data-detail { border-top: 1px solid var(--rule); color: var(--muted); font-size: 14px; }
.data-detail summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
.data-detail ul:not(.plain-list) { padding-left: 18px; margin: 0; }
.chat-panel { display: flex; flex-direction: column; height: min(920px, calc(100dvh - 132px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); min-height: 350px; padding: 0; }
.chat-scroller { min-height: 65px; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 12px 2px 17px; scrollbar-width: thin; scrollbar-color: #4b4b4b transparent; }
.chat-scroller:focus-visible { outline-offset: 0; }
.chat-scroller .empty { padding: 12px 0; }
#chat-messages { display: grid; gap: 20px; }
.chat-item { display: grid; gap: 5px; min-width: 0; max-width: 94%; justify-self: start; }
.chat-item[data-role="user"] { justify-self: end; max-width: 86%; }
.chat-byline { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.chat-byline strong { color: var(--text); font-weight: 610; }
.chat-item[data-role="user"] .chat-byline { justify-content: end; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.chat-item[data-role="user"] .chat-text { background: #2a2a2a; padding: 8px 13px; border-radius: 10px 10px 3px 10px; }
.composer { flex: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 9px; padding: 11px 13px; display: grid; gap: 7px; }
.composer textarea { min-height: 50px; max-height: 21vh; resize: vertical; line-height: 1.35; }
.composer textarea[readonly] { color: var(--muted); }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.delivery { font-size: 13px; color: var(--muted); }
.composer-actions .primary { margin-left: auto; flex-shrink: 0; }
.composer .text-button { padding: 0 3px; justify-self: start; text-align: left; }
@media (max-width: 600px) {
  .brandbar { min-height: 56px; }
  .pair-layout { grid-template-columns: 1fr; gap: 24px; padding: 34px 0; }
  .pair-card { padding: 18px; }
  .panel-heading { margin: 20px 0 15px; }
  .data-body { gap: 16px; }
  .week-list li { grid-template-columns: 70px 1fr; }
  .chat-panel { height: calc(100dvh - 119px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 310px; }
  .chat-item, .chat-item[data-role="user"] { max-width: 95%; }
  .chat-byline { font-size: 11px; }
}
@media (max-height: 570px) {
  .chat-panel { min-height: 260px; }
  .chat-panel .panel-heading { margin: 8px 0 5px; }
  .chat-panel .panel-heading h1 { font-size: 27px; }
  .chat-panel .sub { display: none; }
  .composer textarea { min-height: 44px; }
}
