﻿:root {
  --paper: #f5f2ec;
  --sidebar: #efebe4;
  --surface: rgba(255, 254, 251, 0.86);
  --surface-solid: #fffefb;
  --surface-muted: #f8f5ef;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --muted-soft: #918d86;
  --line: rgba(60, 60, 67, 0.14);
  --line-strong: rgba(60, 60, 67, 0.2);
  --olive: #66715c;
  --rust: #a66f55;
  --blue-gray: #607987;
  --danger: #b0524d;
  --focus-ring: rgba(102, 113, 92, 0.42);
  --shadow-xs: 0 1px 2px rgba(42, 37, 30, 0.04);
  --shadow-sm: 0 6px 18px rgba(42, 37, 30, 0.055);
  --shadow-md: 0 14px 38px rgba(42, 37, 30, 0.085);
  --shadow-lg: 0 28px 80px rgba(31, 27, 22, 0.18);
  --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.92), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(118, 145, 174, 0.055), transparent 26%),
    radial-gradient(circle at 68% 88%, rgba(190, 151, 112, 0.05), transparent 30%),
    linear-gradient(180deg, #f8f6f1 0%, var(--paper) 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body[data-current-view="signal"] .home-main,
body[data-current-view="image"] .home-main { place-items: start center; }

body[data-current-view="signal"] {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overflow-anchor: none;
}

html:has(body[data-current-view="signal"]) {
  overflow: hidden;
}

body[data-current-view="signal"] .home-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

body[data-current-view="signal"] .home-main {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  scrollbar-width: none;
}

body[data-current-view="signal"] .home-main::-webkit-scrollbar {
  display: none;
}

body[data-current-view="home"] {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body[data-current-view="home"] .home-shell,
body[data-current-view="home"] .home-sidebar,
body[data-current-view="home"] .home-main {
  height: 100%;
  min-height: 0;
}

body[data-current-view="home"] .home-main {
  overflow: hidden;
}

body[data-current-view="home"] .home-content {
  height: 100%;
  min-height: calc(100vh - 60px);
}

body[data-current-view="home"] .home-content {
  width: min(100%, 1080px);
}

body[data-current-view="home"] .brand-hero {
  padding-top: clamp(125px, 14dvh, 162px);
}

body[data-current-view="home"] .hero-brand-mark {
  width: clamp(92px, 10dvh, 110px);
  height: clamp(92px, 10dvh, 110px);
  border-radius: 28px;
}

body[data-current-view="home"] .brand-hero h1 {
  margin-top: clamp(16px, 2.1dvh, 24px);
  font-size: clamp(2rem, 4.4dvh, 2.9rem);
}

body[data-current-view="home"] .brand-hero + .sample-cards {
  width: min(100%, calc(clamp(20.25rem, 45dvh, 29.7rem) + 96px));
  justify-content: space-between;
  gap: 0;
  margin-top: clamp(26px, 3.3dvh, 37px);
}

body[data-current-view="home"] .sample-card {
  width: 96px;
  min-height: 96px;
  gap: 11px;
}

body[data-current-view="home"] .home-chat {
  width: min(100%, clamp(560px, calc(53vw - 127px), 920px));
  margin-bottom: 30px;
  padding-top: clamp(18px, 3dvh, 32px);
}

body[data-current-view="home"] .home-composer textarea {
  min-height: 24px;
}

body[data-current-view="home"] .home-composer {
  padding: 6px 8px;
  border-radius: 999px;
}

body[data-current-view="home"] .home-content.chat-started .brand-hero {
  padding-top: 20px;
}

body[data-current-view="home"] .home-content.chat-started .hero-brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

body[data-current-view="home"] .home-content.chat-started .mark-face {
  font-size: 2rem;
}

body[data-current-view="home"] .home-content.chat-started .mark-dot {
  right: 10px;
  top: 10px;
  width: 5px;
  height: 5px;
}

body[data-current-view="home"] .home-content.chat-started .brand-hero h1 {
  margin-top: 12px;
  font-size: 1.35rem;
}

.home-shell { width: 100%; min-height: 100vh; display: flex; }

.home-sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-height: 100vh;
  padding: 35px 28px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.tinker-brand { display: inline-flex; align-items: center; gap: 10px; padding: 0 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.tinker-brand:focus-visible { outline: 2px solid rgba(114, 123, 98, 0.62); outline-offset: 5px; }
.tinker-brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1.25px solid var(--ink); border-radius: 8px 8px 8px 3px; font: 600 19px/1 Georgia, serif; transform: rotate(-6deg); }
.tinker-brand-name {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", sans-serif;
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
}

.sample-nav { display: grid; gap: 7px; margin-top: 70px; }
.sample-nav-item { position: relative; min-height: 42px; display: flex; align-items: center; gap: 13px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 0.92rem; text-decoration: none; transition: color 150ms ease, background-color 150ms ease; }
.sample-nav-item:hover { color: var(--ink); background: rgba(255, 255, 255, 0.42); }
.sample-nav-item.active { color: var(--ink); background: rgba(255, 255, 255, 0.68); }
.sample-nav-item:focus-visible { outline: 2px solid rgba(114, 123, 98, 0.62); outline-offset: 2px; }
.category-icon {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-image: var(--category-icon);
  mask-image: var(--category-icon);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.icon-signal { --category-icon: url("/static/icons/bar-chart-2.svg"); }
.icon-image { --category-icon: url("/static/icons/image.svg"); }
.icon-manual { --category-icon: url("/static/icons/book-open.svg"); }
.nav-item-icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--olive); }

.home-main { min-width: 0; flex: 1; display: grid; place-items: center; padding: 30px 38px; }
.home-content { width: min(100%, 980px); min-height: calc(100vh - 60px); display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.brand-hero { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; flex: 0 0 auto; padding-top: clamp(108px, 15vh, 166px); }
.hero-brand-mark { position: relative; width: 92px; height: 92px; display: grid; place-items: center; margin-inline: auto; transform: translate(-3px, -4px); border: 1px solid rgba(93, 102, 81, 0.28); border-radius: 26px; background: linear-gradient(145deg, #fbfaf7, #e6e2da); box-shadow: 0 18px 44px rgba(47, 48, 43, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.85); }
.mark-face { font: 500 3.45rem/1 Georgia, "Times New Roman", serif; color: var(--olive); transform: translateY(-2px); }
.mark-dot { position: absolute; right: 17px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--rust); }
.brand-hero h1 {
  margin: 21px 0 0;
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Segoe UI", sans-serif;
  font-size: clamp(2.15rem, 4vw, 2.85rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.055em;
}

.sample-cards { width: fit-content; display: grid; grid-template-columns: repeat(3, 96px); gap: 8px; align-self: center; }
.brand-hero + .sample-cards { margin-top: 28px; }
.sample-card {
  width: 96px;
  min-height: 96px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 12px 8px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
  text-align: center;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 120ms var(--ease-apple),
    background-color 180ms var(--ease-apple),
    box-shadow 180ms var(--ease-apple);
}
.sample-card:hover,
.sample-card:focus-visible {
  background: rgba(255, 255, 255, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(60, 60, 67, 0.065),
    0 3px 12px rgba(42, 37, 30, 0.035);
}
.sample-card:active {
  transform: scale(0.985);
  background: rgba(255, 255, 255, 0.64);
}

.sample-card h2 {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.card-icon { width: 35px; height: 32px; color: inherit; }

/* Codex-like home composer */
.home-chat { width: min(100%, 900px); margin: auto auto 0; padding-top: 32px; }
.home-chat-messages { display: grid; gap: 28px; max-height: min(56vh, 560px); margin-bottom: 12px; overflow: auto; padding: 8px 4px 16px; scroll-behavior: smooth; }
.home-chat-message { color: var(--ink); font-size: 1rem; line-height: 1.72; white-space: pre-wrap; }
.home-chat-message-user { justify-self: end; max-width: min(68%, 620px); padding: 11px 16px; border: 0; border-radius: 20px; background: #f1f1f1; }
.home-chat-message-attachment { display: block; width: min(100%, 280px); max-height: 260px; margin: 0 0 9px; border-radius: 14px; object-fit: cover; }
.home-chat-message-file { display: inline-flex; align-items: center; max-width: 100%; margin: 0 0 8px; padding: 7px 10px; border: 1px solid rgba(60, 60, 67, .12); border-radius: 9px; color: var(--muted); background: rgba(255, 255, 255, .48); font-size: .76rem; line-height: 1.3; }
.home-chat-message-assistant { justify-self: start; width: 100%; max-width: 100%; padding: 0 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.home-chat-message.is-error { color: #8d5542; background: transparent; }
.home-composer { position: relative; min-height: 56px; display: flex; align-items: center; gap: 5px; padding: 6px 8px; border: 1px solid #d9d5cc; border-radius: 999px; background: rgba(255, 255, 255, .88); box-shadow: 0 14px 36px rgba(47, 48, 43, .09), 0 2px 5px rgba(47, 48, 43, .04); }
.home-chat-input,
.home-composer textarea { min-width: 0; width: auto; min-height: 24px; max-height: 112px; flex: 1; resize: none; padding: 8px 7px; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; font-size: .94rem; line-height: 1.45; }
.home-composer textarea::placeholder { color: #b7b4ae; }
.home-chat-attachment { position: absolute; left: 14px; bottom: calc(100% + 8px); z-index: 2; max-width: min(100%, 360px); display: inline-flex; align-items: center; gap: 7px; padding: 6px 7px 6px 11px; border: 1px solid #ddd8cf; border-radius: 999px; color: #686e69; background: #f7f5ef; box-shadow: var(--shadow-xs); font-size: .7rem; }
.home-chat-attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-chat-attachment button { width: 20px; height: 20px; flex: 0 0 20px; padding: 0; border: 0; border-radius: 50%; color: #8e8a82; background: transparent; font-size: 1rem; line-height: 1; cursor: pointer; }
.home-chat-attachment button:hover { color: var(--ink); background: rgba(37, 42, 45, .08); }
.home-composer-add,
.home-model-trigger,
.home-model-option,
.home-voice,
.home-send { border: 0; font: inherit; cursor: pointer; }
.home-composer-add { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; }
.home-composer-add svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.home-composer-add:hover { color: var(--ink); background: rgba(60, 60, 67, .075); }
.home-composer-controls { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.home-model-picker { position: relative; }
.home-model-trigger { min-height: 36px; max-width: 210px; display: flex; align-items: center; gap: 5px; padding: 0 10px 0 12px; border-radius: 999px; color: var(--muted-soft); background: transparent; font-size: .76rem; white-space: nowrap; }
.home-model-trigger span { overflow: hidden; text-overflow: ellipsis; }
.home-model-trigger svg { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 160ms var(--ease-apple); }
.home-model-trigger:hover,
.home-model-picker.is-open .home-model-trigger { color: var(--muted); background: rgba(60, 60, 67, .07); }
.home-model-picker.is-open .home-model-trigger svg { transform: rotate(180deg); }
.home-model-menu { position: absolute; right: 0; bottom: calc(100% + 10px); z-index: 20; width: max-content; min-width: 250px; display: grid; gap: 3px; padding: 6px; border: 1px solid rgba(60, 60, 67, .12); border-radius: 16px; color: var(--ink); background: rgba(255, 254, 251, .94); box-shadow: 0 18px 48px rgba(42, 37, 30, .14), inset 0 1px rgba(255, 255, 255, .9); backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px); opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(5px) scale(.98); transform-origin: right bottom; transition: opacity 150ms var(--ease-apple), transform 150ms var(--ease-apple), visibility 150ms; }
.home-model-picker.is-open .home-model-menu { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }
.home-model-option { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 10px; border-radius: 10px; color: var(--ink); background: transparent; font-size: .78rem; text-align: left; white-space: nowrap; }
.home-model-option:hover,
.home-model-option:focus-visible { outline: 0; background: rgba(60, 60, 67, .07); }
.home-model-option svg { width: 16px; height: 16px; fill: none; stroke: var(--olive); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.home-model-option[aria-selected="true"] svg { opacity: 1; }
.home-voice,
.home-send { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; padding: 0; border-radius: 50%; }
.home-voice { color: var(--muted); background: transparent; }
.home-voice svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.home-voice:hover { background: rgba(60, 60, 67, .075); }
.home-voice.is-listening { color: #fff; background: var(--rust); box-shadow: 0 0 0 5px rgba(166, 111, 85, .12); }
.home-send { color: #fff; background: #989a99; transition: background-color 150ms ease, transform 150ms ease; }
.home-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.home-send:not(:disabled) { background: var(--ink); }
.home-send:not(:disabled):hover { transform: translateY(-1px); background: var(--olive); }
.home-send:disabled { opacity: .72; cursor: not-allowed; }
.home-content.chat-started .brand-hero { min-height: 0; flex: 0 0 auto; padding-top: 20px; }
.home-content.chat-started .hero-brand-mark { width: 54px; height: 54px; border-radius: 16px; }
.home-content.chat-started .mark-face { font-size: 2rem; }
.home-content.chat-started .mark-dot { right: 10px; top: 10px; width: 5px; height: 5px; }
.home-content.chat-started .brand-hero h1 { margin-top: 12px; font-size: 1.35rem; }
.home-content.chat-started .sample-cards { display: none; }

.signal-page { width: min(100%, 1160px); }
.signal-page-header { margin-bottom: 22px; }
.signal-page-header h1 {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", sans-serif;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.045em;
}
.signal-page-header p { margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; }
.signal-workspace-grid { display: grid; grid-template-columns: minmax(270px, 0.72fr) minmax(0, 1.55fr); gap: 12px; align-items: stretch; }
.signal-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(47, 48, 43, 0.035);
}
.signal-input-panel { padding: 18px; }
.signal-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.signal-panel-heading h2 { margin: 0; font-size: 0.86rem; font-weight: 600; }
.signal-panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 0.7rem; line-height: 1.5; }
.signal-input-spec { display: grid; gap: 1px; margin: 0 0 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.signal-input-spec div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 11px; background: rgba(251, 250, 247, 0.94); }
.signal-input-spec dt,
.signal-input-spec dd { margin: 0; font-size: 0.69rem; }
.signal-input-spec dt { color: var(--muted); }
.signal-input-spec dd { color: var(--ink); text-align: right; }
.signal-dropzone { min-height: 136px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; padding: 18px; border: 1px dashed #b7b4aa; border-radius: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.38); text-align: center; cursor: pointer; transition: 150ms ease; }
.signal-dropzone:hover,
.signal-dropzone.dragover { border-color: var(--olive); color: var(--ink); background: rgba(114, 123, 98, 0.08); }
.signal-dropzone span { color: var(--olive); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.13em; }
.signal-dropzone strong { color: var(--ink); font-size: 0.78rem; font-weight: 600; line-height: 1.5; }
.signal-dropzone small { font-size: 0.67rem; line-height: 1.5; }
.signal-file-summary { min-width: 0; display: grid; gap: 4px; margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(251, 250, 247, 0.68); }
.signal-file-summary span { color: var(--muted); font-size: 0.66rem; }
.signal-file-summary strong { overflow: hidden; font-size: 0.78rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.signal-file-summary small { color: var(--muted); font-size: 0.66rem; }
.signal-actions { display: flex; gap: 8px; margin-top: 12px; }
.signal-action {
  min-height: 36px;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  color: #f8f7f3;
  background: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}
.signal-action-secondary { border-color: var(--line); color: var(--ink); background: #fbfaf7; }
.signal-action:not(:disabled):hover { opacity: 0.86; }
.signal-action:disabled { opacity: 0.42; cursor: not-allowed; }
.signal-action:focus-visible,
.signal-channel-tabs button:focus-visible,
.signal-wave-zoom button:focus-visible { outline: 2px solid rgba(114, 123, 98, 0.62); outline-offset: 2px; }
.signal-status { min-height: 18px; margin: 9px 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.signal-error { margin: 5px 0 0; color: var(--rust); font-size: 0.72rem; line-height: 1.5; }
.waveform-panel { min-height: 420px; padding: 18px 18px 14px; }
.signal-wave-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.signal-wave-zoom { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(240, 237, 230, 0.72); }
.signal-wave-zoom button { min-width: 34px; min-height: 28px; padding: 0 7px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font: inherit; font-size: 0.7rem; cursor: pointer; }
.signal-wave-zoom button.active { color: #fbfaf7; background: var(--ink); box-shadow: 0 1px 4px rgba(47, 48, 43, 0.12); }
.signal-channel-tabs { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(240, 237, 230, 0.72); }
.signal-channel-tabs button { min-height: 28px; padding: 0 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font: inherit; font-size: 0.7rem; cursor: pointer; }
.signal-channel-tabs button.active { color: var(--ink); background: #fbfaf7; box-shadow: 0 1px 4px rgba(47, 48, 43, 0.08); }
.signal-chart { position: relative; width: 100%; height: 342px; overflow: hidden; border-radius: 10px; background: rgba(255, 255, 255, 0.5); }
.signal-chart svg { display: block; width: 100%; height: 100%; touch-action: none; }
.signal-grid-line { stroke: #ddd9d0; stroke-width: 1; }
.signal-axis-line { stroke: #aaa79f; stroke-width: 1; }
.signal-axis-label { fill: #787d78; font-size: 10px; }
.signal-wave-line { fill: none; stroke: var(--olive); stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.signal-hover-line { stroke: rgba(37, 42, 45, 0.28); stroke-width: 1; stroke-dasharray: 3 3; }
.signal-hover-dot { fill: var(--rust); stroke: #fbfaf7; stroke-width: 2; vector-effect: non-scaling-stroke; }
.signal-empty-text { fill: var(--muted); font-size: 13px; }
.signal-tooltip { position: absolute; z-index: 2; min-width: 128px; padding: 7px 9px; border: 1px solid rgba(37, 42, 45, 0.12); border-radius: 8px; color: var(--ink); background: rgba(251, 250, 247, 0.96); box-shadow: 0 8px 20px rgba(47, 48, 43, 0.12); font-size: 0.7rem; line-height: 1.5; pointer-events: none; }
.signal-diagnosis { margin-top: 12px; padding: 18px; }
.diagnosis-heading { margin-bottom: 12px; }
.signal-result-state { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(251, 250, 247, 0.7); font-size: 0.66rem; }
.signal-result-state.done { border-color: rgba(114, 123, 98, 0.34); color: var(--olive); background: rgba(114, 123, 98, 0.08); }
.signal-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.result-card { min-height: 92px; display: grid; align-content: center; gap: 7px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(251, 250, 247, 0.68); }
.result-card span,
.result-card small { color: var(--muted); font-size: 0.68rem; }
.result-card strong { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.025em; }
.signal-result-detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); gap: 10px; margin-top: 10px; }
.signal-summary,
.signal-top-list-wrap { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.signal-summary h3,
.signal-top-list-wrap h3 { margin: 0; font-size: 0.75rem; font-weight: 600; }
.signal-summary p { margin: 9px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.65; }
.signal-top-list { display: grid; gap: 9px; margin: 11px 0 0; padding: 0; list-style: none; }
.signal-top-list li { display: grid; grid-template-columns: minmax(72px, 0.9fr) minmax(80px, 1.4fr) 52px; align-items: center; gap: 9px; color: var(--muted); font-size: 0.68rem; }
.signal-top-list li > span:first-child { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.signal-top-list li > strong { color: var(--muted); font-size: 0.66rem; text-align: right; }
.signal-score-bar { height: 5px; overflow: hidden; border-radius: 999px; background: #e4e1da; }
.signal-score-bar i { display: block; height: 100%; border-radius: inherit; background: var(--olive); }
.signal-feature-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 10px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.signal-feature-list div { display: grid; gap: 5px; padding: 10px 12px; background: rgba(251, 250, 247, 0.92); }
.signal-feature-list dt,
.signal-feature-list dd { margin: 0; font-size: 0.67rem; }
.signal-feature-list dt { color: var(--muted); }
.signal-feature-list dd { color: var(--ink); font-weight: 600; }


@media (max-width: 900px) {
  body[data-current-view="home"] .home-sidebar {
    width: 178px;
    flex-basis: 178px;
  }
  .home-sidebar { width: 178px; flex-basis: 178px; }
  .home-main { padding: 24px; }
  .brand-hero { min-height: 0; padding-top: 92px; }
  .signal-workspace-grid { grid-template-columns: 1fr; }
  .waveform-panel { min-height: 360px; }
  .signal-chart { height: 280px; }
}

@media (max-width: 680px) {
  body[data-current-view="home"] .home-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  body[data-current-view="home"] .home-sidebar { height: auto; }
  body[data-current-view="home"] .home-sidebar { width: 100%; flex-basis: auto; }
  body[data-current-view="home"] .home-main { height: auto; }
  .home-shell { display: block; }
  .home-sidebar { width: 100%; min-height: 0; padding: 17px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  body[data-current-view="home"] .home-sidebar { padding: 12px 16px; }
  .sample-nav { grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 15px; }
  body[data-current-view="home"] .sample-nav { margin-top: 9px; }
  .sample-nav-item { min-height: 34px; justify-content: center; padding: 0 4px; font-size: 0.72rem; }
  .nav-item-icon { display: none; }
  .home-main { padding: 24px 18px 30px; }
  body[data-current-view="home"] .home-main { padding: 14px 14px 16px; }
  .brand-hero { min-height: 0; padding-top: 58px; }
  body[data-current-view="home"] .brand-hero { padding-top: clamp(8px, 2dvh, 20px); }
  .brand-hero + .sample-cards { margin-top: 20px; }
  body[data-current-view="home"] .brand-hero + .sample-cards { margin-top: 12px; }
  .hero-brand-mark { width: 82px; height: 82px; border-radius: 23px; }
  body[data-current-view="home"] .hero-brand-mark { width: 58px; height: 58px; border-radius: 17px; }
  body[data-current-view="home"] .mark-face { font-size: 2.3rem; }
  body[data-current-view="home"] .mark-dot { right: 10px; top: 10px; width: 5px; height: 5px; }
  body[data-current-view="home"] .brand-hero h1 { margin-top: 9px; font-size: 1.65rem; }
  .sample-cards { grid-template-columns: 1fr; }
  body[data-current-view="home"] .sample-cards { width: min(100%, 318px); grid-template-columns: repeat(3, 80px); justify-content: space-between; gap: 0; }
  .sample-card { min-height: 96px; flex-direction: row; align-items: center; justify-content: center; }
  body[data-current-view="home"] .sample-card { width: 80px; min-height: 80px; flex-direction: column; gap: 7px; padding: 8px 5px; border-radius: 16px; }
  body[data-current-view="home"] .card-icon { width: 28px; height: 28px; flex-basis: 28px; }
  body[data-current-view="home"] .sample-card h2 { font-size: 0.72rem; }
  .home-content { min-height: calc(100vh - 48px); }
  body[data-current-view="home"] .home-content { height: 100%; min-height: 0; }
  .home-chat { padding-top: 24px; }
  body[data-current-view="home"] .home-chat { padding-top: 12px; }
  body[data-current-view="home"] .home-chat { margin-bottom: 0; }
  .home-composer { min-height: 54px; border-radius: 999px; padding: 5px 7px; }
  body[data-current-view="home"] .home-composer { padding: 5px 7px; }
  body[data-current-view="home"] .home-composer textarea { min-height: 24px; max-height: 90px; }
  .home-model-trigger { max-width: 118px; padding-inline: 9px 7px; }
  .home-model-menu { right: -84px; min-width: 236px; }
  .signal-page-header { margin-bottom: 18px; }
  .signal-panel-heading { align-items: flex-start; flex-direction: column; }
  .signal-wave-controls { width: 100%; justify-content: flex-start; }
  .signal-wave-zoom { flex: 0 0 auto; }
  .signal-channel-tabs { width: 100%; }
  .signal-channel-tabs button { flex: 1; padding: 0 5px; }
  .waveform-panel { padding: 15px 12px 12px; }
  .signal-chart { height: 225px; }
  .signal-result-grid,
  .signal-result-detail-grid { grid-template-columns: 1fr; }
  .signal-feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 2026-09 Apple warm polish — visual-only final overrides */
::selection {
  color: var(--ink);
  background: rgba(102, 113, 92, 0.2);
}

body {
  font-weight: 400;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.home-sidebar {
  border-color: rgba(60, 60, 67, 0.12);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.88), transparent 28%),
    linear-gradient(180deg, rgba(241, 238, 231, 0.98), rgba(237, 233, 225, 0.96));
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.48);
}

.tinker-brand {
  border-radius: 11px;
  transition: background-color 180ms var(--ease-apple), transform 180ms var(--ease-apple);
}

.tinker-brand:hover {
  background: rgba(255, 255, 255, 0.46);
}

.tinker-brand:active {
  transform: scale(0.985);
}

.tinker-brand-mark {
  border-color: rgba(29, 29, 31, 0.62);
  border-radius: 11px 11px 11px 4px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(232, 227, 218, 0.78));
  box-shadow: var(--shadow-xs), inset 0 1px rgba(255, 255, 255, 0.9);
}

.sample-nav-item {
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 450;
  transition:
    color 180ms var(--ease-apple),
    background-color 180ms var(--ease-apple),
    border-color 180ms var(--ease-apple),
    box-shadow 180ms var(--ease-apple),
    transform 180ms var(--ease-apple);
}

.sample-nav-item:hover {
  border-color: rgba(60, 60, 67, 0.08);
  background: rgba(255, 255, 255, 0.5);
}

.sample-nav-item.active {
  border-color: rgba(60, 60, 67, 0.1);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-xs), inset 0 1px rgba(255, 255, 255, 0.8);
}

.sample-nav-item:active {
  transform: scale(0.985);
}

.tinker-brand:focus-visible,
.sample-nav-item:focus-visible,
.sample-card:focus-visible,
.home-model-trigger:focus-visible,
.home-composer-add:focus-visible,
.home-voice:focus-visible,
.home-send:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.home-main {
  background:
    radial-gradient(circle at 79% 4%, rgba(111, 143, 171, 0.052), transparent 28%),
    radial-gradient(circle at 26% 92%, rgba(191, 150, 112, 0.046), transparent 32%);
}

.hero-brand-mark {
  border-color: rgba(102, 113, 92, 0.23);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(145deg, #fffefb 0%, #ece8df 58%, #e4e8e4 100%);
  box-shadow:
    0 20px 48px rgba(42, 37, 30, 0.12),
    inset 0 1px rgba(255, 255, 255, 0.95),
    inset 0 -1px rgba(60, 60, 67, 0.045);
}

.hero-brand-mark::after {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: inherit;
  pointer-events: none;
}

.mark-face {
  color: #5f6c57;
  text-shadow: 0 1px rgba(255, 255, 255, 0.6);
}

.mark-dot {
  background: linear-gradient(145deg, #ba8166, #986049);
  box-shadow: 0 2px 5px rgba(166, 111, 85, 0.24);
}

.brand-hero h1 {
  color: var(--ink);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.sample-card h2 {
  font-weight: 450;
}

.home-chat-messages {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.home-chat-messages::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.home-chat-message {
  line-height: 1.72;
}

.home-chat-message-user {
  background: rgba(102, 113, 92, 0.14);
}

.home-chat-message-assistant {
  background: transparent;
  box-shadow: none;
}

.home-chat-message.is-error {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}

.home-composer {
  border-color: rgba(60, 60, 67, 0.16);
  background: rgba(255, 254, 251, 0.82);
  box-shadow: var(--shadow-md), inset 0 1px rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  transition: border-color 180ms var(--ease-apple), box-shadow 180ms var(--ease-apple), background 180ms var(--ease-apple);
}

.home-composer:focus-within {
  border-color: rgba(102, 113, 92, 0.35);
  background: rgba(255, 254, 251, 0.94);
  box-shadow: 0 18px 44px rgba(42, 37, 30, 0.1), 0 0 0 4px rgba(102, 113, 92, 0.08);
}

.home-composer textarea::placeholder {
  color: var(--muted-soft);
}

.home-chat-attachment {
  border-color: rgba(60, 60, 67, 0.12);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-muted);
}

.home-chat-attachment button,
.home-composer-add,
.home-model-trigger,
.home-voice {
  transition: color 160ms var(--ease-apple), background 160ms var(--ease-apple), transform 160ms var(--ease-apple);
}

.home-composer-add:hover,
.home-model-trigger:hover,
.home-chat-attachment button:hover {
  background: rgba(60, 60, 67, 0.07);
}

.home-composer-add:active,
.home-model-trigger:active,
.home-voice:active,
.home-chat-attachment button:active {
  transform: scale(0.94);
}

.home-send {
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.22), 0 3px 9px rgba(95, 108, 87, 0.18);
  transition: background 170ms var(--ease-apple), transform 170ms var(--ease-apple), box-shadow 170ms var(--ease-apple), opacity 170ms var(--ease-apple);
}

.home-send:not(:disabled) {
  background: linear-gradient(180deg, #75806d, #626d5a);
}

.home-send:not(:disabled):hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #6b7763, #586451);
  box-shadow: 0 5px 13px rgba(95, 108, 87, 0.25);
}

.home-send:not(:disabled):active {
  transform: translateY(0) scale(0.96);
}

.home-send:disabled {
  color: rgba(255, 255, 255, 0.9);
  background: #c4c2bc;
  box-shadow: none;
}


@media (max-width: 680px) {
  .home-sidebar {
    box-shadow: inset 0 -1px rgba(255, 255, 255, 0.52);
  }

  .sample-nav-item {
    border-radius: 9px;
  }

  .home-composer {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
