  :root {
    --ink: #0f0f0f;
    --ink-2: #555;
    --ink-3: #999;
    --line: #e8e8e8;
    --line-2: #f0f0f0;
    --surface: #f7f7f5;
    --white123: #ffffff;
    --accent: #2563eb;
    --accent-light: #eff4ff;
    --accent-border: #bfcdfd;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --mono: 'DM Mono', monospace;
    --sans: 'DM Sans', sans-serif;
    --serif: 'Instrument Serif', serif;
  }

  .app {
    display: grid;
	gap: 16px;
    grid-template-columns: 330px 1fr;
  }

  .controls {
	display: flex;
	flex-direction: column;
  }
  .panel-section {
    border: 1px solid var(--bs-border-color);
	border-radius: 10px;
    padding: 15px;
	background:var(--white123);
	margin-bottom:15px;
  }
  .panel-section:last-child { margin-bottom:0; }

  .section-label {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 14px;
  }

  .prop-block { margin-bottom: 18px; }
  .prop-block:last-child { margin-bottom: 0; }

  .prop-block.inactive .prop-name,
  .prop-block.inactive .prop-desc,
  .prop-block.inactive .options-grid,
  .prop-block.inactive .num-row,
  .prop-block.inactive .gap-row {
    opacity: 0.45;
    pointer-events: none;
  }
  .inactive-notice {
    display: none;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 6px 10px;
    margin-top: 8px;
    line-height: 1.4;
    opacity: 1;
    pointer-events: auto;
  }
  .prop-block.inactive .inactive-notice { display: block; }

  .prop-name {
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 4px;
    font-weight: 500;
  }
  .prop-desc {
    font-size: 0.78rem;
    color: var(--ink-2);
    line-height: 1.45;
    margin-bottom: 10px;
  }

  .options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }
  .opt-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--white123);
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-2);
    min-width: 60px;
    text-align: center;
  }
  .opt-btn:hover {
    border-color: var(--accent-border);
    background: var(--accent-light);
    color: var(--accent);
  }
  .opt-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
  }
  .opt-btn svg {
    width: 28px;
    height: 20px;
    flex-shrink: 0;
  }

  .item-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .add-item-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    border: 1.5px solid var(--accent-border);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.12s;
  }
  .add-item-btn:hover { background: #dbeafe; }

  .addItem {font-size:0.7rem;padding:4px 10px;border:1.5px solid var(--accent-border);border-radius:5px;background:var(--accent-light);color:var(--accent);cursor:pointer;letter-spacing:0.04em;transition:all 0.12s;font-weight:500;}
  .removeItem {font-size:0.7rem;padding:4px 10px;border:1px solid var(--line);border-radius:5px;background:var(--white);color:var(--ink-2);cursor:pointer;letter-spacing:0.04em;transition:all 0.12s;}
  .item-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 14px;
  }
  .item-pill {
    font-family: var(--mono);
    font-size: 0.65rem;
    padding: 4px 9px;
    border-radius: 100px;
    border: 1.5px solid var(--line);
    background: var(--white123);
    cursor: pointer;
    transition: all 0.12s;
    color: var(--ink-2);
  }
  .item-pill.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--white123);
  }
  .item-pill:hover:not(.active) {
    border-color: var(--ink-2);
    color: var(--ink);
  }

  .num-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }
  .num-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--ink-2);
    width: 80px;
    flex-shrink: 0;
  }
  .num-input {
    width: 64px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink);
    border: 1.5px solid var(--line);
    border-radius: 6px;
    padding: 5px 8px;
    outline: none;
    transition: border-color 0.12s;
    background: var(--white123);
  }
  .num-input:focus { border-color: var(--accent); }

  .gap-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .gap-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-2);
  }
  input[type="range"] {
    -webkit-appearance: none;
    width: 65%;
    height: 3px;
    border-radius: 2px;
    background: var(--line);
    outline: none;
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
  }
  .gap-val {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--accent);
    min-width: 28px;
  }

  .right-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .preview-area {
	position: sticky;
    padding: 15px;
    display: flex;
	top: 80px;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
	border: 1px solid var(--bs-border-color);
	border-radius: 10px;
	background: var(--white123);
  }
  .preview-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }
  .preview-title {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
  }

  .flex-container {
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    background: #fafaf9;
    min-height: 260px;
    padding: 16px;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    overflow: hidden;
    box-sizing: border-box;
  }

  .inline-flex-wrapper {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .flex-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background: repeating-linear-gradient(
      0deg,
      transparent, transparent 23px,
      var(--line-2) 23px, var(--line-2) 24px
    ),
    repeating-linear-gradient(
      90deg,
      transparent, transparent 23px,
      var(--line-2) 23px, var(--line-2) 24px
    );
    pointer-events: none;
    opacity: 0.5;
  }

  .flex-item {
    background: var(--white123);
    border: 1.5px solid var(--line);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-2);
    width: 80px;
    min-height: 60px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    user-select: none;
    flex-shrink: 0;
  }
  .flex-item:hover {
    border-color: var(--accent-border);
    box-shadow: 0 2px 8px rgba(37,99,235,0.1);
  }
  .flex-item.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
    box-shadow: 0 0 0 3px var(--accent-border);
  }
  .flex-item .item-delete {
    position: absolute;
    top: 4px;
    right: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--ink-2);
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.12s;
    padding: 0;
    line-height: 1;
  }
  .flex-item:hover .item-delete,
  .flex-item.selected .item-delete {
    opacity: 1;
  }
  .flex-item .item-delete:hover {
    background: #fee2e2;
    color: #dc2626;
  }

  .code-area {
    margin-top:20px;
  }

  .explainer-area {
    border: 1px solid var(--line);
	border-radius: 10px;
    padding: 14px 40px;
    background: #fffdf5;
	margin-top: 20px;
  }
  .explainer-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b45309;
    margin-bottom: 6px;
  }
  .explainer-text {
    font-size: 0.82rem;
    color: var(--ink-2);
    line-height: 1.55;
  }
  .explainer-text strong { color: var(--ink); font-weight: 600; }


  .cheatsheet-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 40px;
    background: var(--accent-border);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    transition: background 0.12s;
  }
  .cheatsheet-toggle:hover { background: #98affc; }
  .cheatsheet-body {
    display: none;
    padding: 4px 40px 24px;
    border: 1px solid var(--line);
	background: var(--white123);
  }
  .cheatsheet-body.open { display: block; }
  .cheat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-top: 16px;
  }
  .cheat-section {}
  .cheat-heading {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--line);
  }
  .cheat-axis {
    font-weight: 400;
    color: var(--ink-2);
    font-size: 0.65rem;
  }
  .cheat-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.74rem;
  }
  .cheat-row code {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .cheat-row span {
    color: var(--ink-2);
    font-size: 0.72rem;
    line-height: 1.3;
  }


@media (max-width: 900px) {
	
    .app { grid-template-columns: 1fr; }
	.controls {max-height: 250px;overflow-y:auto;}
	
}