/* Lunes Web — shared visual system. Content surfaces and glass controls are distinct. */
:root {
  color-scheme: light dark;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  font-size: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-small: 12px;
  --radius-card: 22px;
  --radius-panel: 28px;
  --outer: 12px;
  --bg: #f2f2f7;
  --surface: #fff;
  --surface-secondary: #e9e9ef;
  --text: #1c1c1e;
  --secondary: #66666f;
  --line: #dcdce3;
  --accent: #007aff;
  --selection: #e4f0ff;
  --success: #247a43;
  --warning: #995600;
  --danger: #bf2e29;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --shadow: 0 8px 30px #14233b0a;
  --motion: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101012;
    --surface: #1c1c1e;
    --surface-secondary: #2c2c2e;
    --text: #f5f5f7;
    --secondary: #aaaab3;
    --line: #3a3a3e;
    --accent: #5ca9ff;
    --selection: #1b3553;
    --success: #79d194;
    --warning: #e6b56a;
    --danger: #ff8984;
    --glass: rgba(36, 36, 40, 0.72);
    --glass-edge: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 30px #0002;
  }
}
:root[data-theme="dark"] {
  --bg: #101012;
  --surface: #1c1c1e;
  --surface-secondary: #2c2c2e;
  --text: #f5f5f7;
  --secondary: #aaaab3;
  --line: #3a3a3e;
  --accent: #5ca9ff;
  --selection: #1b3553;
  --success: #79d194;
  --warning: #e6b56a;
  --danger: #ff8984;
  --glass: rgba(36, 36, 40, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --shadow: 0 8px 30px #0002;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-small);
  padding: 10px 16px;
  background: var(--surface-secondary);
  cursor: pointer;
  transition:
    background var(--motion),
    color var(--motion);
}
button:disabled {
  opacity: 0.38;
  cursor: default;
}
button[hidden],
[hidden] {
  display: none !important;
}
button.primary,
a.primary {
  background: var(--accent);
  color: #fff;
}
button.danger,
.error {
  color: var(--danger);
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}
h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 1rem;
  font-weight: 600;
}
p {
  line-height: 1.65;
}
small,
.muted {
  color: var(--secondary);
  line-height: 1.5;
}
small {
  font-size: 0.8125rem;
}
input,
textarea,
select {
  background: var(--surface-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  padding: 12px;
  min-height: 44px;
  max-width: 100%;
  min-width: 0;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
label {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
}
.form {
  display: grid;
  gap: 20px;
}
.search {
  width: 100%;
  max-width: 520px;
  border-radius: 14px;
}
.skip {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
}
.skip:focus {
  top: 12px;
  padding: 12px;
  background: var(--surface);
}
/* One shell, adaptive navigation. */
.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--outer);
  padding: var(--outer);
  padding-bottom: max(var(--outer), env(safe-area-inset-bottom));
}
aside {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 8px;
}
.brand {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 32px;
}
.brand .badge {
  font-weight: 400;
}
nav {
  position: relative;
  display: grid;
  gap: 4px;
  isolation: isolate;
}
nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--secondary);
  text-decoration: none;
  z-index: 1;
  font-size: 0.9375rem;
}
nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}
.nav-selection {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(160%);
}
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  color: var(--secondary);
  font-size: 0.75rem;
}
.sidebar-bottom button {
  width: 44px;
  padding: 0;
  border-radius: 50%;
}
main {
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius-panel);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.toolbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px;
  flex-shrink: 0;
  z-index: 3;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}
#actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
#content {
  flex: 1;
  min-height: 0;
  padding: 24px 28px;
  overflow: auto;
  scrollbar-gutter: stable;
}
#content[data-page="chat"] {
  overflow: hidden;
  padding: 0 20px 16px;
}
.stack {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  align-content: start;
}
.stack > * {
  min-width: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 12px;
  min-width: 0;
}
.card {
  min-width: 0;
  max-width: 100%;
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--bg);
  border: 1px solid transparent;
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
}
button.card {
  text-align: left;
  width: 100%;
}
button.card:hover {
  border-color: var(--line);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.row > div {
  min-width: 0;
}
.row strong,
.row small {
  display: block;
}
.row strong {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.row small {
  margin-top: 4px;
}
.row .badge {
  flex-shrink: 0;
}
.list {
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--line) 45%, transparent);
}
.list > button,
.list > .row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  text-align: left;
  border-radius: 0;
}
.list > button:not(:last-child)::after,
.list > .row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
}
.list > button:hover {
  background: var(--selection);
}
.list > button > .row {
  flex: 1;
}
.card > .row {
  min-height: 44px;
}
.list small {
  display: block;
  margin-top: 4px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--secondary);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-secondary);
  white-space: nowrap;
}
.badge svg {
  width: 12px;
  height: 12px;
}
.badge.success {
  color: var(--success);
}
.badge.warning {
  color: var(--warning);
}
.badge.danger {
  color: var(--danger);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-secondary);
}
.filters button {
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
}
.filters button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px #0000000a;
}
.empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  min-height: 230px;
  padding: 32px;
  text-align: center;
}
.empty p {
  max-width: 360px;
  color: var(--secondary);
  font-size: 0.9375rem;
}
.skeleton {
  height: 112px;
  border-radius: var(--radius-card);
  background: linear-gradient(
    100deg,
    var(--bg) 25%,
    var(--surface-secondary) 50%,
    var(--bg) 75%
  );
  background-size: 220% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}
.auth {
  max-width: 440px;
  margin: 8vh auto;
}
#notice {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(90%, 520px);
  padding: 12px 20px;
  border-radius: 22px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
}
/* Circular controls carry accessible names, without duplicate visible labels. */
button.icon-action,
button.icon,
.close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}
button.icon-action .button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.toolbar button,
.composer button:not(.primary),
.close {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 3px 12px #00000007;
  backdrop-filter: blur(18px) saturate(160%);
}
/* Modal header stays separate from the scrolling content. */
dialog {
  width: min(620px, calc(100% - 32px));
  max-height: min(85dvh, 900px);
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-panel);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 32px 100px #0003;
  overflow: hidden;
  --veil: 0.22;
}
dialog::backdrop {
  background: rgba(16, 20, 30, var(--veil));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
dialog > form {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 4;
  margin: 0;
}
.close {
  font-size: 24px;
  color: var(--secondary);
}
#dialog-content {
  display: grid;
  gap: 20px;
  max-height: calc(85dvh - 2px);
  overflow: auto;
  padding: 24px;
  min-width: 0;
}
#dialog-content > * {
  min-width: 0;
  max-width: 100%;
}
#dialog-content > h2:first-child {
  padding-right: 40px;
  min-height: 32px;
  display: flex;
  align-items: center;
}
#dialog-content p,
#dialog-content h2,
#dialog-content h3 {
  overflow-wrap: anywhere;
}
#dialog-content pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
}
#dialog-content img.qr {
  width: min(280px, 100%);
  margin: auto;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
}
/* Chat is a stable workspace; controls float above its content. */
.chat-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px max(8px, calc((100% - 760px) / 2)) 170px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.message {
  margin: 0 0 24px;
  min-width: 0;
}
.message.user {
  margin-left: auto;
  width: fit-content;
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 22px 22px 6px 22px;
  background: #007aff;
  color: #fff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.assistant {
  line-height: 1.75;
  padding: 4px 0;
}
.message details {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 0.875rem;
}
.message summary {
  cursor: pointer;
  min-height: 24px;
  color: var(--secondary);
}
.message details pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}
.message .copy {
  margin-top: 8px;
  color: var(--secondary);
  background: transparent;
}
.composer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  width: min(calc(100% - 16px), 800px);
  margin: auto;
  padding: 12px 16px;
  display: grid;
  gap: 4px;
  border-radius: 30px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 12px 36px #17253d12;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}
.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  resize: none;
  line-height: 24px;
}
.composer textarea:focus-visible {
  outline: 0;
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--glass-edge));
}
.composer footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}
.composer footer > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.busy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--secondary);
  max-width: 170px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.busy::before {
  content: "";
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: breathe 1.1s ease-in-out infinite alternate;
}
.message-flight {
  overflow: hidden;
}
.file-chip {
  padding: 8px 12px;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.message img,
.message video {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 16px;
  display: block;
  margin-top: 12px;
}
.message audio {
  max-width: 100%;
}
.markdown {
  line-height: 1.75;
  overflow-wrap: anywhere;
  min-width: 0;
}
.markdown > * + * {
  margin-top: 12px;
}
.markdown h1 {
  font-size: 1.5rem;
}
.markdown h2 {
  font-size: 1.25rem;
}
.markdown h3 {
  font-size: 1.0625rem;
}
.markdown ul,
.markdown ol {
  padding-left: 24px;
}
.markdown pre {
  position: relative;
  padding: 16px;
  border-radius: 16px;
  background: var(--bg);
  overflow: auto;
  max-width: 100%;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
}
.markdown pre code {
  white-space: pre;
  font-size: inherit;
}
.markdown :not(pre) > code {
  background: var(--surface-secondary);
  border-radius: 5px;
  padding: 2px 4px;
}
.markdown table {
  display: block;
  overflow: auto;
  border-collapse: collapse;
  max-width: 100%;
  font-size: 0.875rem;
}
.markdown th,
.markdown td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}
.markdown blockquote {
  margin: 12px 0;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  color: var(--secondary);
}
.markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}
.task-categories {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.task-categories button {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 16px;
  border-radius: 22px;
  background: var(--bg);
  border: 1px solid transparent;
}
.task-categories strong {
  grid-column: 2;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.task-categories button[aria-pressed="true"] {
  background: var(--selection);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.task-section {
  display: grid;
  gap: 8px;
}
.task-group-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary);
  padding-inline: 16px;
}
.task-list .row {
  flex: 1;
}
.task-list > button > svg {
  width: 14px;
  height: 14px;
  color: var(--secondary);
}
.review-status {
  padding: 12px;
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  color: var(--secondary);
}
[data-review="reviewing"] {
  border-color: var(--accent) !important;
  animation: review-glow 1.8s ease-in-out infinite alternate;
}
@keyframes review-glow {
  to {
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent),
      0 0 18px color-mix(in srgb, var(--accent) 10%, transparent);
  }
}
@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}
@keyframes breathe {
  to {
    opacity: 0.35;
  }
}
.public-page {
  max-width: 1060px;
  margin: auto;
  padding: 24px;
}
.public-page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.public-page header .brand {
  padding: 0;
}
.public-page main {
  margin-top: 40px;
  padding: clamp(24px, 6vw, 72px);
}
.public-page h1 {
  font-size: clamp(32px, 6vw, 64px);
  margin-bottom: 24px;
}
.public-page p {
  margin: 12px 0;
}
.public-page .hero-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  margin: 24px 0;
}
.public-page a.primary {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 999px;
  text-decoration: none;
}
.public-page article h2 {
  margin: 24px 0 12px;
}
.public-page article {
  line-height: 1.8;
}
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 176px minmax(0, 1fr);
  }
  aside {
    padding-inline: 0;
  }
  .brand {
    font-size: 1.5rem;
  }
  .brand .badge {
    display: none;
  }
  .toolbar {
    padding: 16px 20px;
  }
  #content {
    padding: 20px;
  }
  .task-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  :root {
    --outer: 8px;
  }
  .shell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-inline: 8px;
  }
  main {
    order: 0;
    flex: 1;
    border-radius: 26px;
  }
  aside {
    order: 1;
    flex: none;
    padding: 3px 5px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-edge);
    backdrop-filter: blur(24px) saturate(160%);
    box-shadow: var(--shadow);
  }
  aside .brand,
  .sidebar-bottom {
    display: none;
  }
  nav {
    display: flex;
    gap: 2px;
    justify-content: space-around;
  }
  nav a {
    flex: 1;
    min-width: 44px;
    max-width: 64px;
    height: 48px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  nav a span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .nav-selection {
    border-radius: 24px;
  }
  nav svg {
    width: 22px;
    height: 22px;
  }
  .toolbar {
    min-height: 72px;
    padding: 12px 16px;
    gap: 8px;
  }
  .toolbar h1 {
    font-size: 1.375rem;
  }
  #actions {
    gap: 4px;
  }
  #content {
    padding: 16px;
  }
  #content[data-page="chat"] {
    padding: 0 4px 8px;
  }
  .messages {
    padding-top: 20px;
    padding-inline: 12px;
  }
  .composer {
    padding: 10px 12px;
  }
  .message.user {
    max-width: 92%;
  }
  .card {
    padding: 16px;
  }
  .stack {
    gap: 20px;
  }
  .task-list > button {
    padding: 16px;
  }
  .list > button > .row {
    flex-wrap: wrap;
    gap: 8px;
  }
  dialog {
    width: calc(100% - 16px);
    max-height: 90dvh;
    border-radius: 28px;
  }
  #dialog-content {
    max-height: calc(90dvh - 2px);
    padding: 24px;
  }
  .public-page {
    padding: 16px;
  }
  .public-page header {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .toolbar,
  .composer,
  aside,
  .nav-selection,
  .toolbar button,
  .composer button:not(.primary),
  .close {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  dialog::backdrop {
    backdrop-filter: none;
    background: #0008;
  }
}
@media (prefers-contrast: more) {
  :root {
    --line: var(--secondary);
  }
  button,
  .composer,
  .card,
  .list {
    border: 1px solid var(--line);
  }
}

/* Shared interactive selection material. Pointer position and spring state are
   driven by LiquidSelection; the text/icon layer never deforms. */
.liquid-control {
  --selection-outset: 2px;
  --selection-shell-inset: 2px;
  position: relative;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
.liquid-control[data-liquid-axis="x"] {
  touch-action: pan-y;
}
.liquid-control[data-liquid-axis="y"] {
  touch-action: pan-x;
}
.liquid-lens {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: 24px;
  background: rgb(255 255 255 / calc(0.14 - var(--lift, 0) * 0.08));
  border: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  transform-origin: center;
}
[data-liquid-moving] > .liquid-lens,
[data-liquid-dragging] > .liquid-lens {
  will-change: transform;
}
nav.liquid-control[data-liquid-axis="y"] .liquid-lens {
  border-radius: 16px;
}
.liquid-control > button,
.liquid-control > a {
  position: relative;
  z-index: 1;
}
.liquid-control [data-liquid-preview] {
  color: var(--accent);
}
.filters.liquid-control > button {
  background: transparent;
  box-shadow: none;
}
.filters.liquid-control .liquid-lens {
  border-radius: 999px;
}
@media (prefers-reduced-transparency: reduce) {
  .liquid-lens {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
}
@media (prefers-contrast: more) {
  .liquid-lens {
    border-color: var(--text);
  }
}

/* Glass may cross its control boundary briefly; the viewport never gains an
   accidental horizontal scroll range. Content panes retain their own scrolling. */
body {
  overflow-x: clip;
}
.liquid-control {
  overflow: visible;
}

/* Shared material contract: clear body + convex rim; frosted selected lens.
   The rim is a browser approximation, not native optical refraction. */
:root {
  --liquid-clear: rgb(255 255 255 / 0.07);
  --liquid-frost: color-mix(in srgb, var(--surface) 24%, transparent);
  --liquid-rim: inset 0 1px 0 #ffffff80,
    inset 1px 0 1px #ffffff30, inset -1px -1px 1px #16233a20,
    0 5px 18px #17253d10;
}
.glass-clear, .composer, .filters.liquid-control {
  background: var(--liquid-clear);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--liquid-rim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: relative;
  isolation: isolate;
}
.composer { position: absolute; }
/* Full-surface optical layer: displacement strongest at the rounded edge,
   smoothly decreasing inward. The foreground itself never gets filtered. */
.glass-clear::before, .composer::before, .filters.liquid-control::before, aside::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  backdrop-filter: var(--water-filter, none) saturate(115%);
  -webkit-backdrop-filter: saturate(115%);
}
@supports (backdrop-filter: url("#water-glass")) {
  .composer::before, .filters.liquid-control::before, aside::before {
    backdrop-filter: var(--water-filter, none) saturate(115%);
  }
}

.liquid-lens {
  /* A locally frosted patch in the same pane: no raised rim or halo. */
  border: 0;
  box-shadow: none;
  background: var(--liquid-frost);
  backdrop-filter: blur(5px) saturate(125%);
  -webkit-backdrop-filter: blur(5px) saturate(125%);
}
@media (max-width: 680px) {
  aside {
    background: var(--liquid-clear);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: var(--liquid-rim);
  }
}
.glass-demo { display: grid; gap: 24px; }
.glass-demo-stage {
  position: relative; min-height: 380px; padding: 32px 20px;
  border-radius: 28px; overflow: hidden;
  background: linear-gradient(135deg,#246b9277,transparent 60%),
    radial-gradient(ellipse at 85% 65%,#dc915c99,transparent 60%), var(--surface-secondary);
}
.glass-demo-stage .filters { margin: 24px auto; }
.glass-demo-stage .composer { bottom: 20px; }
.glass-demo-backdrop { font-size: clamp(32px,8vw,68px); font-weight: 600; opacity: .45; }
.glass-demo-stage .composer textarea { min-height: 66px; }
@media (prefers-reduced-transparency: reduce) {
  .glass-clear, .composer, .filters.liquid-control, .liquid-lens, aside {
    background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .glass-clear::before, .composer::before, .filters.liquid-control::before { display:none; }
}

/* The desktop sidebar is navigation layout, not a floating glass capsule. */
aside { position: relative; }
@media (min-width: 681px) { aside::before { display: none; } }
@media (prefers-reduced-transparency: reduce) { aside::before { display: none; } }

.glass-demo-backdrop {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  font: 500 18px/32px ui-monospace, monospace; opacity: .65;
  background-image: linear-gradient(#ffffff50 1px, transparent 1px), linear-gradient(90deg,#ffffff50 1px, transparent 1px);
  background-size: 24px 24px;
}
.glass-demo-backdrop > div { white-space: nowrap; }
.glass-demo-stage .filters { margin-top: 64px; }

/* The dense pattern is an opt-in optical test, not the demo's default content. */
.glass-demo-stage:not(.inspect-refraction) .glass-demo-backdrop {
  font-size: 42px; line-height: 100px; opacity: .2;
  background-image: none;
}
.glass-demo-stage:not(.inspect-refraction) .glass-demo-backdrop > div:nth-child(even) {
  transform: translateX(-70px);
}

/* Transmission falls toward the center without smearing background detail. */
.composer::before, .filters.liquid-control::before, aside::before {
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--surface) var(--glass-center-opacity, 22%), transparent) 0%,
    color-mix(in srgb, var(--surface) var(--glass-mid-opacity, 12%), transparent) 45%, transparent 88%);
}
/* The selected lens retains its frosted overlay above the optical body. */

.demo-sent { position: absolute; right: 16px; top: 164px; max-width: 80%; max-height: 60px; overflow: auto; }

.glass-demo-backdrop { inset: -120px 0; }
.demo-optical-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.demo-optical-controls label { display: grid; gap: 8px; flex: 1 1 180px; }
.demo-optical-controls input { width: 100%; }

.glass-settings { display: grid; gap: 16px; }
.glass-setting-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.glass-setting-row input { grid-column: 1 / -1; width: 100%; min-height: 44px; }
.glass-setting-row output { font-variant-numeric: tabular-nums; color: var(--secondary); }
.glass-settings-preview { position: relative; padding: 28px 12px; border-radius: 22px; overflow: hidden; background: linear-gradient(120deg,#80b8c955,#e9c5a755); }
.glass-preview-pattern { position: absolute; left: 8px; top: 36px; white-space: nowrap; font-size: 28px; opacity: .35; }
.glass-settings-preview .filters { margin: auto; }

/* Native range semantics with a shared iOS-inspired liquid interaction skin. */
.liquid-range { position: relative; display: block; width: 100%; height: 44px; isolation: isolate; }
.glass-setting-row > .liquid-range { grid-column: 1 / -1; }
.liquid-range input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 44px; min-height: 44px;
  margin: 0; padding: 0; border: 0; border-radius: 22px;
  background: transparent; box-shadow: none; cursor: pointer;
  appearance: none; -webkit-appearance: none; z-index: 2;
}
.liquid-range input::-webkit-slider-runnable-track { height: 6px; border: 0; background: transparent; }
.liquid-range input::-moz-range-track { height: 6px; border: 0; background: transparent; }
.liquid-range input::-moz-range-progress { background: transparent; }
.liquid-range input::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 40px; height: 24px; margin-top: -9px;
  background: transparent; border: 0; box-shadow: none;
}
.liquid-range input::-moz-range-thumb { width: 40px; height: 24px; background: transparent; border: 0; box-shadow: none; }
.range-track { position: absolute; left: 20px; right: 20px; top: 19px; height: 6px;
  border-radius: 999px; background: color-mix(in srgb,var(--secondary) 20%, transparent); pointer-events: none; overflow: hidden; }
.range-fill { display: block; width: calc(var(--range-progress,0)*100%); height: 100%; background: var(--accent); border-radius: inherit; }
.range-thumb { position: absolute; z-index: 1; pointer-events: none;
  left: calc((100% - 40px)*var(--range-progress,0)); top: 10px; width: 40px; height: 24px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--glass-edge);
  box-shadow: 0 2px 5px #0002, inset 0 1px 0 #ffffff80;
  transition: background 160ms ease, box-shadow 160ms ease; }
.range-thumb::before { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  backdrop-filter:var(--water-filter,none); -webkit-backdrop-filter:var(--water-filter,none); }
.liquid-range[data-pressed] .range-thumb { background: color-mix(in srgb,var(--surface) 18%,transparent); box-shadow: 0 4px 12px #0002,inset 0 1px 0 #ffffffa0; }
.liquid-range:focus-within .range-track { outline-offset: 8px; }
.liquid-range input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.liquid-range[data-disabled] { opacity: .45; }
.liquid-range[data-disabled] input { cursor: not-allowed; }
@media (prefers-reduced-transparency: reduce) {
  .liquid-range[data-pressed] .range-thumb { background: var(--surface); }
  .range-thumb::before { backdrop-filter:none; -webkit-backdrop-filter:none; }
}
@media (forced-colors: active) {
  .range-track,.range-thumb { display:none; }
  .liquid-range input[type="range"] { appearance:auto; -webkit-appearance:auto; }
  .liquid-range input::-webkit-slider-thumb { appearance:auto; -webkit-appearance:auto; }
}

/* Continuous controls track directly; discrete values settle onto native steps. */
.liquid-range[data-stepped] .range-thumb { transition: left 120ms cubic-bezier(.16,1,.3,1), background 160ms ease, box-shadow 160ms ease; }
.liquid-range[data-stepped] .range-fill { transition: width 120ms cubic-bezier(.16,1,.3,1); }
.liquid-control { transform-origin: center; }

/* Shared icon-over-label tabs, with a flat selected material. */
:root {
  --tab-label-size: .625rem;
  --tab-label-weight: 500;
  --tab-icon-size: 22px;
  --tab-icon-stroke: 1.7;
  --tab-item-height: 52px;
  --tab-content-gap: 8px;
  --tab-item-gap: 6px;
}
.filters:has(.glass-tab) {
  gap: var(--tab-item-gap);
  width: min(100%, 288px);
  flex-wrap: nowrap;
  padding: 3px;
  border-radius: 999px;
}
.filters .glass-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--tab-content-gap);
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--tab-item-height);
  padding: 4px 12px;
  font-weight: var(--tab-label-weight);
}
.glass-tab > svg {
  width: var(--tab-icon-size); height: var(--tab-icon-size);
  stroke-width: var(--tab-icon-stroke); flex: none;
}
.glass-tab-label { font-size: var(--tab-label-size); line-height: 1.3; }

@media (max-width: 680px) {
  nav { gap: var(--tab-item-gap); }
  nav svg {
    width: var(--tab-icon-size); height: var(--tab-icon-size);
    stroke-width: var(--tab-icon-stroke);
  }
  nav a {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    min-height: var(--tab-item-height);
    height: auto;
    flex-direction: column;
    gap: var(--tab-content-gap);
    padding: 4px 0;
    border-radius: 999px;
  }
  nav a span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    font-size: var(--tab-label-size);
    font-weight: var(--tab-label-weight);
    line-height: 1.3;
    text-align: center;
  }
}

@media (max-width: 360px) {
  nav { gap: 4px; }
}

/* iOS WebKit accepts SVG backdrop URLs syntactically but does not render their
   displacement. Keep a visible material fallback; do not claim optical parity. */
@supports (-webkit-touch-callout: none) {
  .composer::before, .filters.liquid-control::before, .range-thumb::before {
    -webkit-backdrop-filter: blur(2px) saturate(125%);
    backdrop-filter: blur(2px) saturate(125%);
  }
  .liquid-lens {
    background: color-mix(in srgb, var(--surface) 28%, transparent);
    -webkit-backdrop-filter: blur(5px) saturate(125%);
    backdrop-filter: blur(5px) saturate(125%);
    border: 0;
    box-shadow: none;
  }
  .liquid-control, .liquid-control > a, .liquid-control > button {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
  @media (max-width: 680px) {
    aside::before {
      -webkit-backdrop-filter: blur(2px) saturate(125%);
      backdrop-filter: blur(2px) saturate(125%);
    }
  }
  @media (prefers-reduced-transparency: reduce) {
    .composer::before, .filters.liquid-control::before, .range-thumb::before, aside::before {
      display: none;
    }
    .liquid-lens {
      background: var(--surface);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
  }
}
