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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #a6b9e2 100%);
    color: white;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    font-size: 1.8em;
    font-weight: 600;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #e8ecf1;
}

.panel {
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 250px;
}

.panel.left {
    flex: 0 0 50%;
}

.panel.right {
    flex: 1;
}

.divider {
    width: 4px;
    background: #cbd5e0;
    cursor: col-resize;
    position: relative;
    transition: background 0.2s;
}

.divider:hover {
    background: #667eea;
}

.divider:active {
    background: #764ba2;
}

.panel-header {
    background: #f8fafc;
    padding: 10px 20px 0px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.panel-title {
    font-weight: 600;
    font-size: 1.3em;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title-short {
    display: none;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

button {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

.run-btn {
    background: linear-gradient(135deg, #10b981, #059669);
}

.run-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
}

.stop-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stop-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.menu-btn {
    background: linear-gradient(135deg, #7a9eaf, #4d6c7b);
}

.menu-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #6a8e9f, #3d5c6b);
}

.save-img-btn {
    background: linear-gradient(135deg, #a7326c, #941a51);
}

.save-img-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #db2777, #be185d);
}

.fullscreen-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.fullscreen-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Menu container and dropdown */
.menu-container {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 8px;
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.dropdown-menu.output-menu {
    min-width: 220px;
}

.dropdown-menu.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-item {
    width: 100%;
    padding: 10px 16px;
    background: white;
    color: #2d3748;
    border: none;
    border-radius: 0;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}

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

.menu-item:hover {
    background: #f8fafc;
    transform: none;
    box-shadow: none;
}

.menu-icon {
    font-size: 16px;
}

.menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

.menu-checkbox-item {
    width: 100%;
    padding: 10px 16px;
    background: white;
    color: #2d3748;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    user-select: none;
}

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

.menu-checkbox-item:hover {
    background: #f8fafc;
}

.menu-checkbox-item input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
}

.menu-checkbox-item span {
    flex: 1;
}

.menu-slider-item {
    padding: 10px 16px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
}

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

.menu-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: #2d3748;
}

.menu-slider-value {
    font-weight: 600;
    color: #667eea;
    font-size: 13px;
}

.menu-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.menu-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.menu-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.project-title-display {
    font-size: 0.85em;
    color: #64748b;
    font-weight: 400;
    margin-left: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.project-title-display:hover {
    background: #f1f5f9;
    color: #667eea;
}

.project-title-input {
    font-size: 0.85em;
    color: #2d3748;
    font-weight: 400;
    margin-left: 8px;
    padding: 4px 8px;
    border: 2px solid #667eea;
    border-radius: 4px;
    background: white;
    font-family: inherit;
    outline: none;
}

.save-indicator {
    font-size: 0.75em;
    color: #10b981;
    font-weight: 500;
    margin-left: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #d1fae5;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.save-indicator.unsaved {
    color: #f59e0b;
    background: #fef3c7;
}

.save-icon {
    font-size: 0.6em;
    line-height: 1;
}

.save-indicator.unsaved .save-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
    gap: 10px;
}

.editor-container {
    flex: 1;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    min-height: 300px;
}

.CodeMirror {
    height: 100%;
    font-size: 14px;
    border-radius: 8px;
}

/* Error line highlighting */
.error-line {
    background-color: rgba(255, 100, 100, 0.15) !important;
}

.error-gutter {
    background-color: rgba(255, 50, 50, 0.3) !important;
}

.CodeMirror-gutter-wrapper .error-gutter::before {
    content: "⚠";
    color: #e53e3e;
    font-weight: bold;
}

/* Turtle Command Reference Panel */
.reference-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.reference-header {
    background: linear-gradient(135deg, #667eea 0%, #a6b9e2 100%);
    color: white;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.reference-header:hover {
    background: linear-gradient(135deg, #5568d3 0%, #95a8d1 100%);
}

.reference-title {
    font-weight: 600;
    font-size: 14px;
}

.reference-toggle {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.reference-toggle.collapsed {
    transform: rotate(-90deg);
}

.reference-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 20px;
}

.reference-section {
    margin-bottom: 15px;
}

.reference-section:last-of-type {
    margin-bottom: 0;
}

.reference-section h4 {
    color: #2d3748;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #e2e8f0;
}

.command-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    margin: 4px 0;
    background: #f8fafc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.command-item:hover {
    background: #e6f2ff;
    transform: translateX(4px);
}

.command-item code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.command-item span {
    font-size: 11px;
    color: #718096;
}

.reference-tip {
    margin-top: 15px;
    padding: 10px;
    background: #fef5e7;
    border-left: 3px solid #f39c12;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
}

.reference-tip kbd {
    background: white;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
}

.output-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    overflow: auto;
    background: #f8fafc;
}

.output-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.output-section:first-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.output-section.hidden {
    display: none;
}

.output-header {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Canvas container - ensures proper centering and scaling */
.canvas-wrapper {
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 0;
}

#turtlecanvas {
    /* Make canvas responsive while maintaining aspect ratio */
    width: 100%;
    max-width: 550px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    display: block;
    position: relative;
}

/* When console is hidden, allow canvas to grow larger */
body.console-hidden #turtlecanvas {
    max-width: 700px;
}

body.console-hidden .grid-overlay {
    max-width: 700px;
}

/* Canvas elements inside the container - let Skulpt position them naturally */
#turtlecanvas canvas {
    display: block;
    margin: 0 auto;
}

/* Grid overlay */
.grid-overlay {
    position: absolute;
    width: 100%;
    max-width: 550px;
    aspect-ratio: 1 / 1;
    pointer-events: none;
    z-index: 10;
}

/* Grid line styles are now set dynamically via JavaScript */

.grid-toggle-btn {
    background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
}

.grid-toggle-btn:hover {
    background: linear-gradient(135deg, #319795 0%, #2c7a7b 100%);
    transform: translateY(-1px);
}

.grid-toggle-btn.active {
    background: linear-gradient(135deg, #2c7a7b 0%, #285e61 100%);
}

#output {
    background: #1a202c;
    color: #48bb78;
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 12px;
    border-radius: 6px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.error-output {
    color: #fc8181 !important;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 90%;
    animation: slideUp 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    font-size: 1.4em;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    text-align: center;
}

.modal-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-option {
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    width: 100%;
    font-family: inherit;
    text-align: left;
}

.modal-option:hover {
    border-color: #667eea;
    background: #f7fafc;
    transform: translateX(4px);
}

.modal-option-title {
    font-weight: 600;
    color: #2d3748;
}

.modal-option-desc {
    font-size: 12px;
    color: #718096;
    margin-top: 4px;
}

.reset-settings-btn {
    margin-top: 20px;
    width: 100%;
    padding: 10px;
    background: #fed7d7;
    color: #742a2a;
    border: 2px solid #fc8181;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.reset-settings-btn:hover {
    background: #fc8181;
    color: #fff;
}

.modal-close {
    margin-top: 20px;
    width: 100%;
    padding: 10px;
    background: #cbe0d6;
    color: #33482d;
    border: 2px solid #4aaa72;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.modal-close:hover {
    background: #a0aec0;
}

/* Share Modal Styles */
.share-content {
    padding: 10px 0;
}

.share-description {
    color: #4a5568;
    font-size: 14px;
    margin-bottom: 15px;
}

.share-url-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.share-url-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #2d3748;
    background: #f8fafc;
}

.share-url-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.share-copy-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.share-copy-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
}

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

.share-note {
    color: #718096;
    font-size: 12px;
    font-style: italic;
}

/* Color Picker Modal Styles */
#colorPickerModal .modal-content {
    max-width: 550px;
}

.color-format-group {
    margin-bottom: 20px;
}

.color-format-options {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.color-format-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    flex: 1;
    transition: all 0.2s;
}

.color-format-option:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.color-format-option input[type="radio"] {
    cursor: pointer;
}

.color-format-option input[type="radio"]:checked ~ span,
.color-format-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #eef2ff;
}

.format-example {
    font-size: 11px;
    color: #718096;
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 3px;
}

.color-picker-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.custom-color-picker {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 10px;
}

.custom-color-picker input[type="color"] {
    width: 60px;
    height: 60px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-color-picker input[type="color"]:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.color-preview-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.color-preview {
    width: 100%;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.color-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #4a5568;
    text-align: center;
    font-weight: 600;
}

.insert-color-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
    height: 60px;
}

.insert-color-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
}

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

.color-palette-section {
    margin-bottom: 20px;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.color-box {
    aspect-ratio: 1;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.color-box:hover {
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.color-label {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 6px;
    font-size: 10px;
    text-align: center;
    width: 100%;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 500;
    text-transform: capitalize;
}

.color-box:hover .color-label {
    opacity: 1;
}

/* Prevent text selection while dragging */
body.dragging {
    user-select: none;
    cursor: col-resize !important;
}

body.dragging * {
    cursor: col-resize !important;
}

/* Notification toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2d3748;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 14px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

/* Hidden canvas for rendering */
#hiddenCanvas {
    position: absolute;
    left: -10000px;
    top: -10000px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Settings icon */
.settings-icon {
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 0 !important;
    font-size: 1.1em;
    transition: transform 0.3s ease;
    display: inline-block;
    box-shadow: none !important;
}

.settings-icon:hover {
    transform: rotate(90deg) translateY(0) !important;
}

.settings-icon:active {
    transform: rotate(90deg) translateY(0) !important;
}

/* Settings modal specific styles */
.settings-group {
    margin-bottom: 25px;
}

.settings-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    display: block;
    font-size: 14px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

.theme-option {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 13px;
    background: white;
    width: 100%;
    font-family: inherit;
    color: #2d3748;
}

.theme-option:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.theme-option.active {
    border-color: #667eea;
    background: #edf2f7;
    font-weight: 600;
    color: #667eea;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.font-size-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.font-size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.font-size-value {
    font-weight: 600;
    color: #2d3748;
    min-width: 45px;
    text-align: right;
}

/* Keyboard Shortcuts Modal Styles */
#keyboardShortcutsModal .modal-content {
    max-width: 600px;
}

.shortcuts-list {
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.shortcuts-column {
    display: flex;
    flex-direction: column;
}

.shortcut-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.shortcuts-column .shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-item kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: #2d3748;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-right: 3px;
}

.shortcut-desc {
    margin-left: 10px;
    color: #4a5568;
    font-size: 13px;
    flex: 1;
}

/* Fullscreen mode styles */
.fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #f5f7fa;
    z-index: 9999;
}

.fullscreen-container .header {
    display: none;
}

.fullscreen-container .main-container {
    height: 100vh;
    display: flex;
    gap: 20px;
    padding: 20px;
    justify-content: center;
}

.fullscreen-container .panel.left {
    flex: 1;
    min-width: 300px;
    max-width: none;
}

.fullscreen-container .panel.left .panel-header {
    display: none;
}

.fullscreen-container .divider {
    display: none;
}

.fullscreen-container .panel.right {
    flex: 0 0 auto;
    max-width: none;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.fullscreen-container .panel.right .panel-header {
    display: none;
}

.fullscreen-container .output-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    overflow-y: auto;
}

.fullscreen-container .output-section {
    width: 100%;
    max-width: none;
    margin-top: 20px;
}

.fullscreen-container .output-section:first-child {
    margin-top: 0;
}

.fullscreen-container .output-header {
    display: none;
}

.fullscreen-container #turtlecanvas {
    width: min(calc(100vh - 80px), calc(100vw - 400px));
    height: min(calc(100vh - 80px), calc(100vw - 400px));
    max-width: none;
    aspect-ratio: 1 / 1;
}

.fullscreen-container .grid-overlay {
    width: min(calc(100vh - 80px), calc(100vw - 400px));
    height: min(calc(100vh - 80px), calc(100vw - 400px));
    max-width: none;
    aspect-ratio: 1 / 1;
}

.fullscreen-container .editor-wrapper {
    padding: 0;
    height: 100%;
}

.fullscreen-container .editor-container {
    height: 100%;
}

/* Exit fullscreen indicator */
.exit-fullscreen-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    display: none;
    animation: fadeInOut 3s ease-in-out;
}

.exit-fullscreen-hint.show {
    display: block;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* Coordinate tooltip */
.coordinate-tooltip {
    position: absolute;
    background: rgba(45, 55, 72, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    white-space: nowrap;
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

.coordinate-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(45, 55, 72, 0.95);
}

/* Crosshair cursor for canvas when hovering */
#turtlecanvas {
    cursor: crosshair;
}

#turtlecanvas canvas {
    cursor: crosshair;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 880px) {
    body {
        overflow: auto;
    }

    .main-container {
        flex-direction: column;
        overflow: visible;
        min-height: 100vh;
    }

    .panel.left, .panel.right {
        flex: 0 0 auto;
        min-height: 300px;
        overflow: visible;
    }

    .divider {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }

    /* Hide button text on mobile, show only icons */
    .run-btn,
    .stop-btn,
    .grid-toggle-btn,
    .fullscreen-btn,
    .save-img-btn {
        font-size: 0;
        padding: 7px 10px;
    }

    .run-btn::before {
        content: '▶';
        font-size: 16px;
    }

    .stop-btn::before {
        content: '⏹';
        font-size: 16px;
    }

    .grid-toggle-btn::before {
        content: '⊞';
        font-size: 16px;
    }

    .fullscreen-btn::before {
        content: '⛶';
        font-size: 16px;
    }

    .save-img-btn::before {
        content: '⊡';
        font-size: 16px;
    }

    /* Hide save indicator text on mobile, show only icon */
    .save-indicator .save-text {
        display: none;
    }

    .save-indicator {
        padding: 4px 8px;
        margin-left: 8px;
    }

    /* Hide project filename on mobile to save space */
    .project-title-display {
        display: none;
    }

    /* Show shorter "Editor" instead of "Code Editor" on mobile */
    .panel-title-full {
        display: none;
    }

    .panel-title-short {
        display: inline;
    }
}

@media (max-width: 600px) {
    .shortcuts-list {
        grid-template-columns: 1fr;
        gap: 0;
    }

    #keyboardShortcutsModal .modal-content {
        max-width: 95%;
    }

    #colorPickerModal .modal-content {
        max-width: 95%;
    }

    .color-format-options {
        flex-direction: column;
    }

    .color-palette {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* CodeMirror Search/Replace Dialog Styling */
.CodeMirror-dialog {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    padding: 8px 12px !important;
    border: none !important;
}

.CodeMirror-dialog-top {
    border-bottom: 2px solid #667eea !important;
}

.CodeMirror-dialog-bottom {
    border-top: 2px solid #667eea !important;
}

.CodeMirror-dialog input {
    background: #1a202c !important;
    color: #e2e8f0 !important;
    border: 1px solid #4a5568 !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-family: 'Consolas', 'Monaco', monospace !important;
}

.CodeMirror-dialog input:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
}

.CodeMirror-dialog button {
    background: #667eea !important;
    color: white !important;
    border: none !important;
    padding: 4px 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    margin-left: 4px !important;
}

.CodeMirror-dialog button:hover {
    background: #5568d3 !important;
}

.CodeMirror-dialog span {
    color: #e2e8f0 !important;
}
