* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: pan-x pan-y;
    -webkit-user-select: none;
    user-select: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #000;
    color: #fff;
}

canvas {
    display: block;
    touch-action: none;
}

/* Start Screen */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--geist-background);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    touch-action: manipulation !important;
}

.start-button {
    padding: 16px 32px;
    background: var(--geist-accents-2);
    color: var(--geist-foreground);
    border: 1px solid var(--geist-border);
    border-radius: var(--geist-radius);
    font-size: 18px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation !important;
    pointer-events: auto !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.start-button:hover {
    background: var(--geist-accents-3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.start-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Geist Design System Variables */
:root {
    --geist-background: #000;
    --geist-foreground: #fff;
    --geist-accents-1: #111;
    --geist-accents-2: #333;
    --geist-accents-3: #666;
    --geist-accents-4: #888;
    --geist-accents-5: #aaa;
    --geist-accents-6: #ccc;
    --geist-accents-7: #eaeaea;
    --geist-accents-8: #fafafa;
    --geist-success: #0070f3;
    --geist-error: #ee0000;
    --geist-warning: #f5a623;
    --geist-violet: #7928ca;
    --geist-cyan: #50e3c2;
    --geist-highlight-purple: #f81ce5;
    --geist-highlight-magenta: #eb367f;
    --geist-highlight-pink: #ff0080;
    --geist-link: #0070f3;
    --geist-link-hover: #0051cc;
    --geist-border: rgba(255, 255, 255, 0.1);
    --geist-radius: 6px;
}

/* Toolbar Styles - Geist */
.toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--geist-accents-1);
    border-top: 1px solid var(--geist-border);
    padding: 12px 16px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    touch-action: manipulation !important;
    pointer-events: auto !important;
}

.toolbar-btn {
    background: transparent;
    border: none;
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--geist-radius);
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation !important;
    color: var(--geist-foreground);
    flex: 1;
    max-width: 60px;
    pointer-events: auto !important;
}

.toolbar-btn svg,
.toolbar-btn img {
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

.toolbar-btn svg {
    stroke: var(--geist-foreground);
}

.toolbar-btn img {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.toolbar-btn:hover {
    background: var(--geist-accents-2);
}

.toolbar-btn:active {
    background: var(--geist-accents-3);
    transform: scale(0.95);
}

.toolbar-btn:active svg {
    stroke: var(--geist-foreground);
}

.toolbar-btn:active img {
    opacity: 1;
}

/* Add safe area padding for devices with notches */
@supports (padding: max(0px)) {
    .toolbar {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Geist Modal Styles */
.geist-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    touch-action: auto !important;
    pointer-events: auto !important;
}

.geist-modal.geist-modal-open {
    display: flex;
}

.geist-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.geist-modal-content {
    position: relative;
    background: var(--geist-accents-1);
    border: 1px solid var(--geist-border);
    border-radius: var(--geist-radius) var(--geist-radius) 0 0;
    max-width: 90%;
    width: 500px;
    max-height: 65vh;
    height: 65vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    z-index: 2001;
    margin-bottom: 0;
    transition: transform 0s;
    touch-action: auto;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto !important;
}

.geist-modal-body {
    touch-action: pan-y !important;
    overflow-y: auto;
    pointer-events: auto !important;
}

.geist-modal-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px;
    border-bottom: 1px solid var(--geist-border);
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none !important;
    -webkit-touch-callout: none;
    pointer-events: auto !important;
    -webkit-user-drag: none;
    position: relative;
}

.geist-modal-header:active {
    cursor: grabbing;
}

.geist-modal-title {
    pointer-events: none;
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--geist-foreground);
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.geist-modal-close {
    background: transparent;
    border: none;
    color: var(--geist-foreground);
    font-size: 28px;
    line-height: 1;
    cursor: pointer !important;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--geist-radius);
    transition: background 0.15s ease;
    opacity: 0.6;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    z-index: 10;
    position: relative;
}

.geist-modal-close:hover {
    background: var(--geist-accents-2);
    opacity: 1;
}

.geist-modal-body {
    padding: 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.geist-modal-body::-webkit-scrollbar {
    width: 8px;
}

.geist-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.geist-modal-body::-webkit-scrollbar-thumb {
    background: var(--geist-accents-3);
    border-radius: 4px;
}

.geist-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--geist-accents-4);
}

.geist-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--geist-border);
}

.settings-container {
    padding: 0;
    background: transparent;
}

/* Geist Setting Rows */
.setting-row {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    border-bottom: 1px solid var(--geist-border);
    gap: 12px;
}

.setting-row:last-of-type {
    border-bottom: none;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--geist-foreground);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    opacity: 0.8;
}

/* Geist Slider */
.geist-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.geist-slider {
    flex: 1;
    height: 4px;
    background: var(--geist-accents-2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    touch-action: none !important;
    pointer-events: auto !important;
}

.geist-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--geist-foreground);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.geist-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.geist-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--geist-foreground);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: transform 0.15s ease;
}

.geist-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.geist-slider-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--geist-foreground);
    min-width: 40px;
    text-align: right;
    opacity: 0.8;
}

/* Geist Input */
.geist-input-wrapper {
    width: 100%;
    position: relative;
}

.geist-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--geist-accents-2);
    border: 1px solid var(--geist-border);
    border-radius: var(--geist-radius);
    color: var(--geist-foreground);
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: all 0.15s ease;
    outline: none;
    touch-action: manipulation !important;
    pointer-events: auto !important;
}

.geist-input:focus {
    border-color: var(--geist-link);
    background: var(--geist-accents-1);
}

.geist-input::placeholder {
    color: var(--geist-accents-4);
    opacity: 0.6;
}

.geist-input-with-prefix {
    padding-left: 28px;
}

.geist-input-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--geist-accents-4);
    font-size: 14px;
    pointer-events: none;
}

/* Geist Radio Group */
.geist-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.geist-radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 0;
}

.geist-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--geist-link);
}

.geist-radio-label {
    font-size: 14px;
    color: var(--geist-foreground);
    opacity: 0.8;
    cursor: pointer;
    user-select: none;
}

.geist-radio-option:hover .geist-radio-label {
    opacity: 1;
}

/* Geist Color Field */
.geist-color-field-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.geist-color-picker {
    position: absolute;
    opacity: 0;
    width: 48px;
    height: 48px;
    pointer-events: auto !important;
    cursor: pointer;
    z-index: 10;
    touch-action: manipulation !important;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    padding: 0;
    margin: 0;
}

.geist-color-swatch {
    width: 48px;
    height: 48px;
    border-radius: var(--geist-radius);
    border: 1px solid var(--geist-border);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s ease;
    position: relative;
    touch-action: manipulation !important;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

.geist-color-swatch:hover {
    transform: scale(1.05);
    border-color: var(--geist-accents-3);
}

.geist-color-swatch:active {
    transform: scale(0.95);
}

.geist-color-swatch:focus {
    outline: 2px solid var(--geist-link);
    outline-offset: 2px;
}

/* Geist Switch */
.geist-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

.switch-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--geist-foreground);
    flex: 1;
    margin: 0;
    cursor: pointer;
    user-select: none;
    opacity: 0.8;
}

.geist-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    touch-action: manipulation !important;
    pointer-events: auto !important;
}

.geist-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.geist-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--geist-accents-3);
    transition: 0.2s;
    border-radius: 24px;
}

.geist-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--geist-foreground);
    transition: 0.2s;
    border-radius: 50%;
}

.geist-switch input:checked + .geist-switch-slider {
    background-color: var(--geist-link);
}

.geist-switch input:checked + .geist-switch-slider:before {
    transform: translateX(20px);
}

.geist-switch input:focus + .geist-switch-slider {
    box-shadow: 0 0 0 2px rgba(0, 112, 243, 0.3);
}

/* Geist Button */
.geist-button {
    padding: 8px 16px;
    border-radius: var(--geist-radius);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid var(--geist-border);
    outline: none;
}

.geist-button-secondary {
    background: transparent;
    color: var(--geist-foreground);
    border-color: var(--geist-border);
}

.geist-button-secondary:hover {
    background: var(--geist-accents-2);
    border-color: var(--geist-accents-3);
}

.geist-button-secondary:active {
    background: var(--geist-accents-3);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .toolbar {
        padding: 16px 12px;
    }
    
    .toolbar-btn {
        padding: 14px;
        max-width: 70px;
    }
    
    .toolbar-btn svg,
    .toolbar-btn img {
        width: 28px;
        height: 28px;
    }
    
    .geist-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 65vh;
        height: 65vh;
        border-radius: var(--geist-radius) var(--geist-radius) 0 0;
    }
    
    .geist-modal-body {
        max-height: calc(65vh - 80px);
    }
    
    .settings-container {
        padding: 0;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .toolbar {
        padding: 14px 8px;
    }
    
    .toolbar-btn {
        padding: 12px;
        max-width: 60px;
    }
    
    .toolbar-btn svg,
    .toolbar-btn img {
        width: 24px;
        height: 24px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .toolbar {
        padding: 12px 16px;
    }
    
    .toolbar-btn {
        padding: 10px;
        max-width: 65px;
    }
}
