:root {
  --bg: #f7f7f5;
  --ink: #1f1f1f;
  --muted: #555;
  --border: #DCE6EB;
  --ui-border: #DCE6EB;
  --button-red: #ff3c28;
  --font-ui: "Lato", "Segoe UI", sans-serif;
  --font-hand: "Patrick Hand", "Comic Sans MS", "Marker Felt", cursive;
  --panel-left-width: 300px;
  --panel-right-width: 300px;
  --panel-gap: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--ink);
  background: radial-gradient(circle at top right, #fcfcfa 0%, #f4f4f0 65%, #efefea 100%);
}

.workspace {
  position: relative;
  min-height: 100dvh;
  padding: 0;
}

.canvas-wrap {
  height: 100dvh;
  margin-left: 0;
  margin-right: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  background: #fdfdfb;
}

.header-field {
  display: grid;
  gap: 2px;
  font-size: 0.75rem;
  color: #555;
}

.project-sidebar input,
.project-sidebar select {
  border: 2px solid var(--ui-border);
  border-radius: 0;
  padding: 5px 7px;
  font: inherit;
  background: #fff;
}

.project-sidebar input,
.project-sidebar select {
  min-width: 0;
  width: 100%;
}

.project-dropdown-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
}

.project-dropdown-btn {
  width: 100%;
  border: 2px solid var(--ui-border);
  border-radius: 0;
  background: #fff;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.project-dropdown-caret {
  color: #666;
  font-size: 18px;
  line-height: 1;
}

.project-dropdown-btn:hover {
  background: #F4F7F9;
}

.project-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 0;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
  padding: 6px;
  z-index: 45;
  display: grid;
  gap: 4px;
}

.project-dropdown-menu[hidden] {
  display: none !important;
}

.project-dropdown-empty {
  padding: 8px;
  color: #666;
  font-size: 0.9rem;
}

.project-option-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--ui-border);
  border-radius: 0;
  padding: 3px;
}

.project-option-row.active {
  border-color: var(--ui-border);
  background: #f4f7fb;
}

.project-option-main {
  border: 0;
  background: transparent;
  text-align: left;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
  border-radius: 0;
}

.project-option-main:hover {
  background: #F4F7F9;
}

.project-option-rename-input {
  width: 100%;
  border: 2px solid var(--ui-border);
  border-radius: 0;
  background: #fff;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
}

.project-option-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.project-row-btn {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ui-border);
  border-radius: 0;
  background: #fff;
  font: 700 0.72rem/1 var(--font-ui);
  color: #2a2f34;
  cursor: pointer;
  padding: 0;
}

.project-row-btn:hover {
  background: #F4F7F9;
}

.project-row-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.project-row-btn.danger {
  color: #8d2d21;
}

.sidebar-new-project {
  width: 100%;
}

.sidebar-status {
  margin: 0;
}


.settings-btn,
.close-btn {
  border: 2px solid var(--ui-border);
  background: #fff;
  color: var(--ink);
  border-radius: 0;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-size-sm {
  min-height: 32px;
}

.btn-size-md {
  min-height: 40px;
}

.btn-size-lg {
  min-height: 56px;
}

.btn-with-icon {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.btn-with-icon > span[data-i18n] {
  text-align: center;
}

.btn-icon {
  font-family: "Material Symbols Outlined";
  font-size: 20px;
  line-height: 1;
}

.btn-icon-placeholder {
  visibility: hidden;
}

.settings-btn:hover,
.close-btn:hover {
  background: #F4F7F9;
}

.sidebar-new-project {
  min-height: 40px;
}

.panel {
  position: fixed;
  top: 16px;
  bottom: 16px;
  width: var(--panel-left-width);
  min-width: 220px;
  max-width: min(500px, 42vw);
  max-height: none;
  overflow: auto;
  background: #EAF0F3;
  border: none;
  border-radius: 0;
  padding: 14px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
  z-index: 20;
  overscroll-behavior: contain;
}

.panel-left {
  left: 14px;
}

.panel-right {
  right: 14px;
  width: var(--panel-right-width);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.panel-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  border: 0;
  background: transparent;
  cursor: col-resize;
  padding: 0;
  z-index: 2;
}

.panel-resize-handle:focus {
  outline: none;
}

.panel-resize-right {
  right: -6px;
}

.panel-resize-left {
  left: -6px;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.app-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(6, 37, 82, 0.12);
  background: rgba(6, 37, 82, 0.06);
  color: #062552;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.app-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  flex: 0 0 auto;
}

.storage-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d15f4a;
  box-shadow: 0 0 0 2px rgba(209, 95, 74, 0.2);
  flex: 0 0 auto;
}

.storage-indicator.connected {
  background: #2ea55f;
  box-shadow: 0 0 0 2px rgba(46, 165, 95, 0.2);
}

.storage-indicator.disconnected {
  background: #d15f4a;
  box-shadow: 0 0 0 2px rgba(209, 95, 74, 0.2);
}

.panel-subtitle {
  margin: 14px 0 10px;
  font-size: 1rem;
}

.project-sidebar {
  border: 0;
  padding: 10px 0 0;
  display: grid;
  gap: 8px;
}

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

.component-tile {
  border: 0;
  border-radius: 0;
  background: #f8fbfd;
  width: 100%;
  padding: 8px 7px 7px;
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
  cursor: pointer;
}

.component-tile:hover {
  background: #ffffff;
}

.component-tile span {
  font-size: 14px;
  line-height: 1.2;
  font-family: var(--font-ui);
}

.tile-preview {
  width: 100%;
  height: 46px;
  border: 2px solid #222;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 16px;
  background: transparent;
}

.tile-button {
  background: var(--button-red);
  color: #fff;
  font-weight: 900;
  font-family: var(--font-hand);
  border: 0;
  padding-inline: 10px;
}

.tile-button span {
  font-family: var(--font-hand);
}

.tile-button-label {
  text-align: center;
  width: 100%;
}

.tile-link {
  border: 0;
  justify-content: center;
  gap: 6px;
  color: #1d3c65;
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.tile-link-label {
  border-bottom: 2px solid currentColor;
  line-height: 1;
  padding-bottom: 1px;
}

.tile-link .tile-link-icon {
  font-family: "Material Symbols Outlined";
  font-size: 16px;
  line-height: 1;
}

.tile-image {
  position: relative;
  background: #fff;
  overflow: hidden;
  border: 2px solid #222;
  background-image:
    linear-gradient(to bottom right,
      transparent calc(50% - 1px),
      #222 calc(50% - 1px),
      #222 calc(50% + 1px),
      transparent calc(50% + 1px)
    ),
    linear-gradient(to top right,
      transparent calc(50% - 1px),
      #222 calc(50% - 1px),
      #222 calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

.tile-icon {
  border: 0;
  background: transparent;
  font-size: 16px;
}

.tile-text {
  justify-content: center;
  border: 0;
  background: transparent;
  height: 46px;
  padding: 0;
  color: #1f1f1f;
  font-size: 14px;
  line-height: 1.2;
}

.tile-heading,
.tile-body {
  font-family: var(--font-hand);
}

.tile-heading {
  font-size: 16px;
  font-weight: 700;
}

.tile-body {
  font-size: 14px;
  font-weight: 400;
}

.outline-group {
  margin-top: 14px;
  border-top: 0;
  padding-top: 4px;
}

.outline-group h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.outline-list {
  display: grid;
  gap: 2px;
}

.outline-item,
.outline-group-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  min-height: 30px;
  padding: 5px 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.outline-group-row {
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  justify-content: space-between;
}

.outline-group-toggle {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7a8793;
}

.outline-group-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-rename-input {
  width: 100%;
  min-height: 26px;
  border: 1px solid var(--ui-border);
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 3px 6px;
}

.outline-item.dragging,
.outline-group-item.dragging {
  opacity: 0.45;
}

.outline-item.drop-before,
.outline-group-item.drop-before {
  box-shadow: inset 0 2px 0 #111;
}

.outline-item.drop-after,
.outline-group-item.drop-after {
  box-shadow: inset 0 -2px 0 #111;
}

.outline-item.drop-into,
.outline-group-item.drop-into {
  background: #eef2f7;
}

.outline-placeholder {
  height: 10px;
  border-radius: 0;
  background: #111;
  opacity: 0.28;
  margin: 2px 0;
}

.outline-item {
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
}

.outline-item.selected,
.outline-group-item.selected {
  background: #dce6f0;
}

.outline-item:hover,
.outline-group-item:hover {
  background: #F4F7F9;
}

.outline-group-item {
  font-weight: 700;
}

.outline-item.child {
  margin-left: 16px;
  width: calc(100% - 16px);
}

.canvas {
  position: relative;
  height: 100%;
  min-height: 360px;
  background: #fdfdfb;
  overflow: auto;
  overscroll-behavior: contain;
}

.canvas-space {
  position: relative;
  width: 10000px;
  height: 8000px;
}

.canvas-stage {
  position: relative;
  width: 10000px;
  height: 8000px;
  transform-origin: top left;
}

.element {
  position: absolute;
  user-select: none;
  cursor: move;
}

.element.selected {
  outline: none;
}

.element-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink);
  padding: 8px;
  pointer-events: none;
  letter-spacing: 0.04em;
  line-height: 1.45;
  font-family: var(--font-hand);
  font-size: 1.18rem;
}

.element[data-type="button"] .element-content {
  color: #fff;
  font-weight: 900;
}

.element[data-type="text"] .element-content,
.element[data-type="bodyText"] .element-content,
.element[data-type="heading"] .element-content,
.element[data-type="link"] .element-content {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
}

.element[data-type="icon"] .element-content {
  padding: 0;
}

.link-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 2px solid currentColor;
  line-height: 1;
  padding-bottom: 1px;
}

.link-icon {
  font-family: var(--font-ui);
  font-size: 1.05em;
  line-height: 1;
  text-decoration: none;
  letter-spacing: normal;
  flex: 0 0 auto;
}

.element-content.image {
  align-items: stretch;
  justify-content: stretch;
}

.image-inner {
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(to bottom right,
      transparent calc(50% - 1px),
      var(--ink) calc(50% - 1px),
      var(--ink) calc(50% + 1px),
      transparent calc(50% + 1px)
    ),
    linear-gradient(to top right,
      transparent calc(50% - 1px),
      var(--ink) calc(50% - 1px),
      var(--ink) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

.sketch-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stroke-main {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fill-hatch {
  fill: none;
  stroke: rgba(0, 0, 0, 0.08);
  stroke-width: 0.9;
}

.selection-outline,
.marquee-box {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.connections-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.connection-line {
  fill: none;
  stroke: #1f1f1f;
  stroke-width: 1.6;
  color: #1f1f1f;
}

.connection-line.draft {
  stroke-dasharray: 5 4;
}

.marquee-box {
  border: 1.5px dashed #222;
  background: rgba(0, 0, 0, 0.06);
}

.group-hover-outline {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  border: 2px dashed #ff3c28;
  background: rgba(255, 60, 40, 0.05);
}

.inline-editor {
  position: absolute;
  z-index: 40;
  border: 2px solid #111;
  border-radius: 0;
  background: #fff;
  color: #1f1f1f;
  font-family: var(--font-hand);
  padding: 6px 8px;
  outline: none;
  resize: none;
}

.inline-editor.button-editor {
  text-align: center;
  font-weight: 900;
  color: #fff;
}

.resize-handle {
  display: none !important;
}

.connector-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #1f1f1f;
  background: #fff;
  padding: 0;
  z-index: 7;
  cursor: crosshair;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.connection-end-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #1f1f1f;
  background: #fff;
  padding: 0;
  z-index: 8;
  cursor: crosshair;
}

.prop-group {
  border-top: 0;
  padding-top: 12px;
  margin-top: 12px;
  display: grid;
  gap: 16px;
}

.prop-group h3 {
  margin: 0;
  position: sticky;
  top: -2px;
  background: #EAF0F3;
  padding: 2px 0;
  z-index: 1;
}

.prop-group label {
  display: grid;
  gap: 4px;
  font-size: 1rem;
}

.prop-group input[type="text"],
.prop-group input[type="number"],
.prop-group input[type="color"],
.prop-group select {
  width: 100%;
  border: 2px solid var(--ui-border);
  border-radius: 0;
  padding: 5px 7px;
  font: inherit;
}

.prop-group input[type="color"] {
  height: 42px;
  padding: 4px;
  background: #fff;
}

.swatch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-btn {
  border: 2px solid var(--ui-border);
  border-radius: 0;
  background: #fff;
  padding: 4px 8px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.mini-btn:hover {
  background: #F4F7F9;
}

.zoom-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 6px;
}

.zoom-row .mini-btn {
  min-width: 32px;
  min-height: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

.zoom-row input[type="range"] {
  width: 100%;
}

.zoom-value-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-value-chip {
  min-width: 56px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ui-border);
  background: #fff;
  font: 700 0.85rem/1 var(--font-ui);
}

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

.swatch-chip {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  cursor: pointer;
  background: #fff;
  justify-self: center;
}

.swatch-chip.active {
  outline: 2px solid #111;
  outline-offset: 1px;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-btn.active {
  background: #EAF0F3;
  border-color: #9fb0bb;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  color: var(--muted);
  margin-top: 14px;
  margin-bottom: 12px;
  border: 0;
  background: transparent;
  padding: 2px 0 0;
}

.empty-state-title {
  margin: 0 0 6px;
  font: 700 0.98rem/1.25 var(--font-ui);
  color: #1f1f1f;
}

.empty-state-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font: 400 0.9rem/1.35 var(--font-ui);
}

.empty-state-list li {
  margin: 0;
}

.settings-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 320px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 0;
  padding: 14px;
  z-index: 30;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
  max-height: min(76vh, 620px);
  overflow: auto;
}

.context-menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 0;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
  padding: 6px;
  display: grid;
  gap: 4px;
}

.context-menu button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--ui-border);
  border-radius: 0;
  background: #fff;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}

.context-menu button:hover {
  background: #F4F7F9;
}

.share-feedback {
  position: fixed;
  z-index: 70;
  background: #fff;
  border: 1px solid var(--ui-border);
  padding: 6px 10px;
  font: 700 0.82rem/1.2 var(--font-ui);
  color: #1f1f1f;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  pointer-events: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 80;
  background: #1f1f1f;
  color: #fff;
  border: 1px solid #1f1f1f;
  padding: 8px 12px;
  font: 700 0.84rem/1.2 var(--font-ui);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.settings-group {
  margin-top: 10px;
}

.help-content ul {
  margin: 6px 0 10px 18px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.help-content li {
  line-height: 1.35;
}

.help-panel {
  width: 360px;
}

.panel-icon-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.shortcut-hints {
  margin: 0 0 10px;
}

.text-size-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
}

.text-size-row .mini-btn {
  min-width: 32px;
  min-height: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.text-size-row select {
  width: 100%;
  min-height: 32px;
  height: 32px;
  border: 1px solid var(--ui-border);
  background: #fff;
  padding: 0 7px;
  font: inherit;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.icon-option {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--ui-border);
  background: #fff;
  cursor: pointer;
  padding: 0;
}

.icon-option .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.icon-option:hover {
  background: #F4F7F9;
}

.icon-option.active {
  background: #EAF0F3;
  border-color: #9fb0bb;
}

.canvas-icon-glyph {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ui-border);
  border-radius: 0;
  background: #fff;
  font: 700 1rem/1 var(--font-ui);
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover {
  background: #F4F7F9;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #111;
  outline-offset: 1px;
}

.icon-btn .material-symbols-outlined,
.project-row-btn .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

.button-variant-toggle {
  display: flex;
  gap: 10px;
}

.variant-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.variant-option input {
  margin: 0;
}

@media (max-width: 1024px) {
  .panel {
    position: absolute;
    bottom: 16px;
    max-height: none;
    top: 16px;
  }

  .panel-left {
    left: 22px;
  }

  .panel-right {
    right: 22px;
  }

  .settings-panel {
    width: min(86vw, 320px);
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 0;
  }

  .canvas-wrap {
    height: 100dvh;
    margin-left: 0;
    margin-right: 0;
  }

  .panel {
    position: static;
    bottom: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: 260px;
    margin-bottom: 8px;
  }

  .panel-resize-handle {
    display: none;
  }

  .panel-right {
    margin-top: 8px;
    margin-bottom: 0;
  }

  .settings-panel {
    left: 8px;
    right: 8px;
    width: auto;
    top: 84px;
  }

  .canvas {
    min-height: 300px;
  }

  .project-sidebar input,
  .project-sidebar select,
  .project-dropdown-wrap {
    min-width: 100%;
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1A1A;
    --ink: #e7edf2;
    --muted: #aeb9c3;
    --border: #DCE6EB;
    --ui-border: #3a4650;
  }

  body {
    color: var(--ink);
    background: radial-gradient(circle at top right, #252525 0%, #1A1A1A 65%, #1A1A1A 100%);
  }

  .canvas-wrap,
  .canvas {
    background: #1A1A1A;
  }

  .panel {
    background: #252525;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
  }

  .panel-title,
  .panel-subtitle,
  .outline-group h3,
  .prop-group h3,
  .hint,
  .empty-state,
  .header-field,
  .project-option-main,
  .context-menu button {
    color: var(--ink);
  }

  .project-sidebar {
    border-color: #33414d;
  }

  .project-dropdown-btn,
  .project-option-rename-input,
  .project-row-btn,
  .icon-btn,
  .close-btn,
  .settings-btn,
  .text-size-row select,
  .prop-group input[type="text"],
  .prop-group input[type="number"],
  .prop-group input[type="color"],
  .project-sidebar input,
  .project-sidebar select {
    background: #1A1A1A;
    color: var(--ink);
    border-color: var(--ui-border);
  }

  .icon-option {
    background: #1A1A1A;
    color: var(--ink);
    border-color: var(--ui-border);
  }

  .outline-rename-input {
    background: #1A1A1A;
    color: var(--ink);
    border-color: var(--ui-border);
  }

  .icon-option:hover {
    background: #263440;
  }

  .prop-group h3 {
    background: #252525;
  }

  .project-dropdown-menu,
  .context-menu,
  .settings-panel {
    background: #252525;
    border-color: var(--ui-border);
  }

  .settings-panel {
    background: #fff;
    color: #1f1f1f;
    border-color: #d7dde2;
  }

  .settings-panel h2,
  .settings-panel h3,
  .settings-panel label,
  .settings-panel .hint,
  .settings-panel li {
    color: #1f1f1f;
  }

  .project-option-row {
    border-color: var(--ui-border);
    background: #252525;
  }

  .project-option-row.active {
    background: #1A1A1A;
    border-color: #5b7184;
  }

  .project-option-main:hover,
  .project-row-btn:hover,
  .icon-btn:hover,
  .context-menu button:hover,
  .component-tile:hover {
    background: #263440;
  }

  .component-tile,
  .outline-item,
  .outline-group-item {
    background: #252525;
    border-color: #41505c;
    color: var(--ink);
  }

  .outline-item.selected,
  .outline-group-item.selected {
    background: #1A1A1A;
    border-color: #6c8397;
  }

  .tile-preview {
    border-color: var(--ink);
    color: var(--ink);
  }

  .tile-image {
    border-color: var(--ink);
    background-image:
      linear-gradient(to bottom right,
        transparent calc(50% - 1px),
        var(--ink) calc(50% - 1px),
        var(--ink) calc(50% + 1px),
        transparent calc(50% + 1px)
      ),
      linear-gradient(to top right,
        transparent calc(50% - 1px),
        var(--ink) calc(50% - 1px),
        var(--ink) calc(50% + 1px),
        transparent calc(50% + 1px)
      );
  }

  .marquee-box {
    border-color: #d7e1ea;
    background: rgba(210, 223, 234, 0.14);
  }

  .connection-line {
    stroke: #d7e1ea;
    color: #d7e1ea;
  }

  .connector-handle {
    border-color: #d7e1ea;
    background: #252525;
    box-shadow: 0 0 0 2px rgba(37, 37, 37, 0.65);
  }

  .connection-end-handle {
    border-color: #d7e1ea;
    background: #252525;
  }

  .share-feedback {
    background: #252525;
    color: #e7edf2;
    border-color: #3a4650;
  }

  .toast {
    background: #e7edf2;
    color: #1A1A1A;
    border-color: #e7edf2;
  }

  .platform-badge {
    border-color: rgba(231, 237, 242, 0.16);
    background: rgba(231, 237, 242, 0.08);
    color: #e7edf2;
  }

  .storage-indicator.connected {
    background: #5fd48e;
    box-shadow: 0 0 0 2px rgba(95, 212, 142, 0.25);
  }

  .storage-indicator.disconnected {
    background: #f28672;
    box-shadow: 0 0 0 2px rgba(242, 134, 114, 0.25);
  }
}
