:root {
    --primary: #556b2f;       
    --primary-dark: #3f5a2a;  
    --secondary: #6f8f4e;     
    --accent: #8b6f47;        
    --accent-gold: #b59a6d;         
    --bg-main: #2f3e2c;
    --bg-panel: #f4f1e8;
    --border: #d6d0c2;
    --text-main: #333;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-main), #1f2a1f);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}
body::after {
    content: "Preloading Fonts";
    font-family: 'Almendra', 'Cinzel', 'MedievalSharp', 'Orbitron', 'Permanent Marker', 'IM Fell English SC', 'Nosifer';
    position: absolute;
    left: -9999px; 
    top: -9999px;
    visibility: hidden;
}
.container {
    max-width: 1020px;
    margin: 0 auto;
    padding: 15px 0;
}
.header {
    text-align: center;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}
.header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}
.main-content {
    display: grid;
    grid-template-columns: 650px 350px;
    gap: 15px;
    margin-bottom: 15px;
    align-items: stretch;
    height: calc(100vh - 40px); 
    max-height: 900px; 
}
.canvas-area {
    background: rgba(244, 241, 232, 0.95);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.controls {
    background: rgba(244, 241, 232, 0.95);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100%; 
    overflow-y: auto; 
    overflow-x: hidden;
    position: relative;
}
#positioningSection {
    background: rgba(0, 0, 0, 0.03); 
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}
body.dark-mode #positioningSection {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}
#positioningSection h3 {
    margin-top: 0;
    font-size: 0.9rem;
    color: #555;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 8px;
    margin-bottom: 12px;
}
body.dark-mode #positioningSection h3 {
    color: #ccc;
    border-bottom-color: rgba(255,255,255,0.1);
}
.btn,
.btn-primary,
.btn-secondary,
.btn-tertiary,
.btn-danger,
.btn-history,
.positioning-controls .btn,
.size-controls .btn,
.transform-controls .btn,
.tool-btn {
    background: var(--primary) !important;
    color: #fff !important;
    border: 1px solid rgba(0,0,0,0.25) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15) !important;
}
.btn:hover,
.btn-history:hover,
.positioning-controls .btn:hover,
.size-controls .btn:hover,
.transform-controls .btn:hover,
.tool-btn:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-1px);
}
.btn:active {
    background: #2f3e1f !important;
    transform: translateY(0);
}
.hero-mode-controls .tool-btn,
.hero-mode-controls .btn-style {
    width: 60px;
    height: 60px;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.2s;
    background: #e8e2d3 !important;
    color: #999 !important;
    border: 2px solid #d6d0c2 !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-mode-controls .tool-btn:hover {
    background: #d6d0c2 !important;
    color: #555 !important;
    transform: translateY(-1px);
    border-color: var(--primary) !important;
}
.hero-mode-controls .tool-btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15) !important;
}
body.dark-mode .hero-mode-controls .tool-btn {
    background: #e8e2d3 !important;
    color: #999 !important;
    border-color: #d6d0c2 !important;
}
body.dark-mode .hero-mode-controls .tool-btn:hover {
    background: #3a3a4a !important;
    color: #aaa !important;
    border-color: var(--primary) !important;
}
body.dark-mode .hero-mode-controls .tool-btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary-dark) !important;
}
.filename-display {
    font-size: 0.65rem;
    font-weight: 400;
    color: #888;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px; 
    text-align: right;
}
body.dark-mode .filename-display {
    color: #999;
}
.btn-secondary {
    background: var(--secondary) !important;
}
.btn-tertiary {
    background: #8b6f47 !important;
}
.btn-danger {
    background: #a94442 !important;
}
.btn-history {
    background: #e8e2d3 !important;
    color: #333 !important;
}
.tool-btn {
    background: #f4f1e8 !important;
    color: #333 !important;
}
.tool-btn.active {
    background: var(--primary) !important;
    color: #fff !important;
}
.canvas-scroll-wrapper {
    width: 100%;
    height: 500px;         
    overflow: auto;        
    background: #222;      
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
    position: relative;
    display: block;
}
#canvasViewport {
    transform-origin: 0 0;
    position: relative;
    display: inline-block;
    line-height: 0;
}
#mainCanvas {
    touch-action: none; 
    user-select: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    display: block;
}
body.dark-mode .canvas-scroll-wrapper {
    border-color: #444;
    background: #1a1a1a;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.section-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 15px;
}
.section-header-inline h3 {
    margin-bottom: 0 !important; 
    white-space: nowrap;
}
.header-zoom-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(102, 126, 234, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.15);
}
.header-zoom-control label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
}
.header-zoom-control input[type="range"] {
    width: 120px;
    cursor: pointer;
    height: 6px;
}
.header-zoom-control span {
    font-size: 0.8rem;
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    var(--primary);
}
body.dark-mode .header-zoom-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: #3f3f4a;
}
body.dark-mode .header-zoom-control label {
    color: #e0e0e0;
}
.control-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 20px;
    padding: 5px;
    border-radius: 10px;
    position: sticky;
    top: -20px;
    z-index: 100;
    background: transparent;
    box-shadow: none;
}
.controls::-webkit-scrollbar {
    width: 8px;
}
.controls::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}
.controls::-webkit-scrollbar-thumb {
    var(--primary);
    border-radius: 10px;
}
.tab-btn {
    flex: 1;
    padding: 10px 5px;
    border: none;
    background: #e8e2d3;
    color: #333;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.75rem;
    transition: 0.2s;
    filter: grayscale(1);
}
.tab-btn.active {
    var(--primary);
    color: white;
    font-weight: bold;
    filter: grayscale(0);
}
.tab-btn:hover:not(.active) {
    background: #d6d0c2 !important;
    color: #555 !important;
    transform: translateY(-1px);
}
.shape-selector {
    display: flex;
    gap: 5px;
}
.btn-tab {
    flex: 1;
    background: #e8e2d3 !important;
    color: #999 !important;
    padding: 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-tab.active {
    background: var(--primary) !important;
    color: white !important;
}
.btn-tab:hover:not(.active) {
    background: #d6d0c2 !important;
    color: #555 !important;
    transform: translateY(-1px);
    border-color: var(--primary) !important;
}
.circle-overlay {
    position: absolute; 
    border: 2px dashed var(--accent-gold); 
    box-shadow: 0 0 0 5000px rgba(0, 0, 0, 0.4); 
    border-radius: 50%; 
    pointer-events: none; 
    z-index: 10;
    box-sizing: border-box; 
}
.controls-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    align-items: flex-start;
}
#image-tab #positioningSection .positioning-transform-wrapper {
    grid-template-columns: 1fr !important; 
}
#image-tab #positioningSection .move-controls {
    max-width: 120px;
}
.positioning-size-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.positioning-controls, .size-controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.positioning-controls h4, .size-controls-wrapper h4 {
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 3px;
}
.move-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    max-width: 100px;
}
.size-controls {
    display: flex;
    gap: 4px;
}
.positioning-controls .btn, .size-controls .btn {
    padding: 4px 8px;  
    font-size: 0.75rem;
    min-height: 26px;
    min-width: 32px;  
    display: flex;
    align-items: center;
    justify-content: center;
}
.move-controls .btn:nth-child(1) { grid-column: 2; }
.move-controls .btn:nth-child(2) { grid-column: 1; grid-row: 2; }
.move-controls .btn:nth-child(3) { grid-column: 2; grid-row: 2; }
.move-controls .btn:nth-child(4) { grid-column: 3; grid-row: 2; }
.move-controls .btn:nth-child(5) { grid-column: 2; grid-row: 3; }
.step-size-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.step-size-controls label {
    font-size: 0.85rem;
    color: #333;
}
.step-size-controls select {
    padding: 4px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
}
.transform-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 200px;  
}
.transform-controls h4 {
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 3px;
}
.transform-controls .btn {
    padding: 6px 10px;
    font-size: 0.85rem;
    width: 100%;  
}
.transform-controls select {
    padding: 6px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    width: 100%;  
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}
.btn-secondary:hover {
    background: linear-gradient(135deg, #38a169, #48bb78);
    box-shadow: 0 6px 16px rgba(72, 187, 120, 0.4);
    transform: translateY(-2px);
}
.btn-tertiary:hover {
    background: linear-gradient(135deg, #dd6b20, #ed8936);
    box-shadow: 0 6px 16px rgba(237, 137, 54, 0.4);
    transform: translateY(-2px);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #e53e3e, #f56565);
    box-shadow: 0 6px 16px rgba(245, 101, 101, 0.4);
    transform: translateY(-2px);
}
.btn:active {
    transform: translateY(0);
    filter: brightness(0.9);
}
.filter-controls {
    display: flex;
    flex-direction: column; 
    gap: 12px;
    margin-top: 8px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}
.filter-row {
    display: grid;
    grid-template-columns: 85px 1fr 45px; 
    align-items: center;
    gap: 10px;
}
.filter-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
}
.filter-row input[type="range"] {
    width: 100%;
    cursor: pointer;
}
.filter-row span {
    font-size: 0.8rem;
    color: #666;
    text-align: right;
    font-variant-numeric: tabular-nums; 
}
.filter-row label {
    min-width: 75px;  
    font-size: 0.8rem;  
    color: #333;
}
.filter-row input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
}
.filter-row input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.filter-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.filter-row span {
    min-width: 35px;
    text-align: right;
    font-size: 0.85rem;
    color: #666;
}
.filter-row:nth-child(7) {
    grid-column: 1 / -1;
}
#bgMode, #bgTextureType {
    background-color: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 5px;
    font-weight: 600;
}
body.dark-mode #bgMode, body.dark-mode #bgTextureType {
    background-color: #2d2d3a;
    color: white;
    border-color: #4a4a5a;
}
.export-options {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}
.export-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.export-row label {
    min-width: 70px;
    font-size: 0.85rem;
    color: #333;
}
.export-row select,
.export-row input[type="range"] {
    flex: 1;
    padding: 6px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
}
.export-row input[type="range"] {
    padding: 0;
    border: none;
    height: 6px;
    background: #e0e0e0;
}
.export-row input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #48bb78, #38a169);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.export-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #48bb78, #38a169);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.export-row span {
    min-width: 35px;
    text-align: right;
    font-size: 0.85rem;
    color: #666;
}
#gifOptions {
    padding: 10px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    margin-top: 8px;
}
#gifOptions .export-row {
    margin-bottom: 8px;
}
#gifOptions .export-row:last-child {
    margin-bottom: 0;
}
.section {
    margin-bottom: 15px;
}
.section h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}
.section-header-with-copyright {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.section-header-with-copyright h3 {
    margin-bottom: 0;
}
.copyright-notice {
    font-size: 0.75rem;
    color: #888;
    font-weight: normal;
}
.file-input-area {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transition: all 0.3s ease;
    margin-bottom: 15px;
}
.file-input-area:hover {
    border-color: border-color: var(--primary-dark);;
    transform: translateY(-2px);
    box-shadow: none;
}
.file-input { display: none; }
.file-input-label {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}
.file-input-area p {
    margin-top: 10px;
    color: #666;
    font-size: 0.85rem;
}
.frame-preview {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    border-radius: 50%; 
}
.frame-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    max-height: 360px;  
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}
.frame-option {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    overflow: hidden;
}
.frame-option:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}
.frame-option.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.frame-option canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
.frame-option span {
    position: relative;
    z-index: 1;
    font-weight: 500;
    color: #666;
    font-size: 0.5rem;
    text-align: center;
    padding: 3px;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}
.frame-option.selected span {
    color: white;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}
.custom-frame-upload {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.3); 
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s ease;
}
.custom-frame-upload:hover {
    border-color: var(--primary-dark);  
    box-shadow: 0 8px 16px rgba(85, 107, 47, 0.2);  
}
.custom-frame-upload label.btn {
    background: linear-gradient(135deg, #2e8b57, #228b22); 
    color: white;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(46, 139, 87, 0.4);
    display: inline-block;
}
.custom-frame-upload label.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 139, 87, 0.6);
    background: linear-gradient(135deg, #32cd32, #228b22);
}
.custom-frame-upload p {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #bbb;
    line-height: 1.4;
}
.frame-option[data-frame="custom"] {
    background: linear-gradient(135deg, #1e3c2f, #0f2318);
    border-color: #32cd32;
}
.frame-option[data-frame="custom"]:hover {
    border-color: #90ee90;
    transform: scale(1.08);
}
.frame-option[data-frame="custom"].selected {
    background: linear-gradient(135deg, #2e8b57, #228b22);
    border-color: #90ee90;
    box-shadow: 0 4px 14px rgba(50, 205, 50, 0.5);
}
.frame-option[data-frame="custom"] span {
    color: #666;          
    text-shadow: none;
}
.custom-color-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}
.custom-color-controls input[type="color"] {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 6px;
}
.frame-thickness-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
}
.frame-thickness-controls label {
    min-width: 110px;
    color: #333;
}
.frame-thickness-controls input[type="range"] {
    flex: 0 0 auto;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
}
.frame-thickness-controls input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.frame-thickness-controls input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.frame-thickness-controls span {
    min-width: 40px;
    text-align: right;
    color: #666;
}
.frame-divider {
    grid-column: 1 / -1; 
    display: flex;
    align-items: center;
    margin: 12px 0 6px 0;
    pointer-events: none; 
}
.frame-divider::before,
.frame-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #d6d0c2; 
}
.frame-divider span {
    padding: 0 10px;
    font-size: 0.65rem;
    color: #8b6f47; 
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}
body.dark-mode .frame-divider::before,
body.dark-mode .frame-divider::after {
    background: #4a4a5a;
}
body.dark-mode .frame-divider span {
    color: #b59a6d;
}
.size-input {
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 100%;
}
.action-buttons {
    display: grid;
    gap: 10px;
}
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.preview-area {
    text-align: center;
}
.token-preview {
    width: 200px;           
    height: 200px;          
    border-radius: 50%;     
    border: 2px solid #e0e0e0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.85rem;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    overflow: hidden;       
}
.token-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;    
    border-radius: 50%;
}
.keyboard-hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 6px;
    text-align: center;
    font-style: italic;
}
.text-overlay-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.text-size-color-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.font-style-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.btn-style {
    flex: 1;
    padding: 10px;
    border: 2px solid #d6d0c2 !important;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #e8e2d3 !important;  
    color: #999 !important;           
}
.btn-style:hover {
    background: #d6d0c2 !important;
    color: #555 !important;
    transform: translateY(-1px);
    border-color: var(--primary) !important;
}
.btn-style[data-active="true"] {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15) !important;
}
.btn-style strong,
.btn-style em {
    font-style: normal;
}
.btn-style em {
    font-style: italic;
}
.text-overlay-controls input,
.text-overlay-controls select {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.85rem;
}
.text-overlay-controls input[type="color"] {
    padding: 4px;
    height: 35px;
}
#hpBarOptions {
    transition: all 0.3s ease-in-out;
}
.status-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    background: rgba(0,0,0,0.05);
    padding: 6px;
    border-radius: 8px;
}
.status-item {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    transition: all 0.2s;
    background: white;
    border: 1px solid #ddd;
    height: 32px; 
}
.status-item:hover {
    transform: scale(1.1);
    background: #f0f0f0;
}
.status-item.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
body.dark-mode .status-item {
    background: #2d2d3a;
    border-color: #4a4a5a;
}
.asset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}
.asset-item {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}
.asset-item:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}
.asset-item.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: white;
}
.asset-library-section:has(#enableAssetLibrary:not(:checked)) {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}
body.dark-mode .asset-library-section {
    background: rgba(72, 187, 120, 0.05) !important;
}
body.dark-mode .asset-library-section:has(#enableAssetLibrary:not(:checked)) {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
body.dark-mode .asset-item {
    background: #2d2d3a;
    border-color: #4a4a5a;
}
#image-tab select,
#batch-tab select,
#text-tab select,
#text-tab input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid #d6d0c2; 
    border-radius: 8px;
    font-size: 0.85rem;
    background: #ffffff;
    color: #333;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
#image-tab select:hover,
#batch-tab select:hover,
#text-tab select:hover,
#text-tab input[type="number"]:hover {
    border-color: var(--primary);
}
body.dark-mode #image-tab select,
body.dark-mode #batch-tab select,
body.dark-mode #text-tab select,
body.dark-mode #text-tab input[type="number"] {
    background: #e8e2d3 !important;
    color: #1a1a1a !important;
    border-color: #b5ad99 !important;
}
#image-tab .filter-row:has(#sizePreset) {
    grid-template-columns: 90px 1fr; 
}
#sizePreset {
    width: 100% !important;
    max-width: none !important; 
}
#stepSize {
    width: auto !important;
    min-width: 70px;
}
#rotateImage {
    width: 100%;
}
.text-size-color-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
}
#fontFamily {
    font-weight: 500;
}
#batchCropMode {
    margin-top: 2px;
    height: 32px;
}
#standeeOptions .filter-row, 
#pdfSheetOptions .filter-row {
    grid-template-columns: 85px 1fr; 
    gap: 10px;
    margin-bottom: 10px;
}
#standeeOptions select, 
#standeeOptions input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}
.vtt-field-group {
    background: rgba(0, 0, 0, 0.02);
    padding: 10px; 
    border-radius: 10px;
    margin-bottom: 8px;     
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.vtt-container .filter-row {
    margin-bottom: 6px;     
    display: grid;
    grid-template-columns: 80px 1fr; 
    align-items: center;
    gap: 8px;
}
.vtt-input {
    width: 100%;
    padding: 6px 8px; 
    border: 2px solid #d6d0c2;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #ffffff;
    color: #333;
    transition: all 0.2s ease;
    box-sizing: border-box; 
}
#vttAC, #vttHP, #vttMHP {
    padding: 6px 4px; 
    text-align: center;
}
.vtt-input:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
}
.vtt-checkbox-cluster {
    display: flex; 
    gap: 10px; 
    font-size: 0.75rem; 
    align-items: center;
    flex-wrap: wrap; 
}
.vtt-checkbox-cluster label {
    min-width: 0 !important; 
    white-space: nowrap; 
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.vtt-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
    margin-top: 5px;
    width: 100%;
}
.conditions-box h4 {
    margin-top: 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 5px;
}
body.dark-mode .vtt-input {
    background: #e8e2d3 !important;
    color: #1a1a1a !important;
    border-color: #b5ad99 !important;
}
body.dark-mode .vtt-field-group {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}
body.dark-mode .vtt-input::placeholder {
    color: #777; 
}
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px; 
}
.modal-content {
    position: relative;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    max-width: 600px;
    width: 100%;
    max-height: 90vh; 
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}
.modal-content > div[style*="overflow-y"] {
    flex: 1;
    min-height: 0; 
}
.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
}
.notification {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.notification.show {
    transform: translateX(0);
}
.notification.success {
    background: linear-gradient(135deg, #48bb78, #38a169);
}
.notification.error {
    background: linear-gradient(135deg, #f56565, #e53e3e);
}
.controls {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.canvas-area .token-preview {
    max-width: 200px; 
    height: 200px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    background: white;
}
body.dark-mode .canvas-area, 
body.dark-mode .controls {
    background: #1e1e26 !important; 
    color: #f0f0f0 !important;      
    border-color: #3f3f4a !important;
}
body.dark-mode .section h3,
body.dark-mode .section h4,
body.dark-mode .circle-info,
body.dark-mode .keyboard-hint,
body.dark-mode .filter-row label,
body.dark-mode .export-row label,
body.dark-mode .step-size-controls label {
    color: #e0e0e0 !important;
}
body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode select,
body.dark-mode .size-input,
body.dark-mode .btn-style {
    background: #e8e2d3 !important;
    color: #999 !important;
    border-color: #d6d0c2 !important;
}
body.dark-mode .btn-style:hover {
    background: #3a3a4a !important;
    color: #aaa !important;
    border-color: var(--primary) !important;
}
body.dark-mode .btn-style[data-active="true"] {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary-dark) !important;
}
body.dark-mode .modal-content,
body.dark-mode .modal-content p,
body.dark-mode .modal-content h2,
body.dark-mode .modal-content h3,
body.dark-mode .modal-content h4,
body.dark-mode .modal-content li,
body.dark-mode .modal-content a,
body.dark-mode .modal-content span,
body.dark-mode .modal-content label {
    color: #f0f0f0 !important;
}
body.dark-mode .modal-content a {
    color: #90cdf4 !important; 
}
body.dark-mode .close {
    color: #f0f0f0 !important;
}
body.dark-mode .modal-content {
    background-color: #1e1e26 !important;
    color: #f0f0f0 !important;
}
.tool-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.history-group {
    display: flex;
    gap: 8px;
}
.btn-history {
    flex: 1;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-history:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #ced4da;
}
.btn-history:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-clear-mask {
    margin-top: 5px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-clear-mask:hover {
    background: #feb2b2;
    color: white;
}
#brushCursor {
    position: fixed;
    pointer-events: none; 
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    display: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}
canvas.hero-active {
    cursor: none !important;
}
.standee-section, .pdf-sheet-section, .asset-library-section, 
.resource-ring-section, .hero-mode-controls, .filter-section {
    background: rgba(72, 187, 120, 0.1) !important;
    border: 1px solid rgba(72, 187, 120, 0.3) !important;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}
, .pdf-sheet-section {
    transition: all 0.3s ease;
}
.standee-section:has(#standeeMode:not(:checked)),
.pdf-sheet-section:has(#enablePdfSheet:not(:checked)),
.asset-library-section:has(#enableAssetLibrary:not(:checked)),
.resource-ring-section:has(#enableHpBar:not(:checked)),
.hero-mode-controls:has(#heroMode:not(:checked)),
.filter-section:has(#enableFilters:not(:checked)) {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}
body.dark-mode .standee-section,
body.dark-mode .pdf-sheet-section,
body.dark-mode .asset-library-section,
body.dark-mode .resource-ring-section,
body.dark-mode .hero-mode-controls,
body.dark-mode .filter-section {
    background: rgba(72, 187, 120, 0.05) !important;
}
body.dark-mode .standee-section:has(#standeeMode:not(:checked)),
body.dark-mode .pdf-sheet-section:has(#enablePdfSheet:not(:checked)),
body.dark-mode .asset-library-section:has(#enableAssetLibrary:not(:checked)),
body.dark-mode .resource-ring-section:has(#enableHpBar:not(:checked)),
body.dark-mode .hero-mode-controls:has(#heroMode:not(:checked)),
body.dark-mode .filter-section:has(#heroMode:not(:checked)) {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
.canvas-scroll-wrapper::-webkit-scrollbar {
    width: 14px;  
    height: 14px; 
}
.canvas-scroll-wrapper::-webkit-scrollbar-track {
    background: #e0e0e0; 
    border-radius: 10px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
}
.canvas-scroll-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); 
    border-radius: 10px;
    border: 3px solid #e0e0e0; 
    cursor: pointer;
}
.canvas-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
    filter: brightness(1.1);
}
body.dark-mode .canvas-scroll-wrapper::-webkit-scrollbar-track {
    background: #1a1a20;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
body.dark-mode .canvas-scroll-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 3px solid #1a1a20;
}
.canvas-scroll-wrapper {
    scrollbar-width: auto;
    scrollbar-color: var(--primary) #e0e0e0;
}
body.dark-mode .canvas-scroll-wrapper {
    scrollbar-color: var(--primary) #1a1a20;
}
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .controls {
        max-height: none;
    }
}
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }
    .container {
        padding: 10px;
    }
    .canvas-area, .controls {
        padding: 15px;
    }
    .frame-options {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    }
}