:root {
  color-scheme: dark;
  --ink: #f6f7fb;
  --muted: #a8afbd;
  --line: rgba(255,255,255,.12);
  --panel: rgba(21,25,34,.84);
  --accent: #83e8cd;
  --accent-2: #8bb9ff;
  --danger: #ff7d8d;
}
* { box-sizing: border-box; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
html, body { width: 100%; min-height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-rounded, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 20%, rgba(82,126,170,.19), transparent 25%),
    radial-gradient(circle at 82% 72%, rgba(62,165,137,.13), transparent 30%),
    linear-gradient(145deg, #11141b, #171c26 58%, #0e1117);
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 680px;
  overflow: hidden;
  background:
    linear-gradient(rgba(5,10,18,.18), rgba(5,10,18,.3)),
    url("./assets/mac-desktop-demo-v1.png") center / cover no-repeat;
}
.intro {
  position: fixed;
  top: 26px;
  left: 30px;
  right: 30px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}
.intro h1 { margin: 6px 0 5px; font-size: clamp(23px, 3vw, 38px); letter-spacing: -.04em; }
.intro p { margin: 0; max-width: 620px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .17em; }
.home-link {
  pointer-events: auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.06);
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  backdrop-filter: blur(16px);
}
.pet {
  position: absolute;
  left: 50%;
  top: 51%;
  z-index: 5;
  width: min(720px, 88vw);
  height: min(780px, 90vh);
  transform: translate(-50%, -50%) scale(var(--pet-scale, 1));
  transform-origin: center bottom;
  touch-action: none;
}
.pet iframe {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  color-scheme: normal;
  background: transparent;
}
.control-stack {
  position: absolute;
  left: 50%;
  z-index: 12;
  width: min(470px, 94%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
}
.pet[data-controls-position="top"] .control-stack { top: 10%; }
.pet[data-controls-position="middle"] .control-stack { top: 50%; transform: translate(-50%, -50%); }
.pet[data-controls-position="bottom"] .control-stack { bottom: 1.5%; }
.control-bar {
  position: relative;
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 7px 6px 13px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  background: rgba(17,21,29,.84);
  box-shadow: 0 18px 48px rgba(0,0,0,.34);
  backdrop-filter: blur(24px);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.control-bar.dragging { cursor: grabbing; }
.mini-status {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.mini-status #statusText {
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #788190; }
.control-bar.active .status-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(131,232,205,.11); }
.control-bar.error .status-dot { background: var(--danger); }
.control-divider { width: 1px; height: 24px; margin: 0 4px; background: rgba(255,255,255,.1); }
.tool-button, .emotion-indicator {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #aeb7c5;
  background: transparent;
}
.tool-button { cursor: pointer; transition: color .16s ease, background .16s ease, transform .16s ease; }
.tool-button:hover { color: #fff; background: rgba(255,255,255,.08); transform: translateY(-1px); }
.tool-button svg, .emotion-indicator svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-button.primary { color: var(--accent); background: rgba(131,232,205,.08); }
.tool-button[aria-pressed="true"] {
  color: #091713;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(131,232,205,.1);
}
#talkButton { overflow: hidden; }
.mic-meter {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 3px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(8,20,17,.2);
  opacity: 0;
  transition: opacity .16s ease;
}
#talkButton[aria-pressed="true"] .mic-meter { opacity: 1; }
.mic-level-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: #0e6858;
  transition: width .06s linear, background .1s ease;
}
.mic-threshold-mark {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 56%;
  width: 2px;
  border-radius: 2px;
  background: rgba(4,18,15,.78);
}
#talkButton[data-above-threshold="true"] {
  background: #b6ffe9;
  box-shadow: 0 0 0 5px rgba(131,232,205,.18), 0 0 24px rgba(131,232,205,.32);
}
.emotion-indicator {
  color: #aeb7c5;
  background: rgba(255,255,255,.045);
  transition: border-color .2s ease, transform .2s ease;
}
.emotion-indicator[data-emotion="happy"] { color: #f2d37c; }
.emotion-indicator[data-emotion="sad"] { color: #86baf0; }
.emotion-indicator[data-emotion="angry"] { color: #ef8792; }
.emotion-indicator[data-emotion="surprised"] { color: #c59bea; }
.emotion-indicator.changed { transform: scale(1.09); }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 40;
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #e8ebf1;
  background: rgba(10,13,18,.94);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .14s ease, transform .14s ease;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.has-tooltip:hover::after, .has-tooltip:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.speech-bubble {
  position: absolute;
  left: 50%;
  bottom: var(--bubble-position, 28%);
  z-index: 10;
  width: min(430px, 82%);
  max-height: min(240px, 34%);
  overflow: auto;
  padding: 13px 15px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px 18px 18px 5px;
  background: rgba(18,22,30,.82);
  box-shadow: 0 18px 42px rgba(0,0,0,.3);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.speech-bubble strong, .speech-bubble span { display: block; }
.speech-bubble strong { margin-bottom: 5px; color: var(--accent); font-size: 10px; letter-spacing: .09em; }
.speech-bubble span { font-size: 13px; line-height: 1.5; }
.text-composer {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px 6px 12px;
  border: 1px solid rgba(131,232,205,.2);
  border-radius: 16px;
  color: #edf4f2;
  background: rgba(12,17,22,.76);
  box-shadow: 0 12px 32px rgba(0,0,0,.24);
  backdrop-filter: blur(18px);
}
.text-composer[hidden] { display: none; }
.text-composer textarea {
  min-height: 38px;
  max-height: 94px;
  flex: 1;
  resize: none;
  border: 0;
  padding: 9px 2px;
  background: transparent;
  line-height: 1.35;
}
.text-composer textarea:focus { border: 0; }
.text-send-button {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #09251e;
  background: var(--accent);
  cursor: pointer;
}
.text-send-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: min(430px, calc(100vw - 32px));
  padding: 20px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0,0,0,.48);
  backdrop-filter: blur(30px);
  transform: translateX(calc(100% + 35px));
  transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer.compact { width: min(370px, calc(100vw - 32px)); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.drawer-header h2 { margin: 5px 0 0; font-size: 22px; }
.close-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  cursor: pointer;
}
.tabs, .panel-actions, .field-row { display: flex; gap: 8px; }
.tabs { margin-bottom: 16px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.055); }
.tab {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.tab.active { color: var(--ink); background: rgba(255,255,255,.1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-actions { flex-wrap: wrap; margin: 12px 0; }
.panel-actions button, #calendarButton {
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  color: #10221f;
  background: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
}
.panel-actions .secondary { color: var(--ink); background: rgba(255,255,255,.1); }
.panel-actions .ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.panel-note { color: var(--muted); font-size: 11px; line-height: 1.55; }
.settings-group {
  margin: 15px 0;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.settings-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-group-heading strong, .settings-group-heading span { display: block; }
.settings-group-heading strong { margin-bottom: 4px; font-size: 12px; }
.settings-group-heading span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.small-action, .text-action {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255,255,255,.07);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}
.text-action { margin-top: 10px; color: var(--muted); background: transparent; }
.mini-toggle { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.mini-toggle input { width: auto; }
details.settings-group summary { cursor: pointer; font-size: 12px; font-weight: 800; }
.color-field input { height: 38px; padding: 4px; }
.history-list { display: grid; gap: 9px; margin-top: 14px; }
.history-empty { padding: 28px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.history-item {
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}
.history-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; color: var(--accent); font-size: 9px; font-weight: 850; }
.history-item p { margin: 0; white-space: pre-wrap; color: #dfe3eb; font-size: 12px; line-height: 1.55; }
.notebook-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.notebook-heading strong, .notebook-heading span { display: block; }
.notebook-heading strong { font-size: 13px; }
.notebook-heading span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.notebook-list { display: grid; gap: 11px; margin-top: 14px; }
.notebook-card {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 15px;
  background: rgba(255,255,255,.04);
}
.notebook-card.is-reference { border-color: rgba(131,232,205,.25); }
.notebook-card-header { display: flex; align-items: center; gap: 7px; }
.notebook-card-title { min-width: 0; flex: 1; padding: 8px 9px; font-size: 12px; font-weight: 800; }
.notebook-delete {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.notebook-delete:hover { color: #fff; background: rgba(239,112,125,.12); }
.notebook-card textarea { min-height: 116px; margin-top: 8px; font-size: 11px; }
.notebook-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.notebook-reference { display: flex; align-items: center; gap: 7px; color: #dfe3eb; font-size: 10px; }
.notebook-reference input { width: auto; }
.notebook-updated { color: var(--muted); font-size: 9px; }
.notebook-empty { padding: 25px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.field { display: grid; gap: 7px; margin: 12px 0; color: var(--muted); font-size: 11px; font-weight: 750; }
.field-row .field { flex: 1; min-width: 0; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  color: var(--ink);
  background: rgba(255,255,255,.065);
  outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: rgba(131,232,205,.56); }
input[type="range"] { padding: 0; }
.check-row { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0; color: #dfe3eb; font-size: 12px; line-height: 1.45; }
.check-row input { width: auto; margin-top: 2px; }
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(4,6,9,.38); backdrop-filter: blur(5px); }
.calibration-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6,8,12,.72);
  backdrop-filter: blur(16px);
}
.calibration-overlay[hidden] { display: none; }
.calibration-card {
  width: min(390px, 100%);
  padding: 25px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 24px;
  text-align: center;
  background: rgba(21,25,34,.96);
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.calibration-card h2 { margin: 8px 0; }
.calibration-card > p { margin: 8px 0 16px; }
.calibration-face { margin: 17px 0 6px; font-size: 52px; }
.calibration-progress { height: 6px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.calibration-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .18s ease; }
.secondary-wide {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.07);
  cursor: pointer;
}
@media (max-width: 720px) {
  .intro { top: 18px; left: 18px; right: 18px; }
  .intro p { display: none; }
  .pet { width: 94vw; height: min(700px, 82vh); }
  .pet[data-controls-position="bottom"] .control-stack { bottom: .5%; }
}
@media (max-width: 480px) {
  .desktop { min-height: 620px; }
  .intro h1 { font-size: 21px; }
  .home-link { padding: 8px 10px; }
  .pet { left: 50%; width: 98vw; height: 76vh; }
  .mini-status { max-width: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
