:root {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --bg-color: #f1f5f9;
    --text-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.7);
    --input-bg: #ffffff;
    --border-color: rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass-border: rgba(0, 0, 0, 0.1);
    --transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.4s ease, color 0.4s ease;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Background Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 300px;
    height: 300px;
    filter: blur(60px);
    border-radius: 50%;
    opacity: 0.15;
    animation: move 25s infinite alternate linear;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.blob-1 {
    background: #6366f1;
    top: -10%;
    left: -10%;
}

.blob-2 {
    background: #ec4899;
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    background: #06b6d4;
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes move {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.1); }
}

/* Container */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Top Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 1.25rem;
    border-radius: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}


/* Header */
header {
    text-align: center;
}

.glayout-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.glayout-title span {
    background: linear-gradient(to right, var(--primary), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.7;
    font-weight: 400;
}
 
/* Theme Toggle */
/* theme-toggle removed */

/* AdSense Container */
.ad-container {
    width: 100%;
    max-width: 1000px;
    margin: 1.5rem auto;
    min-height: 90px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-ad {
    position: fixed;
    top: 100px;
    width: 160px;
    height: 600px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: none;
    z-index: 100;
    pointer-events: none;
}

.left-sidebar { left: 10px; }
.right-sidebar { right: 10px; }

@media (min-width: 1450px) {
    .sidebar-ad { display: flex; align-items: center; justify-content: center; pointer-events: auto; }
}

/* Sticky Footer Ad */
.sticky-footer-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-height: 50px;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

@media (min-width: 768px) {
    .sticky-footer-ad { display: none; }
}

body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
}

.app-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .app-container {
        padding: 15px;
        padding-bottom: 70px;
    }
}
吐

/* Removed light-mode specific overrides as it is now default */

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Controls Panel */
.controls-panel {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.control-group label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    opacity: 0.9;
}

.control-group input[type="text"],
.control-group select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.85rem 1.1rem;
    border-radius: 1rem;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.control-group input[type="text"]:focus,
.control-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.hint {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Slider */
.slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
}

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

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.slider-val {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    color: var(--primary);
}

/* Color Row */
.color-row {
    display: flex;
    gap: 1rem;
}

.half {
    flex: 1;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 0.75rem;
    border-radius: 1rem;
}

.color-input-wrap input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--glass-border);
    border-radius: 0.5rem;
}

.color-input-wrap span {
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    opacity: 0.7;
}

/* Shape Options */
.shape-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.frame-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 600px) {
    .frame-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.shape-btn,
.frame-btn {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition);
}

.shape-btn:hover,
.frame-btn:hover {
    border-color: var(--primary);
}

.shape-btn.active,
.frame-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Generate Button */
.generate-btn {
    background: linear-gradient(135deg, var(--primary), #ec4899);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px -8px rgba(99, 102, 241, 0.5);
}

.generate-btn:active {
    transform: translateY(0);
}

/* Preview Panel */
.preview-panel {
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.canvas-wrapper {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    position: relative;
    overflow: hidden;
}

.canvas-wrapper canvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    display: none;
}

.canvas-wrapper canvas.visible {
    display: block;
}

.placeholder-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0.4;
    text-align: center;
}

.placeholder-msg span {
    font-size: 4rem;
}

.placeholder-msg p {
    font-size: 1.1rem;
}

.placeholder-msg.hidden {
    display: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.dl-btn {
    flex: 1;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.9rem;
}

.dl-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.4);
}

.dl-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.dl-btn.secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
}

.dl-btn.secondary:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #10b981;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 2rem;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 2rem;
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .glayout-title {
        font-size: 2.5rem;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
    }

    .action-buttons {
        flex-direction: column;
    }

    .color-row {
        flex-direction: column;
    }
}

/* ============================================================ */
/* FULLSCREEN MODAL */
/* ============================================================ */
.qr-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2, 6, 23, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.qr-modal.active {
    opacity: 1;
    pointer-events: all;
}

.qr-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    transform: scale(0.6) translateY(50px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.25);
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.qr-modal.active .qr-modal-content {
    transform: scale(1) translateY(0);
}

#qr-modal-img {
    max-width: 100%;
    max-height: 55vh;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: var(--transition);
}

.close-btn:hover { 
    background: var(--primary-hover); 
    transform: rotate(90deg);
}

.qr-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

@media (max-width: 600px) {
    .qr-modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

.qr-modal-actions .dl-btn {
    flex: 1;
}
