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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8fafc;
    color: #334155;
    overflow: hidden;
    height: 100vh;
}

/* Header */
.header {
    background: #1e293b;
    color: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #334155;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-subtitle {
    font-size: 0.875rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* Main Container */
.main-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
}

/* Toolbar */
.toolbar {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar-divider {
    width: 1px;
    height: 2rem;
    background: #e2e8f0;
    margin: 0 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: transparent;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-secondary {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-secondary:hover {
    background: #059669;
    border-color: #059669;
}

.btn-outline {
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Samples dropdown */
.samples-select {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.samples-select:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.samples-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Content Area */
.content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Board Container */
.board-container {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #f8fafc;
}

.board {
    position: relative;
    width: 100%;
    min-height: 100%;
    min-width: 2000px;
    min-height: 1500px;
}

/* SVG Connectors Layer */
.connectors-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connector-path {
    fill: none;
    stroke: #6366f1;
    stroke-width: 2;
    stroke-linecap: round;
}

.connector-arrow {
    fill: #6366f1;
}

/* Scene Cards */
.scene {
    position: absolute;
    width: 220px;
    min-height: 140px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: move;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    z-index: 2;
    overflow: hidden;
}

.scene:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.scene.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.scene.dragging {
    z-index: 1000;
    transform: rotate(2deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.scene-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.scene-text {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scene-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.choice-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Inspector Panel */
.inspector {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: calc(100vh - 84px);
  min-width: 300px;
  max-width: 440px;
  overflow: hidden;
}

.inspector-header {
  flex: 0 0 auto;
  padding: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--panel-header-bg, #fff);
}

.inspector-content {
  flex: 1 1 auto;
  min-height: 0; 
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}

.inspector-form {
  flex: 0 0 auto;
  overflow: auto;
  max-height: 60vh;
  padding: 12px;
}

.choices-list,
.hints-list,
.image-gallery,
#unsplashResults {
  max-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.inspector .form-group { margin-bottom: 12px; }
.inspector .btn-small { padding: 6px 8px; }


.inspector-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #94a3b8;
}

.inspector-empty i {
    display: block;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.inspector-form {
    padding: 0;
} */

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Choices Section */
.choices-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.choices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.choices-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.choices-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.choice-item {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.choice-item-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.choice-item-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.choice-delete {
    padding: 0.25rem;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.choice-delete:hover {
    background: #fee2e2;
}

.choice-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-text {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.choice-target {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    background: white;
}

/* Preview Overlay */
.preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container {
    background: white;
    border-radius: 1rem;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.preview-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.preview-content {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.preview-scene h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1e293b;
}

.preview-scene p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: #4b5563;
}

.preview-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-choice {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 1rem;
}

.preview-choice:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.preview-choice.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #fef2f2;
    color: #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        height: calc(100vh - 60px);
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .toolbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .content-area {
        flex-direction: column;
    }
    
    .inspector {
        width: 100%;
        height: 40%;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }
    
    .scene {
        width: 180px;
        min-height: 100px;
        padding: 0.75rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scene.new {
    animation: fadeIn 0.3s ease;
}

.choice-item.new {
    animation: fadeIn 0.3s ease;
}

/* Image Controls */
.image-controls {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
}

.image-type-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.radio-label input[type="radio"] {
    margin: 0;
}

.image-option {
    margin-bottom: 1rem;
}

.help-text {
    display: block;
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.image-gallery img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 0.25rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.image-gallery img:hover {
    border-color: #3b82f6;
}

.image-gallery img.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

.emoji-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.emoji-btn {
    padding: 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.emoji-btn:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
}

.image-preview {
    margin-top: 1rem;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.image-preview .emoji-preview {
    font-size: 4rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    display: inline-block;
}

/* Scene Image Display */
.scene-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.scene-emoji {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 0.75rem;
    display: block;
    height: 80px;
    line-height: 80px;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.scene-category {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.scene-category.question {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.scene-category.info {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.scene-category.decision {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

/* Hints Section */
.hints-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.hints-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.hints-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.hints-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hint-item {
    padding: 0.75rem;
    background: #fef7ed;
    border: 1px solid #fed7aa;
    border-radius: 0.5rem;
    position: relative;
}

.hint-item input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #9a3412;
}

.hint-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    border-radius: 0.25rem;
}

.hint-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-container {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-container.large {
    max-width: 900px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.modal-content {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    text-align: right;
}

/* Analytics Styles */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.analytics-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.analytics-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #64748b;
    font-size: 0.875rem;
}

.stat-value {
    font-weight: 600;
    color: #1e293b;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}
