:root {
  color-scheme: light;
  --cream-0: #fffdf9;
  --cream-1: #fff7ec;
  --cream-2: #ffeddb;
  --peach: #ffc7ac;
  --coral: #ff7168;
  --coral-strong: #ff5c52;
  --orange: #f28a24;
  --butter: #ffd36d;
  --cocoa: #5b2a16;
  --cocoa-soft: #966044;
  --line: rgba(206, 125, 71, 0.2);
  --shadow: 0 20px 60px rgba(131, 73, 38, 0.14);
  --panel-shadow: 0 16px 48px rgba(133, 73, 35, 0.1);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--cocoa);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 190, 129, 0.28), transparent 31rem),
    radial-gradient(circle at 88% 90%, rgba(255, 126, 104, 0.16), transparent 34rem),
    linear-gradient(135deg, #fffaf2 0%, #fff4e8 48%, #fffaf5 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.32;
  pointer-events: none;
}

.ambient-one {
  top: -8rem;
  right: 12%;
  background: rgba(255, 211, 109, 0.55);
}

.ambient-two {
  bottom: -10rem;
  left: 28%;
  background: rgba(255, 113, 104, 0.28);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 250, 243, 0.82);
  box-shadow: 0 8px 30px rgba(126, 72, 37, 0.07);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 143, 58, 0.38);
  border-radius: 16px;
  background: linear-gradient(145deg, #fffaf0, #ffe5c7);
  box-shadow: 0 8px 18px rgba(217, 111, 40, 0.16), inset 0 1px #fff;
}

.brand-mark svg {
  width: 31px;
  height: 31px;
  fill: url("#brand-gradient");
}

.brand-mark svg ellipse {
  fill: #ff7b42;
  stroke: #ef5e2c;
  stroke-width: 1.5;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 21px;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 2px;
  color: var(--cocoa-soft);
  font-size: 12px;
}

.top-actions,
.history-controls,
.filter-row,
.view-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.soft-button,
.primary-button,
.round-button,
.icon-button,
.filter-chip {
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.soft-button:hover,
.primary-button:hover,
.round-button:hover,
.icon-button:hover,
.filter-chip:hover {
  transform: translateY(-1px);
}

.soft-button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 7px 18px rgba(127, 74, 41, 0.07);
  font-size: 13px;
}

.button-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 113, 104, 0.14);
}

.soft-button[aria-pressed="false"] .button-dot {
  background: #d7bda9;
  box-shadow: none;
}

.primary-button {
  min-height: 42px;
  padding: 0 18px;
  border-color: rgba(255, 87, 74, 0.35);
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--coral), #ff8f66);
  box-shadow: 0 10px 24px rgba(255, 105, 88, 0.24), inset 0 1px rgba(255, 255, 255, 0.45);
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(380px, 1fr) minmax(260px, 320px);
  gap: clamp(14px, 2vw, 26px);
  width: min(1660px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 20px clamp(14px, 2vw, 32px) 32px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 253, 249, 0.72);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(18px);
}

.sidebar,
.inspector {
  position: sticky;
  top: 96px;
  align-self: start;
  height: calc(100vh - 116px);
  overflow: hidden;
  border-radius: 26px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 22px 14px 14px;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 15px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sidebar h1,
.inspector h2,
.section-title h3 {
  margin: 0;
}

.sidebar h1 {
  font-size: 23px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 6px 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.73);
}

.search-box span {
  font-size: 23px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  height: 44px;
  border: 0;
  outline: 0;
  color: var(--cocoa);
  background: transparent;
  font-size: 13px;
}

kbd {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid #ebd4c3;
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--cocoa-soft);
  background: #fffaf4;
  font-size: 11px;
  font-family: inherit;
}

.filter-row {
  padding: 0 6px 12px;
}

.filter-chip {
  flex: 1;
  min-height: 35px;
  border-radius: 11px;
  color: var(--cocoa-soft);
  background: #fffaf4;
  font-size: 12px;
}

.filter-chip.active {
  border-color: rgba(255, 108, 92, 0.35);
  color: #d94a3d;
  background: linear-gradient(135deg, #ffe5df, #fff0dd);
  box-shadow: inset 0 1px #fff;
  font-weight: 700;
}

.screen-tree {
  flex: 1;
  overflow: auto;
  padding: 0 4px 20px;
  scrollbar-width: thin;
  scrollbar-color: #e9b998 transparent;
}

.tree-group + .tree-group {
  margin-top: 7px;
}

.group-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.group-toggle:hover {
  background: rgba(255, 230, 210, 0.48);
}

.group-icon {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff4df, #ffd9bb);
  box-shadow: inset 0 1px #fff;
  font-size: 14px;
}

.group-name {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
}

.group-count {
  color: var(--cocoa-soft);
  font-size: 11px;
}

.group-chevron {
  transition: transform 180ms ease;
}

.tree-group.collapsed .group-chevron {
  transform: rotate(-90deg);
}

.tree-group.collapsed .group-items {
  display: none;
}

.group-items {
  display: grid;
  gap: 3px;
  padding: 2px 0 5px 37px;
}

.screen-link {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px 7px 12px;
  border: 0;
  border-radius: 10px;
  color: #825139;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
}

.screen-link::before {
  position: absolute;
  left: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #efc4a6;
  content: "";
}

.screen-link:hover {
  color: var(--cocoa);
  background: rgba(255, 235, 219, 0.55);
}

.screen-link.active {
  color: #cb493d;
  background: linear-gradient(90deg, #ffe4dc, #fff1df);
  box-shadow: inset 0 0 0 1px rgba(255, 117, 99, 0.2);
  font-weight: 800;
}

.screen-link.archive::after {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 5px;
  color: #a16d4f;
  background: #f7e7da;
  content: "旧";
  font-size: 9px;
}

.sidebar-footer {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 11px 8px 2px;
  border-top: 1px dashed #efd9c7;
  color: var(--cocoa-soft);
  font-size: 12px;
}

.sidebar-footer span:first-child {
  color: var(--coral-strong);
  font-weight: 800;
}

.stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.stage-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(610px, 100%);
  min-height: 62px;
  padding: 8px 12px;
  border-radius: 20px;
}

.round-button,
.icon-button {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.77);
}

.round-button {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.round-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.screen-heading {
  min-width: 0;
  padding: 0 14px;
  text-align: center;
}

.screen-heading strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.category-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  color: #c4563d;
  background: #ffe8da;
  font-size: 10px;
  font-weight: 800;
}

.screen-position {
  min-width: 54px;
  color: var(--cocoa-soft);
  text-align: right;
  font-size: 11px;
}

.phone-area {
  position: relative;
  display: grid;
  width: 100%;
  min-height: calc(100vh - 194px);
  place-items: center;
  padding: 22px 8px 40px;
}

.phone-shadow {
  position: absolute;
  bottom: 36px;
  left: 50%;
  width: min(430px, 78%);
  height: 58px;
  border-radius: 50%;
  background: rgba(101, 53, 26, 0.2);
  filter: blur(22px);
  transform: translateX(-50%);
}

.phone-frame {
  position: relative;
  z-index: 2;
  width: min(430px, calc((100vh - 220px) * 0.46154), 92%);
  padding: 11px;
  border: 1px solid rgba(100, 56, 30, 0.34);
  border-radius: 42px;
  background: linear-gradient(145deg, #6d3c22 0%, #3e2113 48%, #724126 100%);
  box-shadow:
    0 28px 72px rgba(77, 39, 18, 0.3),
    inset 0 0 0 2px rgba(255, 236, 210, 0.18),
    inset 0 0 0 6px rgba(30, 14, 7, 0.22);
  transform: scale(var(--phone-scale, 1));
  transform-origin: center top;
  transition: transform 180ms ease;
}

.phone-speaker {
  position: absolute;
  z-index: 8;
  top: 17px;
  left: 50%;
  width: 76px;
  height: 18px;
  border-radius: 0 0 14px 14px;
  background: #3c2013;
  box-shadow: inset 0 -1px rgba(255, 255, 255, 0.1);
  transform: translateX(-50%);
  pointer-events: none;
}

.phone-screen {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 852 / 1846;
  border-radius: 32px;
  background: #fff9f0;
}

.phone-screen > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.loading-cover {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  place-items: center;
  color: var(--cocoa-soft);
  background: #fff8ef;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.loading-cover.visible {
  opacity: 1;
}

.loading-cover p {
  margin: 10px 0 0;
  font-size: 12px;
}

.paw-loader {
  display: inline-block;
  font-size: 34px;
  animation: hop 900ms ease-in-out infinite;
}

@keyframes hop {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

.hotspot-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: auto;
  outline: none;
}

.gesture-hint {
  position: absolute;
  z-index: 3;
  bottom: 7px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 146, 88, 0.25);
  border-radius: 999px;
  color: var(--cocoa-soft);
  background: rgba(255, 250, 243, 0.8);
  box-shadow: 0 7px 20px rgba(113, 62, 33, 0.08);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  transition: opacity 180ms ease;
}

.gesture-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.quick-nav {
  display: none;
  width: min(430px, 94%);
  grid-template-columns: repeat(3, 1fr);
  padding: 6px;
  border-radius: 18px;
}

.quick-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  color: var(--cocoa-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.quick-nav button:hover {
  color: #d64d3e;
  background: #ffe8dc;
}

.inspector {
  overflow-y: auto;
  padding: 22px;
  scrollbar-width: thin;
  scrollbar-color: #e9b998 transparent;
}

.inspector-top {
  padding-bottom: 19px;
  border-bottom: 1px dashed #ecd4c2;
}

.inspector h2 {
  font-size: 22px;
  line-height: 1.35;
}

.inspector-top > p:last-child {
  overflow-wrap: anywhere;
  margin: 9px 0 0;
  color: var(--cocoa-soft);
  font-size: 11px;
  line-height: 1.55;
}

.inspector-section {
  padding: 19px 0;
  border-bottom: 1px dashed #ecd4c2;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h3 {
  font-size: 14px;
}

.section-title span {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #cf5142;
  background: #ffe9de;
  font-size: 10px;
  font-weight: 800;
}

.action-list {
  display: grid;
  gap: 8px;
}

.action-card {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  width: 100%;
  gap: 9px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid rgba(235, 179, 143, 0.46);
  border-radius: 15px;
  color: var(--cocoa);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 239, 223, 0.58));
  box-shadow: 0 6px 16px rgba(126, 66, 31, 0.055);
  cursor: pointer;
  text-align: left;
  transition: transform 150ms ease, border 150ms ease, box-shadow 150ms ease;
}

.action-card:hover {
  border-color: rgba(255, 103, 88, 0.45);
  box-shadow: 0 9px 22px rgba(158, 76, 38, 0.11);
  transform: translateY(-1px);
}

.action-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #fff5df, #ffd7b9);
  box-shadow: inset 0 1px white;
}

.action-copy strong,
.action-copy small {
  display: block;
}

.action-copy strong {
  font-size: 12px;
}

.action-copy small {
  overflow: hidden;
  max-width: 145px;
  margin-top: 3px;
  color: var(--cocoa-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.action-arrow {
  color: var(--coral);
  font-size: 17px;
}

.empty-actions {
  padding: 16px 10px;
  border: 1px dashed #e8c8b0;
  border-radius: 14px;
  color: var(--cocoa-soft);
  text-align: center;
  background: rgba(255, 248, 239, 0.58);
  font-size: 11px;
  line-height: 1.6;
}

.view-controls {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.view-controls button {
  height: 34px;
  min-width: 34px;
  border: 0;
  border-radius: 10px;
  background: #fff2e5;
  cursor: pointer;
}

.view-controls button:last-child {
  min-width: 50px;
  margin-left: auto;
  color: #c2533f;
  font-size: 11px;
  font-weight: 700;
}

.view-controls span {
  min-width: 42px;
  text-align: center;
  font-size: 11px;
}

.switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  cursor: pointer;
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 12px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--cocoa-soft);
  font-size: 9px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch-row i {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #e2cbbb;
  transition: background 160ms ease;
}

.switch-row i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 7px rgba(87, 46, 23, 0.22);
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked + i {
  background: linear-gradient(90deg, var(--coral), #ff9a6a);
}

.switch-row input:checked + i::after {
  transform: translateX(18px);
}

.flow-help {
  display: flex;
  gap: 11px;
  margin-top: 18px;
  padding: 15px !important;
  border: 1px solid rgba(250, 179, 84, 0.32) !important;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff4d9, #ffe8dd);
}

.help-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: linear-gradient(145deg, #ffb646, #ff7c5e);
}

.flow-help strong {
  font-size: 12px;
}

.flow-help p {
  margin: 5px 0 0;
  color: #87583d;
  font-size: 10px;
  line-height: 1.55;
}

.keyboard-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  padding: 17px 2px 3px;
  color: var(--cocoa-soft);
  font-size: 9px;
}

.keyboard-help span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 28px;
  left: 50%;
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: white;
  background: rgba(91, 42, 22, 0.92);
  box-shadow: 0 12px 32px rgba(79, 39, 19, 0.25);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-stagebar,
.mobile-only,
.sidebar-scrim {
  display: none;
}

body.phone-fullscreen .phone-frame {
  width: min(540px, calc((100vh - 34px) * 0.46154));
}

body.phone-fullscreen .phone-area {
  min-height: 100vh;
  padding: 12px;
  background: radial-gradient(circle at center, #fff1e1, #f1c8ab);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(240px, 280px) minmax(370px, 1fr);
  }

  .inspector {
    position: static;
    grid-column: 1 / -1;
    display: grid;
    height: auto;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 20px;
    overflow: visible;
  }

  .inspector-top,
  .inspector-section {
    border: 0;
  }

  .keyboard-help {
    display: none;
  }
}

@media (max-width: 800px) {
  .topbar {
    min-height: 64px;
    padding: 8px 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .brand strong {
    font-size: 18px;
  }

  .brand small,
  .top-actions .soft-button,
  .top-actions .primary-button:first-of-type {
    display: none;
  }

  .top-actions .primary-button {
    min-height: 40px;
    padding: 0 13px;
    font-size: 12px;
  }

  .app-shell {
    display: block;
    min-height: calc(100vh - 64px);
    padding: 10px 8px 28px;
  }

  .sidebar {
    position: fixed;
    z-index: 90;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 340px);
    height: 100vh;
    border-radius: 0 28px 28px 0;
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 80;
    inset: 0;
    display: block;
    background: rgba(73, 38, 20, 0.33);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-only {
    display: grid;
  }

  .icon-button {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .mobile-stagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 5px 8px;
    color: var(--cocoa-soft);
    font-size: 11px;
  }

  .stage-toolbar {
    width: 100%;
    min-height: 54px;
    border-radius: 17px;
  }

  .phone-area {
    min-height: auto;
    padding: 16px 6px 38px;
  }

  .phone-frame {
    width: min(92vw, 410px);
  }

  .gesture-hint {
    bottom: 2px;
  }

  .quick-nav {
    display: grid;
    margin-top: 8px;
  }

  .inspector {
    display: block;
    margin-top: 14px;
    padding: 18px;
    border-radius: 22px;
  }

  .inspector-top {
    border-bottom: 1px dashed #ecd4c2;
  }

  .inspector-section {
    border-bottom: 1px dashed #ecd4c2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
