/* styles.css */

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background-color: #000;
  color: #fff;
}

#glcanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* Prevents default touch behaviors */
  -webkit-user-select: none;
  user-select: none;
}

#ui-overlay {
    position: fixed; /* Change from absolute to fixed */
    top: 20px;
    left: 20px;
    z-index: 10;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.75), rgba(20, 20, 20, 0.85));
    padding: 20px;
    border-radius: 12px;
    max-width: 320px;
    max-height: 90vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    pointer-events: auto; /* Ensure UI interactions work */
    touch-action: pan-y; /* Allow vertical scrolling only */
}

#ui-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#restore-ui {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#restore-ui::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 2px;
}

#restore-ui:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

#restore-ui.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

h1 {
  margin-top: 0;
  text-align: center;
  font-size: 1.5em;
}

.controls {
    position: relative;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 20px;
}

.controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
}

.controls label {
  margin-bottom: 5px;
}

.controls select,
.controls button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.controls button {
    background: linear-gradient(135deg, rgba(60, 60, 60, 0.9), rgba(40, 40, 40, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.controls button:hover {
    background: linear-gradient(135deg, rgba(80, 80, 80, 0.9), rgba(60, 60, 60, 0.9));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#randomize-all {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    font-weight: bold;
    margin: 10px 0;
}

#randomize-all:hover {
    background: linear-gradient(135deg, #357abd, #2b62a3);
}

#parameter-controls {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.parameter-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 10px;
}

.parameter-group label {
  margin-bottom: 5px;
  font-size: 0.9em;
  color: #fff;
}

.parameter-group input[type="range"],
.parameter-group input[type="color"] {
  width: 100%;
}

.parameter-group input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 5px 0;
}

#color-management {
  margin-top: 15px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.color-layer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.color-layer input[type="color"] {
  width: 50px;
}

.color-layer input[type="range"] {
  flex: 1;
}

.color-layer button {
  padding: 4px 8px;
  background: #666;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
}

.color-layer button:hover {
  background: #888;
}

/* UI Size Variations */
.ui-size-compact {
    transform: scale(0.55);
    transform-origin: top left;
}

.ui-size-normal {
    transform: scale(0.8);
    transform-origin: top left;
}

.ui-size-large {
    transform: scale(1);
    transform-origin: top left;
}

.ui-wrapper {
    width: 320px; /* Base width */
    position: relative;
}

.ui-size-compact .ui-wrapper {
    width: calc(320px / 0.55); /* Compensate for scale */
}

.ui-size-normal .ui-wrapper {
    width: calc(320px / 0.8); /* Compensate for scale */
}

.ui-size-large .ui-wrapper {
    width: 320px;
}

.ui-settings {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ui-size-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 5px;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.ui-size-options.hidden {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
}

@media (max-width: 600px) {
    #ui-overlay {
        max-width: calc(100% - 40px);
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
    }

    h1 {
        font-size: 1.2em;
    }

    .dream-title {
        font-size: 1.5em;
        letter-spacing: 3px;
    }

    .controls {
        padding: 10px;
    }

    .controls select,
    .controls button {
        padding: 12px;
        font-size: 1em;
    }
}

/* Mobile Portrait Adjustments */
@media (max-width: 600px) and (orientation: portrait) {
    #ui-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
        transform: none !important; /* Override scale for full screen */
    }

    .ui-wrapper {
        width: 100% !important; /* Override wrapper width for full screen */
        height: 100%;
        overflow-y: auto;
        padding: 20px;
        box-sizing: border-box;
    }

    .ui-size-compact {
        font-size: 0.9em;
    }

    .ui-size-normal {
        font-size: 1em;
    }

    .ui-size-large {
        font-size: 1.1em;
    }
}

.dream-title {
    margin: 0 0 20px;
    text-align: center;
    font-size: 1.8em;
    font-family: 'Arial', sans-serif;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(
        270deg,
        #ff3366,
        #ff00ff,
        #00ffff,
        #33ff66,
        #ff3366
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    padding: 15px 0;
    animation: gradientFlow 8s ease infinite, glowPulse 2s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.dream-title::before,
.dream-title::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(255, 255, 255, 0.3),
        rgba(255, 51, 102, 0.5),
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: borderGlow 3s ease-in-out infinite;
}

.dream-title::before { top: 0; }
.dream-title::after { bottom: 0; }

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes glowPulse {
    0% { filter: brightness(1) blur(0px); }
    50% { filter: brightness(1.2) blur(0.6px); }
    100% { filter: brightness(1) blur(0px); }
}

@keyframes borderGlow {
    0% { opacity: 0.3; transform: translateX(-50%) scaleX(0.8); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1.1); }
    100% { opacity: 0.3; transform: translateX(-50%) scaleX(0.8); }
}

.support-button {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.05)
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.support-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: translateX(-100%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    20% { transform: translateX(100%); }
    100% { transform: translateX(100%); }
}

.support-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.15),
        rgba(255, 255, 255, 0.07)
    );
    border-color: rgba(255, 255, 255, 0.2);
}

#recording-controls {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.recording-options {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.recording-options select {
    flex: 1;
}

#recording-status {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

#start-recording {
    background: linear-gradient(135deg, #ff4b4b, #ff6b6b);
}

#start-recording.recording {
    background: linear-gradient(135deg, #4bff4b, #6bff6b);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Add styles for toggle switches */
.toggle-input {
    appearance: none;
    width: 50px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-input::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.toggle-input:checked {
    background: rgba(255, 255, 255, 0.3);
}

.toggle-input:checked::before {
    transform: translateX(26px);
}

.parameter-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recording-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.tab-content {
    display: none;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.tab-content.active {
    display: block;
}

.time-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.time-input input {
    width: 60px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    text-align: center;
}

.recording-controls select {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    font-size: 0.9em;
}

.size-inputs {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.size-inputs > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auto-size {
    padding: 4px 8px;
    font-size: 0.8em;
    background: rgba(255, 255, 255, 0.2);
}

/* Frame Selection Modal */
.frame-select-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.frame-select-content {
    background: rgba(30, 30, 30, 0.9);
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
}

.frame-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
}

.frame-slider {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
}

/* ...existing code... */

.timeline-selector {
    position: relative;
    height: 40px;
    margin: 20px 0;
}

.timeline-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%);
}

.timeline-marker {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.timeline-marker:hover {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.timeline-marker.start {
    left: 0;
}

.timeline-marker.end {
    left: 100%;
}

.quick-adjust {
    display: grid;
    gap: 10px;
    margin: 15px 0;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-slider {
    width: 100%;
    height: 20px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    outline: none;
}

.quick-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.share-links {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.share-links p {
    margin: 0 0 10px 0;
    color: white;
    text-align: center;
}

.share-links a {
    display: block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    transition: all 0.3s ease;
}

.share-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}
