:root {
    --primary: #8b4513;
    --secondary: #2c3e50;
    --accent: #c0392b;
    --bg: #fdfbf7;
    --text: #333;
    --circle-border: #3498db;
    --poly-fill: rgba(139, 69, 19, 0.1);
    --poly-stroke: #d35400;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background: var(--secondary);
    color: white;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

h1 {
    margin: 0;
    font-size: 1.3rem;
    letter-spacing: 1.5px;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: normal;
}

main {
    display: flex;
    position: relative;
    padding: 15px;
    gap: 15px;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

/* 左侧画布区域 */
.canvas-container {
    flex: 1.5;
    min-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 1px solid #eee;
}


canvas {
    display: block;
}

/* 右上角放大镜 */
.magnifier {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    height: 240px;
    background: #fff;
    border: 3px solid #c0392b;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 10;
}

#magnifierCanvas {
    width: 100%;
    height: 100%;
}


/* 右侧控制面板 */
.controls-panel {
    flex: 1;
    min-width: 320px;
    max-width: 380px;
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.panel-section {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag {
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}

.data-card {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.data-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--primary);
}

.highlight-value {
    font-size: 1.3rem;
    color: var(--accent);
    display: block;
    text-align: right;
    margin-top: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.slider-container {
    margin-top: 8px;
}

input[type=range] {
    width: 100%;
    margin: 8px 0;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #666;
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

button {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: var(--secondary);
    color: white;
}

.btn-primary:hover {
    background: #34495e;
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: white;
    grid-column: span 2;
}

.btn-accent:hover {
    background: #a93226;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: #f0f0f0;
}

.explanation {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.5;
    background: #fff8e1;
    padding: 10px;
    border-radius: 6px;
}

.explanation p {
    margin: 6px 0;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    main {
        flex-direction: column;
    }

    .canvas-container {
        min-height: 400px;
    }

    .controls-panel {
        max-width: none;
    }
}