@font-face {
  font-family: "MLDA Hand CN";
  src: url("/assets/fonts/HanziPenSC-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "MLDA Hand CN";
  src: url("/assets/fonts/HanziPenSC-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "MLDA Hand CN";
  src: url("/assets/fonts/HanziPenSC-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "MLDA Hand CN";
  src: url("/assets/fonts/HanziPenSC-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #efe8dc;
  --paper: #f8f2e8;
  --paper-strong: #fffaf0;
  --ink: #211f1c;
  --muted: #6f675b;
  --line: rgba(58, 49, 39, 0.18);
  --panel: rgba(255, 250, 240, 0.92);
  --accent: #b8863b;
  --accent-dark: #6f4d1f;
  --teal: #284f55;
  --shadow: 0 18px 42px rgba(55, 43, 28, 0.14);
  --hand-cn: "MLDA Hand CN", "HanziPen SC", "Hannotate SC", "Kaiti SC", "STKaiti", "Songti SC", cursive;
  --hand-en: "MLDA Hand CN", "Bradley Hand", "Marker Felt", "Segoe Print", "Comic Sans MS", "Brush Script MT", cursive;
  --brush-en: "MLDA Hand CN", "Marker Felt", "Bradley Hand", "Segoe Print", "Comic Sans MS", "Brush Script MT", cursive;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.55), transparent 30%),
    linear-gradient(125deg, rgba(242, 235, 222, 0.96), rgba(229, 218, 199, 0.88)),
    var(--bg);
  color: var(--ink);
  font-family: var(--hand-cn);
  font-size: 15px;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(40, 34, 26, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 34, 26, 0.025) 1px, transparent 1px);
  background-size: 18px 18px, 18px 18px;
  opacity: 0.32;
}

button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.82);
  color: var(--ink);
  font: inherit;
  font-family: var(--hand-cn);
  padding: 0 12px;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 252, 246, 0.88);
  color: var(--ink);
  font: inherit;
  font-family: var(--hand-cn);
  padding: 6px 8px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-field input {
  width: auto;
  min-height: 0;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 242, 232, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(48, 39, 27, 0.06);
}

body.home-mode .topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.home-mode .toolbar {
  display: none;
}

.topbar span {
  color: var(--muted);
}

.brand-strip {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 260px;
}

.brand-button {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-family: var(--brush-en);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-strip span {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--hand-en);
}

.toolbar {
  display: none;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar input {
  width: 220px;
}

.toolbar select {
  width: 190px;
}

.hidden {
  display: none !important;
}

.home-view {
  position: relative;
  min-height: calc(100vh - 62px);
  overflow: hidden;
  padding: clamp(42px, 7vw, 92px) clamp(28px, 8vw, 118px);
  background:
    linear-gradient(112deg, rgba(250, 245, 235, 0.88) 0%, rgba(250, 245, 235, 0.76) 48%, rgba(239, 226, 205, 0.56) 100%),
    var(--paper);
}

.home-reference {
  position: absolute;
  inset: 0;
  background-image: url("/assets/landing/home-2.png");
  background-size: cover;
  background-position: center;
  opacity: 0.11;
  filter: saturate(0.75);
  pointer-events: none;
}

.home-view::after {
  position: absolute;
  left: -8%;
  right: -10%;
  bottom: -84px;
  height: 190px;
  content: "";
  background: #171512;
  transform: rotate(-4deg);
  box-shadow: 0 -12px 26px rgba(26, 22, 17, 0.13);
}

.pendant-sketch {
  position: absolute;
  left: clamp(24px, 5vw, 88px);
  top: 0;
  width: 142px;
  height: 310px;
  border-left: 2px solid rgba(32, 30, 27, 0.55);
  pointer-events: none;
}

.pendant-sketch span {
  position: absolute;
  left: -42px;
  top: 178px;
  width: 84px;
  height: 72px;
  border: 2px solid rgba(32, 30, 27, 0.62);
  border-radius: 42px 42px 20px 20px;
  background: rgba(255, 250, 239, 0.38);
  box-shadow: inset 0 -12px 20px rgba(184, 134, 59, 0.18), 0 32px 48px rgba(184, 134, 59, 0.18);
}

.pendant-sketch span::after {
  position: absolute;
  left: 22px;
  bottom: 8px;
  width: 40px;
  height: 10px;
  border-radius: 50%;
  content: "";
  background: rgba(244, 193, 95, 0.58);
  filter: blur(2px);
}

.plan-paper {
  position: absolute;
  right: clamp(24px, 7vw, 110px);
  top: clamp(40px, 6vw, 72px);
  width: min(45vw, 640px);
  aspect-ratio: 1.5;
  transform: rotate(8deg);
  opacity: 0.82;
  border: 1px solid rgba(67, 55, 41, 0.2);
  background: rgba(255, 250, 240, 0.64);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.plan-paper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.48;
  mix-blend-mode: multiply;
}

.plan-paper span {
  position: absolute;
  color: var(--accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-style: italic;
}

.plan-paper span:nth-of-type(1) {
  right: 12%;
  top: 10%;
}

.plan-paper span:nth-of-type(2) {
  right: 8%;
  top: 28%;
}

.home-copy {
  position: relative;
  z-index: 2;
  max-width: 570px;
  padding-top: clamp(72px, 11vh, 126px);
  margin-left: clamp(0px, 10vw, 240px);
}

.script-note,
.gold-script,
.home-footer-note {
  font-family: var(--hand-en), var(--hand-cn);
  font-style: italic;
  color: var(--accent);
}

.script-note {
  margin: 0 0 16px clamp(220px, 20vw, 330px);
  font-size: 20px;
  line-height: 1.18;
  color: #2c2a26;
}

.home-copy h1 {
  margin: 0;
  font-family: var(--brush-en);
  font-size: 148px;
  line-height: 0.85;
  font-weight: 900;
  letter-spacing: 0;
}

.subtitle {
  margin: 20px 0 48px;
  font-family: var(--hand-en), var(--hand-cn);
  font-size: 34px;
  color: #2d2923;
  border-bottom: 3px solid rgba(184, 134, 59, 0.48);
  width: max-content;
  max-width: 100%;
}

.cn-line {
  margin: 0 0 16px;
  font-size: 31px;
  letter-spacing: 0.04em;
}

.home-rule {
  width: 42px;
  height: 2px;
  margin: 44px 0 34px;
  background: #2b2824;
}

.micro-copy {
  margin: 0 0 22px;
  color: #5d5850;
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.08em;
  font-family: var(--hand-en), var(--hand-cn);
}

.gold-script {
  margin: 0;
  font-size: 24px;
}

.home-actions {
  position: absolute;
  z-index: 3;
  top: clamp(250px, 39vh, 420px);
  right: clamp(34px, 10vw, 210px);
  width: min(520px, 42vw);
  display: grid;
  filter: drop-shadow(0 18px 22px rgba(61, 49, 33, 0.16));
}

.home-card {
  min-height: 116px;
  display: grid;
  grid-template-columns: 66px 1fr 32px;
  align-items: center;
  gap: 22px;
  border: 0;
  border-bottom: 1px solid rgba(72, 60, 45, 0.16);
  border-radius: 0;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  text-align: left;
  padding: 22px 30px;
}

.home-card:first-child {
  border-radius: 3px 3px 0 0;
}

.home-card:last-child {
  border-bottom: 0;
  border-radius: 0 0 3px 3px;
}

.home-card:hover {
  transform: translateX(4px);
  border-color: transparent;
  color: var(--ink);
}

.home-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
  letter-spacing: 0.04em;
  font-family: var(--hand-cn);
}

.home-card small {
  color: #625c53;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-family: var(--hand-en);
}

.home-card b {
  font-size: 30px;
  font-weight: 300;
}

.home-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 27px;
}

.home-icon.dark {
  background: #242421;
}

.home-icon.gold {
  background: #bd8730;
}

.home-icon.blue {
  background: #48606a;
}

.home-footer-note {
  position: absolute;
  z-index: 2;
  left: 45%;
  bottom: 42px;
  color: var(--accent);
  font-size: 24px;
}

.project-flow {
  min-height: calc(100vh - 62px);
  padding: 28px;
}

.flow-shell {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.flow-progress {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.flow-progress span {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.68);
  color: var(--muted);
  font-size: 13px;
}

.flow-progress span.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: rgba(255, 252, 246, 0.95);
}

.flow-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
}

.flow-main,
.flow-side {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 10px 28px rgba(64, 49, 31, 0.08);
}

.flow-main {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.flow-side {
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.flow-copy {
  display: grid;
  gap: 10px;
  max-width: 620px;
}

.flow-copy h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

.flow-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.project-manager {
  min-height: calc(100vh - 72px);
  padding: 36px clamp(18px, 5vw, 64px);
}

.manager-shell {
  display: grid;
  gap: 22px;
  max-width: 980px;
  margin: 0 auto;
}

.manager-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.manager-header h1 {
  margin: 0 0 8px;
  font-size: clamp(36px, 6vw, 64px);
  font-family: var(--hand-cn);
  line-height: 0.95;
}

.manager-header p {
  margin: 0;
  color: var(--muted);
}

.project-manager-list {
  display: grid;
  gap: 10px;
}

.project-manager-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 10px 24px rgba(64, 49, 31, 0.07);
}

.project-manager-item div:first-child {
  display: grid;
  gap: 4px;
}

.project-manager-item strong {
  font-size: 18px;
  color: var(--ink);
}

.project-manager-item span {
  color: var(--muted);
  font-size: 13px;
}

.project-manager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manager-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.project-options {
  position: relative;
}

.project-options summary {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.82);
  color: var(--ink);
  font-family: var(--hand-cn);
  padding: 5px 12px;
  cursor: pointer;
  list-style: none;
}

.project-options summary::-webkit-details-marker {
  display: none;
}

.project-options summary:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.project-options-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 6;
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.97);
  box-shadow: 0 12px 24px rgba(64, 49, 31, 0.13);
}

.project-options-menu button {
  width: 100%;
}

.project-owner-line {
  display: block;
  padding: 6px 8px 8px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.admin-management .manager-shell {
  max-width: 1120px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 360px);
  gap: 18px;
}

.user-management-grid {
  grid-template-columns: minmax(0, 720px);
}

.admin-subpages {
  margin-top: 18px;
}

.admin-card,
.auth-dialog {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: 0 10px 28px rgba(64, 49, 31, 0.08);
}

.admin-card {
  padding: 18px;
}

.admin-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-card-header h2 {
  margin: 0;
  font-size: 24px;
}

.admin-card-actions {
  display: flex;
  gap: 10px;
}

.admin-user-list {
  display: grid;
  gap: 10px;
}

.admin-user-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(160px, 220px) 92px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.68);
}

.admin-user-item div {
  display: grid;
  gap: 3px;
}

.admin-user-item span {
  color: var(--muted);
  font-size: 12px;
}

.admin-user-item b {
  font-size: 24px;
  color: var(--accent-dark);
}

.admin-user-action-cell {
  position: relative;
  justify-self: end;
}

.admin-user-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  display: grid;
  gap: 4px;
  min-width: 128px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.98);
  box-shadow: 0 14px 28px rgba(50, 39, 24, 0.16);
}

.admin-user-options button {
  width: 100%;
  text-align: left;
}

.admin-form {
  display: grid;
  gap: 4px;
}

.ai-api-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ai-api-entry span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.profile-info-row {
  display: grid;
  gap: 5px;
  padding: 9px 0 6px;
}

.profile-info-row span {
  color: var(--muted);
  font-size: 12px;
}

.profile-info-row strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.account-action-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.account-action-group button {
  width: 100%;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(33, 31, 28, 0.28);
  backdrop-filter: blur(8px);
}

.auth-dialog {
  width: min(420px, 100%);
  padding: 20px;
}

.ai-api-dialog {
  width: min(520px, 100%);
}

.admin-action-dialog {
  width: min(500px, 100%);
}

.ai-api-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.confirm-check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px;
  margin: 4px 0 14px;
}

.confirm-check-row input {
  width: auto;
  min-height: auto;
  margin-top: 2px;
}

.danger-button {
  border-color: rgba(147, 45, 28, 0.42);
  color: #8f2d1c;
}

.flow-eyebrow {
  color: var(--accent-dark) !important;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.upload-card,
.preference-placeholder {
  min-height: 148px;
  border: 1px dashed rgba(58, 49, 39, 0.26);
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.58);
}

.upload-card {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
}

.upload-card input {
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
  position: absolute;
}

.upload-card strong {
  font-size: 24px;
  color: var(--ink);
}

.upload-card span,
.preference-placeholder span {
  color: var(--muted);
}

.upload-card span.uploading {
  color: var(--accent-dark);
}

.upload-plan-stage {
  display: grid;
  gap: 8px;
}

#uploadPlanSvg {
  width: 100%;
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.82);
  touch-action: none;
  cursor: crosshair;
}

#uploadPlanSvg.manual-space-drawing,
#uploadPlanSvg.manual-space-drawing * {
  cursor: crosshair !important;
}

.manual-drawing-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-plan-empty-bg {
  fill: rgba(255, 250, 240, 0.68);
}

.upload-plan-empty-text {
  fill: var(--muted);
  font-size: 18px;
}

.upload-plan-image {
  opacity: 0.96;
}

.recognized-space-polygon {
  fill: var(--space-fill, rgba(184, 134, 59, 0.14));
  stroke: var(--space-stroke, rgba(139, 94, 38, 0.82));
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.recognized-space-polygon.active {
  fill: var(--space-fill, rgba(75, 104, 116, 0.18));
  stroke: var(--space-stroke, #385969);
}

.recognized-space-polygon.needs-review {
  stroke-dasharray: 7 5;
}

.recognized-space-draft,
.recognized-space-draft-fill {
  fill: rgba(184, 134, 59, 0.1);
  stroke: #bd8730;
  stroke-width: 2;
  stroke-dasharray: 8 6;
  vector-effect: non-scaling-stroke;
}

.recognized-space-draft-fill {
  fill: rgba(184, 134, 59, 0.18);
  stroke: none;
}

.recognized-space-draft-line {
  fill: none;
  stroke: #9c6d25;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.recognized-space-draft-preview {
  fill: none;
  stroke: #bd8730;
  stroke-width: 2.4;
  stroke-dasharray: 8 6;
  vector-effect: non-scaling-stroke;
}

.recognized-space-vertex {
  fill: #fffaf0;
  stroke: #385969;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: grab;
}

.recognized-space-vertex.draft {
  stroke: #bd8730;
}

.recognized-space-vertex.preview {
  fill: rgba(255, 250, 240, 0.82);
  stroke: #bd8730;
  stroke-dasharray: 3 3;
}

.recognized-space-label {
  fill: #2b2824;
  font-size: 13px;
  paint-order: stroke;
  stroke: rgba(255, 250, 240, 0.9);
  stroke-width: 3px;
}

.ai-coordinate-debug-overlay {
  display: none;
  pointer-events: none;
}

.ai-coordinate-debug-overlay.enabled {
  display: block;
}

.ai-debug-input-frame {
  fill: none;
  stroke: #9333ea;
  stroke-dasharray: 12 8;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.ai-debug-displayed-image-frame {
  fill: none;
  stroke: #0f766e;
  stroke-dasharray: 5 5;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.ai-debug-raw-polygon {
  fill: none;
  stroke: #ea580c;
  stroke-dasharray: 9 6;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.ai-debug-transformed-polygon {
  fill: none;
  stroke: #111827;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.ai-debug-raw-partition-polygon {
  fill: rgba(220, 38, 38, 0.05);
  stroke: #dc2626;
  stroke-dasharray: 3 7;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.ai-debug-gap-component {
  fill: rgba(250, 204, 21, 0.36);
  stroke: #a16207;
  stroke-dasharray: 4 4;
  stroke-width: 1.7;
  vector-effect: non-scaling-stroke;
}

.ai-debug-gap-label {
  fill: #713f12;
  font-size: 11px;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3px;
}

.ai-debug-calibration-point {
  fill: #ffffff;
  stroke: #dc2626;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.ai-debug-calibration-crosshair {
  stroke: #dc2626;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.ai-debug-calibration-label {
  fill: #7f1d1d;
  font-size: 11px;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3px;
}

.scale-calibration-overlay {
  pointer-events: none;
}

.scale-calibration-crosshair {
  stroke: #0f766e;
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.scale-calibration-crosshair.preview {
  stroke: #d99010;
  stroke-dasharray: 3 3;
}

.scale-calibration-point {
  fill: #fffaf0;
  stroke: #0f766e;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.scale-calibration-point.preview {
  stroke: #d99010;
}

.scale-calibration-line {
  stroke: #0f766e;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.scale-calibration-line.preview {
  stroke: #d99010;
  stroke-dasharray: 7 5;
}

.scale-calibration-label {
  fill: #0f514d;
  font-size: 13px;
  paint-order: stroke;
  stroke: rgba(255, 250, 240, 0.92);
  stroke-width: 3px;
}

.preference-placeholder {
  display: grid;
  place-items: center;
}

.generation-progress-card {
  width: min(640px, 100%);
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  margin: auto;
  padding: 48px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 18px 48px rgba(64, 49, 31, 0.1);
}

.generation-progress-card h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1;
  font-family: var(--hand-cn);
  color: var(--ink);
}

.generation-progress-card p {
  margin: 0;
  color: var(--muted);
}

.generation-spinner {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(58, 49, 39, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: generation-spin 1s linear infinite;
}

@keyframes generation-spin {
  to {
    transform: rotate(360deg);
  }
}

.manual-room-button.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: rgba(255, 252, 246, 0.96);
}

.recognition-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.space-recognition-panel {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.space-recognition-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.space-recognition-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
}

.space-recognition-header strong {
  color: var(--ink);
}

.space-recognition-header button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 13px;
}

.space-recognition-header button.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: rgba(255, 252, 246, 0.96);
}

.scale-calibration-status {
  margin: -2px 0 0;
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1.5;
}

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

.recognized-space-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.72);
}

.recognized-space-item.active {
  border-color: var(--accent);
  background: rgba(255, 252, 246, 0.96);
}

.recognized-space-item.needs-review {
  border-color: rgba(181, 96, 32, 0.48);
  background: rgba(255, 247, 237, 0.88);
}

.recognized-space-select {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-width: 0;
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.recognized-space-delete {
  align-self: center;
  min-width: 64px;
  min-height: 32px;
  border-color: rgba(138, 48, 28, 0.35);
  color: #8a301c;
  white-space: nowrap;
}

.recognized-space-delete:hover {
  border-color: #8a301c;
  color: #6d2414;
}

.recognized-space-item strong {
  color: var(--ink);
}

.recognized-space-item span {
  color: var(--muted);
  font-size: 12px;
}

.recognized-space-review {
  color: #9a4f18 !important;
}

.recognized-space-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 252, 246, 0.64);
}

.primary-flow-button {
  background: rgba(184, 134, 59, 0.16);
  border-color: rgba(184, 134, 59, 0.42);
  color: var(--accent-dark);
}

.secondary-flow-button {
  background: rgba(255, 252, 246, 0.76);
  border-color: rgba(75, 69, 61, 0.2);
  color: var(--muted);
}

.secondary-flow-button:hover {
  color: var(--ink);
  border-color: rgba(75, 69, 61, 0.34);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  gap: 14px;
  padding: 14px;
}

.backend-panel,
.backend-runtime-cache {
  display: none !important;
}

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(64, 49, 31, 0.08);
  overflow: auto;
  max-height: calc(100vh - 90px);
}

.panel:last-child {
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.panel h1,
.panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.25;
  font-family: var(--hand-cn);
}

.panel h2 {
  margin-top: 18px;
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.canvas-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.6);
  box-shadow: 0 10px 28px rgba(64, 49, 31, 0.08);
}

.client-inspector {
  padding: 20px;
  background: rgba(255, 250, 240, 0.82);
}

.plan-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.workbench-project-name {
  width: min(300px, 28vw);
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.workbench-project-name input {
  min-height: 32px;
  background: rgba(255, 252, 246, 0.72);
}

.plan-tab-group,
.plan-tab-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-tab-actions {
  margin-left: auto;
}

.plan-tabs button {
  min-width: 84px;
}

.plan-tabs button.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: rgba(255, 252, 246, 0.96);
}

.tab-panel {
  min-height: 0;
}

.illuminance-panel,
.fixture-schedule {
  min-height: calc(100vh - 150px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.58);
}

.illuminance-panel h2,
.fixture-schedule h2 {
  margin: 0 0 10px;
  font-size: 26px;
}

.illuminance-panel p,
.fixture-schedule p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.illuminance-toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}

.illuminance-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.illuminance-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(124px, 1fr));
  gap: 8px;
}

.illuminance-settings label,
.illuminance-run-control {
  display: grid;
  grid-template-rows: 14px 34px;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 14px;
}

.illuminance-run-control {
  margin-left: auto;
}

.illuminance-run-control > span {
  visibility: hidden;
}

.illuminance-settings select,
.illuminance-actions button {
  box-sizing: border-box;
  height: 34px;
  border: 1px solid rgba(75, 69, 61, 0.22);
  color: var(--ink);
  font-size: 13px;
  line-height: 32px;
}

.illuminance-settings select {
  background: rgba(255, 255, 255, 0.85);
}

.illuminance-actions button {
  align-self: end;
  margin-left: 0;
  min-width: 104px;
  padding-block: 0;
  white-space: nowrap;
}

.illuminance-legend {
  width: min(360px, 100%);
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 12px;
}

.illuminance-legend i {
  display: block;
  width: 100%;
  height: 12px;
  border: 1px solid rgba(58, 49, 39, 0.2);
  border-radius: 999px;
  background: linear-gradient(90deg, #2b83ba 0%, #66c2a5 25%, #ffff8c 52%, #fdae61 74%, #d7191c 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.illuminance-legend-ticks {
  position: relative;
  margin-top: 4px;
  height: 16px;
  line-height: 1.2;
}

.illuminance-legend-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.illuminance-legend-ticks .tick-50 {
  left: 0;
  transform: none;
}

.illuminance-legend-ticks .tick-300 {
  left: 29.412%;
}

.illuminance-legend-ticks .tick-600 {
  left: 64.706%;
}

.illuminance-legend-ticks .tick-900 {
  right: 0;
  transform: none;
}

.illuminance-space-average-card {
  fill: rgba(255, 250, 240, 0.92);
  stroke: rgba(86, 68, 45, 0.24);
  stroke-width: 1;
}

.illuminance-space-average-title {
  fill: #4b3b26;
  font-size: 13px;
  font-weight: 700;
}

.illuminance-space-average-line {
  fill: #5d5850;
  font-size: 12px;
}

.fixture-schedule-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 22px;
}

.fixture-schedule-panel {
  display: grid;
  gap: 10px;
}

.fixture-schedule-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.fixture-schedule-row strong {
  font-size: 22px;
  color: var(--ink);
}

.fixture-schedule-row span {
  color: var(--muted);
}

.fixture-schedule-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.fixture-schedule-row b {
  color: var(--accent-dark);
  font-weight: 600;
}

.client-inspector-header {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.client-inspector-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.client-inspector-header h2 {
  margin: 0;
  font-size: 18px;
}

.client-inspector-heading-row button {
  min-width: 78px;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.client-inspector-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.fixture-detail-card {
  margin-top: 16px;
}

.rule-logic-list {
  display: grid;
  gap: 12px;
}

.rule-logic-card {
  display: grid;
  gap: 10px;
  padding: 13px 0 15px;
  border-bottom: 1px solid var(--line);
}

.rule-logic-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.rule-logic-title strong {
  color: var(--ink);
  font-size: 15px;
}

.rule-logic-title span,
.rule-logic-meta,
.rule-logic-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.rule-logic-card p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.rule-logic-items {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-logic-item {
  display: grid;
  gap: 3px;
  padding-left: 10px;
  border-left: 2px solid rgba(182, 151, 94, 0.36);
}

.fixture-empty-state {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  color: var(--muted);
  line-height: 1.55;
}

.fixture-empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.fixture-add-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.fixture-add-actions button {
  width: 100%;
  justify-content: center;
  background: rgba(255, 252, 246, 0.92);
}

.fixture-detail-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.fixture-detail-title strong {
  font-size: 24px;
  color: var(--ink);
}

.fixture-detail-title span {
  color: var(--accent-dark);
  font-size: 14px;
}

.fixture-parameter-editor {
  display: grid;
  gap: 10px;
  margin: 16px 0 4px;
  padding: 14px;
  border: 1px solid rgba(182, 151, 94, 0.3);
  background: rgba(255, 252, 246, 0.72);
}

.fixture-parameter-editor h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.fixture-parameter-editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.fixture-parameter-editor select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(75, 69, 61, 0.22);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 13px;
}

.fixture-parameter-editor-muted p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.fixture-derived-parameter {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
}

.fixture-detail-list {
  display: grid;
  gap: 14px;
  margin: 16px 0 18px;
}

.fixture-detail-list div {
  display: grid;
  gap: 5px;
}

.fixture-detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.fixture-detail-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.secondary-danger {
  width: 100%;
  color: #8f2f18;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.canvas-toolbar button {
  width: 36px;
  padding: 0;
}

#planSvg,
#illuminanceSvg {
  width: 100%;
  height: calc(100vh - 134px);
  min-height: 480px;
  display: block;
  background:
    linear-gradient(rgba(255, 250, 240, 0.92), rgba(255, 250, 240, 0.92)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 16px 28px rgba(53, 42, 28, 0.08);
  touch-action: none;
  cursor: grab;
}

#planSvg.is-panning,
#illuminanceSvg.is-panning {
  cursor: grabbing;
}

#planSvg:focus,
#illuminanceSvg:focus {
  outline: none;
}

.illuminance-cell {
  stroke: none;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.illuminance-room-frame {
  fill: none;
  stroke: rgba(34, 31, 28, 0.7);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.illuminance-fixture-marker {
  pointer-events: none;
}

.illuminance-empty-text {
  fill: var(--muted);
  font-size: 16px;
  paint-order: stroke;
  stroke: rgba(255, 250, 240, 0.9);
  stroke-width: 3px;
}

.room-shell {
  fill: #f9fafb;
  stroke: #2d3748;
  stroke-width: 2;
}

.room-outline {
  fill: rgba(251, 251, 248, 0.52);
  stroke: #222831;
  stroke-width: 2;
}

.room-outline.has-background-plan {
  fill: rgba(255, 255, 255, 0.08);
  stroke: #23211d;
  stroke-width: 2;
}

.background-plan-image {
  pointer-events: none;
}

.object-rect {
  fill: rgba(184, 134, 59, 0.13);
  stroke: #8a5a20;
  stroke-width: 1.5;
}

.opening-rect {
  fill: rgba(213, 237, 247, 0.34);
  stroke: #24748f;
  stroke-width: 1.5;
}

.wall-rect {
  fill: rgba(222, 226, 230, 0.34);
  stroke: #495057;
  stroke-width: 1.5;
}

.zone-rect {
  fill: rgba(34, 197, 94, 0.08);
  stroke: rgba(22, 101, 52, 0.55);
  stroke-width: 1;
  stroke-dasharray: 5 4;
}

.fixture-strip {
  fill: none;
  stroke: #f4b933;
  stroke-width: 2.2;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(247, 190, 54, 0.68)) drop-shadow(0 0 6px rgba(247, 190, 54, 0.32));
}

.fixture-strip-hit-area {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  stroke-linecap: round;
  cursor: grab;
  pointer-events: stroke;
}

.fixture-point-symbol {
  cursor: pointer;
  filter: drop-shadow(0 0 3px rgba(247, 190, 54, 0.76)) drop-shadow(0 0 8px rgba(247, 190, 54, 0.34));
}

.fixture-symbol-core {
  fill: rgba(255, 249, 220, 0.9);
  stroke: #d99010;
  stroke-width: 1;
}

.fixture-symbol-cross {
  stroke: #d99010;
  stroke-width: 0.85;
  stroke-linecap: round;
}

.fixture-symbol-outer-ring {
  fill: none;
  stroke: #18864f;
  stroke-width: 0.95;
}

.fixture-type-chandelier {
  filter: drop-shadow(0 0 3px rgba(47, 172, 103, 0.68)) drop-shadow(0 0 8px rgba(47, 172, 103, 0.28));
}

.fixture-type-chandelier .fixture-symbol-core {
  fill: rgba(224, 255, 236, 0.88);
  stroke: #18864f;
}

.fixture-type-chandelier .fixture-symbol-cross {
  stroke: #18864f;
}

.fixture-type-grille {
  cursor: pointer;
  filter: drop-shadow(0 0 2px rgba(47, 79, 96, 0.45));
}

.fixture-type-panel {
  cursor: pointer;
  filter: drop-shadow(0 0 2px rgba(72, 88, 104, 0.45));
}

.fixture-panel-body {
  fill: rgba(247, 250, 252, 0.94);
  stroke: #445160;
  stroke-width: 0.75;
}

.fixture-panel-switch {
  stroke: #445160;
  stroke-width: 0.8;
  stroke-linecap: round;
}

.fixture-grille-head {
  fill: rgba(245, 252, 255, 0.92);
  stroke: #315264;
  stroke-width: 0.5;
}

.fixture-grille-cross {
  stroke: #315264;
  stroke-width: 0.38;
  stroke-linecap: square;
}

.fixture-strip-endpoint {
  fill: #fff8d2;
  stroke: #d99010;
  stroke-width: 1.45;
  cursor: grab;
  filter: drop-shadow(0 0 3px rgba(247, 190, 54, 0.7));
}

.fixture-strip-endpoint.fixture-selected {
  stroke-width: 2;
}

.fixture-label {
  fill: #32363b;
  font-size: 4.9px;
  pointer-events: none;
}

.fixture-node {
  cursor: pointer;
}

.fixture-hit-area {
  fill: transparent;
  stroke: transparent;
  cursor: pointer;
}

.fixture-endpoint-hit-area {
  fill: transparent;
  stroke: transparent;
  cursor: grab;
}

.alignment-guide {
  fill: none;
  stroke: rgba(245, 170, 28, 0.9);
  stroke-width: 1.35;
  stroke-dasharray: 6 5;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(247, 190, 54, 0.5));
}

.alignment-guide.axis-lock {
  stroke: rgba(15, 118, 110, 0.86);
}

.fixture-selected {
  filter: drop-shadow(0 0 4px rgba(247, 190, 54, 0.92)) drop-shadow(0 0 12px rgba(247, 190, 54, 0.5));
}

.fixture-selected .fixture-symbol-core {
  stroke-width: 1.5;
}

.fixture-selected .fixture-symbol-cross {
  stroke-width: 1.2;
}

.fixture-selected .fixture-symbol-outer-ring {
  stroke-width: 1.35;
}

.fixture-selected .fixture-grille-head {
  stroke-width: 0.8;
}

.fixture-selected .fixture-panel-body {
  stroke-width: 1.15;
}

.fixture-selected .fixture-panel-switch {
  stroke-width: 1.05;
}

.fixture-strip.fixture-selected {
  stroke-width: 3;
}

.fixture-dragging {
  opacity: 0.75;
}

.target-point {
  fill: rgba(40, 79, 85, 0.92);
  stroke: #ffffff;
  stroke-width: 1.4;
}

.target-line {
  fill: none;
  stroke: #284f55;
  stroke-width: 3.2;
  stroke-linecap: round;
}

.target-zone {
  fill: rgba(40, 79, 85, 0.10);
  stroke: #284f55;
  stroke-width: 1.8;
  stroke-dasharray: 4 3;
}

.target-status-needs_review {
  stroke: #b45309;
}

.target-status-blocked {
  stroke: #b91c1c;
  fill: rgba(185, 28, 28, 0.18);
}

.target-node {
  cursor: pointer;
}

.target-hit-area {
  fill: transparent;
  stroke: transparent;
  stroke-width: 12;
  cursor: pointer;
}

.target-selected {
  stroke: #111827;
  stroke-width: 3;
}

.target-dragging {
  opacity: 0.78;
}

.target-label {
  fill: #211f1c;
  font-size: 9px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2px;
  pointer-events: none;
}

.grid-line {
  stroke: #e6e8ec;
  stroke-width: 1;
}

.dimension-line {
  stroke: #68707a;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.legend-card {
  fill: rgba(255, 250, 240, 0.9);
  stroke: var(--line);
  stroke-width: 1;
}

.svg-label {
  fill: #2d3748;
  font-size: 14px;
  font-family: var(--hand-cn);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.object-form {
  display: grid;
  gap: 8px;
}

.list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.list-item,
.debug-block {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 252, 246, 0.72);
  padding: 8px;
}

.list-item {
  display: grid;
  gap: 6px;
}

.list-item-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.2);
}

.list-item button {
  justify-self: start;
}

.ai-semantic-debug {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 252, 246, 0.72);
  padding: 8px;
}

.ai-semantic-debug summary {
  cursor: pointer;
  font-weight: 700;
}

.ai-semantic-debug-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.ai-semantic-debug-raw {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.small-muted {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--hand-cn);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    height: auto;
    padding: 12px;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .home-view {
    padding: 32px 18px 120px;
  }

  .pendant-sketch,
  .plan-paper,
  .home-reference {
    display: none;
  }

  .home-copy {
    margin-left: 0;
    padding-top: 24px;
  }

  .home-copy h1 {
    font-size: 92px;
  }

  .subtitle {
    font-size: 30px;
  }

  .cn-line {
    font-size: 28px;
  }

  .script-note {
    margin-left: 0;
  }

  .home-actions {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    margin-top: 32px;
  }

  .home-footer-note {
    left: 24px;
  }

  .project-flow {
    padding: 12px;
  }

  .flow-step {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .panel,
  .panel:last-child {
    max-height: none;
  }
}

body.home-mode .topbar {
  display: none;
}

.home-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
  background: #e8dfcf;
}

.home-view::after {
  display: none;
}

.home-stage {
  position: relative;
  width: min(100vw, 200vh);
  height: min(100vh, 50vw);
  aspect-ratio: 2 / 1;
  max-width: none;
  overflow: hidden;
  background: #efe5d6;
  box-shadow: none;
}

.home-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.home-art-authenticated {
  display: none;
}

body.home-mode.home-authenticated .home-art-guest {
  display: none;
}

body.home-mode.home-authenticated .home-art-authenticated {
  display: block;
}

body.home-mode.home-guest .home-art-guest {
  display: block;
}

body.home-mode.home-guest .home-art-authenticated {
  display: none;
}

.home-actions {
  position: absolute;
  left: 54.6%;
  top: 37.1%;
  width: 18%;
  height: 37.4%;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  filter: none;
}

body.home-mode.home-guest .home-actions {
  left: 53.2%;
  top: 52.7%;
  width: 19.2%;
  height: 12.8%;
  grid-template-rows: 1fr;
}

body.home-mode.home-guest .homeProject,
body.home-mode.home-guest .homeNewProject {
  display: none;
}

body.home-mode.home-guest #homeProjectButton,
body.home-mode.home-guest #homeNewProjectButton {
  display: none;
}

.home-card {
  min-height: 0;
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.01);
  box-shadow: none;
  color: transparent;
  cursor: pointer;
  padding: 0;
}

.home-card span {
  opacity: 0;
}

.home-card:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.01);
  box-shadow: none;
  border-color: transparent;
  color: transparent;
}

.home-card:focus-visible {
  outline: none;
}

@media (max-width: 980px) {
  .home-view {
    min-height: 100vh;
    padding: 0;
  }

  .home-stage {
    width: min(100vw, 200vh);
    height: min(100vh, 50vw);
    max-width: none;
    box-shadow: none;
  }

  .home-actions {
    left: 54.6%;
    top: 37.1%;
    width: 18%;
    height: 37.4%;
    margin: 0;
  }

  body.home-mode.home-guest .home-actions {
    left: 53.2%;
    top: 52.7%;
    width: 19.2%;
    height: 12.8%;
  }
}
