* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: #0f172a;
  background: #f8fafc;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.app__header {
  margin-bottom: 16px;
}
.app__header h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
}
.app__subtitle {
  margin: 0;
  color: #64748b;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}
.app__footer {
  margin-top: 24px;
  color: #475569;
  font-size: 13px;
}

/* Main content layout with sidebar */
.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}

.main-content {
  min-width: 0; /* Prevents grid overflow */
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hide sidebar on smaller screens */
@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }
}

.panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.panel__title {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.controls__row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.controls__row--ops {
  gap: 20px;
}
.controls__row--actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  color: #334155;
}
.field input {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.field input:hover {
  border-color: #10b981;
}

.field input[type="number"] {
  width: 140px;
}
.field--range {
  min-width: 260px;
  flex: 1;
}

.field--range input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none;
  opacity: 0.8;
  transition: opacity 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.field--range input[type="range"]:hover {
  opacity: 1;
}

.field--range input[type="range"]:focus {
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Webkit browsers (Chrome, Safari, Edge) */
.field--range input[type="range"]::-webkit-slider-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #d1fae5;
  border-radius: 3px;
  border: none;
}

.field--range input[type="range"]::-webkit-slider-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #10b981;
  cursor: pointer;
  -webkit-appearance: none;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.field--range input[type="range"]::-webkit-slider-thumb:hover {
  background: #059669;
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Firefox */
.field--range input[type="range"]::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #d1fae5;
  border-radius: 3px;
  border: none;
}

.field--range input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #10b981;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.field--range input[type="range"]::-moz-range-thumb:hover {
  background: #059669;
  transform: scale(1.1);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input {
  width: 18px;
  height: 18px;
  appearance: none;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox input:checked {
  background: #10b981;
  border-color: #10b981;
}

.checkbox input:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.checkbox input:hover {
  border-color: #10b981;
}

.checkbox input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover {
  background: #f1f5f9;
}
.btn--primary {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}
.btn--primary:hover {
  background: #059669;
}

.preview-description {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  font-size: 14px;
  color: #15803d;
  font-weight: 500;
}

.preview {
  position: relative;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px;
}
.preview__header {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.header-field {
  white-space: nowrap;
}

.loading {
  position: absolute;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: #334155;
  background: rgba(248, 250, 252, 0.6);
  border-radius: 12px;
}
.loading.show {
  display: flex;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Blur content while loading */
.preview.loading-active .problems {
  filter: blur(3px);
  opacity: 0.5;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.problems {
  margin: 0;
  padding-left: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 32px;
  row-gap: 16px;
}
.problems li {
  break-inside: avoid;
  font-size: 16px;
  line-height: 1.6;
  list-style-position: inside;
  padding: 0 8px;
}
.vprob {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  white-space: pre;
  line-height: 1.7;
  font-size: 24px;
  margin: 0;
}
.vprob__line {
  display: block;
}

/* Smaller numbering for list items */
.problems li::marker {
  font-size: 12px;
}

@media (max-width: 720px) {
  .problems {
    grid-template-columns: 1fr;
  }
}

/* Ad Container Styling */
.ad-container {
  margin: 16px 0;
  text-align: center;
  display: block;
  position: relative;
}

/* AdSense container */
.ad-container ins.adsbygoogle {
  width: 100%;
}

.ad-container--top {
  margin-top: 0;
  margin-bottom: 24px;
}

.ad-container--bottom {
  margin-top: 24px;
  margin-bottom: 0;
}

.ad-container--sidebar {
  margin: 0;
  min-height: 250px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ad-container ins {
  width: 100%;
}

/* Hide placeholder when ads are loaded */
.ad-container ins:not(:empty) ~ .ad-container::before,
.ad-container:has(ins:not(:empty))::before {
  display: none;
}

@media (max-width: 720px) {
  .ad-container {
    margin: 12px 0;
    min-height: 80px;
  }
}
