.encoder-layout {
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
}

/* checkbox toggle */
.toggle-option {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
}

.toggle-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}

.toggle-option input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.toggle-option input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #fff;
  line-height: 1;
}

.toggle-option input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.toggle-text {
  user-select: none;
}

/* panels */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  min-height: 300px;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.panel:first-child {
  border-right: 1px solid var(--border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.panel-label {
  font-family: 'Sora', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel textarea {
  flex: 1;
  padding: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  overflow-y: auto;
  word-break: break-all;
}

.panel textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.4;
}

.panel textarea[readonly] {
  cursor: default;
}

/* scrollbar styling */
.panel textarea::-webkit-scrollbar {
  width: 6px;
}

.panel textarea::-webkit-scrollbar-track {
  background: transparent;
}

.panel textarea::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.panel textarea::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* responsive */
@media (max-width: 560px) {
  .panels {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel {
    min-height: 180px;
  }

  .panel:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .panel textarea {
    font-size: 0.72rem;
  }
}

/* Prevent iOS auto-zoom on focus */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}
