html,
body {
  background: #fffaf3;
}

body {
  color: var(--studio-ink);
  font-family: var(--studio-font);
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(115, 87, 246, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(27, 168, 219, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #fff7fc 0%, #f7fcff 58%, #fff9eb 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(32, 23, 45, 0.12);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--studio-ink);
  font-size: 1rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--studio-ink);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--studio-sun), var(--studio-pink));
  box-shadow: var(--studio-shadow-sm);
}

.command-bar {
  width: fit-content;
  max-width: 100%;
  display: flex;
  gap: 7px;
  padding: 4px;
  border: 1px solid rgba(32, 23, 45, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--studio-shadow-sm);
  overflow-x: auto;
}

.command,
.mini-button,
.tool-button,
.action-grid button,
.wide-button,
.emoji-grid button,
.drawing-menu,
.select-row select,
.pdf-controls select,
.color-picks input,
.rgb-row label {
  border: 1px solid rgba(32, 23, 45, 0.12);
  border-radius: 8px;
  background: #ffffff;
}

.command {
  min-height: 40px;
  box-shadow: none;
}

.command-strong {
  border-color: rgba(115, 87, 246, 0.48);
  background: #f3efff;
  color: #533db2;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "canvas"
    "tools"
    "props";
  background: transparent;
}

.canvas-area {
  min-height: 0;
  background:
    linear-gradient(90deg, rgba(32, 23, 45, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(32, 23, 45, 0.045) 1px, transparent 1px),
    rgba(255, 255, 255, 0.52);
  background-size: 28px 28px;
}

.canvas-toolbar {
  min-height: 58px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(32, 23, 45, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.zoom-group,
.canvas-size {
  min-height: 42px;
  padding: 4px;
  border: 1px solid rgba(32, 23, 45, 0.1);
  border-radius: 8px;
  background: #ffffff;
}

.stage-wrap {
  padding: 30px;
  background:
    linear-gradient(90deg, rgba(245, 95, 159, 0.065) 1px, transparent 1px),
    linear-gradient(0deg, rgba(115, 87, 246, 0.055) 1px, transparent 1px);
  background-size: 24px 24px;
}

.stage {
  border: 1px solid rgba(32, 23, 45, 0.14);
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 18px 54px rgba(32, 23, 45, 0.13);
}

.stage::before,
.stage::after {
  z-index: 5;
  border: 1px solid rgba(32, 23, 45, 0.12);
  background: rgba(255, 211, 90, 0.74);
}

.statusbar {
  min-height: 36px;
  border-top: 1px solid rgba(32, 23, 45, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.toolbox {
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(32, 23, 45, 0.1);
  background: rgba(255, 247, 252, 0.92);
}

.tool-button {
  width: 44px;
  height: 44px;
  color: var(--studio-ink);
  box-shadow: var(--studio-shadow-sm);
}

.tool-button.is-active {
  border-color: var(--studio-pink);
  background: #fff0f7;
  color: #7a2854;
  transform: none;
  box-shadow: inset 0 0 0 1px rgba(245, 95, 159, 0.18), var(--studio-shadow-sm);
}

.drawing-menu {
  min-height: 44px;
  box-shadow: var(--studio-shadow-sm);
}

.properties {
  display: grid;
  grid-auto-flow: initial;
  grid-auto-columns: initial;
  grid-template-columns: 1.05fr 1.05fr 1fr 1fr 1fr 0.9fr;
  gap: 12px;
  max-height: none;
  overflow: auto hidden;
  padding: 12px;
  border-top: 1px solid rgba(32, 23, 45, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(32, 23, 45, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--studio-shadow-sm);
}

.panel h2 {
  margin-bottom: 11px;
  color: var(--studio-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel h2::before {
  width: 8px;
  height: 8px;
}

.swatches {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.swatch {
  min-height: 28px;
  border: 1px solid rgba(32, 23, 45, 0.12);
  border-radius: 8px;
}

.range-row {
  grid-template-columns: 72px minmax(0, 1fr) 42px;
  min-height: 40px;
  color: var(--studio-ink-2);
}

.range-row input,
#zoomRange {
  accent-color: var(--studio-violet);
}

.emoji-grid {
  grid-template-columns: repeat(4, minmax(34px, 1fr));
  gap: 8px;
}

.emoji-grid button {
  width: auto;
  min-width: 0;
  height: 40px;
}

.action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.action-grid button,
.wide-button {
  min-height: 40px;
}

@media (max-width: 1280px) {
  .properties {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 342px;
  }
}

@media (min-width: 1000px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 620px;
    overflow: hidden;
  }

  .workspace {
    min-height: 0;
    grid-template-columns: 76px minmax(0, 1fr) 360px;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "tools canvas props";
  }

  .toolbox {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 0;
    border-right: 1px solid rgba(32, 23, 45, 0.1);
  }

  .tool-separator {
    width: 36px;
    height: 1px;
    margin: 4px 0;
  }

  .drawing-menu {
    width: 52px;
    min-width: 0;
    flex: 0 0 auto;
    padding: 0;
    justify-content: center;
  }

  .drawing-menu svg {
    margin: 0;
  }

  .drawing-menu select {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
  }

  .canvas-area {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .stage-wrap {
    min-height: 0;
    overflow: auto;
    padding: 28px;
  }

  .stage {
    transform-origin: top left;
  }

  .properties {
    grid-template-columns: 1fr;
    align-content: start;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 0;
    border-left: 1px solid rgba(32, 23, 45, 0.1);
  }

  .panel {
    min-width: 0;
  }

  .emoji-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .command-bar {
    width: 100%;
  }

  .workspace {
    min-height: 780px;
    grid-template-rows: minmax(520px, 1fr) auto auto;
  }

  .canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .zoom-group,
  .canvas-size {
    width: 100%;
  }

  .properties {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .stage-wrap {
    padding: 18px;
  }

  .toolbox {
    justify-content: flex-start;
  }

  .emoji-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
