:root {
  color-scheme: dark;
  --bg-0: #0a0b0d;
  --bg-1: #111316;
  --bg-2: #171a1f;
  --card: #1b1f25;
  --card-soft: #20252e;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #eff2f6;
  --muted: #9ba5b3;
  --accent: #1fce7a;
  --accent-press: #1aa866;
  --assistant-bubble: #242a34;
  --user-bubble: #22c46c;
  --danger: #e26767;
  --shadow-card: 0 14px 36px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.22);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  font-family: "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(circle at 30% -20%, rgba(39, 152, 101, 0.17) 0%, rgba(39, 152, 101, 0) 40%),
    radial-gradient(circle at 100% 0%, rgba(64, 92, 180, 0.2) 0%, rgba(64, 92, 180, 0) 35%),
    linear-gradient(180deg, #0c0e12 0%, #0a0b0d 100%);
  color: var(--text);
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

body.voice-overlay-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 880px);
  height: 100dvh;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 10px)
    10px
    calc(env(safe-area-inset-bottom, 0px) + 10px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.top-dock {
  display: grid;
  gap: 10px;
  min-height: 0;
  z-index: 10;
}

.topbar,
.status-strip,
.workbench-card,
.staged-files,
.composer,
.task-panel,
.panel,
.message-card {
  border: 1px solid var(--line);
}

.topbar,
.status-strip,
.workbench-card,
.staged-files,
.composer,
.task-panel,
.panel {
  background: linear-gradient(180deg, rgba(28, 32, 39, 0.88) 0%, rgba(17, 20, 25, 0.92) 100%);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-xl);
  padding: 10px 12px;
}

.header-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.session-title {
  min-width: 0;
}

.session-title h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.session-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-strip {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  overflow-x: auto;
}

.status-pill {
  flex: 1 0 auto;
  min-width: 102px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-align: center;
  font-size: 0.74rem;
}

.status-pill--profile {
  color: #b7ffce;
  border-color: rgba(82, 221, 145, 0.3);
}

.chat-shell {
  min-height: 0;
  overflow: hidden;
}

.chat-scroll {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px 10px;
  scroll-behavior: smooth;
}

.message-card {
  width: fit-content;
  max-width: min(84%, 660px);
  border-radius: 16px;
  padding: 8px 10px 9px;
  box-shadow: var(--shadow-soft);
}

.message-card--assistant {
  margin-right: auto;
  background: var(--assistant-bubble);
  border-top-left-radius: 6px;
}

.message-card--user {
  margin-left: auto;
  background: var(--user-bubble);
  border-color: rgba(41, 190, 110, 0.76);
  color: #08130e;
  border-top-right-radius: 6px;
}

.message-card--pending {
  opacity: 0.82;
}

.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.message-role {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.message-time {
  font-size: 0.7rem;
  color: rgba(226, 235, 245, 0.6);
}

.message-card--user .message-time {
  color: rgba(7, 37, 21, 0.58);
}

.message-body {
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

.message-body img,
.message-body video,
.message-body audio {
  width: 100%;
  display: block;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.message-body audio {
  min-height: 40px;
}

.message-caption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.message-card--user .message-caption {
  color: rgba(9, 45, 25, 0.7);
}

.message-model {
  margin-top: 8px;
  font-size: 0.74rem;
  color: rgba(170, 178, 193, 0.9);
}

.message-card--user .message-model {
  color: rgba(9, 45, 25, 0.62);
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.composer {
  position: relative;
  z-index: 20;
  display: grid;
  gap: 10px;
  border-radius: 16px;
  padding: 10px;
}

.workbench-card {
  border-radius: var(--radius-lg);
  padding: 12px;
  display: grid;
  gap: 10px;
  max-height: min(48vh, 420px);
  overflow: hidden;
}

.workbench-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.workbench-head__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workbench-title h2 {
  margin: 0;
  font-size: 0.96rem;
}

.workbench-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

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

.workbench-entry {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.82rem;
}

.workbench-entry.is-active {
  border-color: rgba(35, 214, 128, 0.45);
  color: #d7ffe9;
  background: rgba(31, 206, 122, 0.17);
}

.workbench-preview {
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.17);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.workbench-body {
  min-height: 140px;
  overflow-y: auto;
}

.workbench-section-title {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

.workbench-preview__line {
  font-size: 0.8rem;
  color: #dbe2ea;
}

.workbench-preview__line--muted {
  color: var(--muted);
}

.workbench-kv {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.workbench-actions-inline {
  display: flex;
  gap: 8px;
}

.workbench-actions-inline button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0 12px;
}

.workbench-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workbench-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
}

.workbench-row small {
  color: var(--muted);
}

.workbench-row--task {
  align-items: flex-start;
}

.workbench-row--task > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workbench-row--task strong,
.workbench-row--task small {
  display: block;
}

.workbench-empty {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
}

.workbench-task-active {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(31, 206, 122, 0.22);
  border-radius: 12px;
  background: rgba(31, 206, 122, 0.08);
  padding: 10px;
  font-size: 0.82rem;
}

.workbench-terminal {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 11, 15, 0.74);
  padding: 10px 12px;
  color: #d6e0ea;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.55;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.staged-files {
  border-radius: 13px;
  padding: 10px;
}

.section-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.staged-files__list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.file-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 9px;
}

.file-chip__meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.file-chip__name {
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chip__detail {
  font-size: 0.74rem;
  color: var(--muted);
}

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

.composer-input-wrap {
  min-width: 0;
}

.composer textarea,
.hold-voice-button {
  width: 100%;
  min-height: 40px;
  height: 40px;
  max-height: 132px;
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 9px 12px;
  background: #12161c;
  outline: none;
  line-height: 20px;
}

.composer textarea::placeholder {
  color: #7f8c9c;
}

.composer textarea:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(52, 209, 133, 0.6);
  box-shadow: 0 0 0 3px rgba(31, 206, 122, 0.16);
}

.plus-menu {
  position: relative;
}

.plus-menu summary {
  list-style: none;
}

.plus-menu summary::-webkit-details-marker {
  display: none;
}

.plus-button,
.voice-toggle-button,
.hold-voice-button,
.send-button,
.primary-button,
.ghost-button,
.file-chip__remove {
  border-radius: 12px;
}

.plus-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: #d9e2ee;
  font-weight: 800;
  font-size: 1.2rem;
}

.plus-menu[open] .plus-button {
  color: #fff;
  border-color: rgba(31, 206, 122, 0.6);
  background: rgba(31, 206, 122, 0.24);
}

.voice-toggle-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: #d9e2ee;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0;
}

.voice-toggle-button.is-active {
  border-color: rgba(31, 206, 122, 0.55);
  color: #cffff0;
  background: rgba(31, 206, 122, 0.14);
}

.hold-voice-button {
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 700;
  color: #eef3f8;
  background: #2b2f34;
  border-color: rgba(255, 255, 255, 0.08);
  touch-action: none;
}

.hold-voice-button.is-recording {
  background: #353a41;
  border-color: rgba(31, 206, 122, 0.4);
}

.hold-voice-button.is-disabled,
.hold-voice-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.hold-voice-button:active {
  background: #3b424b;
}

.plus-sheet {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(96vw, 360px);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, #1d2129 0%, #14181f 100%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 10px;
  display: grid;
  gap: 10px;
  animation: slideUp 0.18s ease;
}

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

.sheet-action--wide {
  grid-column: 1 / -1;
}

.sheet-action {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  text-align: center;
  display: grid;
  place-items: center;
}

.sheet-action__label {
  font-size: 0.78rem;
  color: #d7deea;
}

.send-button,
.primary-button {
  min-height: 42px;
  border: none;
  padding: 0 14px;
  background: var(--accent);
  color: #052414;
  font-weight: 700;
}

.send-button:active,
.primary-button:active {
  background: var(--accent-press);
}

.send-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.send-button.is-busy {
  box-shadow: inset 0 0 0 1px rgba(5, 36, 20, 0.14);
}

.ghost-button,
.file-chip__remove {
  min-height: 34px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0 11px;
}

.ghost-button--compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.composer-actions,
.panel-actions {
  display: grid;
  gap: 8px;
}

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

.composer-actions .ghost-button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding:
    max(18px, env(safe-area-inset-top, 0px))
    18px
    max(18px, env(safe-area-inset-bottom, 0px));
  background: rgba(3, 6, 10, 0.62);
  backdrop-filter: blur(8px);
  z-index: 70;
}

.overlay.active {
  display: flex;
}

html.ios-standalone .overlay {
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  overflow-y: visible;
  backdrop-filter: none;
  background: rgba(3, 6, 10, 0.82);
}

.panel {
  width: min(100%, 430px);
  margin: auto 0;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border-radius: 18px;
  padding: 16px;
}

html.ios-standalone .panel {
  position: relative;
  z-index: 1;
  max-height: none;
  overflow: visible;
  transform: translateZ(0);
}

.panel h2 {
  margin: 0;
  font-size: 1rem;
}

.panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.field span {
  color: var(--muted);
  font-size: 0.8rem;
}

.field input,
.field textarea,
.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #141a22;
  min-height: 42px;
  padding: 8px 10px;
  outline: none;
  font-size: 16px;
}

html.ios-standalone .field input,
html.ios-standalone .field textarea,
html.ios-standalone .field select {
  position: relative;
  z-index: 2;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.voice-message {
  min-width: 112px;
  width: var(--voice-width, auto);
  max-width: min(68vw, 220px);
  border: none;
  border-radius: 14px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  position: relative;
}

.message-card--user .voice-message {
  background: #30c86a;
  color: #072112;
}

.message-card--user .voice-message::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #30c86a;
  transform: translateY(-50%) rotate(45deg);
}

.voice-message__duration {
  font-size: 1rem;
  font-weight: 700;
}

.voice-message__wave {
  width: 28px;
  height: 16px;
  position: relative;
  display: inline-block;
}

.voice-message__wave::before,
.voice-message__wave::after {
  content: "";
  position: absolute;
  inset: 0;
  border-right: 3px solid currentColor;
  border-radius: 50%;
}

.voice-message__wave::after {
  right: 8px;
  left: 8px;
  opacity: 0.6;
}

.voice-message.is-playing .voice-message__wave::before {
  animation: voiceWave 0.9s ease-in-out infinite;
}

.voice-message.is-playing .voice-message__wave::after {
  animation: voiceWave 0.9s ease-in-out infinite reverse;
}

.voice-recording-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    16px
    max(24px, env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(6px);
}

.voice-recording-overlay__bubble {
  display: flex;
  justify-content: center;
  margin: auto 0 120px;
  pointer-events: none;
}

.voice-recording-overlay__preview {
  min-width: 148px;
  min-height: 84px;
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, #96efae 0%, #69d886 100%);
  color: #052414;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
  position: relative;
}

.voice-recording-overlay__preview::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: #79e38f;
  border-radius: 4px;
  transform: translateX(-50%) rotate(45deg);
}

.voice-recording-wave {
  display: inline-flex;
  align-items: end;
  gap: 4px;
  height: 32px;
}

.voice-recording-wave span {
  width: 4px;
  border-radius: 999px;
  background: rgba(5, 36, 20, 0.86);
  animation: voiceMeter 1s ease-in-out infinite;
}

.voice-recording-wave span:nth-child(1),
.voice-recording-wave span:nth-child(7) {
  height: 12px;
  animation-delay: -0.34s;
}

.voice-recording-wave span:nth-child(2),
.voice-recording-wave span:nth-child(6) {
  height: 18px;
  animation-delay: -0.22s;
}

.voice-recording-wave span:nth-child(3),
.voice-recording-wave span:nth-child(5) {
  height: 26px;
  animation-delay: -0.12s;
}

.voice-recording-wave span:nth-child(4) {
  height: 32px;
}

#voiceTranscribeTarget {
  display: none !important;
}

.voice-recording-overlay__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  justify-items: center;
}

.voice-recording-target {
  width: min(220px, 74vw);
  min-height: 64px;
  border-radius: 999px;
  background: rgba(28, 30, 34, 0.92);
  color: #f3f5f8;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 18px;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 0.16s ease, background 0.16s ease;
}

.voice-recording-target.is-active {
  transform: translateY(-8px) scale(1.03);
  background: rgba(54, 58, 64, 0.96);
}

.voice-recording-overlay__footer {
  margin-top: 18px;
  text-align: center;
  color: #f6f7f8;
  font-size: 1rem;
  font-weight: 700;
}

.panel-note {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.error-text {
  min-height: 18px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: #ff8f8f;
}

.task-panel {
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(204, 230, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
}

.task-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.task-panel__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #d7e3f3;
}

.task-panel__state {
  font-size: 0.76rem;
  font-weight: 700;
  color: #8effbf;
  text-transform: capitalize;
}

.task-panel__summary {
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

.task-panel__meta {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

.task-panel__stop {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  border: none;
  border-radius: 10px;
  background: #cc4a4a;
  color: #fff;
  font-weight: 700;
}

.task-panel__stop:disabled {
  opacity: 0.5;
}

.task-step-list {
  display: grid;
  gap: 8px;
}

.task-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.task-step summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: #dbe4ef;
}

.task-step summary::-webkit-details-marker {
  display: none;
}

.task-step pre {
  margin: 0;
  padding: 0 12px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c7d3e1;
  font-size: 0.76rem;
  line-height: 1.5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.task-panel[data-state="failed"] .task-panel__state,
.task-panel[data-state="cancelled"] .task-panel__state,
.task-panel[data-state="cancelling"] .task-panel__state {
  color: #ff9999;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes voiceWave {
  0%,
  100% {
    transform: scaleY(0.85);
    opacity: 0.45;
  }
  50% {
    transform: scaleY(1.15);
    opacity: 1;
  }
}

@keyframes voiceMeter {
  0%,
  100% {
    transform: scaleY(0.72);
    opacity: 0.54;
  }
  50% {
    transform: scaleY(1.12);
    opacity: 1;
  }
}

@media (max-width: 740px) {
  .app-shell {
    padding:
      calc(env(safe-area-inset-top, 0px) + 8px)
      8px
      calc(env(safe-area-inset-bottom, 0px) + 8px);
    gap: 8px;
  }

  .chat-scroll {
    gap: 7px;
  }
}

@media (max-width: 480px) {
  .status-strip {
    padding: 7px;
  }

  .status-pill {
    min-width: 88px;
    font-size: 0.72rem;
  }

  .session-title h1 {
    font-size: 0.95rem;
  }

  .message-card {
    max-width: 88%;
    padding: 7px 9px 8px;
  }

  .message-body {
    font-size: 0.9rem;
  }

  .composer-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 6px;
  }

  .composer textarea,
  .hold-voice-button {
    min-height: 40px;
    height: 40px;
    padding: 9px 10px;
  }

  .plus-button,
  .voice-toggle-button,
  .hold-voice-button,
  .send-button {
    height: 40px;
    min-height: 40px;
  }

  .plus-sheet {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
    width: auto;
    max-width: none;
  }

  .voice-recording-overlay__bubble {
    margin-bottom: 104px;
  }

  .voice-recording-overlay__preview {
    min-width: 136px;
    min-height: 76px;
    padding: 16px 18px;
  }

  .sheet-action {
    min-height: 62px;
  }

  .sheet-action__label {
    font-size: 0.74rem;
  }

  .composer-actions {
    grid-template-columns: 1fr;
  }
}

.memory-viewer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.memory-viewer h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.memory-viewer p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.memory-viewer__empty {
  color: var(--muted);
  font-size: 0.82rem;
}

.memory-viewer__list {
  display: grid;
  gap: 10px;
}

.memory-viewer__item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.memory-viewer__item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.memory-viewer__item small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.memory-viewer__item pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
}
