:root {
  color-scheme: light;
  --paper: #f7f8f3;
  --panel: #ffffff;
  --panel-soft: #f3f7f2;
  --ink: #16231f;
  --text: #283833;
  --muted: #66756f;
  --line: #d8e0d7;
  --line-strong: #b7c5bb;
  --brand: #1f6f5b;
  --brand-dark: #143d35;
  --blue: #2f6f95;
  --clay: #bb694c;
  --sun: #e8a93d;
  --danger: #9a3a2f;
  --shadow: 0 18px 46px rgba(22, 35, 31, .10);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--paper);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
  background:
    linear-gradient(rgba(47, 111, 149, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 111, 91, .055) 1px, transparent 1px),
    radial-gradient(circle at 0 0, rgba(232, 169, 61, .10), transparent 340px),
    var(--paper);
  background-size: 42px 42px, 42px 42px, auto, auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1480px;
  min-height: calc(100vh - 36px);
  margin: 0 auto;
}

.input-panel,
.result-panel {
  border: 1px solid rgba(183, 197, 187, .92);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
}

.result-panel {
  min-height: calc(100vh - 36px);
  overflow: hidden;
}

.brand-card {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px),
    var(--brand-dark);
  background-size: 24px 24px;
  color: #fff;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 54px;
  height: 54px;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 8px;
  background: #f7f8f3;
  color: var(--brand-dark);
  font-weight: 950;
  overflow: hidden;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: auto 9px 8px;
  height: 2px;
  background: var(--sun);
}

.brand-mark::after {
  inset: 12px auto auto 13px;
  width: 28px;
  height: 18px;
  border: 2px solid var(--brand);
  border-bottom: 0;
  background: transparent;
  transform: skewY(-22deg);
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.brand-domain {
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 800;
}

h1 {
  color: #fff;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-copy p:last-child {
  color: rgba(255, 255, 255, .78);
  line-height: 1.55;
}

.brand-chips,
.assumption-list,
.consult-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-chips span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 7px;
  padding: 0 10px;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .88);
  font-size: 12px;
  font-weight: 850;
}

.design-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
}

textarea {
  min-height: 172px;
  resize: vertical;
  line-height: 1.58;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 91, .14);
}

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

.example-row button,
.primary-action,
.secondary-action {
  min-width: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 850;
}

.example-row button {
  min-height: 38px;
  border: 1px solid #d5dfd7;
  background: #eef4ed;
  color: var(--brand-dark);
  font-size: 13px;
}

.example-row button:hover {
  background: #e2ece3;
}

.primary-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  background: var(--brand);
  color: #fff;
}

.primary-action:hover {
  background: #185b4b;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: wait;
  opacity: .72;
}

.secondary-action {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  padding: 0 18px;
}

.secondary-action:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.spin {
  animation: spin 1s linear infinite;
}

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

.error-line {
  padding: 10px 12px;
  border: 1px solid rgba(154, 58, 47, .16);
  border-radius: 7px;
  background: #fae7e0;
  color: var(--danger);
  line-height: 1.5;
}

.empty-state {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
}

.empty-state h2 {
  max-width: 680px;
  color: var(--ink);
  font-size: 31px;
  line-height: 1.18;
}

.empty-state p:last-child {
  max-width: 540px;
  color: var(--muted);
  line-height: 1.7;
}

.empty-visual {
  width: min(620px, 100%);
  aspect-ratio: 1.64 / 1;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--brand-dark);
  border-radius: 8px;
  background:
    linear-gradient(rgba(47, 111, 149, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 111, 149, .13) 1px, transparent 1px),
    #fbfdf9;
  background-size: 26px 26px;
  box-shadow: 0 18px 36px rgba(22, 35, 31, .12);
}

.plan-room {
  position: absolute;
  display: grid;
  place-items: center;
  border: 2px solid var(--brand-dark);
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(12px, 1.6vw, 18px);
}

.plan-room-living {
  left: 34%;
  top: 46%;
  width: 41%;
  height: 36%;
  background: #deefe4;
}

.plan-room-master {
  left: 8%;
  top: 50%;
  width: 24%;
  height: 32%;
  background: #f2ddd0;
}

.plan-room-kitchen {
  left: 38%;
  top: 16%;
  width: 24%;
  height: 24%;
  background: #d8e7f2;
}

.plan-room-study {
  left: 76%;
  top: 16%;
  width: 16%;
  height: 28%;
  background: #f5e4b7;
}

.plan-room-bath {
  left: 17%;
  top: 16%;
  width: 18%;
  height: 24%;
  background: #eadced;
}

.ai-route {
  position: absolute;
  left: 58%;
  top: 33%;
  width: 23%;
  height: 30%;
  border-top: 3px solid var(--clay);
  border-right: 3px solid var(--clay);
  border-radius: 0 8px 0 0;
}

.ai-pin {
  position: absolute;
  left: 55%;
  top: 27%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 8px;
  background: var(--clay);
  color: #fff;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(22, 35, 31, .18);
}

.consult-panel,
.result-grid {
  display: grid;
  gap: 22px;
  padding: 26px;
}

.consult-header {
  max-width: 840px;
  display: grid;
  gap: 8px;
}

.consult-header h2 {
  color: var(--ink);
  font-size: 30px;
  line-height: 1.2;
}

.consult-header p:last-child,
.question-item small,
.scheme-option span,
.scheme-option small,
.room-item span,
.room-item small,
li {
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--brand) !important;
  font-size: 13px;
  font-weight: 900;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--sun);
}

.assumption-list span {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.question-form {
  display: grid;
  gap: 18px;
}

.question-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.question-item,
.ready-note {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
}

.question-item textarea {
  min-height: 88px;
}

.ready-note {
  color: var(--text);
}

.result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding-bottom: 2px;
}

.result-header h2 {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 31px;
  line-height: 1.16;
}

.result-header p,
.brand-row p {
  color: var(--muted);
}

.result-header p {
  line-height: 1.66;
}

.site-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 8px;
}

.site-facts span {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.option-panel,
.analysis-panel {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.section-heading h3,
.analysis-panel h3,
.tool-panel h3,
.revise-panel h3,
.floor-title h3,
.detail-band h3 {
  color: var(--ink);
  font-size: 18px;
}

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

.scheme-option {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.scheme-option:hover {
  border-color: var(--brand);
}

.scheme-option.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 91, .13);
}

.scheme-option strong {
  color: var(--ink);
  font-size: 17px;
}

.scheme-option em {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.tool-panel,
.analysis-panel,
.revise-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.tool-panel {
  display: grid;
  grid-template-columns: minmax(180px, .32fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tool-body,
.revise-form,
.score-list,
.plan-stack,
.floor-section {
  display: grid;
  gap: 12px;
}

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

.tool-actions .secondary-action {
  min-height: 42px;
  padding: 0 11px;
}

.danger-action {
  color: var(--danger);
}

.tool-status,
.revise-status {
  padding: 10px 12px;
  border: 1px solid rgba(31, 111, 91, .14);
  border-radius: 7px;
  background: #e6f3eb;
  color: #245c45;
  font-weight: 800;
}

.tool-status.is-error,
.revise-status.is-error {
  border-color: rgba(154, 58, 47, .16);
  background: #fae7e0;
  color: var(--danger);
}

.saved-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.saved-empty {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
}

.saved-plan {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.saved-plan strong,
.room-item strong {
  color: var(--ink);
}

.saved-plan span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.saved-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.saved-actions .secondary-action {
  min-height: 34px;
  padding: 0 10px;
}

.analysis-panel {
  grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
}

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

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-weight: 850;
}

.score-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7df;
}

.score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--blue));
}

.area-table-inner {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.area-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.3fr) minmax(70px, .6fr) minmax(110px, .8fr);
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e8eee7;
  color: var(--muted);
}

.area-row:last-child {
  border-bottom: 0;
}

.area-head,
.area-total {
  background: #edf4ed;
  color: var(--ink);
  font-weight: 900;
}

.floor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.floor-title span {
  color: var(--muted);
  font-size: 14px;
}

.floor-plan {
  position: relative;
  width: 100%;
  min-height: 420px;
  overflow: hidden;
  border: 3px solid var(--brand-dark);
  border-radius: 6px;
  aspect-ratio: 1.62 / 1;
  background:
    linear-gradient(rgba(47, 111, 149, .16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 111, 149, .16) 1px, transparent 1px),
    #fbfdf9;
  background-size: 28px 28px;
}

.north {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid var(--brand-dark);
  border-radius: 50%;
  background: #fbfdf9;
  color: var(--ink);
  font-weight: 950;
}

.room {
  position: absolute;
  min-width: 68px;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 6px;
  overflow: hidden;
  padding: 10px;
  border: 2px solid var(--brand-dark);
}

.room strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
}

.room span {
  color: #3d4a46;
  font-size: 12px;
  line-height: 1.35;
}

.room-0 { background: #deefe4; }
.room-1 { background: #f2ddd0; }
.room-2 { background: #d8e7f2; }
.room-3 { background: #f5e4b7; }
.room-4 { background: #dce9d9; }
.room-5 { background: #eadced; }
.room-6 { background: #d9ecea; }

.revise-panel {
  display: grid;
  grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.revise-form textarea {
  min-height: 84px;
  background: #fff;
}

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

.revise-actions .primary-action,
.revise-actions .secondary-action {
  min-height: 42px;
  padding: 0 14px;
}

.detail-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.detail-band h3 {
  margin-bottom: 12px;
}

.detail-band ul {
  margin: 0 0 22px;
  padding-left: 20px;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.room-item {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdf9;
}

.room-item small {
  font-size: 12px;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }

  .result-header,
  .detail-band,
  .analysis-panel,
  .tool-panel,
  .revise-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .workspace {
    min-height: calc(100vh - 20px);
  }

  .input-panel,
  .consult-panel,
  .result-grid {
    padding: 16px;
  }

  .brand-card {
    padding: 14px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  h1 {
    font-size: 24px;
  }

  .example-row,
  .site-facts,
  .room-list,
  .question-list,
  .scheme-options,
  .tool-actions,
  .saved-plans,
  .revise-actions {
    grid-template-columns: 1fr;
  }

  .empty-state {
    padding: 20px 16px;
  }

  .empty-state h2,
  .consult-header h2,
  .result-header h2 {
    font-size: 25px;
  }

  .empty-visual {
    aspect-ratio: .95 / 1;
  }

  .ai-pin {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  .consult-actions {
    display: grid;
  }

  .floor-plan {
    min-height: 340px;
    aspect-ratio: .78 / 1;
  }

  .room {
    padding: 7px;
  }

  .room strong {
    font-size: 13px;
  }

  .room span {
    display: none;
  }

  .area-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media print {
  .app-shell {
    padding: 0;
    background: #fff;
  }

  .workspace {
    display: block;
    max-width: none;
    min-height: auto;
  }

  .input-panel,
  .tool-panel,
  .revise-panel {
    display: none !important;
  }

  .result-panel {
    min-height: auto;
    border: 0;
    box-shadow: none;
  }

  .result-grid {
    padding: 0;
  }

  .floor-plan {
    min-height: 360px;
    break-inside: avoid;
  }

  .detail-band {
    break-inside: avoid;
  }
}
