:root {
  --paper: #f3f0e7;
  --ink: #1e2928;
  --muted: #66706c;
  --line: #c7c8bc;
  --green: #1f6456;
  --green-soft: #d4e2d9;
  --orange: #e56d3f;
  --white: #fbfaf5;
  --shadow: 0 18px 50px rgba(33, 44, 41, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
button, input { font: inherit; }
button { color: inherit; }

.topbar {
  height: 84px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 21px; letter-spacing: .12em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font: 9px/1.2 ui-monospace, monospace; letter-spacing: .16em; }
.brand-mark { width: 39px; height: 39px; border: 1px solid var(--ink); border-radius: 50%; display: grid; place-content: center; gap: 3px; }
.brand-mark i { display: block; width: 17px; height: 1px; background: var(--ink); }
.brand-mark i:nth-child(2) { width: 11px; }
.saved-indicator { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.saved-indicator span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 7px; }

main { max-width: 1480px; padding: 48px clamp(22px, 5vw, 76px) 80px; margin: auto; }
.intro { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(280px, 440px); align-items: end; gap: 60px; margin-bottom: 42px; }
.eyebrow { color: var(--green); font: 700 11px/1 ui-monospace, monospace; letter-spacing: .22em; margin: 0 0 15px; }
h1 { margin: 0; font: 400 clamp(38px, 5.4vw, 74px)/1.06 Georgia, "Noto Serif", serif; letter-spacing: -.04em; }
h1 em { color: var(--green); font-weight: 400; }
.lead { margin: 0 0 6px; color: var(--muted); font-size: 14px; line-height: 1.9; border-left: 1px solid var(--orange); padding-left: 22px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .75fr); gap: 16px; padding-right: 300px; }
.plan-panel, .check-panel { background: var(--white); border: 1px solid #deded4; box-shadow: var(--shadow); }
.plan-panel { padding: 28px; min-width: 0; }
.check-panel { padding: 28px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.panel-head > div:first-child { min-width: 0; }
.step { color: var(--orange); font: 700 10px/1 ui-monospace, monospace; letter-spacing: .16em; display: block; margin-bottom: 7px; }
h2 { font: 500 18px/1.2 Georgia, "Noto Serif", serif; margin: 0; }
.floor-tabs { display: flex; gap: 4px; background: #ebe9e1; padding: 4px; border-radius: 4px; }
.floor-tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 13px; font-size: 12px; cursor: pointer; border-radius: 2px; }
.floor-tabs button.active { background: var(--white); color: var(--green); box-shadow: 0 1px 5px rgba(0,0,0,.09); }

.plan-stage { position: relative; min-height: 520px; background-color: #e7e4da; background-image: linear-gradient(rgba(41,58,53,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(41,58,53,.055) 1px, transparent 1px); background-size: 22px 22px; padding: 44px; display: grid; place-items: center; overflow: hidden; }
.floor-plan { width: min(92%, 640px); height: 400px; display: grid; gap: 5px; padding: 5px; background: var(--ink); box-shadow: 8px 11px 0 rgba(31,100,86,.13); transition: opacity .2s; }
.room { position: relative; border: 0; background: #faf8f0; cursor: pointer; overflow: hidden; padding: 16px; text-align: left; min-width: 0; }
.room::before { content: ""; position: absolute; inset: 7px; border: 1px solid #d4d4c8; pointer-events: none; }
.room:hover, .room:focus-visible { background: #e3ece6; outline: 2px solid var(--green); outline-offset: -2px; }
.room.selected { background: var(--green-soft); }
.room.selected::after { content: ""; position: absolute; width: 10px; height: 10px; right: 12px; top: 12px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(229,109,63,.18); }
.room-name { position: relative; display: block; font: 600 12px/1.3 ui-monospace, monospace; letter-spacing: .08em; }
.room-hint { position: relative; display: block; margin-top: 5px; color: #79817d; font-size: 10px; }
.fixture { position: absolute; opacity: .65; pointer-events: none; }
.fixture.window { height: 5px; background: #63a69a; left: 22%; right: 22%; bottom: 6px; border-left: 4px solid white; border-right: 4px solid white; }
.fixture.door { width: 23px; height: 23px; border: solid #a89579; border-width: 1px 1px 0 0; border-radius: 0 100% 0 0; bottom: 7px; right: 7px; }
.layout-one { grid-template: 1.1fr .9fr / 1.35fr .9fr; }
.layout-studio { grid-template: 1.25fr .75fr / 1.4fr .8fr; }
.layout-two { grid-template: 1fr 1fr / 1.1fr 1fr 1fr; }
.layout-two .room[data-room="entry"] { grid-column: 2 / 4; }
.compass { position: absolute; left: 17px; top: 17px; color: var(--green); font: 700 10px ui-monospace, monospace; text-align: center; }
.compass i { display: block; height: 24px; width: 1px; background: var(--green); margin: 4px auto; position: relative; }
.compass i::before { content: ""; position: absolute; top: -2px; left: -3px; border: 3px solid transparent; border-bottom: 6px solid var(--green); transform: translateY(-50%); }
.legend { position: absolute; bottom: 15px; right: 18px; display: flex; gap: 15px; font-size: 10px; color: var(--muted); }
.dot { width: 8px; height: 8px; display: inline-block; border: 1px solid var(--green); border-radius: 50%; margin-right: 5px; }
.active-dot { background: var(--orange); border-color: var(--orange); }

.panel-head.compact { align-items: flex-start; }
.area-kicker { margin: 0 0 4px; color: var(--green); font: 700 10px ui-monospace, monospace; letter-spacing: .13em; }
.count-badge { background: var(--ink); color: white; padding: 7px 9px; font: 10px ui-monospace, monospace; white-space: nowrap; }
.area-note { color: var(--muted); font-size: 12px; line-height: 1.65; margin: -10px 0 19px; min-height: 40px; }
.check-items { border-top: 1px solid var(--line); }
.check-card { padding: 15px 0; border-bottom: 1px solid var(--line); }
.check-card label { display: grid; grid-template-columns: 20px 1fr; gap: 10px; cursor: pointer; }
.check-card input { position: absolute; opacity: 0; }
.fake-check { width: 18px; height: 18px; border: 1px solid #9da39f; margin-top: 1px; display: grid; place-items: center; }
.check-card input:checked + .fake-check { background: var(--green); border-color: var(--green); }
.check-card input:checked + .fake-check::after { content: ""; width: 7px; height: 4px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg) translateY(-1px); }
.check-copy strong { display: block; font-size: 13px; font-weight: 600; }
.check-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.na-note { margin: 8px 0 0 30px; padding-left: 8px; border-left: 2px solid #d9a486; color: #9b664b; font-size: 10px; line-height: 1.45; }
.na-note:empty { display: none; }
.custom-box { margin-top: 20px; }
.custom-box label { font-size: 11px; color: var(--muted); }
.custom-row { display: flex; margin-top: 8px; }
.custom-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: transparent; padding: 11px; outline: none; font-size: 12px; }
.custom-row input:focus { border-color: var(--green); }
.custom-row button { width: 43px; border: 0; background: var(--orange); color: white; font-size: 22px; cursor: pointer; }
.input-error { color: #b5452f; font-size: 10px; min-height: 13px; margin: 5px 0 0; }

.tray { position: fixed; z-index: 5; top: 84px; right: 0; bottom: 0; width: 292px; background: #1f2d2a; color: #f5f2e8; box-shadow: -13px 0 35px rgba(20,34,30,.15); transition: transform .25s ease; }
.tray-handle { display: none; }
.tray-inner { height: 100%; padding: 32px 26px; display: flex; flex-direction: column; }
.tray-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.tray-title > div { display: flex; gap: 10px; align-items: baseline; }
.tray-title .step { color: #f38b62; }
.tray-title h2 { font-size: 20px; }
.text-button { border: 0; color: #9faaa7; background: none; padding: 5px; cursor: pointer; font-size: 10px; }
.text-button:hover { color: white; }
.tray-help { color: #9faaa7; font-size: 11px; line-height: 1.6; padding-bottom: 17px; border-bottom: 1px solid #45514e; }
.tray-list { overflow: auto; flex: 1; margin: 2px -8px 12px 0; padding-right: 8px; }
.tray-empty { margin: 34px 0; color: #8b9793; font: 12px/1.8 ui-monospace, monospace; text-align: center; }
.tray-group { margin: 18px 0; }
.tray-group h3 { color: #d6bbb0; font: 700 9px ui-monospace, monospace; letter-spacing: .14em; margin: 0 0 8px; }
.tray-item { display: grid; grid-template-columns: 1fr 22px; gap: 5px; border-bottom: 1px solid #394642; padding: 8px 0; }
.tray-item span { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.tray-item button { border: 0; background: none; color: #7f8c88; cursor: pointer; font-size: 16px; }
.tray-item button:hover { color: #f38b62; }
.tray-actions { min-height: 48px; }
.primary-button { width: 100%; border: 0; padding: 13px; background: #e56d3f; color: white; cursor: pointer; font-size: 12px; letter-spacing: .06em; }
.primary-button:disabled { opacity: .35; cursor: not-allowed; }
#copyStatus { display: block; min-height: 14px; color: #b8c5c0; text-align: center; font-size: 10px; margin-top: 7px; }

@media (max-width: 1120px) {
  .workspace { padding-right: 0; }
  .tray { top: auto; width: 100%; height: min(72vh, 570px); transform: translateY(calc(100% - 55px)); }
  .tray.open { transform: translateY(0); }
  .tray-handle { height: 55px; width: 100%; border: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 25px; background: #1f2d2a; color: white; cursor: pointer; border-bottom: 1px solid #45514e; }
  .tray-handle b { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; background: var(--orange); margin-right: 7px; }
  .tray-handle i { width: 9px; height: 9px; border-left: 1px solid white; border-top: 1px solid white; transform: rotate(45deg); transition: .2s; }
  .tray.open .tray-handle i { transform: rotate(225deg); }
  .tray-inner { height: calc(100% - 55px); padding: 22px 25px; }
}
@media (max-width: 820px) {
  .topbar { height: 70px; }
  .saved-indicator { display: none; }
  main { padding-top: 32px; }
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .lead { max-width: 570px; }
  .workspace { grid-template-columns: 1fr; }
  .plan-stage { min-height: 440px; padding: 34px 24px; }
  .floor-plan { height: 330px; }
}
@media (max-width: 530px) {
  .brand small { display: none; }
  main { padding: 28px 14px 80px; }
  h1 { font-size: 39px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .floor-tabs { width: 100%; }
  .floor-tabs button { flex: 1; padding-inline: 5px; }
  .plan-panel, .check-panel { padding: 17px; }
  .plan-stage { min-height: 370px; padding: 31px 12px; }
  .floor-plan { width: 100%; height: 280px; }
  .room { padding: 12px 9px; }
  .room-name { font-size: 10px; }
  .room-hint, .legend { display: none; }
  .panel-head.compact { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
