:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #253d30;
  background: #f5f4ed;
  font-synthesis: none;
  --green: #234b39;
  --muted: #748174;
  --border: #dfe4d9;
  --lime: #d7e6aa;
  --cream: #f5f4ed;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  color: var(--green);
  padding: 9px 13px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.15s;
}
button:hover {
  background: #eaf0df;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
canvas:focus-visible {
  outline: 3px solid #d39947;
  outline-offset: 3px;
}
.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.primary:hover {
  background: #386647;
}
input:not([type="checkbox"]):not([type="range"]):not([type="color"]),
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: #253d30;
}
label {
  font-size: 0.875rem;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 0.95rem;
  font-weight: 650;
}
h3 {
  font-size: 1.2rem;
  letter-spacing: -0.035em;
}
.muted {
  font-size: 0.8125rem;
  color: var(--muted);
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  color: #75846d;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 17px 28px;
  border-bottom: 1px solid var(--border);
  background: #fafbf5;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--green);
  text-decoration: none;
  white-space: nowrap;
  font-size: 1.1rem;
  font-weight: 750;
  letter-spacing: -0.04em;
}
.brand em {
  font-style: normal;
  font-weight: 450;
  color: #71816c;
  margin-left: 5px;
}
.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
#save-status {
  font-size: 0.8125rem;
  color: var(--muted);
}
.workspace {
  display: grid;
  grid-template-columns: 230px minmax(360px, 1fr) 295px;
  max-width: 1700px;
  margin: auto;
  min-height: calc(100vh - 124px);
}
.sidebar {
  padding: 27px 22px;
  border-right: 1px solid var(--border);
  background: #f9faf4;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #96b764;
}
.sidebar > label {
  display: block;
  margin: 15px 0 7px;
}
.sidebar > .section-heading:not(:first-child) {
  margin-top: 32px;
}
.animations {
  display: grid;
  gap: 5px;
}
.animation-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border-color: transparent;
  padding: 11px 12px;
  text-transform: capitalize;
  text-align: left;
}
.animation-button.active {
  background: #e4edcd;
  border-color: #d7e4bd;
}
.animation-button .count {
  font-size: 0.75rem;
  color: #77856b;
  font-weight: 450;
}
.animation-button .name {
  display: flex;
  gap: 10px;
  align-items: center;
}
.clip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #577f42;
}
.clip-dot.empty {
  background: transparent;
  border: 1px solid #98a58b;
}
.hint {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #7b8576;
  margin-top: 18px;
}
.settings {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin: 24px 0 20px;
}
.settings summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}
.settings label {
  display: block;
  margin: 13px 0 6px;
}
.wide {
  width: 100%;
}
.sidebar > .wide {
  margin-bottom: 10px;
}
.offline-status {
  display: block;
  margin-top: 18px;
  font-size: 0.75rem;
  color: #77876b;
}
.editor {
  padding: 30px 32px 24px;
  min-width: 0;
}
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 23px;
}
h1 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.2;
  margin-top: 7px;
}
.badge {
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 0.75rem;
  color: #77816d;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
}
.tool-group {
  display: flex;
  gap: 5px;
}
.toolbar button {
  background: transparent;
  border-color: transparent;
  padding: 8px 10px;
}
.toolbar button.active {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 2px 3px #28422c08;
}
.toolbar button span {
  margin-left: 5px;
}
.canvas-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  height: min(47vh, 490px);
  background: #e9ebe3;
  border: 1px solid #dbe0d3;
  border-radius: 12px;
  overflow: hidden;
}
.canvas-stage::before {
  content: "";
  position: absolute;
  width: 66%;
  height: 66%;
  border: 1px solid #dce1d4;
  border-radius: 50%;
  pointer-events: none;
}
#drawing {
  display: block;
  width: min(88%, 384px, max(240px, calc(47vh - 52px)));
  aspect-ratio: auto;
  object-fit: contain;
  image-rendering: pixelated;
  touch-action: none;
  background-color: #fff;
  background-image: conic-gradient(
    #e9ece7 25%,
    transparent 0 50%,
    #e9ece7 0 75%,
    transparent 0
  );
  background-size: 24px 24px;
  box-shadow: 0 8px 25px #30492d12;
  cursor: crosshair;
  z-index: 1;
}
.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 12px;
}
.field-pair label {
  min-width: 0;
}
#sheet-dialog {
  width: min(560px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
}
#sheet-preview {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  image-rendering: pixelated;
  background: repeating-conic-gradient(#e9ece7 0% 25%, #fff 0% 50%) 0 / 16px
    16px;
}
#sheet-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 5px;
  max-height: 240px;
  overflow-y: auto;
  margin: 12px 0;
}
.sheet-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  min-height: 65px;
}
.sheet-cell canvas {
  max-width: 48px;
  max-height: 48px;
  image-rendering: pixelated;
  background: #fff;
}
.sheet-cell span {
  font-size: 0.7rem;
}
.sheet-cell.selected {
  border: 2px solid #385d42;
  background: #dbe9b3;
}
.sheet-mapping {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.8rem;
}
#drawing.grid {
  background-size: 24px 24px;
}
.canvas-caption {
  position: absolute;
  bottom: 14px;
  color: #7c8873;
  font-size: 0.75rem;
}
.canvas-options {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 14px 0 17px;
  font-size: 0.8125rem;
  color: #718169;
}
.canvas-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
}
input[type="checkbox"] {
  accent-color: var(--green);
}
.keyboard-hint {
  margin-left: auto;
  font-size: 0.75rem;
  color: #8b9485;
}
.palette-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--border);
}
.color-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #6b7964;
  white-space: nowrap;
}
input[type="color"] {
  border: 0;
  padding: 0;
  width: 31px;
  height: 31px;
  background: transparent;
  cursor: pointer;
}
.palette {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 5px;
  box-shadow: 0 0 0 1px #d7decd;
}
.swatch.selected {
  box-shadow: 0 0 0 2px #344e38;
}
.timeline {
  margin-top: 23px;
}
.frame-actions {
  display: flex;
  gap: 5px;
}
.frame-actions button {
  padding: 6px 9px;
  font-size: 0.8125rem;
}
.frames {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}
.frame {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 90px;
  padding: 7px;
  border-radius: 8px;
  text-align: center;
  background: #fff;
}
.frame.active {
  border-color: #62804b;
  box-shadow: 0 0 0 1px #62804b;
}
.frame canvas {
  width: 56px;
  height: 56px;
  display: block;
  image-rendering: pixelated;
  background: conic-gradient(#edf0e9 25%, #fff 0 50%, #edf0e9 0 75%, #fff 0);
  background-size: 12px 12px;
}
.frame span {
  display: block;
  font-size: 0.75rem;
  margin-top: 3px;
  color: #849176;
}
.empty-frames {
  font-size: 0.875rem;
  padding: 18px;
  color: #748174;
}
.timing {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.8125rem;
}
.timing label {
  font-size: 0.8125rem;
}
input[type="range"] {
  width: 130px;
  accent-color: var(--green);
}
.timing .muted {
  margin-left: auto;
}
.preview-panel {
  padding: 30px 23px;
  border-left: 1px solid var(--border);
  background: #fafbf5;
}
.live-badge {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  color: #5e7c4a;
  background: #e9f0dc;
  border-radius: 4px;
  padding: 4px 6px;
}
.preview-stage {
  height: 250px;
  border: 1px solid #dce5cc;
  border-radius: 12px;
  background: #eff3e3;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.preview-halo {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #e6edcf;
  top: 23px;
}
.preview-stage canvas {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  z-index: 1;
  margin-top: 18px;
}
.ground {
  position: absolute;
  bottom: 40px;
  width: 132px;
  height: 12px;
  background: #cfddba;
  border-radius: 50%;
}
.tiny-flower {
  position: absolute;
  color: #c4d390;
  font-size: 27px;
  bottom: 41px;
}
.flower-one {
  left: 21px;
  transform: rotate(20deg);
}
.flower-two {
  right: 19px;
  bottom: 59px;
  transform: rotate(-20deg);
  font-size: 19px;
}
.preview-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 8px;
  font-size: 0.75rem;
  color: #849176;
}
.preview-controls button {
  font-size: 0.8125rem;
  padding: 7px 9px;
}
.export-note {
  padding-top: 35px;
  margin-top: 30px;
  border-top: 1px solid var(--border);
}
.export-note h3 {
  margin-top: 9px;
  line-height: 1.4;
}
.export-note p {
  font-size: 0.875rem;
  color: #7c8973;
  line-height: 1.65;
  margin: 12px 0 21px;
}
.export-note button {
  margin-bottom: 8px;
}
.subtle {
  background: transparent;
  border-color: transparent;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: #929b88;
}
footer > span:first-child {
  letter-spacing: 0.12em;
  font-weight: 700;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #234b39;
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  z-index: 10;
  box-shadow: 0 5px 20px #234b3930;
  max-width: 90vw;
  font-size: 0.875rem;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: min(440px, 90vw);
  color: var(--green);
  background: #fafbf5;
}
dialog::backdrop {
  background: #203d2b66;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 1.35rem;
}
dialog p {
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 12px 0 18px;
  color: #718169;
}
dialog label {
  display: block;
  margin: 15px 0 7px;
}
dialog input[type="checkbox"] {
  width: auto;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1450px) {
  .workspace {
    grid-template-columns: 250px minmax(360px, 1fr) 330px;
  }
  .editor {
    padding-inline: 50px;
  }
  .canvas-stage {
    height: 490px;
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 200px minmax(300px, 1fr) 240px;
  }
  .editor {
    padding: 24px 20px;
  }
  .sidebar {
    padding: 24px 16px;
  }
  .preview-panel {
    padding: 24px 16px;
  }
  .toolbar button span,
  .keyboard-hint {
    display: none;
  }
  .topbar {
    gap: 15px;
    padding: 15px 20px;
  }
  #save-status {
    display: none;
  }
  h1 {
    font-size: 1.4rem;
  }
  .palette-row {
    gap: 10px;
    flex-wrap: wrap;
  }
  .canvas-stage {
    height: 360px;
  }
  .preview-stage {
    height: 220px;
  }
}
@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .preview-panel {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
  .preview-panel > .section-heading {
    grid-column: 1/-1;
    margin: 0;
  }
  .preview-stage {
    height: 200px;
  }
  .preview-controls {
    grid-column: 1;
    grid-row: 3;
    margin: 0;
  }
  .export-note {
    grid-column: 2;
    grid-row: 2/4;
    border: 0;
    padding: 0;
    margin: 0;
  }
  .local-note {
    grid-column: 1/-1;
    margin: 0;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .topbar nav {
    margin-left: auto;
    flex-wrap: wrap;
  }
  .topbar nav button {
    padding: 8px 10px;
  }
  .canvas-stage {
    min-height: 270px;
    height: 320px;
  }
  .editor-header .badge {
    display: none;
  }
  footer > span:last-child {
    display: none;
  }
}
@media (max-width: 580px) {
  .workspace {
    display: block;
  }
  .topbar {
    padding: 14px 16px;
    gap: 12px;
  }
  .topbar nav {
    width: 100%;
    margin: 0;
    justify-content: space-between;
    gap: 4px;
  }
  .topbar nav button {
    font-size: 0.8125rem;
    padding: 8px;
  }
  .brand {
    font-size: 1rem;
  }
  .sidebar {
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }
  .sidebar > .section-heading:first-child {
    grid-column: 1/-1;
    margin-bottom: 0;
  }
  .sidebar > label {
    margin: 4px 0;
    grid-row: 2;
  }
  .sidebar > #pet-name,
  .sidebar > #pet-author {
    grid-row: 3;
  }
  .sidebar > .section-heading:not(:first-child) {
    grid-column: 1/-1;
    margin: 14px 0 0;
  }
  .animations {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1/-1;
    gap: 2px;
  }
  .animation-button {
    padding: 8px;
  }
  .animation-button .count {
    display: none;
  }
  .hint {
    display: none;
  }
  .settings {
    grid-column: 1/-1;
    margin: 8px 0;
    padding-top: 12px;
  }
  .sidebar > .wide {
    margin: 0;
  }
  .offline-status {
    margin: 0;
    align-self: center;
  }
  .editor {
    padding: 22px 16px;
  }
  .editor-header {
    margin-bottom: 15px;
  }
  h1 {
    font-size: 1.5rem;
  }
  .canvas-stage {
    height: 355px;
  }
  .canvas-options {
    gap: 12px;
  }
  .palette-row {
    gap: 12px;
  }
  .preview-panel {
    padding: 22px 16px;
    gap: 14px;
  }
  .export-note h3 {
    font-size: 1.05rem;
  }
  .export-note p {
    font-size: 0.8125rem;
  }
  .preview-stage canvas {
    width: 96px;
    height: 96px;
  }
  .preview-stage {
    height: 190px;
  }
  .preview-halo {
    width: 130px;
    height: 130px;
  }
  .tiny-flower {
    display: none;
  }
  footer {
    padding: 14px 16px;
  }
  .frame-actions button {
    font-size: 0.75rem;
    padding: 7px;
  }
  .timing {
    gap: 7px;
  }
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.import-step {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 24px;
}
.import-step h3,
#help-dialog h3 {
  font-size: 1rem;
  margin: 0 0 10px;
}
.sheet-advanced {
  margin: 16px 0;
}
.sheet-advanced summary {
  cursor: pointer;
  font-size: 0.875rem;
}
#help-dialog {
  width: min(620px, 90vw);
  max-height: 85dvh;
  overflow: auto;
}
#help-dialog section {
  margin-top: 24px;
}
#help-dialog ol {
  padding-left: 22px;
  font-size: 0.875rem;
  line-height: 1.7;
}
#help-dialog li {
  margin: 10px 0;
}
#sheet-import-summary {
  background: #edf2e6;
  padding: 12px;
  border-radius: 8px;
}
