/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 頂部標題欄 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-left, .header-right {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-center h1 {
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.version-text {
    font-size: 10px;
    color: #666;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 8px;
}

/* 操作列樣式 */
.button-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.control-button:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.control-button:hover:not(:disabled) {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.control-button.togglable.active {
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    background: #0d47a1;
}

.control-button.togglable:not(.active) {
    background: #aaa;
    color: white;
}

.control-item {
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 4px;
}

.control-item input[type="checkbox"] {
    accent-color: #2196F3;
}

/* 主體內容區域 */
.main-container {
    flex: 1;
    display: flex;
    height: calc(100vh - 50px);
    min-height: 0;
}

.canvas-container {
    flex: 1;
    position: relative;
    margin: 10px;
    margin-right: 5px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    background: white;
}

#canvas, #svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#canvas {
    cursor: crosshair;
    z-index: 1;
}

#svg {
    pointer-events: none;
    z-index: 2;
}

.console {
    width: 280px;
    background: rgba(0, 0, 0, 0.9);
    color: #40c080;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    padding: 15px;
    margin: 10px;
    margin-left: 5px;
    border-radius: 12px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.console::-webkit-scrollbar {
    width: 6px;
}

.console::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 3px;
}

/* 響應式設計 */
@media (orientation: portrait) {
    .main-container {
        flex-direction: column;
    }

    .canvas-container {
        flex: 1;
        margin: 10px;
        margin-bottom: 5px;
        min-height: 0;
    }

    .console {
        width: auto;
        height: 90px;
        margin: 5px 10px 10px 10px;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .header {
        height: 45px;
        padding: 0 10px;
    }

    .header-center h1 {
        font-size: 16px;
    }

    .control-button {
        font-size: 12px;
        padding: 5px 8px;
    }

    .version-text {
        font-size: 9px;
    }

    .console {
        font-size: 11px;
        padding: 10px;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    }

    .header {
        background: rgba(30, 30, 30, 0.95);
    }

    .header-center h1 {
        color: #fff;
    }

    .version-text {
        color: #ccc;
        background: rgba(255, 255, 255, 0.1);
    }

    .control-button {
        background: #1565C0;
    }

    .control-button:hover {
        background: #0D47A1;
    }

    .console {
        background: rgba(0, 0, 0, 0.85);
        color: #00ff99;
    }
}
