@font-face {
  font-family: Rajdhani;
  src: url("./assets/Rajdhani-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Rajdhani;
  src: url("./assets/Rajdhani-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Rajdhani;
  src: url("./assets/Rajdhani-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #163b3f;
  --forest: #214b4e;
  --sage: #739487;
  --paper: #f6f7f5;
  --line: #d7dfdd;
  --muted: #506963;
  --pale: #e9efeb;
  font: 400 17px/1.4 Rajdhani, "Bahnschrift", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body, h1, h2, p, ol { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #397a80; outline-offset: 3px; }
svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.site-header { background: white; border-bottom: 1px solid var(--line); }
.header-inner, main { width: min(100% - 72px, 1490px); margin-inline: auto; }
.header-inner, .identity, .back-link { display: flex; align-items: center; }
.header-inner { min-height: 74px; justify-content: space-between; gap: 16px; }
.identity { gap: 24px; }
.brand { display: inline-flex; align-items: flex-start; gap: 4px; font-size: 43px; line-height: .92; font-weight: 700; letter-spacing: -2.8px; }
.brand img { width: 12px; height: 12px; margin-top: 3px; }
.header-caption { border-left: 1px solid var(--line); padding-left: 24px; color: var(--muted); }
.back-link { gap: 10px; font-weight: 600; }
.back-link svg { width: 16px; height: 16px; transform: rotate(-35deg); }
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
main { padding: 27px 0 28px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 22px; }
.intro-kicker { display: flex; gap: 9px; align-items: center; color: var(--muted); }
.intro-kicker span { width: 20px; height: 2px; background: var(--sage); }
h1 { margin: 3px 0 1px; font-size: clamp(42px, 4.5vw, 65px); font-weight: 600; letter-spacing: -.052em; line-height: 1; }
.intro p:last-child { color: var(--muted); }
.button, .tool, .icon-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; font-weight: 600; line-height: 1.1; }
.button { min-height: 44px; padding: 9px 15px; white-space: nowrap; }
.primary { color: white; background: var(--ink); }
.primary:hover:not(:disabled) { background: #2d5a5c; }
.secondary { background: white; border-color: #c3d2cb; }
.secondary:hover { background: #f2f6f2; }
.button.compact { min-height: 34px; padding: 5px 10px; font-size: 15px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 278px; gap: 18px; align-items: start; }
.editor, .measurements { background: white; border: 1px solid var(--line); min-width: 0; }
.filebar, .toolbar, .editor-footer { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; gap: 8px; }
.filebar { min-height: 44px; border-bottom: 1px solid var(--line); font-weight: 600; }
.file-caption { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-caption span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-caption svg, .filebar label { color: var(--muted); }
.filebar label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 15px; }
select { background: white; border: 1px solid var(--line); padding: 3px; max-width: 115px; }
.toolbar { min-height: 52px; padding-block: 5px; flex-wrap: wrap; }
.tool-group, .zoom-group, .draw-actions { display: flex; align-items: center; gap: 4px; }
.tool { min-height: 36px; padding: 5px 9px; white-space: nowrap; font-size: 16px; }
.tool svg { width: 18px; height: 18px; }
.tool:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--pale); }
.tool[aria-pressed="true"], .tool[aria-pressed="true"]:hover { color: white; background: var(--ink); }
.icon-button { width: 34px; height: 34px; padding: 0; }
.fit { border-left: 1px solid var(--line); margin-left: 3px; }
#zoom-level { min-width: 51px; text-align: center; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.viewport {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(340px, calc(100dvh - 390px), 900px);
  border-block: 1px solid var(--line);
  overflow: hidden;
  background: #eef2ef radial-gradient(#b3c5bb 0.8px, transparent 0.8px) center / 18px 18px;
}
.viewport.is-drop { box-shadow: inset 0 0 0 3px var(--sage); }
#drawing { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.viewport[data-mode="reference"], .viewport[data-mode="polygon"] { cursor: crosshair; }
.viewport[data-mode="pan"] { cursor: grab; }
.viewport.is-panning { cursor: grabbing; }
.empty-state { padding: 14px; text-align: center; cursor: default; }
.empty-illustration { width: 140px; height: 104px; stroke: none; margin-bottom: 5px; }
.empty-state h2 { font-size: clamp(25px, 3vw, 33px); line-height: 1.15; font-weight: 600; letter-spacing: -.025em; }
.empty-state p { color: var(--muted); margin: 5px 0 16px; }
.file-types { display: block; color: var(--muted); font-size: 12px; margin-top: 12px; }
.loading { position: absolute; background: white; border: 1px solid var(--line); padding: 13px 21px; font-weight: 700; }
.editor-footer { min-height: 44px; font-size: 15px; color: var(--muted); }
.editor-footer p { padding: 5px 0; }
.editor-footer .error { color: #9b342b; font-weight: 700; }
.total-card { padding: 18px 19px 17px; background: var(--forest); color: white; }
.total-card p { color: #deebe4; }
.total-value { font-size: 53px; font-weight: 600; letter-spacing: -.042em; line-height: 1.13; margin: 6px 0 3px; overflow-wrap: anywhere; }
.total-value span { font-size: 24px; letter-spacing: 0; white-space: nowrap; }
.measurements { margin-top: 12px; }
.reference-row { display: flex; align-items: center; gap: 11px; padding: 14px; border-bottom: 1px solid var(--line); }
.reference-icon { display: grid; place-items: center; background: var(--pale); width: 36px; height: 36px; flex: none; }
.measurements h2 { font-size: 19px; font-weight: 700; line-height: 1.15; }
.measurements p { color: var(--muted); font-size: 15px; }
.area-section { padding: 14px; }
.area-section h2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.area-section h2 span { font-size: 14px; background: var(--pale); border-radius: 20px; min-width: 24px; text-align: center; padding: 3px 5px; }
#area-list { padding: 0; list-style: none; max-height: 280px; overflow: auto; }
.area-item { display: flex; justify-content: space-between; align-items: center; gap: 5px; padding: 6px 0; border-top: 1px solid var(--line); font-weight: 600; }
.area-item > span:first-child { display: flex; align-items: center; gap: 6px; }
.area-item > span:nth-child(2) { margin-left: auto; text-align: right; }
.swatch { width: 9px; height: 9px; background: var(--swatch); flex: none; }
.area-item button { width: 29px; height: 30px; flex: none; }
.area-item svg { width: 16px; height: 16px; }
.local-note { color: var(--muted); margin: 10px 2px 0; font-size: 14px; }
dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); padding: 23px; color: var(--ink); }
dialog::backdrop { background: #102f3399; }
dialog h2 { font-size: 31px; line-height: 1.2; margin: 3px 0 6px; }
dialog p { color: var(--muted); }
dialog label { display: block; font-weight: 700; margin: 15px 0 4px; }
.distance-field { display: flex; align-items: center; gap: 10px; }
.distance-field input { border: 1px solid #a9bfb5; padding: 8px; width: min(100%, 180px); }
.field-error { color: #9b342b; margin-top: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 19px; }

@media (max-width: 900px) {
  .header-inner, main { width: calc(100% - 34px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; }
}
@media (max-width: 730px) {
  .workspace { grid-template-columns: 1fr; }
  .summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; }
  .measurements { margin-top: 0; }
  .local-note { grid-column: 1 / -1; margin-top: 0; }
  .total-card { padding: 12px; }
  .total-value { font-size: clamp(32px, 7vw, 53px); }
}
@media (max-width: 470px) {
  .header-inner, main { width: calc(100% - 24px); }
  .header-caption { display: none; }
  .header-inner { min-height: 61px; }
  .intro { align-items: start; flex-direction: column; gap: 10px; padding-bottom: 14px; }
  main { padding-top: 16px; }
  .toolbar, .filebar, .editor-footer { padding-inline: 7px; }
  .tool { padding-inline: 6px; }
  .editor-footer { align-items: start; flex-direction: column; padding-bottom: 5px; gap: 2px; }
}
