* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a2e;
    color: #333;
    height: 100vh;
    display: flex;
    overflow: hidden;
    position: relative;
}

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.notification.error {
    background: rgba(220, 53, 69, 0.95);
    color: white;
}

.notification.success {
    background: rgba(40, 167, 69, 0.95);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes solpixelsTitleScroll {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -200% 0;
    }
}

.sidebar,
.sidebar-right {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar { width: 320px; }
.sidebar-right { width: 280px; }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar-header h1 {
    font-size: 3rem;
    margin-bottom: 5px;
    position: relative;
    background-image:
        repeating-linear-gradient(90deg,
        rgb(255, 238, 0) 0px,
        rgb(255, 174, 0) 8px,
            rgb(255, 247, 129) 16px);
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: solpixelsTitleScroll 64s linear infinite reverse;
}

.logotext
{
    text-shadow: 4px 4px 4px rgba(0,0,0,0.5);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.tagline {
    font-size: 0.85rem;
    opacity: 0.9;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.footer-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.footer-steps {
    margin: 0;
    padding-left: 20px;
    font-size: 0.8rem;
    line-height: 1.8;
}

.footer-steps li {
    margin-bottom: 5px;
}

.controls-box {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.footer-link {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

.footer-link:hover {
    opacity: 0.8;
}

.token-link {
    color: white;
    font-weight: 700;
    text-decoration: underline;
}

.token-link:hover {
    opacity: 0.8;
}

.panel {
    display: none;
}

.panel:not(.hidden) {
    display: block;
}

.panel h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.panel h3 {
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.panel h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.panel p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.balance-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    padding: 4px;
    border-radius: 0;
    text-align: center;
    margin-bottom: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}

.balance-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-display {
    font-size: 2.5rem;
    font-weight: bold;
}

.color-picker-section {
    margin-bottom: 20px;
}

.color-picker-section label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

#currentColorHex {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

.color-picker-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

#colorPicker {
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: crosshair;
    background: white;
}

#hueSlider {
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: pointer;
}

.color-preview-box {
    width: 100%;
    height: 40px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 0;
    background: #000000;
}

.canvas-info {
    width: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
    flex-shrink: 0;
}

.canvas-stats-bottom {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
}

.stat-bottom {
    display: flex;
    gap: 8px;
}

.stat-label {
    opacity: 0.8;
}

#mouseCoords, .pixels-used-number {
    font-family: monospace;
    font-weight: 600;
}

#mouseCoords {
    display: inline-block;
    min-width: 10ch;
    text-align: right;
}

.btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.btn-block {
    width: 100%;
    margin-bottom: 10px;
}

.btn-primary {
    background: rgba(255,255,255,0.9);
    color: #667eea;
}

.btn-primary:hover {
    background: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 4px 6px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.3);
}

.btn-share {
    background: #1DA1F2;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 900;
}

.btn-share:hover {
    background: #1a8cd8;
    transform: translateY(-1px);
}

.btn-share svg {
    flex-shrink: 0;
}

.btn-help {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 900;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.btn-help:hover {
    transform: translateY(-1px);
}

.secret-section {
    margin: 20px 0;
}

.secret-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.secret-url-container {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.secret-url-container input {
    flex: 1;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 0;
    font-family: monospace;
    font-size: 0.8rem;
    background: #ffffff;
    color: #000000;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    font-size: 1rem;
    background: #ffffff;
    color: #000000;
}

#orderBagsInput.input-error {
    border-color: #f87171;
}

#orderBagsHelp.error-text {
    color: #fecaca;
}

.rainbow-outline {
    position: relative !important;
    z-index: 1 !important;
    border: 2px solid transparent !important;
    border-radius: 6px !important;
    background-clip: padding-box !important;
}

.rainbow-outline::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(
        from 0deg,
        #ff4b1f,
        #ff9a00,
        #f9f871,
        #00f260,
        #00c9ff,
        #845ec2,
        #ff4b1f
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    animation: rainbowBorderSpin 4s linear infinite;
    z-index: -1;
}

@keyframes rainbowBorderSpin {
    to {
        transform: rotate(360deg);
    }
}

.form-group input[type="text"]::placeholder {
    color: rgba(0,0,0,0.5);
}

.pixels-preview {
    margin-top: 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.info-text {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.4;
}

.wallet-address-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wallet-address-container input[type="text"] {
    flex: 1;
    min-width: 0;
}

.wallet-address-container .btn-icon {
    flex: 0 0 auto;
}

.orders-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.orders-section h4 {
    margin-bottom: 12px;
}

.order-item {
    background: rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 0;
    margin-bottom: 10px;
    font-size: 0.85rem;
    line-height: 1.6;
}

.order-item div {
    margin-bottom: 5px;
}

.order-wallet-code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    word-break: break-all;
    display: block;
    margin-top: 2px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.4);
}

.order-wallet-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-wallet-row .order-wallet-code {
    flex: 1;
}

.order-wallet-row .order-qr-btn {
    margin-left: auto;
}

.order-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.order-status.pending {
    background: #ffc107;
    color: #856404;
}

.order-status.completed {
    background: #28a745;
    color: white;
}

#orderBagsInput {
    border-width: 6px;
    border-style: solid;
    border-color: #ff4b1f;
    animation: rainbowBorderColors 4s linear infinite;
    padding: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);}

@keyframes rainbowBorderColors {
    0% { border-color: #ff4b1f; }
    16% { border-color: #ff9a00; }
    32% { border-color: #f9f871; }
    48% { border-color: #00f260; }
    64% { border-color: #00c9ff; }
    80% { border-color: #845ec2; }
    100% { border-color: #ff4b1f; }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    padding: 20px;
    overflow: auto;
}

.canvas-wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
    height: 100%;
    flex: 1 1 auto;
}

.canvas-container {
    background: transparent;
    padding: 10px;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border: 2px solid #333;
    overflow: hidden;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.canvas-inner {
    position: relative;
    display: inline-block;
}

.canvas-background {
    position: absolute;
    inset: 0;
    background-image: url('../i/bg.webp');
    opacity: 0.1;
    background-blend-mode: lighten;
    background-repeat: repeat;
    background-size: auto;
    animation: solpixelsBgScroll 30s linear infinite;
    z-index: 0;
    pointer-events: none;
}

#pixelCanvas {
    position: relative;
    z-index: 1;
    display: block;
    border: 0;
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 100%;
    height: auto;
    max-height: 100%;
}

.pixel-preview-cursor {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    border: 1px solid white;
    pointer-events: none;
    display: none;
}

.canvas-hint {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    text-align: center;
}

.leaderboard-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.leaderboard-item {
    background: rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.leaderboard-rank {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 30px;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-username {
    font-weight: 600;
    margin-bottom: 3px;
}

.leaderboard-username a {
    color: white;
    text-decoration: none;
}

.leaderboard-username a:hover {
    text-decoration: underline;
}

.leaderboard-pixels {
    font-size: 0.85rem;
    opacity: 0.9;
}

.help-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 950;
}

.help-modal {
    position: relative;
    background: #111827;
    color: #f9fafb;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.help-modal h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.help-modal h3 {
    font-size: 1.1rem;
    margin-top: 14px;
    margin-bottom: 8px;
}

.help-modal p,
.help-modal ul {
    font-size: 0.9rem;
    line-height: 1.6;
}

.help-modal ul {
    margin-left: 20px;
}

.help-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 3rem;
    cursor: pointer;
}

.help-modal-close:hover {
    color: #e5e7eb;
}

.hidden {
    display: none !important;
}

@keyframes solpixelsBgScroll {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 0px 1024px;
    }
}

@media (max-width: 1400px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 1024px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 40vh;
    }

    .sidebar-right {
        display: none;
    }

    .main-content {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .sidebar-header h1 {
        font-size: 1.5rem;
    }

    #pixelCanvas {
        max-width: calc(100vw - 40px);
    }
}

a {
    color: #1a8cd8;
}