/* fractint.css — dark theme layout for Fractint WASM */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: #0d0d0d;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
}

/* ------------------------------------------------------------------ */
/* Canvas area                                                         */
/* ------------------------------------------------------------------ */

#canvas-container {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: #000;
  overflow: hidden;
  min-width: 0;
  min-height: 0; /* important for flex children in column layouts */
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  outline: none;
}

/* Active cycling state */
#cycle-toggle.active {
  background: #0af;
  color: #000;
  border-color: #0af;
}

#cycle-toggle.active:hover {
  background: #08d;
}

/* ------------------------------------------------------------------ */
/* Loading overlay                                                     */
/* ------------------------------------------------------------------ */

#loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #333;
  border-top-color: #7cf;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  font-size: 16px;
  color: #aaa;
}

#progress-bar {
  width: 240px;
  height: 8px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
}

#progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #37a, #7cf);
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* ------------------------------------------------------------------ */
/* Controls panel                                                      */
/* ------------------------------------------------------------------ */

#controls-panel {
  flex: 0 0 200px;
  background: #1a1a1a;
  border-left: 1px solid #333;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
}

button {
  background: #2a2a2a;
  color: #ddd;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

button:hover {
  background: #3a3a3a;
  border-color: #666;
}

button:active {
  background: #222;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #aaa;
}

select {
  width: 100%;
  padding: 5px 6px;
  background: #222;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
}

select:focus {
  border-color: #0af;
  outline: none;
}

select:hover {
  border-color: #666;
}

input[type="range"] {
  width: 100%;
  accent-color: #7cf;
}

input[type="number"] {
  width: 100%;
  padding: 5px 6px;
  background: #222;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

input[type="number"]:focus {
  border-color: #0af;
  outline: none;
}

/* ------------------------------------------------------------------ */
/* QR code widget                                                      */
/* ------------------------------------------------------------------ */

#qr-canvas {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80px;
}

/* qrcodejs renders a table or canvas; centre and round it */
#qr-canvas canvas,
#qr-canvas img {
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  border: 3px solid #2a2a2a;
}

.qr-hint {
  display: block;
  text-align: center;
  color: #555;
  font-size: 11px;
  margin-top: 4px;
}

.help-hint {
  margin-top: auto;
  padding: 8px;
  background: #111;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  color: #555;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Responsive: stack vertically on narrow screens                     */
/* ------------------------------------------------------------------ */

@media (max-width: 640px) {
  #app {
    flex-direction: column;
  }

  #controls-panel {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    border-top: 1px solid #333;
    padding: 8px;
    gap: 12px;
  }

  .control-group {
    flex: 1 1 160px;
  }

  .help-hint {
    display: none;
  }
}
