@layer base {
  body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background-color: #FCFAF6;
    color: #1E293B;
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #F6F3EB;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

#fsq-bar {
  width: 52%;
}

#suds-indicator {
  left: 30%;
}

#calm-mode[data-active="false"] {
  background-color: #fff1f2;
  border-color: #fecdd3;
  color: #b91c1c;
}

#calm-mode[data-active="false"] > span:first-child {
  background-color: #dc2626;
  animation: none;
}

.arachnoteur-app {
  --ink: #1E293B;
  --paper: #FCFAF6;
  --panel: #FFFFFF;
  --line: #EAE5D9;
  --acc: #2F6B5F;
  --acc-dark: #115347;
  --acc-soft: #EAF5F1;
  --muted: #475569;
  box-sizing: border-box;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 14px/1.45 'Plus Jakarta Sans', system-ui, sans-serif;
}

.arachnoteur-app *,
.arachnoteur-app *::before,
.arachnoteur-app *::after {
  box-sizing: border-box;
}

.arachnoteur-app h1,
.arachnoteur-app h2,
.arachnoteur-app .card b,
.arachnoteur-app .sheet h3 {
  font-family: 'Fraunces', Georgia, serif;
}

.arachnoteur-app > header {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.arachnoteur-app > header h1 {
  margin: 0;
  font-size: 21px;
}

.arachnoteur-app > header .sub {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.arachnoteur-app #modelName {
  width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.arachnoteur-app .spacer {
  flex: 1;
}

.arachnoteur-app button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.arachnoteur-app button:hover {
  border-color: var(--acc);
  color: var(--acc-dark);
}

.arachnoteur-app button.primary,
.arachnoteur-app .card.on {
  border-color: var(--acc);
  background: var(--acc);
  color: #fff;
}

.arachnoteur-app button.primary:hover,
.arachnoteur-app .card.on:hover {
  background: var(--acc-dark);
  color: #fff;
}

.arachnoteur-app button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.arachnoteur-app > main {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.arachnoteur-app #stage {
  position: relative;
  flex: 1;
  min-width: 0;
  touch-action: none;
}

.arachnoteur-app #view {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.arachnoteur-app #stage.checker #view {
  background: repeating-conic-gradient(#EAE5D9 0 25%, #FCFAF6 0 50%) 0 0 / 22px 22px;
}

.arachnoteur-app #stageInfo {
  position: absolute;
  bottom: 10px;
  left: 12px;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.arachnoteur-app #panel {
  width: 360px;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 14px 60px;
  border-left: 1px solid var(--line);
  background: #F6F3EB;
}

.arachnoteur-app section h2 {
  margin: 18px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--acc-dark);
  font-size: 12px;
  text-transform: uppercase;
}

.arachnoteur-app section:first-child h2 {
  margin-top: 0;
}

.arachnoteur-app .row,
.arachnoteur-app .colorrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.arachnoteur-app .colorrow {
  flex-wrap: wrap;
}

.arachnoteur-app .colorrow label.toggle {
  flex: 0 1 auto;
}

.arachnoteur-app .row label,
.arachnoteur-app .colorrow label {
  flex: 0 0 118px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.arachnoteur-app .row input[type='range'] {
  flex: 1;
  min-width: 0;
  width: 0;
  accent-color: var(--acc);
}

.arachnoteur-app .row input[type='number'],
.arachnoteur-app .seedbox input {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.arachnoteur-app .row input[type='number'] {
  width: 58px;
  flex-shrink: 0;
}

.arachnoteur-app .cards,
.arachnoteur-app .swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}

.arachnoteur-app .card {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.arachnoteur-app .sw {
  display: flex;
  width: 34px;
  height: 22px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 6px;
  cursor: pointer;
}

.arachnoteur-app .sw i {
  flex: 1;
}

.arachnoteur-app .sw:first-child i {
  border-radius: 5px 0 0 5px;
}

.arachnoteur-app .sw:last-child i {
  border-radius: 0 5px 5px 0;
}

.arachnoteur-app .colorrow input[type='color'] {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.arachnoteur-app .seedbox {
  display: flex;
  align-items: center;
  gap: 6px;
}

.arachnoteur-app .seedbox input {
  flex: 1;
  min-width: 0;
  width: 0;
}

.arachnoteur-app details {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.arachnoteur-app summary {
  padding: 7px 10px;
  color: var(--acc-dark);
  font-size: 12px;
  cursor: pointer;
}

.arachnoteur-app details .inner {
  padding: 2px 10px 8px;
}

.arachnoteur-app .toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.arachnoteur-app .modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 41, 59, .58);
}

.arachnoteur-app .modal.open {
  display: flex;
}

.arachnoteur-app .sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.arachnoteur-app .sheet h3 {
  margin-bottom: 12px;
}

.arachnoteur-app .gal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.arachnoteur-app .gal .g {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.arachnoteur-app .gal img {
  display: block;
  width: 100%;
}

.arachnoteur-app .gal .g p {
  overflow: hidden;
  padding: 4px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arachnoteur-app .gal .g button {
  margin: 0 2px 6px;
  padding: 4px 7px;
  font-size: 11px;
}

.arachnoteur-app #toast {
  position: fixed;
  z-index: 30;
  bottom: 18px;
  left: 50%;
  padding: 8px 16px;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: var(--acc-dark);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.arachnoteur-app .fld {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 13px;
}

.arachnoteur-app .fld .opt {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 12px;
}

.arachnoteur-app .sheet canvas {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-conic-gradient(#EAE5D9 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.arachnoteur-app .testline {
  padding: 3px 0;
  font-size: 12px;
}

.arachnoteur-app .testline.ok::before {
  color: var(--acc);
  content: '✓ ';
}

.arachnoteur-app .testline.ko::before {
  color: #EA580C;
  content: '✗ ';
}

#simulator-frame {
  height: min(900px, 82vh);
  min-height: 640px;
}

@media (max-width: 900px) {
  .arachnoteur-app > main {
    flex-direction: column;
  }

  .arachnoteur-app #stage {
    height: min(32vh, 16rem);
    min-height: 160px;
    flex: none;
  }

  .arachnoteur-app #panel {
    width: 100%;
    min-height: 0;
    flex: 1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .arachnoteur-app > header {
    gap: 8px;
  }

  .arachnoteur-app #modelName {
    width: 120px;
  }

  #simulator-frame {
    height: 82vh;
  }
}