:root {
  font-family: Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color: #252923;
  background: #e9ece7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,input,select {
  font: inherit;
}

button,a,input,select {
  outline-offset: 4px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .4;
}

a {
  color: #38614f;
}

button {
  color: inherit;
}

input,select {
  min-width: 0;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
  outline: 2px solid #397259;
}

h2,h3,p {
  margin-top: 0;
}

.studio {
  height: 100dvh;
  display: grid;
  grid-template-columns: 254px minmax(320px,1fr) 250px;
  grid-template-rows: 76px minmax(0,1fr) 34px;
}

.topbar {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid #d3d8d0;
  background: #fbfcfa;
}

.brand {
  font-family: Georgia,serif;
  font-size: 26px;
  white-space: nowrap;
  line-height: 1;
}

.brand>span {
  font-style: italic;
  color: #50705c;
}

.brand small {
  display: block;
  font: 12px ui-sans-serif,sans-serif;
  letter-spacing: 1.4px;
  margin-top: 10px;
}

.document-title {
  border: 0;
  background: transparent;
  text-align: center;
  flex: 1;
  font-size: 15px;
  width: 100px;
}

.topbar button,.workspace-toolbar button {
  border: 1px solid #cbd3c9;
  background: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
}

.palette,.inspector {
  background: #fbfcfa;
  padding: 22px 16px;
  overflow: auto;
}

.palette {
  border-right: 1px solid #d3d8d0;
  display: flex;
  flex-direction: column;
}

.inspector {
  border-left: 1px solid #d3d8d0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-heading h2,.inspector h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.panel-heading>span {
  font-size: 12px;
  color: #798275;
}

.palette input[type=search] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccd4c9;
  background: white;
  border-radius: 6px;
  font-size: 14px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 6px;
  overflow: auto;
  padding: 14px 1px;
  align-content: start;
}

.glyph-tile {
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f1f3ee;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 8px 4px 6px;
  gap: 4px;
}

.glyph-tile:hover {
  background: #e0e9df;
  border-color: #92a98f;
}

.glyph-tile > svg {
  width: 48px;
  height: 43px;
  overflow: visible;
}

.glyph-tile span {
  font-size: 14px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glyph-ink :is(ellipse,polygon,polyline,rect,circle,line,path) {
  stroke: #272d26 !important;
  stroke-width: 2 !important;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.glyph-ink .filler {
  stroke: none !important;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid #d1d8ce;
  color: #65725e;
  font-size: 14px;
  min-height: 56px;
}

.paper-scroll {
  overflow: auto;
  flex: 1;
  padding: 40px;
  display: grid;
  justify-items: center;
  align-items: start;
  background-image: radial-gradient(#c9d0c5 .65px,transparent .65px);
  background-size: 12px 12px;
}

.paper {
  background: #fff;
  box-shadow: 0 3px 7px #24311c12,0 18px 40px #24311c0a;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  color: #272d26;
}

.inspector p {
  font-size: 14px;
  line-height: 1.6;
  color: #6c7567;
  margin-top: 16px;
}

.reference-note {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid #dce1d7;
}

.reference-note>span {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: #7c8576;
}

.reference-note h3 {
  font-family: Georgia,serif;
  font-size: 21px;
  font-weight: normal;
  line-height: 1.35;
  margin: 12px 0;
}

.reference-note a {
  font-size: 14px;
}

.statusbar {
  grid-column: 1/-1;
  background: #f8faf6;
  border-top: 1px solid #d3d8d0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 12px;
  color: #737d6c;
}

@media (max-width:1050px) {
  .studio {
    grid-template-columns: 210px minmax(280px,1fr) 210px;
  }
  .topbar {
    gap: 12px;
    padding: 0 16px;
  }
  .paper-scroll {
    padding: 24px;
  }
  .palette,.inspector {
    padding: 18px 12px;
  }
}

@media (max-width:760px) {
  .studio {
    grid-template-columns: 176px minmax(250px,1fr);
    grid-template-rows: 76px minmax(350px,1fr) auto 34px;
    min-width: 440px;
  }
  .inspector {
    grid-column: 1/-1;
    max-height: 240px;
    border-top: 1px solid #d3d8d0;
    display: flex;
    gap: 20px;
  }
  .reference-note {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .topbar .brand small {
    display: none;
  }
  .brand {
    font-size: 21px;
  }
  .palette-grid {
    grid-template-columns: repeat(2,1fr);
  }
  .statusbar span:last-child {
    display: none;
  }
  .document-title {
    font-size: 13px;
  }
}

.file-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.file-actions button {
  padding: 8px 10px;
}

.export-menu {
  position: relative;
  font-size: 14px;
}

.export-menu summary {
  list-style: none;
  background: #355c45;
  color: white;
  border: 1px solid #355c45;
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  gap: 18px;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu>div {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  padding: 6px;
  background: white;
  box-shadow: 0 5px 20px #25341c30;
  border: 1px solid #d3dccf;
  border-radius: 8px;
  width: 170px;
}

.export-menu>div button {
  border: 0;
  width: 100%;
  text-align: left;
}

.export-menu>div button:hover {
  background: #eef3eb;
}

.category-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 14px 0 12px;
}

.category-tabs button {
  font-size: 14px;
  padding: 7px 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #64725c;
}

.category-tabs button[aria-pressed=true] {
  background: #e6eddf;
  color: #315238;
  border-color: #c3d2b9;
}

.inside-control,.lock-control {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  line-height: 1.5;
}

.inside-control {
  align-items: flex-start;
}

.inside-control input,.lock-control input,.grid-toggle input {
  accent-color: #426849;
  flex-shrink: 0;
}

.placement-note {
  font-size: 12px;
  color: #6a785f;
  line-height: 1.5;
  margin: 8px 0 0;
}

.palette-grid {
  flex: 1;
  min-height: 0;
}

.glyph-tile small {
  font-size: 12px;
  color: #728168;
}

.palette-foot {
  padding-top: 12px;
  border-top: 1px solid #dae1d4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}

.palette-foot>button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 3px 0;
  font-size: 14px;
}

.palette-foot>button span {
  border: 1px solid #adbea2;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  line-height: 18px;
}

.palette-foot a {
  color: #74846a;
}

.tool-group {
  display: flex;
  gap: 5px;
  align-items: center;
}

.tool-group button {
  padding: 5px 10px;
  min-height: 32px;
}

.grid-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  margin-left: 8px;
}

.zoom-label {
  font-size: 13px;
  min-width: 43px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dimension-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.number-field {
  display: flex;
  align-items: center;
  background: #eef2e9;
  border: 1px solid #dce4d4;
  border-radius: 5px;
  padding: 8px 7px;
  gap: 4px;
  font-size: 12px;
  color: #718064;
}

.number-field input {
  border: 0;
  background: transparent;
  min-width: 0;
  width: 100%;
  font-size: 14px;
  text-align: right;
  color: #293322;
  appearance: textfield;
}

.number-field input::-webkit-inner-spin-button {
  appearance: none;
}

.parent-control {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  gap: 6px;
  margin: 18px 0 12px;
  color: #627456;
}

.parent-control select {
  padding: 8px;
  border: 1px solid #d1ddc8;
  border-radius: 5px;
  background: white;
  color: #2d3b23;
  font-size: 14px;
  width: 100%;
}

.selection-actions {
  display: flex;
  gap: 6px;
}

.selection-actions button {
  flex: 1;
  background: white;
  border: 1px solid #cdd9c4;
  border-radius: 5px;
  padding: 8px 5px;
  font-size: 14px;
}

.selection-actions button:hover {
  background: #eef3e9;
}

.text-button {
  font-size: 13px;
  border: 0;
  padding: 10px 0;
  background: transparent;
  color: #527143;
  text-align: left;
}

.inspector .shape-hint {
  font-size: 13px;
  line-height: 1.6;
  color: #7a866f;
  margin: 14px 0;
}

.layers {
  border-top: 1px solid #dce3d4;
  padding-top: 22px;
  margin-top: 24px;
}

.layers .panel-heading {
  margin-bottom: 10px;
}

.layer {
  width: 100%;
  background: transparent;
  display: flex;
  gap: 7px;
  align-items: center;
  border: 0;
  border-radius: 4px;
  text-align: left;
  padding: 8px 9px;
  font-size: 14px;
  min-height: 33px;
}

.layer:hover {
  background: #f0f4eb;
}

.layer.active {
  background: #e3ecd9;
  color: #385528;
}

.layer-icon {
  color: #809171;
}

.layer small {
  margin-left: auto;
  font-size: 12px;
  color: #859379;
}

.reference-note {
  margin-top: 28px;
  padding-top: 20px;
}

.reference-note .text-button {
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

.no-results {
  grid-column: 1/-1;
  font-size: 14px;
  color: #728168;
}

.help-panel {
  position: fixed;
  z-index: 15;
  bottom: 52px;
  left: 272px;
  max-width: 460px;
  max-height: 80vh;
  overflow: auto;
  border: 1px solid #bbcbb0;
  border-radius: 10px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 12px 80px #1c2e1840;
}

.help-panel h2 {
  font-family: Georgia,serif;
  font-size: 26px;
  font-weight: normal;
}

.help-panel p {
  font-size: 15px;
  line-height: 1.7;
  color: #5c6c50;
}

.help-panel .help-note {
  font-size: 13px;
  color: #809172;
}

.close-help {
  float: right;
  background: transparent;
  border: 0;
  font-size: 24px;
}

.statusbar>span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 16px;
}

.statusbar>span:last-child {
  white-space: nowrap;
}

.paper-scroll {
  justify-items: normal;
}

.paper {
  margin: 0 auto;
  display: block;
}

.properties {
  min-width: 0;
}

@media (max-width:1100px) {
  .topbar {
    gap: 8px;
  }
  .brand {
    font-size: 23px;
  }
  .brand small {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .file-actions {
    gap: 3px;
  }
  .file-actions button {
    padding: 7px;
  }
  .export-menu summary {
    padding: 8px 10px;
  }
  .workspace-toolbar {
    padding: 10px;
  }
  .help-panel {
    left: 225px;
  }
  .dimension-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width:760px) {
  .studio {
    height: 100dvh;
    grid-template-rows: 110px minmax(260px,1fr) 200px 34px;
    min-width: 360px;
    grid-template-columns: 140px minmax(220px,1fr);
  }
  .topbar {
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 12px;
  }
  .brand {
    font-size: 22px;
  }
  .document-title {
    flex: 1;
    min-width: 100px;
  }
  .file-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }
  .palette {
    padding: 14px 8px;
  }
  .palette-grid {
    gap: 4px;
  }
  .glyph-tile {
    padding: 6px 1px;
  }
  .glyph-tile span {
    font-size: 12px;
  }
  .category-tabs button {
    font-size: 12px;
  }
  .inside-control {
    font-size: 12px;
  }
  .palette input[type=search] {
    font-size: 12px;
    padding: 9px 7px;
  }
  .inspector {
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .inspector .reference-note {
    display: none;
  }
  .layers {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .dimension-grid {
    grid-template-columns: 1fr 1fr;
  }
  .workspace-toolbar {
    flex-wrap: wrap;
    gap: 5px;
  }
  .tool-group {
    gap: 2px;
  }
  .tool-group button {
    padding: 4px 7px;
  }
  .paper-scroll {
    padding: 20px;
  }
  .help-panel {
    left: 12px;
    right: 12px;
    bottom: 40px;
    max-width: none;
  }
  .statusbar {
    padding: 0 10px;
  }
  .statusbar>span {
    font-size: 12px;
  }
  .selection-actions button {
    font-size: 12px;
  }
  .inside-control input {
    margin-left: 0;
  }
  .panel-heading h2 {
    font-size: 14px;
  }
}

/* Nested SVGs in glyph artwork retain their own viewport geometry. */
.layer-row { display: flex; align-items: center; }
.layer-row .layer { flex: 1; min-width: 0; }
.layer-row .layer > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.layer-order { display: flex; flex-shrink: 0; gap: 2px; }
.layer-order button { border: 0; border-radius: 4px; background: transparent; padding: 4px; font-size: 16px; }
.layer-order button:hover:not(:disabled) { background: #e3ecd9; }
.snap-distance { width: 55px; padding: 5px; border: 1px solid #cbd3c9; border-radius: 4px; background: white; font-size: 14px; }
.free-children { width: 100%; margin-top: 10px; border: 1px solid #cdd9c4; background: white; border-radius: 5px; padding: 8px; font-size: 14px; }
.page-settings { border-top: 1px solid #dce3d4; margin-top: 24px; padding-top: 22px; }
.workspace-toolbar { flex-wrap: wrap; gap: 8px; }
@media(max-width:760px) { .page-settings { margin: 0; } }

[hidden] { display: none !important; }

/* Utterance bar: type text, choose a width, or let Auto fit the page. */
.utterance-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 22px;
  border-bottom: 1px solid #d1d8ce;
  background: #fbfcfa;
  font-size: 14px;
  color: #65725e;
}
.utterance-bar textarea {
  /* Room to type comes first; the controls wrap onto a second row. */
  flex: 1 1 360px;
  min-width: min(360px, 100%);
  font: inherit;
  font-size: 16px; /* 16px stops phones zooming the page on focus */
  color: #252923;
  border: 1px solid #cbd3c9;
  border-radius: 8px;
  padding: 9px 12px;
  resize: vertical;
  min-height: 40px;
  field-sizing: content;
  max-height: 30vh;
}
.width-control {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.width-control input { width: 120px; accent-color: #477558; }
.width-control output { min-width: 4.5em; font-variant-numeric: tabular-nums; }
#gap { width: 80px; }
#gap-label { min-width: 1.5em; }
.utterance-bar button {
  border: 1px solid #cbd3c9;
  background: #fff;
  border-radius: 6px;
  padding: 8px 12px;
}
.utterance-bar button[aria-pressed=true] { background: #e3eddd; border-color: #a9c0a4; }
.palette-toggle { display: none; }
#art [data-node-id], [data-handle] { touch-action: none; }

/* Phones: the page gets the full width; the palette opens over it on demand. */
@media (max-width:760px) {
  /* The screen scrolls as a whole: page first, details below it. */
  .studio {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: auto auto auto 34px;
    min-width: 0;
    height: auto;
    min-height: 100dvh;
  }
  .paper-scroll { height: 64dvh; flex: none; }
  .inspector { max-height: none; }
  .statusbar { position: sticky; bottom: 0; }
  .grid-toggle, .snap-distance { display: none; }
  .palette { display: none; }
  .studio.palette-open .palette {
    display: flex;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    bottom: 34px;
    width: min(240px, 80vw);
    box-shadow: 0 12px 60px #1c2e1840;
  }
  .palette-toggle { display: inline-block; }
  .utterance-bar { flex-wrap: wrap; padding: 10px; gap: 8px 12px; }
  .utterance-bar textarea { flex-basis: 100%; }
  .width-control { flex: 1; }
  .width-control input { flex: 1; width: auto; }
  .paper-scroll { padding: 12px; }
  .workspace-toolbar { min-height: 0; gap: 8px; flex-wrap: wrap; }
}

/* Paint buckets: clicks reach the shapes themselves, not the glyph boxes. */
.paint-tools input[type=color] { width: 34px; height: 32px; padding: 2px; border: 1px solid #cbd3c9; border-radius: 6px; background: #fff; }
.workspace-toolbar button[aria-pressed=true] { background: #e3eddd; border-color: #a9c0a4; }
.painting .paper, .painting .paper * { cursor: crosshair !important; }
.painting #art .hit, .painting #overlay, .painting #overlay * { pointer-events: none !important; }
.painting #art .glyph-body, .painting #art .glyph-hat { pointer-events: auto !important; }
.painting #art [data-part] { pointer-events: visiblePainted; }
.painting #art [data-closed] { pointer-events: all; }
/* A hollow shape's inside is clicked through its underlay, which sits in
   the right place in the paint order; the outline itself takes its stroke. */
.painting #art [data-under] { pointer-events: all; }
.painting #art [data-hollow] { pointer-events: visibleStroke; }
@media (max-width:760px) { .workspace-toolbar { justify-content: flex-start; } }

.dither-control { display: inline-flex; align-items: center; gap: 6px; color: #65725e; font-size: 13px; }
.dither-control input { width: 84px; }
.dither-control output { min-width: 3.2em; font-variant-numeric: tabular-nums; }
.dither-control input { accent-color: #477558; }
/* The paint group is the widest: let it wrap within itself on narrow screens. */
.paint-tools { flex-wrap: wrap; min-width: 0; }

/* nasa and nasa ale wear their glyphs. */
.tool-group .glyph-button { display: inline-flex; align-items: center; gap: 1px; padding: 3px 6px; }
.glyph-button svg { display: block; }
.glyph-button .glyph-ink :is(ellipse,polygon,polyline,rect,circle,line,path) { stroke-width: 1.4 !important; }
.glyph-button[aria-pressed=true] .glyph-ink :is(ellipse,polygon,polyline,rect,circle,path)[fill="#FFF"],
.glyph-button[aria-pressed=true] .glyph-ink :is(ellipse,polygon,polyline,rect,circle,path)[fill="#FFFFFF"] { fill: #e3eddd; }
/* kule | walo pimeja: two sides of one switch. */
.medium-toggle { display: inline-flex; border: 1px solid #cbd3c9; border-radius: 7px; overflow: hidden; }
.tool-group .medium-toggle button { border: 0; border-radius: 0; min-height: 30px; white-space: nowrap; }
.tool-group .medium-toggle button + button { border-left: 1px solid #cbd3c9; }
.medium-toggle button[aria-pressed=true] { background: #355c45; color: #fff; }
.medium-toggle #medium-dither[aria-pressed=true] { background: #1d211c; }
[hidden].dither-control, #paint-colour[hidden] { display: none; }
