:root {
  color-scheme: light dark;
  --bg: #f7f3ec;
  --panel: #fffdf9;
  --ink: #293e35;
  --muted: #70786d;
  --line: #e6e6db;
  --accent: #cf5d3b;
  --soft: #f0eadc;
  --sage: #e8eddf;
  --shadow: 0 12px 40px #35483008;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 85% 12%, #ece8d4 0, transparent 45%), var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
button,
input,
textarea,
a {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  min-height: 46px;
  padding: 10px 18px;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover,
.button:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
button[hidden],
[hidden] {
  display: none !important;
}
.wrap {
  max-width: 1160px;
  margin: auto;
  padding: 0 28px;
}
header {
  height: 104px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 25px;
  letter-spacing: -1px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
}
.brand > span:last-child {
  color: var(--accent);
}
.brand-icon {
  background: var(--ink);
  border-radius: 13px;
  margin-right: 10px;
  font-size: 22px;
  padding: 3px 7px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.model {
  font-size: 11px;
  letter-spacing: 0.04em;
  background: var(--sage);
  border-radius: 30px;
  padding: 6px 12px;
}
.model:before {
  content: "●";
  color: #67976b;
  margin-right: 6px;
}
nav {
  display: flex;
  margin-top: 26px;
  gap: 8px;
}
nav button {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 13px;
  min-height: 40px;
}
nav button.active {
  background: var(--ink);
  color: var(--bg);
}
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  min-height: 350px;
  gap: 40px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--accent);
}
h1 {
  font-size: clamp(48px, 6vw, 76px);
  line-height: 1.05;
  letter-spacing: -4px;
  margin: 20px 0;
}
h2 {
  font-size: 22px;
  letter-spacing: -0.6px;
  margin: 0;
}
h3 {
  font-size: 17px;
  margin: 10px 0;
}
p {
  color: var(--muted);
}
.hero p {
  max-width: 420px;
  font-size: 16px;
  margin: 18px 0;
}
.hero-note {
  font-size: 11px;
  color: var(--muted);
}
.hero-note > span:first-child {
  color: var(--accent);
  padding-right: 5px;
}
.dog-art {
  position: relative;
  width: 300px;
  justify-self: center;
}
.dog-art img {
  width: 100%;
  transform: rotate(-5deg);
  border-radius: 50%;
}
.dog-bubble {
  position: absolute;
  bottom: 10px;
  right: -20px;
  background: var(--panel);
  padding: 12px 24px;
  border-radius: 20px 20px 20px 3px;
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 700;
  transform: rotate(5deg);
}
.orbit {
  position: absolute;
  font-size: 40px;
  color: var(--accent);
  z-index: 1;
}
.orbit-one {
  left: -20px;
  top: 50px;
  transform: rotate(-15deg);
}
.orbit-two {
  right: 0;
  top: 5px;
}
.workspace {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  margin: 25px 0 65px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.section-title {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.section-title h2 {
  font-size: 17px;
}
.step {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 5px 8px;
}
.dropzone {
  text-align: center;
  background: var(--bg);
  border: 1.5px dashed #cbd0bd;
  border-radius: 16px;
  padding: 28px 15px;
}
.dropzone.drag {
  border-color: var(--accent);
}
.upload-icon {
  display: inline-flex;
  background: var(--sage);
  color: var(--ink);
  width: 50px;
  height: 50px;
  border-radius: 16px;
  align-items: center;
  justify-content: center;
  font-size: 27px;
}
.dropzone p {
  font-size: 12px;
  max-width: 260px;
  margin: 8px auto 20px;
}
.dropzone small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 14px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.record-row {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.record-row button {
  flex: 1;
  font-size: 12px;
}
details {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 17px 0;
}
summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  min-height: 30px;
}
summary span {
  float: right;
  font-size: 10px;
  color: var(--muted);
}
.context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 15px;
}
label {
  font-size: 12px;
}
label span {
  display: block;
  margin-bottom: 5px;
}
input,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  color: var(--ink);
  min-width: 0;
}
.full {
  grid-column: 1/-1;
}
.analyze {
  width: 100%;
  font-size: 14px;
}
.sample {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  width: 100%;
  margin-top: 9px;
}
.welcome {
  background: linear-gradient(145deg, var(--sage), var(--panel));
  padding: 44px 34px;
  text-align: center;
  min-height: 510px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mini-paws {
  font-size: 45px;
  opacity: 0.8;
  transform: rotate(-12deg);
  margin-bottom: 20px;
}
.welcome h2 {
  font-size: 38px;
  line-height: 1.15;
  margin: 18px 0;
  letter-spacing: -1.5px;
}
.welcome p {
  font-size: 13px;
  max-width: 300px;
}
.feature-pills {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 15px 0 30px;
}
.feature-pills span {
  font-size: 9px;
  border: 1px solid #ccd4c5;
  border-radius: 20px;
  padding: 5px 9px;
}
.note {
  font-size: 10px;
  color: var(--muted);
  max-width: 320px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}
#preview img,
#preview video,
#camera {
  max-width: 100%;
  max-height: 230px;
  border-radius: 14px;
  display: block;
  margin: 12px auto;
}
#preview audio {
  width: 100%;
}
#preview p {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.result {
  text-align: center;
}
.result-emoji {
  font-size: 65px;
}
.result .badge {
  display: inline-block;
  font-size: 10px;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--sage);
}
.speech {
  background: var(--sage);
  border-radius: 22px 22px 22px 3px;
  padding: 24px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin: 22px 0;
}
.confidence {
  height: 6px;
  border-radius: 9px;
  background: var(--soft);
  overflow: hidden;
}
.confidence span {
  height: 100%;
  display: block;
  background: var(--accent);
}
.result small {
  font-size: 10px;
  color: var(--muted);
}
.result p {
  font-size: 12px;
  text-align: left;
}
.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}
.signals details {
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 11px;
  text-align: left;
  margin: 0;
  max-width: 100%;
}
.signals summary {
  font-size: 10px;
  min-height: 20px;
}
.result ul {
  text-align: left;
  font-size: 13px;
  padding-left: 20px;
}
.vet {
  background: #ffe4df;
  color: #962a23;
  padding: 14px;
  border: 1px solid #f1b3a4;
  border-radius: 12px;
  font-size: 12px;
  text-align: left;
}
.result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.result-actions button {
  font-size: 12px;
}
.diary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 45px;
  gap: 15px;
}
.diary-heading h1 {
  font-size: 46px;
  letter-spacing: -2px;
}
#stats {
  margin: 24px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}
.bars {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 110px;
  margin-top: 15px;
}
.bar-col {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 4px;
}
.bar-col i {
  width: 75%;
  background: var(--accent);
  border-radius: 5px 5px 0 0;
  min-height: 2px;
}
.bar-col small {
  font-size: 9px;
}
.entry {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 15px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}
.entry img {
  width: 65px;
  height: 65px;
  object-fit: cover;
  border-radius: 12px;
}
.entry p {
  margin: 4px 0;
  font-size: 14px;
}
.entry small {
  font-size: 10px;
  color: var(--muted);
}
#patternResult {
  margin-top: 20px;
}
#status {
  text-align: center;
  color: var(--accent);
  margin: 20px 0;
  min-height: 25px;
  font-size: 14px;
}
#error {
  background: #ffe4df;
  color: #962a23;
  padding: 16px;
  border-radius: 12px;
  overflow-wrap: anywhere;
}
footer {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding-top: 23px !important;
  padding-bottom: 25px !important;
  color: var(--muted);
  font-size: 10px;
}
.heart {
  color: var(--accent);
}
dialog {
  max-width: 450px;
  width: calc(100% - 32px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  color: var(--ink);
  padding: 25px;
}
dialog::backdrop {
  background: #172c2477;
  backdrop-filter: blur(4px);
}
dialog img {
  width: 100%;
  border-radius: 16px;
  margin-top: 20px;
}
.close {
  float: right;
  padding: 6px 12px;
}
.loading {
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
@media (max-width: 700px) {
  .wrap {
    padding: 0 20px;
  }
  header {
    height: 80px;
  }
  .brand {
    font-size: 21px;
  }
  .header-right {
    gap: 8px;
  }
  .model {
    font-size: 9px;
    padding: 5px 8px;
  }
  .header-right button {
    padding: 8px 11px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 30px;
  }
  .hero h1 {
    font-size: 60px;
  }
  .hero p {
    font-size: 14px;
  }
  .dog-art {
    width: 220px;
    margin-top: 20px;
  }
  .workspace {
    grid-template-columns: 1fr;
    margin-top: 30px;
    gap: 20px;
  }
  .panel {
    padding: 22px;
  }
  .welcome {
    min-height: 350px;
  }
  .welcome h2 {
    font-size: 33px;
  }
  footer {
    flex-direction: column;
    gap: 5px;
  }
  .diary-heading {
    align-items: start;
  }
  .diary-heading h1 {
    font-size: 38px;
  }
  #stats {
    grid-template-columns: 1fr;
  }
  .eyebrow {
    font-size: 9px;
  }
  .speech {
    font-size: 23px;
  }
  .dropzone {
    padding: 25px 10px;
  }
  .dropzone h3 {
    font-size: 15px;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17271f;
    --panel: #21332a;
    --ink: #f0efdf;
    --muted: #aab6a8;
    --line: #3a4b3f;
    --accent: #e88c69;
    --soft: #3b4d3c;
    --sage: #304638;
  }
  body {
    background:
      radial-gradient(ellipse at 85% 12%, #34432b 0, transparent 45%), var(--bg);
  }
  .primary {
    color: #17271f;
  }
  .vet {
    background: #4e2924;
    color: #ffb4a1;
    border-color: #7f4238;
  }
  .brand-icon {
    background: var(--sage);
  }
  #error {
    background: #4e2924;
    color: #ffb4a1;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transform: none !important;
    scroll-behavior: auto !important;
  }
}

.camera-timeline {
  border-left: 3px solid var(--accent, #b85f43);
  padding-left: 2rem;
}
.camera-timeline li {
  padding: 1rem 0;
}
.camera-alert {
  padding: 1rem;
  margin: 1rem 0;
  border: 2px solid #a26920;
  border-radius: 12px;
  white-space: pre-line;
}
.camera-alert.urgent {
  border-color: #ac2533;
}
#cameraClips label {
  display: block;
  margin: 0.5rem 0;
}
#cameraClips input,
#cameraClips textarea {
  display: block;
  width: 100%;
}

.live-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
}
.live-controls label {
  display: grid;
  gap: 0.4rem;
  max-width: 180px;
}
.live-stage {
  position: relative;
  background: #16251e;
  border-radius: 1rem;
  overflow: hidden;
}
#liveVideo {
  display: block;
  width: 100%;
  max-height: 65vh;
}
#liveOverlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  color: white;
  background: #16251ed9;
  padding: 0.7rem;
  max-height: 55%;
  overflow: auto;
}
#liveOverlay:empty {
  display: none;
}
#liveOverlay p {
  margin: 0.2rem;
}
#liveBanner {
  border: 2px solid #a84024;
  padding: 1rem;
  border-radius: 0.6rem;
}
#liveTimeline {
  max-height: 24rem;
  overflow: auto;
}

#liveOverlay .badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
  margin: 0.2rem;
  background: #fff;
  color: #16251e;
}
#liveOverlay strong {
  display: block;
}
#liveTimeline .live-skipped {
  color: #68716b;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-block: 0.2rem;
}

/* OS camera-effect warning in live mode */
.notice {
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  background: #fff4e5;
  color: #8a4b08;
  font-size: 0.9rem;
}
