* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow: hidden;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn.primary {
    background: #4CAF50;
    border-color: #4CAF50;
}

.btn.danger {
    background: #f44336;
    border-color: #f44336;
}

.btn.small {
    padding: 4px 8px;
    font-size: 12px;
}

.panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 350px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 20px;
    z-index: 900;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.panel h3 {
    margin-bottom: 15px;
    color: #4CAF50;
    font-size: 1.2rem;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
    font-size: 14px;
}

textarea {
    width: 100%;
    min-height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 12px;
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

textarea[readonly] {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
    border-color: rgba(255, 255, 255, 0.2);
}

.json-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.action-buttons .btn {
    flex: 1;
}

.json-info {
    margin-top: 8px;
    padding: 8px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 4px;
}

.json-info small {
    color: #81C784;
    font-size: 11px;
}

.json-status {
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 12px;
    display: none;
}

.json-status.valid {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #4CAF50;
}

.json-status.invalid {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: #f44336;
}

.stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    display: none;
}

.stats h4 {
    color: #64B5F6;
    margin-bottom: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 13px;
}

.error, .success {
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
}

.viewer-header {
    justify-content: space-between;
}

.viewer-message {
    position: fixed;
    top: 88px;
    left: 24px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.45);
    color: #e2e8f0;
    z-index: 950;
    max-width: 320px;
    font-size: 0.92rem;
    line-height: 1.4;
    display: none;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(10px);
}

.viewer-message.viewer-error {
    background: rgba(185, 28, 28, 0.88);
    border-color: rgba(248, 113, 113, 0.6);
    color: #fff;
}

.viewer-message.viewer-success {
    background: rgba(34, 197, 94, 0.88);
    border-color: rgba(134, 239, 172, 0.6);
    color: #022c22;
}

.viewer-message.viewer-info {
    background: rgba(14, 116, 144, 0.82);
    border-color: rgba(125, 211, 252, 0.5);
    color: #e0f2fe;
}

.stats-overlay {
    position: fixed;
    bottom: 24px;
    left: 24px;
    padding: 18px 22px;
    min-width: 260px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
    z-index: 940;
    display: none;
    box-shadow: 0 25px 45px rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
}

.stats-overlay h4 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: #60a5fa;
}

.stats-overlay .stats-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.stats-overlay .stats-row strong {
    color: #f8fafc;
}

.viewer-canvas {
    position: fixed;
    inset: 0;
    z-index: 100;
}

body.viewer-mode {
    overflow: hidden;
}

body.landing-page {
    margin: 0;
    font-family: "Segoe UI", Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

.landing-hero {
    position: relative;
    min-height: 68vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5vw;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.35), rgba(15, 23, 42, 0.95));
    overflow: hidden;
}

.landing-overlay {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(120deg, rgba(30, 64, 175, 0.35), rgba(15, 118, 110, 0.2));
    opacity: 0.65;
}

.landing-content {
    position: relative;
    max-width: 720px;
    text-align: center;
    z-index: 2;
}

.landing-content h1 {
    font-size: clamp(2.6rem, 4vw, 3.4rem);
    margin-bottom: 18px;
    color: #f8fafc;
}

.landing-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(226, 232, 240, 0.92);
    margin-bottom: 28px;
}

.landing-actions {
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-main {
    background: radial-gradient(circle at top, rgba(30, 64, 175, 0.08), rgba(15, 23, 42, 0.92));
}

.landing-section {
    padding: 68px 6vw;
}

.landing-section.alt {
    background: rgba(15, 23, 42, 0.95);
}

.landing-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 34px;
    color: #bfdbfe;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
}

.landing-grid article {
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.45);
}

.landing-grid h3 {
    color: #facc15;
    margin-bottom: 12px;
}

.landing-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: stretch;
}

.landing-columns > div {
    flex: 1 1 280px;
}

.landing-steps {
    list-style: decimal;
    padding-left: 20px;
    line-height: 1.7;
    color: rgba(226, 232, 240, 0.88);
}

.landing-card {
    background: linear-gradient(160deg, rgba(59, 130, 246, 0.2), rgba(15, 118, 110, 0.18));
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 22px 60px rgba(14, 165, 233, 0.18);
}

.landing-form {
    display: grid;
    gap: 18px;
    flex: 1 1 320px;
    background: rgba(15, 23, 42, 0.85);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid rgba(30, 64, 175, 0.18);
}

.landing-form input,
.landing-form textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.8);
    color: #f8fafc;
}

.landing-form input:focus,
.landing-form textarea:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.landing-footer {
    background: rgba(15, 23, 42, 0.95);
    padding: 24px 6vw;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(59, 130, 246, 0.18);
}

.landing-footer nav {
    display: flex;
    gap: 18px;
}

.landing-footer a {
    color: rgba(191, 219, 254, 0.85);
    text-decoration: none;
}

.landing-footer a:hover {
    color: #f8fafc;
}

@media (max-width: 720px) {
    .landing-actions {
        flex-direction: column;
    }
    .landing-form {
        padding: 22px;
    }
    .landing-footer {
        flex-direction: column;
        text-align: center;
    }
}

.error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    z-index: 2000;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #4CAF50;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#containerInput {
    min-height: 60px !important;
}

#outputJSON {
    min-height: 160px;
    font-size: 11px;
    opacity: 0.9;
}