textarea:focus,
textarea:focus-visible {
  outline: none;
}
.preview {
  position: relative;
  border-top: 1px solid #dfe0e5;
  background-color: #fff;
  container-type: inline-size;
  overflow: hidden;
  min-height: 320px;
}
.preview--result {
  font-family: var(--font-ioskeley-mono);
  border: none;
  font-size: 16px;
  line-height: 1.25em;
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
  overflow: hidden;
  opacity: 0;
  position: relative;
  z-index: 1;
  transition: opacity 0.32s ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.preview--result.is-ready {
  opacity: 1;
}

.preview--result::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.preview--loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f7f7;
  color: #a3a3a3;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.preview--loading.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.preview--loading-ascii {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--font-ioskeley-mono);
}

.preview--loading-frames {
  position: relative;
  width: 10ch;
  height: 1.5em;
  color: #737373;
  font-size: 0.875rem;
  line-height: 1.5;
}

.preview--loading-frames > span {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: preview-ascii-frame 1.12s steps(1, end) infinite;
}

.preview--loading-frames > span:nth-child(2) { animation-delay: -0.98s; }
.preview--loading-frames > span:nth-child(3) { animation-delay: -0.84s; }
.preview--loading-frames > span:nth-child(4) { animation-delay: -0.7s; }
.preview--loading-frames > span:nth-child(5) { animation-delay: -0.56s; }
.preview--loading-frames > span:nth-child(6) { animation-delay: -0.42s; }
.preview--loading-frames > span:nth-child(7) { animation-delay: -0.28s; }
.preview--loading-frames > span:nth-child(8) { animation-delay: -0.14s; }

.preview--loading-label {
  color: #a3a3a3;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes preview-ascii-frame {
  0%, 12.49% { opacity: 1; }
  12.5%, 100% { opacity: 0; }
}

.codesandbox-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
}

.filetree {
  display: flex;
  flex-direction: column;
  width: 210px;
  min-width: 210px;
  border-right: 1px solid #e5e7eb;
  background-color: #fafafa;
  flex-shrink: 0;
}

.filetree-root {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
}

.react-icon {
  flex-shrink: 0;
  color: #6b7280;
}

.root-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.root-action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s ease;
  border-radius: 3px;
}

.root-action-button:hover {
  background-color: #f3f4f6;
  color: #6b7280;
}

.root-action-input {
  width: 100px;
  outline: none;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  padding: 2px 6px;
  margin: 0;
  background-color: #fff;
  font-size: 12px;
  color: #374151;
}

.root-action-input:focus {
  border-color: #6b7280;
}

.filetree-files {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 6px 0;
}

.filetree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  cursor: pointer;
  color: #374151;
  font-size: 13px;
  transition: background-color 0.15s ease, opacity 0.2s ease-out, transform 0.2s ease-out;
  border: none;
  background: #fafafa;
  text-align: left;
  width: 100%;
}

.filetree-item:hover {
  background-color: #f3f4f6;
}

.filetree-item.active {
  color: #171717;
  background-color: #e7e7e7;
}

.filetree-item.active:hover {
  background-color: #e7e7e7;
}

.file-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: #6b7280;
  background-color: inherit;
  transition: background-color 0.15s ease;
}

.filetree-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.filetree-item--folder {
  font-weight: 600;
  color: #262626;
}

.filetree-children {
  position: relative;
}

.filetree-children::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 17px;
  border-left: 1px solid #dedede;
  pointer-events: none;
}

.filetree-item--nested {
  padding-left: 26px;
}

.filetree-item--editing {
  background-color: #f9fafb;
}

.filetree-item--deleting {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  pointer-events: none;
}

.filetree-item-input {
  flex: 1;
  outline: none;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  padding: 2px 0;
  margin: 0;
  background-color: transparent;
  font-size: 13px;
  font-weight: 400;
  line-height: normal;
  color: #374151;
  font-family: inherit;
  caret-color: #9ca3af;
  letter-spacing: normal;
  vertical-align: baseline;
}

.filetree-item-input:focus {
  border-color: #d1d5db;
  outline: none;
}

.editor {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.editor[data-active-extension="css"] .sh__token--identifier {
  color: var(--sh-property) !important;
}

.editor[data-active-extension="css"] .sh__token--class {
  color: var(--sh-string) !important;
}

.editor[data-active-extension="css"] .sh__token--sign {
  color: var(--sh-sign) !important;
}

.editor [data-codice-code-line-number] {
  opacity: 0.4;
  color: #9ca3af;
}


[data-codesandbox] {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 36px 4px rgb(200 200 200 / 50%);
  background-color: #fff;
  display: flex;
  flex-direction: column;
  height: 660px;
  min-height: 620px;
}

[data-codesandbox="react"] {
  width: 100%;
  height: auto;
  min-height: 0;
  gap: 1.25rem;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  background: transparent;
}

[data-codesandbox="react"] .preview {
  width: 100%;
  min-height: 340px;
  border-top: 0;
  background: #f5f5f4;
}

[data-codesandbox="react"] .preview--result {
  height: 100%;
  min-height: 100%;
}

[data-codesandbox="react"] .codesandbox-layout {
  width: min(840px, calc(100% - 1rem));
  height: 320px;
  margin: 0 auto;
  flex: none;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 36px 4px rgb(200 200 200 / 45%);
}

@media (prefers-reduced-motion: reduce) {
  .preview--loading,
  .preview--result {
    transition: none;
  }

  .preview--loading-frames > span {
    animation: none;
  }

  .preview--loading-frames > span:first-child {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  [data-codesandbox="react"]:not([data-focused]) .codesandbox-layout {
    width: 100%;
  }
}
