@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;1,500&display=swap');
:root{--paper:#f3eee5;--paper-light:#faf7f0;--panel:#fffdf8;--ink:#23231e;--muted:#77746c;--line:#dcd5c8;--oak:#b98950;--oak-dark:#8b5f35;--sage:#647661;--pale:#e8ddc9;--shadow:0 22px 60px rgba(57,45,30,.08)}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;color:var(--ink);font-family:'DM Sans',Arial,sans-serif;background:var(--paper);font-size:15px}
button,input,select{font:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #a2713e;outline-offset:2px}
.site-shell{min-height:100vh;background:radial-gradient(circle at 75% 4%,#f9f4e9 0,transparent 32%),var(--paper)}
.topbar{height:82px;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:0 clamp(24px,4.7vw,72px);border-bottom:1px solid #e1d9cb}
.brand{border:0;background:none;padding:0;display:flex;align-items:center;gap:12px;color:var(--ink);font-size:24px;font-weight:700;letter-spacing:.06em}
.brand-period{color:var(--oak)}
.brand-mark{width:31px;height:31px;display:flex;flex-direction:column;justify-content:center;gap:4px;border:2px solid var(--ink);padding:5px;transform:rotate(-9deg)}
.brand-mark span{display:block;height:2px;background:var(--ink);transform:rotate(-17deg)}
.topbar-right{display:flex;align-items:center;gap:36px;font-size:10px;font-weight:700;letter-spacing:.15em}
.topbar-note{color:#918b80}
.sheet-spec{display:flex;align-items:center;color:#514c43;white-space:nowrap}
.spec-dot{width:7px;height:7px;background:#7a886c;border-radius:50%;margin-right:9px}
.view{display:none;max-width:1600px;margin:auto}
.view.active{display:block}
.view-home{padding:0 clamp(24px,4.7vw,72px)}
.home-grid{display:grid;grid-template-columns:1.03fr .97fr;min-height:min(760px,calc(100vh - 160px));gap:clamp(36px,6vw,90px);align-items:center}
.home-copy{padding:48px 0}
.eyebrow{font-size:11px;font-weight:700;letter-spacing:.22em;color:var(--oak-dark);display:flex;align-items:center;gap:13px}
.eyebrow-line{width:32px;height:1px;background:var(--oak-dark)}
h1,h2,h3,p{margin-top:0}
h1,h2,h3{font-family:'Playfair Display',Georgia,serif;font-weight:500}
h1{font-size:clamp(72px,8.7vw,142px);line-height:.98;letter-spacing:-.065em;margin:36px 0 30px}
h1 em{font-weight:500;color:var(--oak-dark)}
.home-intro{max-width:510px;color:#665f54;font-size:17px;line-height:1.78}
.home-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:38px}
.btn{border:1px solid transparent;min-height:49px;display:inline-flex;align-items:center;justify-content:center;gap:30px;padding:0 22px;font-size:13px;font-weight:700;transition:transform .2s,background .2s,border-color .2s;white-space:nowrap}
.btn:hover{transform:translateY(-2px)}
.btn-primary{background:var(--ink);color:#fffdf6}
.btn-primary:hover{background:#453a2c}
.btn-outline{background:transparent;border-color:#a89c8b;color:var(--ink)}
.btn-outline:hover{background:#eae1d2}
.btn-text{background:none;color:#6c6256;text-decoration:underline;text-underline-offset:5px;padding-inline:10px}
.btn-large{height:57px;min-width:190px}
.home-features{display:flex;flex-wrap:wrap;gap:26px;margin-top:70px;padding-top:21px;border-top:1px solid var(--line);font-size:11px;color:#756e63}
.home-features span{white-space:nowrap}
.home-features b{color:var(--oak-dark);margin-right:7px}
.home-art{position:relative;align-self:stretch;min-height:550px;margin:34px 0;background:repeating-linear-gradient(0deg,rgba(255,255,255,.06) 0,rgba(255,255,255,.06) 1px,transparent 1px,transparent 65px),repeating-linear-gradient(97deg,rgba(79,50,24,.025) 0,rgba(79,50,24,.025) 2px,transparent 2px,transparent 20px),#d4b88d;padding:36px clamp(28px,4vw,64px) 31px;display:flex;flex-direction:column;box-shadow:var(--shadow);overflow:hidden}
.home-art:before{content:"";position:absolute;inset:13px;border:1px solid rgba(60,42,26,.19);pointer-events:none}
.art-caption{display:flex;justify-content:space-between;gap:12px;font-size:10px;letter-spacing:.15em;font-weight:700;color:#594733}
.art-caption-top{margin-bottom:24px}
.art-caption-bottom{align-items:center;margin-top:24px}
.art-arrow{font-size:22px;font-weight:400}
.art-board{position:relative;flex:1;border:2px solid #695a46;min-height:400px;background:repeating-linear-gradient(87deg,transparent 0,transparent 24px,rgba(100,70,40,.035) 26px,transparent 30px),#dbc5a1;box-shadow:inset 0 0 0 7px rgba(255,255,255,.15)}
.art-piece{position:absolute;border:1px solid rgba(61,52,39,.7);display:flex;align-items:center;justify-content:center;font-family:Georgia,serif;font-size:18px;color:#554738}
.art-piece-a{left:2%;top:1%;width:45%;height:42%;background:#c1a77c}
.art-piece-b{left:48%;top:1%;width:50%;height:25%;background:#bd9b6d}
.art-piece-c{left:48%;top:27%;width:50%;height:16%;background:#e5d4b3}
.art-piece-d{left:2%;top:44%;width:30%;height:54%;background:#a78456}
.art-piece-e{left:33%;top:44%;width:65%;height:26%;background:#d4b589}
.art-piece-f{left:33%;top:71%;width:65%;height:27%;background:#c7ab7e}
.home-footer{display:flex;justify-content:space-between;padding:23px 0 30px;border-top:1px solid var(--line);font-size:10px;font-weight:700;letter-spacing:.16em;color:#9a8e7b}
.view-projects,.view-entry,.view-result{padding:53px clamp(24px,4.7vw,72px) 70px}
.page-head{display:flex;justify-content:space-between;align-items:end;gap:24px;margin-bottom:35px}
.page-head h2{font-size:clamp(42px,5.1vw,72px);line-height:1.1;letter-spacing:-.05em;margin:14px 0 12px}
.heading-period{color:var(--oak)}
.page-head p{color:#706a60;line-height:1.6;margin:0}
.projects-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:17px}
.project-head-actions{display:flex;gap:9px;flex-wrap:wrap;justify-content:flex-end}
.project-head-actions .btn{gap:8px}
.storage-note{font-size:12px;color:#82786a;margin:-19px 0 16px}
.backup-message{min-height:18px;margin-bottom:8px;font-size:12px;color:#a14532}
.backup-message.ok{color:#5c7955}
.project-card{background:var(--panel);border:1px solid #e3dbce;padding:24px;min-height:245px;display:flex;flex-direction:column;box-shadow:0 8px 28px rgba(55,43,28,.035)}
.project-card-head{display:flex;justify-content:space-between;align-items:start}
.project-icon{width:39px;height:39px;border:1px solid var(--line);display:grid;place-items:center;color:var(--oak-dark);font-size:19px}
.project-date,.small-label{font-size:10px;font-weight:700;letter-spacing:.17em;color:#968775}
.project-card h3{font-size:27px;line-height:1.2;margin:22px 0 8px}
.project-card p{color:#82786a;font-size:12px;margin-bottom:20px}
.project-card-actions{margin-top:auto;display:flex;justify-content:space-between;align-items:center}
.project-open,.project-delete,.save-link{border:0;background:none;padding:6px 0;font-size:12px;font-weight:700;color:var(--oak-dark)}
.project-delete{color:#9a8c7d;text-decoration:underline;text-underline-offset:3px}
.empty-projects{grid-column:1/-1;text-align:center;background:#faf7f0;border:1px dashed #cbbda9;padding:70px 20px}
.empty-projects .empty-icon{font-family:Georgia,serif;font-size:48px;color:var(--oak-dark)}
.empty-projects h3{font-size:30px;margin:12px 0}
.empty-projects p{color:var(--muted)}
.step-pill{border:1px solid var(--line);border-radius:50%;width:75px;height:75px;display:grid;place-items:center;font-family:Georgia,serif;font-size:25px;flex-shrink:0}
.step-pill span{color:#b5aa99;font-size:14px;margin-left:-8px}
.entry-layout{display:grid;grid-template-columns:minmax(0,1fr) 292px;gap:22px;align-items:start}
.entry-card{background:var(--panel);border:1px solid #e5ddd0;padding:30px;box-shadow:var(--shadow)}
.entry-card-header{display:flex;align-items:end;justify-content:space-between;gap:20px;padding-bottom:30px;border-bottom:1px solid var(--line)}
.field{display:flex;flex-direction:column;gap:9px;font-size:11px;font-weight:700;color:#80786d;letter-spacing:.045em}
.field input,.field select{height:44px;width:100%;padding:0 12px;border:1px solid #d8cfc0;background:#fffefa;color:var(--ink);border-radius:0;min-width:0}
.field input::placeholder{color:#aaa197}
.field input:disabled{background:#f1ebe1;color:#7e766b}
.project-name-field{width:min(420px,100%)}
.unit-chip{font-size:10px;letter-spacing:.13em;font-weight:700;color:var(--oak-dark);padding:11px 13px;background:#f0e5d4;white-space:nowrap}
.pieces-header{display:flex;justify-content:space-between;margin:28px 0 13px;color:#83796d;font-size:10px;letter-spacing:.16em;font-weight:700}
.pieces-header span:last-child{color:#a58761;letter-spacing:0}
.piece-rows{display:flex;flex-direction:column;gap:11px}
.piece-row{display:grid;grid-template-columns:32px minmax(100px,1.5fr) minmax(84px,1fr) minmax(84px,1fr) 68px 82px;align-items:end;gap:10px;background:#f7f2e9;border:1px solid #e7ddcf;padding:14px}
.piece-row.is-accepted{border-color:#a7b5a1;background:#f2f5ef}
.piece-index{align-self:center;font-family:Georgia,serif;font-size:21px;color:#b6a48b;text-align:center}
.input-unit{position:relative}
.input-unit input{padding-right:32px}
.input-unit em{position:absolute;right:10px;top:13px;font-style:normal;color:#a69a8b;font-size:11px}
.row-actions{display:flex;gap:5px}
.row-actions button{height:44px;width:36px;border:1px solid #d8cfc0;background:#fffefa;color:#6e6254;font-size:20px}
.row-actions button:hover{background:#e9dccb}
.row-accept{color:#587051!important}
.add-piece{margin-top:15px;width:100%;height:49px;border:1px dashed #b7aa99;background:none;color:#765e42;font-size:13px;font-weight:700}
.add-piece:hover{background:#f3eadd}
.form-message{min-height:21px;margin-top:12px;color:#a14532;font-size:12px}
.form-message.ok{color:#5c7955}
.entry-actions{display:flex;align-items:center;gap:19px;margin-top:15px;padding-top:24px;border-top:1px solid var(--line)}
.entry-aside{background:#e8ddc9;padding:30px;border:1px solid #dbceb8}
.aside-number{font-family:Georgia,serif;font-size:50px;color:#9a754a}
.aside-number span{font-size:20px;color:#baa488}
.entry-aside h3{font-size:35px;line-height:1.15;margin:18px 0}
.entry-aside p{font-size:13px;line-height:1.75;color:#6f6150}
.aside-rule{height:1px;background:#c8b99e;margin:27px 0}
.spec-list{display:grid;gap:13px}
.spec-list div{display:flex;justify-content:space-between;gap:10px;font-size:11px}
.spec-list span{color:#95836f;font-weight:700;letter-spacing:.08em}
.spec-list strong{font-size:12px}
.entry-aside small{display:block;margin-top:32px;font-size:10px;line-height:1.6;color:#85735d}
.result-head-actions{display:flex;gap:10px;flex-wrap:wrap}
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:20px}
.stat{background:var(--panel);border:1px solid #e4dbcd;padding:19px 22px;display:flex;flex-direction:column;min-height:127px}
.stat span{font-size:10px;letter-spacing:.14em;color:#928475;font-weight:700}
.stat strong{font-family:'Playfair Display',Georgia,serif;font-size:39px;font-weight:500;line-height:1.25;margin-top:4px}
.stat small{color:#958b7d;font-size:11px}
.stat-accent{background:#e7dac6}
.workspace{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:20px;align-items:start}
.canvas-card,.editor-card{background:var(--panel);border:1px solid #e2d9ca}
.canvas-toolbar{height:73px;padding:0 23px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line)}
.toolbar-title{display:flex;flex-direction:column;gap:4px}
.toolbar-title strong{font-size:17px}
.sheet-nav{display:flex;align-items:center;gap:12px}
.sheet-nav button{width:33px;height:33px;background:#f4eee4;border:1px solid var(--line);font-size:17px}
.sheet-nav button:disabled{opacity:.4;cursor:not-allowed}
.sheet-nav span{font-size:11px;font-weight:700;min-width:40px;text-align:center}
.board-stage{padding:26px 28px 31px;display:flex;flex-direction:column;align-items:center;overflow:auto;background:radial-gradient(#e5ded2 .8px,transparent .8px);background-size:13px 13px}
.dimension{font-size:11px;color:#877665;font-weight:700;letter-spacing:.07em}
.dimension-top{width:min(100%,376px);text-align:center;margin-left:34px;margin-bottom:9px;position:relative}
.dimension-top:before,.dimension-top:after{content:"";position:absolute;top:50%;width:39%;height:1px;background:#b8a996}
.dimension-top:before{left:0}.dimension-top:after{right:0}
.board-row{display:flex;align-items:center;gap:16px}
.dimension-side{writing-mode:vertical-rl;transform:rotate(180deg)}
.layout-board{width:min(64vw,376px);aspect-ratio:1/2;position:relative;background:repeating-linear-gradient(135deg,rgba(106,72,35,.19) 0,rgba(106,72,35,.19) 1px,transparent 1px,transparent 10px),#eadbc4;border:2px solid #9b7d58;box-shadow:0 15px 30px rgba(62,42,20,.12);touch-action:none}
.board-piece{position:absolute;border:1px solid #876c50;background:#ba9567;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;color:#2f2920;cursor:grab;overflow:hidden;user-select:none;touch-action:none;padding:2px}
.board-piece:nth-child(5n+2){background:#d3b78a}.board-piece:nth-child(5n+3){background:#c5a476}.board-piece:nth-child(5n+4){background:#e0c99e}.board-piece:nth-child(5n){background:#ae8b5c}
.board-piece.selected{outline:3px solid #40584c;outline-offset:-4px;z-index:3}
.board-piece.dragging{opacity:.75;cursor:grabbing;z-index:4}
.board-piece.invalid{background:#d49284!important;outline-color:#a13c2f}
.board-piece b{font-size:11px;line-height:1.1;overflow:hidden;text-overflow:ellipsis;max-width:100%;white-space:nowrap}
.board-piece small{font-size:9px;margin-top:2px;white-space:nowrap}
.board-piece.tiny b{font-size:9px}.board-piece.tiny small{display:none}
.canvas-foot{display:flex;flex-wrap:wrap;gap:18px;padding:15px 22px;border-top:1px solid var(--line);font-size:11px;color:#82786a}
.canvas-foot span:last-child{margin-left:auto;font-weight:700;color:#6f5b43}
.legend-dot{display:inline-block;width:10px;height:10px;background:#bd9a6a;border:1px solid #92785b;margin-right:5px}
.legend-free{background:repeating-linear-gradient(135deg,rgba(106,72,35,.38) 0,rgba(106,72,35,.38) 1px,transparent 1px,transparent 5px),#eadbc4}
.editor-card{padding:25px}
.editor-intro h3{font-size:31px;line-height:1.15;margin:14px 0}
.editor-intro p{font-size:12px;color:#7a7063;line-height:1.65;margin-bottom:22px}
.selection-panel{border-top:1px solid var(--line);border-bottom:1px solid var(--line);min-height:214px;padding:18px 0}
.empty-selection{display:flex;align-items:center;gap:12px;color:#928778}
.empty-selection span{font-size:28px}
.empty-selection p{font-size:12px;line-height:1.5;margin:0}
.selected-title{display:flex;justify-content:space-between;align-items:center;gap:10px}
.selected-title strong{font-size:15px}
.selected-title span{font-size:10px;color:#968b7e}
.selected-dim{color:#765e43;font-size:13px;margin:6px 0 18px}
.editor-button-row{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.editor-button-row .btn{padding-inline:8px;min-height:42px;gap:6px;font-size:11px}
.move-field{margin-top:16px}
.move-field select{height:41px}
.position-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.position-fields input{height:39px}
.editor-message{min-height:35px;padding-top:8px;color:#9d4936;font-size:11px;line-height:1.4}
.editor-message.ok{color:#587051}
.editor-bottom{border-top:1px solid var(--line);padding-top:15px}
.btn-full{width:100%;margin-bottom:6px}
.result-footer{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-top:18px;color:#8b8173;font-size:11px}
.save-link{text-decoration:underline;text-underline-offset:4px;white-space:nowrap}
@media(max-width:1050px){.home-grid{grid-template-columns:1fr 1fr;gap:32px}.home-features{gap:14px}.entry-layout,.workspace{grid-template-columns:minmax(0,1fr) 255px}.piece-row{grid-template-columns:25px minmax(90px,1.4fr) minmax(70px,1fr) minmax(70px,1fr) 58px 72px;gap:6px;padding:10px}.entry-card{padding:22px}.row-actions button{width:32px}}
@media(max-width:820px){.topbar-note{display:none}.home-grid{grid-template-columns:1fr}.home-art{min-height:530px;margin-top:0}.home-copy{padding:58px 0 10px}.home-features{margin-top:40px}.entry-layout,.workspace{grid-template-columns:1fr}.entry-aside{display:none}.editor-card{display:grid;grid-template-columns:1fr 1fr;gap:20px}.editor-intro{grid-row:1/3}.editor-bottom{grid-column:2}.projects-list{grid-template-columns:repeat(2,minmax(0,1fr))}.stats-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:610px){.topbar{height:68px}.sheet-spec{font-size:9px}.home-grid{min-height:0}.home-copy{padding:48px 0 15px}h1{font-size:clamp(65px,16vw,94px);margin:28px 0}.home-intro{font-size:15px}.home-actions{display:grid}.btn-large{width:100%}.home-features{display:grid;gap:13px;margin-top:36px}.home-art{min-height:460px;padding:27px}.art-board{min-height:330px}.home-footer{gap:18px;font-size:9px}.home-footer span:last-child{display:none}.view-projects,.view-entry,.view-result{padding:38px 20px 55px}.page-head{align-items:start;flex-direction:column}.page-head h2{font-size:46px}.step-pill{display:none}.entry-card{padding:18px}.entry-card-header{align-items:start;flex-direction:column}.piece-row{grid-template-columns:23px 1fr 1fr;gap:9px}.piece-row .field:nth-child(2){grid-column:2/4}.piece-index{grid-row:1/3}.field-quantity{grid-column:2}.row-actions{grid-column:3;justify-content:end}.piece-row .field:nth-child(3),.piece-row .field:nth-child(4){grid-row:2}.piece-row .field:nth-child(3){grid-column:2}.piece-row .field:nth-child(4){grid-column:3}.piece-row .field:nth-child(2){grid-row:1}.entry-actions{flex-direction:column;align-items:stretch}.entry-actions .btn{width:100%}.projects-list{grid-template-columns:1fr}.project-head-actions{justify-content:flex-start}.project-head-actions .btn{flex:1}.storage-note{margin-top:-18px}.result-head-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.result-head-actions .btn{padding-inline:10px;gap:5px;font-size:11px}.stats-grid{gap:8px}.stat{min-height:111px;padding:14px}.stat strong{font-size:32px}.board-stage{padding:23px 10px}.layout-board{width:min(72vw,310px)}.dimension-top{width:min(72vw,310px)}.editor-card{display:block}.result-footer{align-items:start;flex-direction:column}.canvas-foot span:last-child{margin-left:0}}
