.osf-root {
  --osf-ink: #101828;
  --osf-muted: #5b6472;
  --osf-panel: #f6f8fb;
  --osf-line: rgba(16, 24, 40, 0.16);
  --osf-hot: #f43f5e;
  --osf-green: #22c55e;
  --osf-blue: #2563eb;
  --osf-amber: #f59e0b;
  --osf-black: #05070b;
  --osf-shadow: rgba(16, 24, 40, 0.2);

  position: relative;
  width: 100%;
  color: var(--osf-ink);
}

.osf-root *,
.osf-root *::before,
.osf-root *::after {
  box-sizing: border-box;
}

.osf-console {
  display: grid;
  gap: 1rem;
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--osf-line);
  border-radius: 0.5rem;
  background:
    linear-gradient(135deg, rgba(244, 63, 94, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(37, 99, 235, 0.08), transparent 36%),
    var(--osf-panel);
  box-shadow: 0 1.5rem 4rem -3rem var(--osf-shadow);
}

.osf-screen-shell {
  position: relative;
  min-height: 18rem;
  overflow: hidden;
  border: 1px solid rgba(5, 7, 11, 0.72);
  border-radius: 0.35rem;
  background: #000;
}

.osf-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 18rem;
}

.osf-dialog-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.35rem;
  width: fit-content;
  background: var(--osf-hot);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.osf-controls {
  display: grid;
  gap: 0.85rem;
}

.osf-controls label {
  display: grid;
  gap: 0.35rem;
}

.osf-field {
  display: grid;
  gap: 0.5rem;
}

.osf-controls span,
.osf-label {
  color: var(--osf-muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.osf-controls input {
  width: 100%;
  min-height: 2.45rem;
  border: 1px solid var(--osf-line);
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--osf-ink);
  font-weight: 800;
}

.osf-controls input[type='range'] {
  min-height: 1.8rem;
  accent-color: var(--osf-hot);
}

.osf-mode-grid,
.osf-duration-grid {
  display: grid;
  gap: 0.55rem;
}

.osf-mode-option,
.osf-duration-option {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  min-height: 4.8rem;
  border: 1px solid var(--osf-line);
  border-radius: 0.45rem;
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.62);
  color: var(--osf-ink);
  text-align: left;
  cursor: pointer;
}

.osf-mode-option {
  grid-template-columns: 3.2rem minmax(0, 1fr);
  align-items: center;
}

.osf-mode-option strong,
.osf-duration-option strong {
  color: var(--osf-ink);
  font-size: 0.86rem;
  font-weight: 950;
  line-height: 1.1;
}

.osf-mode-option small,
.osf-duration-option small {
  grid-column: 2;
  color: var(--osf-muted);
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.25;
}

.osf-duration-option small {
  grid-column: auto;
}

.osf-mode-option:hover,
.osf-duration-option:hover,
.osf-mode-option.is-selected,
.osf-duration-option.is-selected {
  border-color: rgba(244, 63, 94, 0.72);
  background: rgba(244, 63, 94, 0.08);
}

.osf-mode-option.is-selected,
.osf-duration-option.is-selected {
  box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.52);
}

.osf-mode-preview {
  grid-row: span 2;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(16, 24, 40, 0.2);
  border-radius: 0.35rem;
  overflow: hidden;
}

.osf-mode-preview-hybrid {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0 2px, rgba(5, 7, 11, 0.9) 2px 4px),
    linear-gradient(135deg, #f43f5e, #22c55e 42%, #2563eb);
  background-blend-mode: overlay, normal;
}

.osf-mode-preview-cycle {
  background: linear-gradient(90deg, #f00 0 33%, #0f0 33% 66%, #00f 66%);
}

.osf-mode-preview-noise {
  background:
    radial-gradient(circle at 20% 28%, #fff 0 2px, transparent 2px),
    radial-gradient(circle at 72% 18%, #fff 0 1px, transparent 1px),
    radial-gradient(circle at 42% 72%, #fff 0 2px, transparent 2px),
    repeating-linear-gradient(45deg, #05070b 0 3px, #f8fafc 3px 5px, #667085 5px 7px);
}

.osf-duration-grid {
  grid-template-columns: repeat(auto-fit, minmax(7.8rem, 1fr));
}

.osf-duration-option {
  min-height: 4.35rem;
  min-width: 0;
}

.osf-duration-option strong,
.osf-duration-option small {
  overflow-wrap: anywhere;
}

.osf-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.osf-actions button {
  min-height: 2.7rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  padding: 0.55rem 0.8rem;
  font-weight: 950;
  cursor: pointer;
}

.osf-actions button:first-child {
  background: var(--osf-hot);
  color: #fff;
}

.osf-actions button:first-child:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.osf-actions button:not(:first-child) {
  border-color: var(--osf-line);
  background: transparent;
  color: var(--osf-ink);
}

.osf-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 7, 11, 0.72);
  z-index: 4;
}

.osf-modal[hidden] {
  display: none;
}

.osf-dialog {
  display: grid;
  gap: 0.85rem;
  width: min(100%, 31rem);
  padding: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.34);
}

.osf-dialog h2 {
  margin: 0;
  color: #101828;
  font-size: clamp(1.25rem, 5vw, 2rem);
  line-height: 1.05;
}

.osf-dialog p,
.osf-dialog small {
  margin: 0;
  color: #475467;
  font-size: 0.92rem;
  line-height: 1.48;
}

.osf-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem;
  border: 1px solid rgba(244, 63, 94, 0.22);
  border-radius: 0.4rem;
  background: rgba(244, 63, 94, 0.06);
  color: #101828;
  font-weight: 850;
}

.osf-confirm input {
  margin-top: 0.15rem;
  accent-color: var(--osf-hot);
}

.osf-safety-continue {
  min-height: 2.85rem;
  border: 0;
  border-radius: 0.4rem;
  background: var(--osf-hot);
  color: #fff;
  font-weight: 950;
  cursor: pointer;
}

.osf-safety-continue:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.osf-root:fullscreen,
.osf-root.osf-windowed.osf-active {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
}

.osf-root:fullscreen .osf-console,
.osf-root.osf-windowed.osf-active .osf-console {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}

.osf-root:fullscreen .osf-screen-shell,
.osf-root.osf-windowed.osf-active .osf-screen-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.osf-root:fullscreen .osf-canvas,
.osf-root.osf-windowed.osf-active .osf-canvas {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

.osf-root:fullscreen .osf-controls,
.osf-root.osf-windowed.osf-active .osf-controls {
  display: none;
}

.theme-dark .osf-root {
  --osf-ink: #f6f8fb;
  --osf-muted: #a4adba;
  --osf-panel: #11151b;
  --osf-line: rgba(255, 255, 255, 0.15);
  --osf-shadow: rgba(0, 0, 0, 0.52);
}

.theme-dark .osf-controls input {
  background: rgba(255, 255, 255, 0.06);
  color: var(--osf-ink);
}

.theme-dark .osf-mode-option,
.theme-dark .osf-duration-option {
  background: rgba(255, 255, 255, 0.055);
}

.theme-dark .osf-mode-option:hover,
.theme-dark .osf-duration-option:hover,
.theme-dark .osf-mode-option.is-selected,
.theme-dark .osf-duration-option.is-selected {
  background: rgba(244, 63, 94, 0.14);
}

.theme-dark .osf-dialog {
  background: #11151b;
}

.theme-dark .osf-dialog h2,
.theme-dark .osf-confirm {
  color: #f6f8fb;
}

.theme-dark .osf-dialog p,
.theme-dark .osf-dialog small {
  color: #a4adba;
}

@media (min-width: 820px) {
  .osf-console {
    grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 0.65fr);
  }

  .osf-screen-shell,
  .osf-canvas {
    min-height: 28rem;
  }

  .osf-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .osf-console {
    padding: 0.75rem;
  }

  .osf-screen-shell,
  .osf-canvas {
    min-height: 15.5rem;
  }

  .osf-duration-grid {
    grid-template-columns: 1fr;
  }

}

body.is-widget .osf-console {
  width: 100%;
}
