/* Geist Mono Thin */
@font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmQ5e6jXzTmgWFK4jpbr4eAfRFyqf922cfr6CkQMrj2PPg);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmQ5e6jXzTmgWFK4jpbr4eAfRFyqf922cfr6CkQMrj2PPg) format("opentype");
    font-weight: 100;
  }
  /* Geist Mono Ultralight */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/Qma6K2ZE6Ch7K76xkHQ8NFZ4odzNMDmDc41pcUVMBdSNot);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/Qma6K2ZE6Ch7K76xkHQ8NFZ4odzNMDmDc41pcUVMBdSNot) format("opentype");
    font-weight: 200;
  }
  /* Geist Mono Light */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmSY4bzyQNZ3XZWTDdJgMovgSyfdrm6fa2wE426kTfkuuN);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmSY4bzyQNZ3XZWTDdJgMovgSyfdrm6fa2wE426kTfkuuN) format("opentype");
    font-weight: 300;
  }
  /* Geist Mono Regular */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmUManxUqYX4sd1R4TjBJbR19YsCaVt7gpqiiuxVb6ins3);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmUManxUqYX4sd1R4TjBJbR19YsCaVt7gpqiiuxVb6ins3) format("opentype");
    font-weight: 400;
  }
  /* Geist Mono Medium */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmPrcRxMJ4wwR3UyKH91iFC7bgeEfJisW4CKSPS9FSdX4M);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmPrcRxMJ4wwR3UyKH91iFC7bgeEfJisW4CKSPS9FSdX4M) format("opentype");
    font-weight: 500;
  }
  /* Geist Mono Semibold */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmcPEgkJ2sRz5oUzxeuGWYp7KRfrLktr1HmX7wzeEBv6c6);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmcPEgkJ2sRz5oUzxeuGWYp7KRfrLktr1HmX7wzeEBv6c6) format("opentype");
    font-weight: 600;
  }
  /* Geist Mono Bold */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmXLsfAzuBZRLRSuxndV6YDng3xZcNWBuMo7kisDZhTmV3);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmXLsfAzuBZRLRSuxndV6YDng3xZcNWBuMo7kisDZhTmV3) format("opentype");
    font-weight: 700;
  }
  /* Geist Mono Black */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmSVHJB1cNPr7j3tm3rZHhEVZnAvmaojL3RPAE6Zy7jYqk);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmSVHJB1cNPr7j3tm3rZHhEVZnAvmaojL3RPAE6Zy7jYqk) format("opentype");
    font-weight: 800;
  }
  /* Geist Mono Ultrablack */
  @font-face {
    font-family: "GeistMono";
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmZFtLSb3WzJUy8oy3t49iU6MCnsVynKFJmwJcKPGZBbP7);
    src: url(https://indigo-cautious-chinchilla-877.mypinata.cloud/ipfs/QmZFtLSb3WzJUy8oy3t49iU6MCnsVynKFJmwJcKPGZBbP7) format("opentype");
    font-weight: 900;
  }

  

/* Base Styles */
:root {
    --primary-color: #333;
    --secondary-color: #666;
    --background-color: #f0ede8;  /* Slightly darker off-white */
    --surface-color: #eae7e2;     /* Slightly darker off-white for surfaces */
    --border-color: #dcd9d4;      /* Soft gray for borders */
    --theme-color: #90ee90;
    --theme-color-hover: #7fdd7f;
    --theme-color-active: #6ecc6e;
    --font-family-mono: "GeistMono", monospace;
}

body {
    font-family: var(--font-family-mono);
    font-weight: 400;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: var(--background-color);
    background-image: url('https://arweave.net/jZ3EAO7Pl3ldWyNLkfDJ9ksghEouDZSuOAvS9T9Ii6M');
    background-repeat: repeat;
    background-position: center;
    background-attachment: fixed;
    background-size: 85%;  /* Scale the background pattern to 75% */
    color: var(--primary-color);
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 0rem !important;
    background-color: transparent;
}

@media (max-width: 1040px) {  /* 1000px + 40px for padding */
    .container {
        padding: 10px;
    }
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-family-mono);
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    font-weight: 100;  /* Using Geist Mono Thin for the main title */
}

h2 {
    font-weight: 300;  /* Using Geist Mono Light for section headers */
}

h3 {
    font-weight: 400;  /* Using Geist Mono Regular for subsection headers */
}

.description {
    font-family: var(--font-family-mono);
    font-weight: 300;
    font-size: 0.8rem;
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

/* Sections */
section {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: rgba(247, 245, 242, 0.85);  /* Match header opacity */
}

/* Header area styles */
.header-content {
    max-width: 450px;
    margin: 0 auto 2rem auto;
    background-color: rgba(247, 245, 242, 0.85);
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* File Upload */
.upload-container {
    text-align: center;
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    margin-bottom: 2rem;
    background-color: rgba(144, 238, 144, 0.15);
    transition: all 0.3s ease;
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;  /* Prevent content from spilling out */
}

.upload-container:hover {
    border-color: var(--theme-color);
}

.upload-container .description {
    margin: 1rem 0 0 0;
    color: var(--secondary-color);
}

#image-preview {
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: filter 0.3s ease;
    display: block;  /* Ensure block display */
}

.preview-active {
    padding: 1rem !important;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;  /* Prevent content from spilling out */
}

.preview-active:hover #image-preview {
    filter: brightness(0.8);
}

.preview-active:hover::after {
    content: "Reupload Image";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    pointer-events: none;
}

.preview-active .upload-content {
    display: none;
}

/* ASCII Output */
.ascii-container {
    font-family: var(--font-family-mono);
    font-weight: 400;
    white-space: pre;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ascii-line {
    display: flex;
    justify-content: center;
    white-space: pre;
}

.ascii-char {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    line-height: 1;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--theme-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    section {
        padding: 0.5rem;
    }
}

/* Animation Preview */
.animation-container {
    text-align: center;
    margin: 1rem 0;
}

/* Form Styles */
.config-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background-color: rgba(247, 245, 242, 0.85);  /* Match header opacity */
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.form-group {
    margin: 0;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;  /* Using Geist Mono Medium for labels */
    color: var(--primary-color);
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    box-sizing: border-box;
    font-family: var(--font-family-mono);
    font-weight: 400;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-family: var(--font-family-mono);
    font-weight: 500;  /* Using Geist Mono Medium for buttons */
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--theme-color);
    color: var(--primary-color);
    border-color: var(--theme-color);
}

.btn-primary:hover {
    background-color: var(--theme-color-hover);
    border-color: var(--theme-color-hover);
}

.btn-primary:active {
    background-color: var(--theme-color-active);
    border-color: var(--theme-color-active);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--theme-color);
    border-color: var(--theme-color);
    color: var(--primary-color);
}

.btn-secondary:active {
    background-color: var(--theme-color-active);
    border-color: var(--theme-color-active);
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    margin: 1rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--theme-color);
    cursor: pointer;
    transition: background .2s;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--theme-color);
    cursor: pointer;
    transition: background .2s;
    border: none;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--theme-color-hover);
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--theme-color-hover);
}

/* Animation Container */
.animation-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.animation-container img {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
}

/* Density Display */
.density-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* State Configuration */
.state-config-section {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

#state-config-section .state-entry {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
}

#state-config-section .state-entry > * {
    flex: 0 0 auto;
}

#state-config-section .state-entry label {
    width: 80px;
    min-width: 80px;
    margin: 0;
    display: flex;
    align-items: center;
    height: 40px;
}

#state-config-section .state-char,
#state-config-section .state-color,
#state-config-section .state-bgcolor,
#state-config-section .remove-state {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

#state-config-section .state-char {
    text-align: center;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: var(--surface-color);
}

#state-config-section .color-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    position: relative;  /* For tooltip positioning */
}

#state-config-section .color-input-group::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: 4px;
}

#state-config-section .color-input-group:hover::after {
    opacity: 1;
    visibility: visible;
}

#state-config-section input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background-color: transparent;
}

#state-config-section input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 3px;
}

#state-config-section input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

#state-config-section input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

#state-config-section .remove-state {
    background: var(--surface-color);
    color: #dc3545;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#state-config-section .remove-state:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.state-controls {
    max-width: 600px;
    margin: 1rem auto;
    text-align: center;
}

/* Character Selection Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: rgba(247, 245, 242, 0.85);  /* Match header opacity */
    margin: 10% auto;
    padding: 1rem;
    width: 90%;
    max-width: 600px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-body {
    overflow-y: auto;
    padding-right: 0.5rem;
    flex-grow: 1;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    cursor: pointer;
}

.close:hover {
    color: var(--primary-color);
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
}

.char-grid-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-family-mono);
    font-weight: 500;  /* Using Geist Mono Medium for better visibility */
    font-size: 1.2rem;
    transition: all 0.2s ease-in-out;
}

.char-grid-item:hover {
    background-color: var(--theme-color);
    color: var(--primary-color);
    border-color: var(--theme-color);
}

.mt-4 {
    margin-top: 2rem;
}

/* Debug Mode Styles */
.debug-toggle-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 1000;
}

.debug-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

.debug-toggle-label input[type="checkbox"] {
    cursor: pointer;
}

.debug-log {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    font-family: var(--font-family-mono);
    font-weight: 400;
    font-size: 12px;
    padding: 12px;
    border-radius: 4px;
    overflow-y: auto;
    z-index: 999;
}

.debug-log div {
    margin-bottom: 4px;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .debug-log {
        width: 90%;
        max-height: 400px;
        font-size: 11px;
    }
    
    .debug-toggle-container {
        bottom: 10px;
        right: 10px;
    }
}

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

.config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin: 0 auto;
    margin-bottom: 2rem;
}

.config-column {
    min-width: 0;  /* Prevents overflow in grid items */
    padding: 0rem 0.5rem;
    > .description {
        padding: 0rem 1.5rem;
    }
}

.config-column h3 {
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Make the generate buttons more prominent and consistently styled */
#generate-ascii,
#animation-form button[type="submit"] {
    padding: 0.75rem 2rem;
    font-size: 1.2rem;
    min-width: 200px;
    font-family: var(--font-family-mono);
    font-weight: 500;  /* Using Geist Mono Medium for buttons */
}

.text-center {
    text-align: center;
}

.config-column .state-entry {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
}

.config-column .state-entry > * {
    flex: 0 0 auto;
}

.config-column .state-entry label {
    width: 60px;
    min-width: 60px;
    margin: 0;
    display: flex;
    align-items: center;
    height: 30px;
    font-size: 0.75rem;  /* Make state labels smaller */
}

.config-column .state-char,
.config-column .state-color,
.config-column .state-bgcolor,
.config-column .remove-state {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

.config-column .state-char {
    text-align: center;
    font-size: 1.2rem;
    font-family: var(--font-family-mono);
    font-weight: 500;  /* Using Geist Mono Medium for better visibility */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: var(--surface-color);
}

.config-column .color-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30px;
    position: relative;  /* For tooltip positioning */
}

.config-column .color-input-group::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: 4px;
}

.config-column .color-input-group:hover::after {
    opacity: 1;
    visibility: visible;
}

.config-column input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background-color: transparent;
}

.config-column input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 3px;
}

.config-column input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.config-column input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

.config-column .remove-state {
    background: var(--surface-color);
    color: #dc3545;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-column .remove-state:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.state-controls {
    text-align: center;
    margin-top: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.density-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 0.5rem;
}

.density-labels .form-text {
    margin: 0;
    flex: 0 0 auto;
}

.density-labels .density-value {
    text-align: center;
}

@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        max-height: 90vh;
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 0.25rem;
        padding: 0.5rem;
    }
    
    .char-grid-item {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
} 

#loom-companion-mv3 {
    display: none;
}