:root {
  color-scheme: light;
  --canvas: var(--helio-page);
  --surface: var(--helio-panel);
  --text: var(--helio-ink);
  --muted: var(--helio-muted);
  --line: var(--helio-line);
  --accent: var(--helio-accent);
  --link: var(--accent);
  --section-title: var(--accent);
  --action: var(--helio-action);
  --on-action: var(--helio-action-ink);
  --subtitle: var(--muted);
  --danger: #ad2b33;
  --panel-fill: color-mix(in srgb, var(--surface) 96%, var(--text));
  --control-fill: color-mix(in srgb, var(--surface) 93%, var(--text));
  --press: color-mix(in srgb, var(--panel-fill) 84%, var(--link));
  --healthy: #257949;
  --badge: #ffd0be;
  --badge-ink: var(--helio-action-ink);
  --hero-chrome: var(--helio-header);
  --hero-mid: var(--helio-header-bottom);
  --soft-accent: var(--helio-tint);
  --radius-pill: 999px;
  --radius-row: 16px;
  --radius-panel: 22px;
  --control-height: 46px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  font: 16px/1.4 Roboto, "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--canvas);
  color: var(--text);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #2a2630;
  --surface: #38323d;
  --text: #fff7f2;
  --muted: #ded0d9;
  --line: #554957;
  --accent: #ffba9e;
  --hero-chrome: #342b3b;
  --hero-mid: #40313d;
  --soft-accent: #503744;
  --healthy: #a4e1b4;
  --badge: #ffc0a3;
  --danger: #ffabab;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; overflow-x: clip; }
button, input { font: inherit; color: inherit; }
button {
  border: 0; border-radius: var(--radius-pill); cursor: pointer; touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 140ms ease, color 140ms ease, filter 120ms ease; }
}
button, a, input, label { -webkit-tap-highlight-color: transparent; }
:is(button, a, input):focus:not(:focus-visible) { outline: none; }
:is(button, a, input):focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
main { max-width: 560px; margin-inline: auto; padding: 16px 16px calc(84px + var(--safe-bottom)); }
.telegram-shell main { max-width: none; }
:root[data-fullscreen="true"] main { padding-top: calc(16px + var(--safe-top, 0px)); }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 650; overflow-wrap: anywhere; }
small { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; }
.launch { position: fixed; inset: 0; display: grid; place-items: center; background: var(--canvas); }
.launch img { animation: breathe 2s ease-in-out infinite alternate; filter: drop-shadow(0 12px 24px #e7736052); }
@keyframes breathe { to { transform: translateY(-6px); } }
#studio-view, .studio-loading { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: var(--canvas); }
.studio-loading { display: grid; place-items: center; padding: 16px; color: var(--muted); }
.luna-icon {
  display: block; flex: 0 0 auto; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.group, .welcome { border-radius: var(--radius-panel); background: var(--panel-fill); }
.group { overflow: hidden; }
.group:has(> .rich-row) { padding: 3px; }
.catalog-section, .tool-shortcuts { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline: 12px; margin-bottom: 6px; }
.catalog-section h2 {
  min-width: 0;
  color: var(--section-title);
  font-size: 15px; line-height: 18px; font-weight: 600;
}
.section-more, .catalog-notice button, .discover-empty button {
  background: transparent; color: var(--link); font-size: 14px; min-height: 40px; padding: 4px 10px;
}
.section-more:active, .catalog-notice button:active, .discover-empty button:active { background: var(--press); }
.section-more { flex: none; white-space: nowrap; }
.catalog-notice { padding: 12px; color: var(--muted); font-size: 14px; }
.catalog-notice[role="alert"] { color: var(--danger); }
.rich-row {
  position: relative; display: flex; align-items: center; width: 100%;
  min-height: 60px; padding: 10px 17px; border-radius: var(--radius-row); text-align: start; background: transparent;
}
.rich-row + .rich-row::before {
  content: ""; position: absolute; inset: 0 20px auto; height: 1px;
  pointer-events: none; background: var(--line);
}
.rich-row + .rich-row:has(.row-leading)::before { inset-inline-start: 65px; }
.rich-row:focus-visible, .model-option:focus-visible {
  box-shadow: inset 0 0 0 2px var(--link);
}
:root[data-input-mode="pointer"] :is(button, a, input):focus-visible { box-shadow: none; }
.rich-row:is(:active, [data-pressed]), .compact:active, .choices button:active {
  background-color: var(--press);
}
.row-icon { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; color: var(--muted); }
.row-icon > :is(img, .luna-icon) { width: 28px; height: 28px; object-fit: contain; }
.row-icon > img { border-radius: 6px; }
.row-leading { margin-inline-end: 12px; flex-basis: 36px; width: 36px; height: 36px; }
.row-leading > :is(img, .catalog-emoji, .connection-initials) { display: grid; place-items: center; width: 36px; height: 36px; }
.catalog-art { display: block; object-fit: contain; border-radius: 8px; }
.catalog-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 26px; line-height: 1; }
.connection-initials { padding: 3px; color: var(--muted); background: var(--line); border-radius: 9px; font-size: 13px; }
.row-details { flex: none; color: var(--link); font-size: 14px; padding-inline-start: 8px; white-space: nowrap; }
.row-trailing { margin-inline-start: 16px; font-size: 23px; line-height: 1; }
.selection-mark {
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 19px; height: 19px; border-radius: 50%; background: var(--action); color: var(--on-action);
}
.selection-mark::after {
  content: ""; width: 8px; height: 4px; border: solid currentColor; border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}
.row-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-title { display: block; font-size: 16px; line-height: 20px; font-weight: 400; }
.row-subtitle { margin-top: 2px; font-size: 14px; line-height: 18px; font-weight: 400; color: var(--subtitle); }
.row-accent { color: var(--accent); }
.row-subtitle.healthy { color: var(--healthy); }
.page-heading { margin: 4px 4px 16px; }
.catalog-empty { margin: 24px 6px; color: var(--muted); }
.discover-empty p { display: flex; align-items: center; gap: 8px; }
.discover-empty .luna-icon { width: 18px; height: 18px; }
.recommended h3 { margin: 0; padding: 0 12px 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.connected-state { color: var(--healthy); margin-top: 5px; }
.chat-examples { display: grid; gap: 9px; margin-top: 20px; }
.chat-example {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  width: 100%; min-height: 52px; padding: 10px 12px 10px 16px;
  border-radius: var(--radius-panel); background: var(--panel-fill); color: var(--text); text-align: start;
  overflow-wrap: anywhere;
}
.chat-example:active { background: var(--press); }
.chat-example b { color: var(--accent); font-weight: 550; white-space: nowrap; }
.example-send {
  display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: var(--soft-accent); color: var(--accent);
}
.example-send .luna-icon { width: 16px; height: 16px; }
.model-popover {
  position: fixed; inset: var(--model-top) auto auto var(--model-left); z-index: 10;
  width: min(278px, calc(100vw - 16px)); max-width: none;
  max-height: min(440px, calc(100dvh - var(--model-top) - 12px));
  margin: 0; padding: 6px; border: 1px solid color-mix(in srgb, var(--line) 66%, transparent);
  border-radius: 26px; overflow: hidden; color: var(--text);
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 28px #0003;
}
.model-popover[open] { display: flex; flex-direction: column; animation: model-in 120ms ease-out; }
.model-popover .model-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
@keyframes model-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .model-popover[open] { animation: none; } }
.model-option {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 22px; align-items: center; gap: 6px;
  width: 100%; min-height: 72px; padding: 10px 16px; border-radius: var(--radius-row);
  background: transparent; text-align: start;
}
.model-popover .model-option { min-height: 64px; padding: 7px 10px; }
.model-option + .model-option::before {
  content: ""; position: absolute; inset: 0 10px auto; height: 1px;
  background: var(--line); pointer-events: none;
}
.model-option:active { background: var(--press); }
.model-option-copy { min-width: 0; }
.model-option-title { display: flex; align-items: center; gap: 7px; }
.model-option-title strong {
  min-width: 0; overflow-wrap: anywhere;
  font-size: 17px; line-height: 22px; font-weight: 400;
}
.model-option small { font-size: 14px; line-height: 18px; }
.model-tier { border-radius: 999px; background: var(--soft-accent); color: var(--accent); padding: 2px 7px; font-size: 11px; }
.model-check { color: var(--accent); font-size: 18px; text-align: end; }
.model-error { color: var(--text); padding: 6px 10px; font-size: 13px; }
.row-badge {
  display: inline-flex; align-items: center; padding: 0 5px; margin-inline-start: 4px;
  min-height: 19px; border-radius: 5px; vertical-align: 1px; white-space: nowrap;
  background: var(--badge); color: var(--badge-ink); font-size: 12px; line-height: 15px; font-weight: 500;
}
.row-badge.pro { background: var(--soft-accent); color: var(--accent); }
.home-hero { position: relative; isolation: isolate; }
.home-hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: -16px calc(50% - 50vw) -20px;
  background: linear-gradient(180deg, var(--hero-chrome), var(--canvas));
}
.home-controls { display: flex; align-items: center; gap: 8px; }
.compact {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; height: 44px; padding: 0 12px;
  background: var(--control-fill); font-size: 14px; line-height: 18px; font-weight: 500;
}
.compact > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-selector { flex-shrink: 1; margin-inline-end: auto; }
.model-chevron { flex: none; transition: transform 160ms ease; }
.model-selector[aria-expanded="true"] .model-chevron { transform: rotate(180deg); }
.balance-button { flex: none; background: var(--action); color: var(--on-action); }
.compact.balance-button:active { background-color: var(--action); filter: brightness(.92); }
.balance-button img { flex: none; object-fit: contain; }
.theme-control { flex: 0 0 44px; padding: 0; color: var(--text); }
.theme-control .luna-icon { width: 18px; height: 18px; }
.sun-stage { position: relative; display: grid; place-items: center; height: 166px; isolation: isolate; overflow: clip; }
.compact-hero .sun-stage { height: 132px; }
.sun-stage::before {
  content: ""; position: absolute; inset-block: 0; left: 50%; width: min(100%, 320px);
  transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(ellipse 50% 52% at 50% 51%,
    #e48948 2%, #f39d5a 36%, #ffc58b 58%, #ffd6ad83 78%, transparent 100%);
}
.sun-position { position: relative; z-index: 1; color: #fffdf5;
  transition: transform 270ms cubic-bezier(.24,.66,.32,1), color 220ms ease; }
.solar-mark { width: 116px; height: 116px; display: block; }
.sun-stage .solar-mark { filter: drop-shadow(0 2px 5px #98462056); animation: heliobob 6s ease-in-out infinite; }
.compact-hero .solar-mark { width: 97px; height: 97px; }
@keyframes heliobob { 50% { transform: translateY(-2px); } }
.sun-horizon {
  display: none; position: absolute; z-index: 2; inset: 72% 0 0; pointer-events: none;
  background: linear-gradient(180deg, #343543, #2b2e39 25%, var(--canvas) 100%);
  mask-image: linear-gradient(90deg, transparent, black 23%, black 77%, transparent);
}
.sun-horizon::before {
  content: ""; position: absolute; top: 0; left: 50%; width: min(80%, 252px); height: 1px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #a57a7266 26%, #efbc9ac4 50%, #a57a7266 74%, transparent);
}
.sun-horizon::after {
  content: ""; position: absolute; top: 2px; left: 50%; width: 94px; height: 15px; transform: translateX(-50%);
  background: radial-gradient(ellipse 38px 1px at 49% 2px, #efbc9ab0, transparent),
    radial-gradient(ellipse 26px 1px at 55% 7px, #e5b19294, transparent),
    radial-gradient(ellipse 16px 1px at 44% 12px, #d9a78972, transparent);
}
:root[data-theme="dark"] .sun-horizon { display: block; }
:root[data-theme="dark"] .sun-position { color: #ebad77; transform: translateY(18px); }
:root[data-theme="dark"] .sun-stage::before {
  background: radial-gradient(ellipse 50% 39% at 50% 60%, #e49d4165, #e18b5232 48%, transparent 99%);
}
.sun-title { margin: 0 auto; min-height: 39px; text-align: center; font-size: clamp(25px, 7vw, 33px); line-height: 39px;
  color: var(--text); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 100%; }
.sun-title bdi { unicode-bidi: isolate; }
.compact-hero .sun-title { font-size: clamp(23px, 7vw, 29px); }
.compact-hero { margin-bottom: 14px; }
@media (prefers-reduced-motion: reduce) {
  .sun-stage .solar-mark { animation: none; }
  .sun-position, .model-chevron { transition: none; }
}
.hero-mark { display: block; object-fit: contain; filter: drop-shadow(0 9px 18px #ae4e3b36); }
.subpage-back:active, .luna-sheet header button:active { background: var(--press); }
.agent-bust {
  position: relative; display: block; width: 126px; height: 126px;
  --fade-portrait: linear-gradient(#000 82%, transparent);
  -webkit-mask-image: var(--fade-portrait); mask-image: var(--fade-portrait);
}
.agent-piece {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.agent-body {
  -webkit-mask-image: linear-gradient(transparent 41%, #000 56%);
  mask-image: linear-gradient(transparent 41%, #000 56%);
  transform-origin: 50% 88%;
  animation: luna-breath 5.8s ease-in-out infinite;
}
.agent-head {
  -webkit-mask-image: linear-gradient(#000 51%, transparent 62%);
  mask-image: linear-gradient(#000 51%, transparent 62%);
  transform-origin: 50% 62%;
  animation: luna-head 7.4s ease-in-out infinite;
}
.agent-hair {
  --hair: radial-gradient(ellipse 22% 31% at 80% 50%, #000 14%, transparent 87%);
  -webkit-mask-image: var(--hair); mask-image: var(--hair);
  transform-origin: 65% 28%;
  animation: luna-hair 4.6s ease-in-out infinite;
}
:root[data-avatar="ocean"] .agent-hair { --hair: radial-gradient(ellipse 23% 34% at 23% 49%, #000 14%, transparent 88%); }
@keyframes luna-breath { 50% { transform: scaleY(1.017); } }
@keyframes luna-head { 50% { transform: translateY(-1px) rotate(.65deg); } }
@keyframes luna-hair { 50% { transform: translateX(1px) rotate(1.2deg); } }
.subpage-header { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 16px; }
.subpage-back { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; margin-inline-start: -8px; background: var(--control-fill); }
.native-back .subpage-back { display: none; }
.luna-sheet header button {
  display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px;
  border-radius: 50%; background: var(--surface); color: var(--text); font-size: 26px; line-height: 1;
}
.catalog-search {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  border-radius: var(--radius-pill); color: var(--muted); background: var(--control-fill);
}
.home-hero + .catalog-search { margin-top: 24px; }
.catalog-create + .catalog-search { margin-top: 12px; }
.catalog-create .row-leading { color: var(--link); }
.catalog-search input {
  flex: 1; min-width: 0; min-height: 44px; padding: 7px 0; border: 0;
  background: transparent; color: var(--text);
}
.catalog-search input::placeholder { color: var(--muted); }
:root:not([data-input-mode="pointer"]) .catalog-search:has(input:focus-visible) {
  outline: 2px solid var(--link); outline-offset: -2px;
}
.catalog-search input:focus-visible { outline: none; box-shadow: none; }
.catalog-chips { display: flex; overflow-x: auto; scrollbar-width: none; gap: 6px; margin-top: 12px;
  overscroll-behavior-x: contain; touch-action: pan-x pan-y; user-select: none; }
.catalog-chips::-webkit-scrollbar { display: none; }
.catalog-chips button {
  flex: 0 0 auto; min-height: 40px; padding: 0 14px;
  background: var(--control-fill); color: var(--muted); font-size: 14px;
}
.catalog-chips button[aria-pressed="true"] { background: var(--action); color: var(--on-action); }
.catalog-chips button:active:not([aria-pressed="true"]) { background: var(--press); }
.catalog-chips button[aria-pressed="true"]:active { filter: brightness(.92); }
.catalog-chips button:focus-visible { outline-offset: -2px; }
:root:is([data-page="skills"], [data-page="skill_collection"]) main { max-width: 820px; }
:root[data-page="skill_detail"] main { max-width: 620px; }
.group:has(> .skill-row) {
  display: grid; gap: 10px; padding: 0; overflow: visible; background: transparent;
}
.skill-row {
  min-width: 0; min-height: 84px; padding: 14px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
}
.skill-row + .skill-row::before { display: none; }
.skill-row .row-title { font-size: 17px; line-height: 1.28; font-weight: 650; }
.skill-row .row-subtitle { margin-top: 4px; line-height: 1.4; }
.skill-row .row-leading {
  flex: 0 0 48px; width: 48px; height: 48px; margin-inline-end: 11px;
  border-radius: 14px; background: var(--soft-accent); color: var(--accent);
}
.skill-row .row-leading > :is(img, .luna-icon) { width: 30px; height: 30px; }
.skill-row .row-trailing { align-self: center; flex-basis: 18px; width: 18px; margin-inline-start: 6px; }
.skill-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; margin-top: 8px; }
.skill-card-meta > span {
  display: inline-flex; gap: 5px; align-items: center; min-width: 0;
  color: var(--muted); font-size: 13px; line-height: 1.3;
}
.skill-card-meta .skill-card-status {
  padding: 3px 8px; border-radius: var(--radius-pill); background: var(--control-fill);
}
.skill-card-meta .is-installed { color: var(--healthy); }
.skill-card-service > :is(img, .luna-icon) { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 4px; }
@media (min-width: 650px) {
  :is(#skill-results, :root[data-page="skill_collection"] main) .group:has(> .skill-row) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 359px) {
  .skill-row { padding-inline: 10px; }
  .skill-row .row-leading { flex-basis: 42px; width: 42px; height: 42px; margin-inline-end: 9px; }
}
.detail-hero { display: grid; justify-items: center; text-align: center; gap: 6px; margin: 16px 0 24px; }
.detail-icon {
  display: grid; place-items: center; width: 74px; height: 74px; margin-bottom: 4px;
  border-radius: 21px; background: var(--surface); color: var(--accent);
}
.detail-icon .luna-icon { width: 36px; height: 36px; }
.detail-icon img { object-fit: contain; border-radius: 10px; }
.detail-hero h2 { font-size: 24px; line-height: 1.2; }
.detail-hero p, .detail-status { color: var(--muted); }
.icloud-form { display: block; width: 100%; height: max(420px, calc(100dvh - 100px)); border: 0; border-radius: 16px; }
.detail-status { margin-top: 16px; text-align: center; }
.detail-card { margin: 12px 0; padding: 16px 20px; }
.skill-hero {
  display: flex; align-items: center; gap: 15px; padding: 16px; margin: 12px 0;
  text-align: start; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface);
}
.skill-hero > div { min-width: 0; overflow-wrap: anywhere; }
.skill-hero .detail-icon { flex: 0 0 62px; width: 62px; height: 62px; margin: 0; border-radius: 18px; background: var(--soft-accent); }
.skill-hero :is(.catalog-art, .luna-icon) { width: 38px; height: 38px; }
.skill-hero h2 { font-size: clamp(20px, 5vw, 25px); }
.skill-hero p { margin-top: 4px; font-size: 14px; }
.skill-overview {
  display: grid; gap: 14px; padding: 17px; line-height: 1.5;
  border: 1px solid var(--line); background: var(--surface);
}
.skill-overview .skill-example {
  margin: 0; padding: 10px 12px; border-radius: 11px; background: var(--panel-fill);
  border-inline-start: 3px solid var(--accent);
}
.skill-overview .skill-example small { color: var(--text); font-weight: 650; }
.skill-connections h3 { margin: 0; font-size: 15px; font-weight: 650; }
.skill-connections .service-tags { gap: 8px; margin-top: 7px; }
.skill-connections .dependency small { font-size: 13px; }
.skill-example { margin-top: 12px; overflow-wrap: anywhere; }
.skill-example small { margin-bottom: 3px; }
.connection-setup { color: var(--muted); }
.connection-setup .plain-action { color: var(--accent); }
.connection-danger.plain-action { color: var(--danger); }
.connection-management { display: grid; gap: 8px; }
.connection-management > button { margin-top: 0; }
.connection-items { margin: 0; padding-inline-start: 18px; overflow-wrap: anywhere; }
.connection-items li + li { margin-top: 8px; }
.connection-items time { color: var(--muted); font-variant-numeric: tabular-nums; }
.service-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.service-tags > span, .dependency { padding: 6px 12px; border-radius: var(--radius-pill); color: var(--muted); background: var(--canvas); font-size: 13px; }
.dependency { display: flex; gap: 8px; align-items: center; text-align: start; min-height: 44px; color: var(--text); font-size: 14px; }
.dependency:active { background: var(--press); }
.dependency small { color: var(--link); font-size: 12px; }
.dependency > .catalog-art { flex: 0 0 22px; border-radius: 4px; }
.detail-icon .catalog-emoji { font-size: 45px; }
.detail-actions { margin-top: 16px; }
.site-frame { display: block; width: 100%; height: min(68dvh, 46rem); min-height: 22rem; border: 0; border-radius: 12px; }
.site-usage { margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.site-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; align-items: center; padding: 3px; }
.site-list-row + .site-list-row { border-top: 1px solid var(--line); }
.site-remove { min-height: 44px; padding: 0 12px; background: transparent; color: var(--danger); font-size: 14px; }
.site-remove:active { background: var(--press); }
.site-delete-actions { margin-top: 12px; }
.skill-actions { display: grid; gap: 8px; }
.skill-actions > button { margin-top: 0; }
.skill-editor { display: grid; gap: 16px; padding: 0 16px 24px; }
.skill-editor label { display: grid; gap: 6px; font-size: 15px; }
.skill-editor :is(input, textarea, select) {
  width: 100%; min-height: var(--control-height); padding: 12px 16px; border-radius: var(--radius-pill); border: 0;
  background: var(--control-fill); color: inherit; font: inherit;
}
.skill-editor select { padding-inline-end: 24px; }
.skill-editor textarea { border-radius: var(--radius-panel); resize: vertical; }
.primary {
  width: 100%; min-height: 48px; padding: 9px 16px; margin-top: 10px;
  background: var(--action); color: var(--on-action); font-weight: 600;
}
.primary:active:not(:disabled) { filter: brightness(.92); }
.primary:focus-visible { box-shadow: inset 0 0 0 2px var(--on-action), 0 0 0 2px var(--action); }
.primary:disabled { background: var(--control-fill); color: var(--muted); }
button[data-action="connect"][aria-busy="true"]::after {
  content: ""; display: inline-block; width: .85em; height: .85em; margin-inline-start: .6em;
  vertical-align: -.08em; border: 2px solid currentColor; border-inline-end-color: transparent;
  border-radius: 50%; animation: connection-spin .7s linear infinite;
}
@keyframes connection-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  button[data-action="connect"][aria-busy="true"]::after { animation: none; }
}
.plain-action {
  width: 100%; min-height: var(--control-height); margin-top: 6px; padding: 8px 16px;
  background: var(--control-fill); color: var(--link); font-weight: 500;
}
.plain-action:active { background: var(--press); }
.plain-action:is([data-action="delete_personal"], [data-action="stop_schedule"]) { color: var(--danger); }
.appearance-offer { display: grid; justify-items: center; gap: 14px; padding: 16px 12px; text-align: center; }
.appearance-offer p { max-width: 32ch; color: var(--muted); }
.appearance-offer + .primary { background: var(--badge); color: var(--badge-ink); }
.appearance-carousel { display: flex; align-items: center; justify-content: center; gap: 9px; overflow: hidden; }
.appearance-card { width: min(57vw, 214px); margin: 8px 0; text-align: center; touch-action: pan-y; animation: avatar-arrive .3s ease both; }
.appearance-card img { display: block; width: 100%; height: auto; border-radius: 18px; }
.appearance-card .agent-bust { margin: 0 auto; }
.helio-portrait { position: relative; width: min(100%, 272px); aspect-ratio: 1; overflow: hidden; margin: 8px auto;
  border-radius: 24px; background: radial-gradient(ellipse, #f6ae68, #fce0bc 70%); }
.helio-portrait > img { display: block; width: 100%; height: 100%; object-fit: cover; animation: portrait-appear 1350ms ease both; }
.helio-portrait .solar-mark { position: absolute; top: 64%; left: 46%; width: 44%; height: auto; color: white;
  animation: portrait-mark 1350ms ease both; filter: drop-shadow(0 0 18px #ff9100); }
@keyframes portrait-appear { 0%, 27% { opacity: 0; transform: scale(1.8); transform-origin: 46% 64%; } }
@keyframes portrait-mark { 0%, 27% { transform: translate(-41%, -82%) scale(1); opacity: 1; }
  83% { opacity: .8; } 100% { transform: translate(-50%, -50%) scale(.08); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .helio-portrait > img { animation: none; } .helio-portrait .solar-mark { display: none; } }
.appearance-card figcaption { margin-top: 8px; font-weight: 500; }
.avatar-step { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--surface); font-size: 25px; }
.avatar-step:active { background: var(--press); }
.appearance-options { display: flex; justify-content: center; gap: 8px; margin: 3px 0 8px; }
.appearance-options button { padding: 2px; border-radius: 12px; background: transparent; }
.appearance-options button[aria-pressed="true"] { background: var(--accent); }
.appearance-options img { display: block; width: 44px; height: 44px; border-radius: 8px; }
@keyframes avatar-arrive { from { transform: translateX(12px) rotateY(14deg); opacity: .55; } }
.luna-sheet {
  inset: auto 0 0; width: min(100%, 560px); max-width: none; max-height: min(75dvh, 520px);
  margin: auto auto 0; padding: 12px 16px calc(14px + var(--safe-bottom));
  border: 0; border-radius: 20px 20px 0 0; background: var(--canvas); color: var(--text);
}
.luna-sheet::backdrop { background: #0007; }
.luna-sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.luna-sheet header h2 { font-size: 20px; line-height: 1.2; font-weight: 650; }
.sheet-error { margin-top: 8px; color: var(--muted); }
.sheet-error:empty { display: none; }
.zone-list { margin-top: 8px; max-height: 44dvh; overflow-y: auto; }
.welcome { padding: 22px 18px 17px; }
.welcome > img { width: 86px; height: 86px; margin: 0 auto 14px; }
.welcome h1, .welcome p { text-align: center; }
.welcome p { margin-top: 8px; color: var(--muted); }
.choices { display: grid; gap: 8px; }
.choices { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.choices button { background: var(--canvas); color: var(--accent); padding: 8px; min-height: var(--control-height); }
main.setup-layout {
  display: flex; flex-direction: column; max-width: 464px; padding: 0;
  height: 100vh; height: min(100dvh, var(--tg-viewport-stable-height, 100dvh));
}
.setup-content {
  flex: 1; min-height: 0; padding: clamp(17px, 4vh, 29px) 16px 12px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
}
.setup-content::-webkit-scrollbar { display: none; }
.setup-header { text-align: center; margin-bottom: 21px; }
.setup-header img {
  display: block; width: 76px; height: 76px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 13px;
}
.setup-header h1 { font-size: 23px; font-weight: 660; line-height: 1.22; letter-spacing: -.3px; }
.setup-progress { display: flex; gap: 4px; justify-content: center; margin-top: 12px; }
.setup-progress span { width: 12px; height: 3px; border-radius: 3px; background: var(--line); }
.setup-progress .filled { background: var(--accent); }
.setup-options, .setup-name { border-radius: 16px; background: var(--surface); }
.setup-options { overflow: hidden; }
.setup-option {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 9px 20px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.setup-option + .setup-option::before {
  content: ""; position: absolute; top: 0; height: 1px; background: var(--line);
  inset-inline: 20px; pointer-events: none;
}
.setup-option:active, .setup-link:active, .setup-next:not(:disabled):active { background: var(--press); }
.setup-option img { display: block; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.setup-option input { opacity: 0; position: absolute; inset-inline-end: 15px; width: 22px; height: 22px; margin: 0; }
.setup-mark {
  display: grid; place-items: center; flex: 0 0 22px; height: 22px;
  margin-inline-start: auto; border: 2px solid var(--muted); border-radius: 50%;
}
.setup-option input:focus-visible + .setup-mark { outline: 2px solid var(--accent); outline-offset: 2px; }
.setup-option input:checked + .setup-mark { border-color: var(--accent); }
.setup-option input[type="radio"]:checked + .setup-mark::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}
.setup-option input[type="checkbox"] + .setup-mark { border-radius: 6px; }
.setup-option input[type="checkbox"]:checked + .setup-mark { background: var(--badge); }
.setup-option input[type="checkbox"]:checked + .setup-mark::after {
  content: ""; width: 5px; height: 10px; border: solid var(--badge-ink);
  border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg);
}
.setup-name { display: block; width: 100%; border: 0; padding: 12px 15px; min-height: 49px; }
.setup-name::placeholder { color: var(--muted); opacity: 1; }
.setup-actions {
  flex: none; background: var(--canvas); padding: 10px 16px calc(5px + var(--safe-bottom));
}
.setup-next, .setup-link { display: block; width: 100%; font-weight: 600; }
.setup-links { display: flex; justify-content: center; gap: 8px; }
.setup-links .setup-link { flex: 1; min-height: 44px; }
.setup-next {
  min-height: 48px; padding: 10px 14px;
  background: var(--surface); color: var(--accent);
}
.setup-next:disabled { color: var(--muted); opacity: .65; }
.setup-link { min-height: 44px; padding: 8px 12px; background: transparent; color: var(--accent); }
.setup-content .setup-link { margin-top: 4px; }
.error { color: var(--muted); text-align: center; padding: 10px; }
#nav {
  display: flex; position: fixed; z-index: 2; bottom: calc(8px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 32px), 528px); background: var(--panel-fill); border-radius: var(--radius-pill); padding: 4px; gap: 3px;
  box-shadow: 0 2px 18px #0002, inset 0 0 0 1px var(--line);
}
#nav button {
  display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-width: 0; min-height: 49px; padding: 5px 1px;
  background: transparent; color: var(--muted); font-size: 11px; line-height: 14px;
}
#nav button[aria-current="page"] { background: var(--press); color: var(--link); font-weight: 600; }
#nav button:active { background: var(--press); }
#nav button[aria-current="page"]:active { filter: brightness(.9); }
@media (prefers-reduced-motion: reduce) { .launch img, .agent-piece, .appearance-card { animation: none; } }

.voice-choice { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 20px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.voice-choice:active { background: var(--pressed, rgba(128,128,128,.12)); }
.voice-choice input { accent-color: var(--accent); width: 18px; height: 18px; }
.voice-choice select { max-width: 52%; color: inherit; background: var(--bg, transparent); font: inherit; }
.about-field { display: grid; gap: 6px; margin: 0 0 16px; }
.about-field .setup-name { margin: 0; }
.voice-note { display: grid; gap: 8px; margin: 18px 0; }
.voice-note textarea { font: inherit; color: inherit; padding: 12px; border: 1px solid var(--line, #8886); border-radius: 12px; background: transparent; resize: vertical; }
.operation-status { display: inline-grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 7px; }
.operation-status img, .operation-status video { width: 22px; height: 22px; object-fit: contain; }
@media (prefers-reduced-motion: no-preference) {
  .operation-status > span { animation: show-operation .14s ease-out; }
}
@keyframes show-operation { from { opacity: .55; } to { opacity: 1; } }
.skill-repeat-days { min-width: 0; margin: 0; padding: 0; border: 0; }
.skill-repeat-days div { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.skill-repeat-days label { position: relative; display: block; text-align: center; }
.skill-repeat-days input { position: absolute; inset: 0; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.skill-repeat-days span {
  display: grid; place-items: center; min-height: 42px; padding: 4px 0;
  border-radius: var(--radius-pill); background: var(--control-fill);
}
.skill-repeat-days input:checked + span { background: var(--action); color: var(--on-action); }
.skill-repeat-days input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
