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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 200px;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px;
    border-right: 2px solid #00b4d8;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    position: relative;
}

#canvas-container {
    width: 100%;
    height: 100%;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00b4d8;
}

.header h1 {
    font-size: 20px;
    margin-bottom: 5px;
    color: #00b4d8;
}

.header p {
    font-size: 12px;
    color: #90e0ef;
}

.control-section {
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #00b4d8;
}

.control-section h3 {
    color: #00b4d8;
    margin-bottom: 8px;
    font-size: 14px;
}

.fractal-type {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.fractal-select {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    border: 1px solid #00b4d8;
    color: white;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    margin-bottom: 15px;
}

.fractal-select option {
    background: #1a1a2e;
    color: white;
}

.fractal-btn {
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: center;
}

.fractal-btn:hover {
    background: linear-gradient(135deg, #0077b6, #005f8a);
    transform: translateY(-2px);
}

.fractal-btn.active {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.action-btn:hover {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
}

.info-panel {
    background: rgba(0, 0, 0, 0.9);
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #4cc9f0;
}

.info-panel h4 {
    color: #4cc9f0;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-panel p {
    font-size: 11px;
    line-height: 1.3;
    color: #caf0f8;
}

.param-group {
    margin-bottom: 10px;
}

.param-group label {
    display: block;
    margin-bottom: 5px;
    color: #90e0ef;
    font-size: 12px;
}

.param-group input[type="range"] {
    width: 100%;
    margin: 5px 0;
}

.param-value {
    font-size: 11px;
    color: #caf0f8;
    text-align: right;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.action-btn {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.action-btn:hover {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
}

.info-panel {
    background: rgba(0, 0, 0, 0.9);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #4cc9f0;
}

.info-panel h4 {
    color: #4cc9f0;
    margin-bottom: 10px;
}

.info-panel p {
    font-size: 12px;
    line-height: 1.4;
    color: #caf0f8;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #00b4d8;
    font-size: 18px;
    text-align: center;
}

.stats {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    color: #90e0ef;
}

.rule-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #00b4d8;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
    margin-top: 5px;
}

.rule-input:focus {
    outline: none;
    border-color: #4cc9f0;
    box-shadow: 0 0 5px rgba(76, 201, 240, 0.5);
}

.rule-editor label {
    color: #90e0ef;
    font-size: 12px;
    display: block;
    margin-bottom: 5px;
}

.edit-rule-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.edit-rule-btn:hover {
    background: linear-gradient(135deg, #ee5a24, #d63031);
}

/* 弹出式规则编辑器 */
.rule-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.rule-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #00b4d8;
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 180, 216, 0.3);
}

.rule-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #00b4d8;
}

.rule-modal-title {
    color: #00b4d8;
    font-size: 18px;
    font-weight: bold;
}

.rule-modal-close {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
}

.rule-modal-close:hover {
    background: rgba(255, 107, 107, 0.1);
}

.rule-section {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #4cc9f0;
}

.rule-section h4 {
    color: #4cc9f0;
    margin-bottom: 10px;
    font-size: 14px;
}

.rule-list {
    margin-bottom: 15px;
}

.rule-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.rule-symbol {
    background: rgba(76, 201, 240, 0.1);
    border: 1px solid #4cc9f0;
    border-radius: 4px;
    padding: 8px;
    color: white;
    text-align: center;
    font-weight: bold;
}

.rule-production {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #00b4d8;
    border-radius: 4px;
    padding: 8px;
    color: white;
    font-family: 'Courier New', monospace;
}

.rule-actions {
    display: flex;
    gap: 5px;
}

.rule-action-btn {
    background: rgba(76, 201, 240, 0.2);
    border: 1px solid #4cc9f0;
    border-radius: 3px;
    color: #4cc9f0;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
}

.rule-action-btn:hover {
    background: rgba(76, 201, 240, 0.4);
}

.rule-param-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.rule-param-item {
    display: flex;
    flex-direction: column;
}

.rule-param-label {
    color: #90e0ef;
    font-size: 12px;
    margin-bottom: 5px;
}

.rule-param-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #00b4d8;
    border-radius: 4px;
    padding: 8px;
    color: white;
    font-size: 12px;
}

.rule-param-input:focus {
    outline: none;
    border-color: #4cc9f0;
    box-shadow: 0 0 5px rgba(76, 201, 240, 0.5);
}

.rule-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #00b4d8;
}

.rule-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.rule-modal-apply {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
    color: white;
}

.rule-modal-apply:hover {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
}

.rule-modal-cancel {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.rule-modal-cancel:hover {
    background: rgba(255, 107, 107, 0.4);
}

.add-rule-btn {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
}

.add-rule-btn:hover {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
}

/* 参数控制模态框 */
.param-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1001;
    backdrop-filter: blur(5px);
}

.param-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #ff6b6b;
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.3);
}

.param-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ff6b6b;
}

.param-modal-title {
    color: #ff6b6b;
    font-size: 18px;
    font-weight: bold;
}

.param-modal-close {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
}

.param-modal-close:hover {
    background: rgba(255, 107, 107, 0.1);
}

.param-section {
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ff6b6b;
}

.param-section h4 {
    color: #ff6b6b;
    margin-bottom: 8px;
    font-size: 14px;
}

.param-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ff6b6b;
}

.param-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.param-modal-apply {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.param-modal-apply:hover {
    background: linear-gradient(135deg, #ee5a24, #d63031);
}

.param-modal-cancel {
    background: rgba(76, 201, 240, 0.2);
    color: #4cc9f0;
    border: 1px solid #4cc9f0;
}

.param-modal-cancel:hover {
    background: rgba(76, 201, 240, 0.4);
}