/* ================================================================
   form.css · 表单模块全量样式
   ================================================================ */

.section-panel { display: none; animation: fadeIn 0.35s ease; }
.section-panel.active { display: block; }

.form-demo-box {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.form-group label { font-size: 13px; font-weight: 600; color: var(--accent-cyan); }
.form-group input, .form-group select, .form-group textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.form-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border: none;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}
.form-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4); }

/* ================================================================
   板块 1
   ================================================================ */
.form-box-mock {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 30px 20px;
  background: rgba(59, 130, 246, 0.05);
  border: 2px dashed rgba(59, 130, 246, 0.6);
  border-radius: 12px;
}
.form-box-label {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--bg-primary);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 4px;
}

.submit-anim-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}
.submit-anim-layer.active { display: flex; opacity: 1; }
.anim-data-packet {
  position: absolute;
  left: 15%;
  z-index: 2;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: bold;
  color: #000;
  background: var(--accent-green);
  border-radius: 20px;
  transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.anim-server {
  position: absolute;
  right: 10%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  font-weight: bold;
  color: var(--accent-cyan);
  text-align: center;
  background: rgba(6, 182, 212, 0.1);
  border: 2px solid var(--accent-cyan);
  border-radius: 8px;
}
.anim-server-target {
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-cyan);
  background: #000;
  border-radius: 4px;
}

/* ================================================================
   板块 2：input 全量字典专属样式 (完整独立版)
   ================================================================ */
/* ================================================================
   input 控制台：快递盒动画专属样式 (放入右侧面板)
   ================================================================ */

/* 外框包装 */
.packaging-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.packaging-area.active-glow {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

/* 快递盒 */
.express-box {
  width: 140px;
  height: 100px;
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 2px solid #475569;
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

/* 收件人标签 (name) */
.express-label {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 10px;
  font-weight: bold;
  padding: 4px 6px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.express-label::before {
  content: '收件人 (name): ';
  color: #64748b;
  font-size: 9px;
}

/* 物品 (value) */
.express-item {
  position: absolute;
  bottom: 10px;
  background: var(--accent-green);
  color: #000;
  font-size: 10px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(-60px) scale(0.5);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.express-item::before {
  content: '物品 (value): ';
  color: rgba(0, 0, 0, 0.6);
  font-size: 9px;
}

/* 控制区输入框 */
.packaging-controls {
  width: 100%;
  display: flex;
  gap: 10px;
}
.packaging-controls .control-group {
  flex: 1;
  margin-bottom: 0;
}

/* 动效触发类 */
.packaging-area.name-anim .express-box {
  animation: boxShake 0.4s ease;
}
.packaging-area.value-anim .express-item {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: dropIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes boxShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes dropIn {
  0% { transform: translateY(-60px) scale(0.5); opacity: 0; }
  70% { transform: translateY(5px) scale(1.1); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* --- 互斥警告高亮 --- */
.mutex-warning {
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid var(--accent-pink);
  color: var(--accent-pink);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  margin-top: 12px;
  width: 100%;
  text-align: center;
  animation: pulsePink 2s infinite;
}
@keyframes pulsePink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4); }
  50% { box-shadow: 0 0 10px 2px rgba(236, 72, 153, 0.4); }
}

/* --- 选项面板的 checked 按钮 --- */
.checked-options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.checked-btn {
  display: inline-block;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.checked-btn:hover {
  border-color: var(--accent-cyan);
}
.checked-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  font-weight: bold;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* --- 【大屏专属】单选/复选可视化分组与盖戳 --- */

.visual-group-wrapper {
  position: relative;
  padding-top: 40px;
  width: 100%;
  max-width: 360px;
}

.name-group-node {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 2px dashed var(--accent-blue);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent-blue);
  font-weight: bold;
  white-space: nowrap;
  z-index: 2;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.group-line-main {
  position: absolute;
  top: 28px;
  left: 50%;
  width: 2px;
  height: 20px;
  background: var(--accent-blue);
  opacity: 0.5;
}

.visual-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.visual-option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  user-select: none;
}

.visual-option-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: var(--accent-blue);
  opacity: 0.5;
}

.visual-option-item.is-checked {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.05);
}

.visual-option-item input {
  display: none;
}

.visual-box-mock {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s;
  flex-shrink: 0;
}

.visual-option-item[data-type="checkbox"] .visual-box-mock {
  border-radius: 4px;
}

.visual-option-item.is-checked .visual-box-mock {
  border-color: var(--accent-green);
  background: var(--accent-green);
}

.check-stamp {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) scale(3) rotate(-15deg);
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: bold;
  border: 2px solid var(--accent-green);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.visual-option-item.is-checked .check-stamp {
  opacity: 1;
  transform: translateY(-50%) scale(1) rotate(-15deg);
  animation: stampDown 0.3s ease;
}

@keyframes stampDown {
  0% { transform: translateY(-50%) scale(3) rotate(-15deg); opacity: 0; }
  100% { transform: translateY(-50%) scale(1) rotate(-15deg); opacity: 1; }
}

.visual-value-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 大屏底部控制台 */
.visual-console-box {
  margin-top: 20px;
  background: #000;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--bg-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #10b981;
  min-height: 60px;
  line-height: 1.6;
  width: 100%;
  max-width: 360px;
}

/* 选项组虚线框 */
.visual-group-border {
  border: 2px dashed rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.03);
  border-radius: 12px;
  padding: 24px 16px 16px;
  position: relative;
  width: 100%;
  max-width: 360px;
}

.visual-group-label {
  position: absolute;
  top: -12px;
  left: 20px;
  background: var(--bg-primary);
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* 两栏面板布局 */
.props-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.props-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.props-col-title {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: bold;
  margin-bottom: 4px;
}

/* 大屏提交按钮 */
.mock-submit-btn {
  width: 100%;
  max-width: 360px;
  padding: 12px;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
  font-weight: bold;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.mock-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

/* ================================================================
   板块 3：透明遮罩表单绑定方案 (精准修复版)
   ================================================================ */

/* 大屏容器 */
.form-container-relative {
    position: relative;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

/* 真正的表单界面 */
.form-real-ui {
    padding: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    position: relative;
    z-index: 2;
}

/* 内部按钮样式 */
.form-real-ui .btn-internal {
    margin-top: 24px;
    width: 100%;
}

/* 【核心】虚线遮罩框 - 精准覆盖输入区 */
.form-dashed-overlay {
    position: absolute;
    top: -15px;
    left: -15px;
    /* 动态计算高度：总高度减去底部留给按钮和间距的 80px */
    bottom: 90px; 
    right: -15px; /* 虚线框整体包住输入区 */
    border: 2px dashed var(--accent-blue);
    border-radius: 8px;
    pointer-events: none;
    z-index: 1; 
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.form-dashed-overlay::before {
    content: '<form> 表单框';
    position: absolute;
    top: -12px;
    left: 12px;
    background: #0a0f1a;
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* 绑定后，按钮飞到外面的绝对定位 */
.form-btn-external {
    position: absolute;
    bottom: -10px; /* 保证按钮完全露在外面 */
    right: 0;
    width: 160px;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    margin-top: 0;
}

/* 修复单选框文字被挤压折行的问题 */
.demo-opt-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap; /* 强制不换行 */
}

/* ================================================================
   板块 4：CSS 美化高级沙盒专属样式 (面板分栏 & 控件修复)
   ================================================================ */

.stage-wrapper { min-width: 0; max-width: 100%; overflow: hidden; }
.code-output { width: 100%; max-width: 100%; overflow-x: auto; background: #0a0f1a; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.code-output pre { margin: 0; padding: 16px; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; word-break: break-all; white-space: pre-wrap; }

/* 面板基础 */
#dynamicStyleProps { display: flex; flex-direction: column; gap: 12px; width: 100%; }
#dynamicStyleProps .control-group {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02); border-radius: var(--radius-sm); border: 1px solid rgba(255, 255, 255, 0.05);
}
#dynamicStyleProps label {
  font-size: 12px; color: var(--text-secondary); display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono);
}
#dynamicStyleProps label span { color: var(--accent-cyan); font-weight: 700; background: rgba(6, 182, 212, 0.1); padding: 2px 6px; border-radius: 4px; }

/* 原生的输入手感（不要动，保证丝滑） */
#dynamicStyleProps input[type="color"] {
  -webkit-appearance: auto !important; appearance: auto !important;
  width: 100%; height: 32px; padding: 0; border: 1px solid var(--bg-tertiary); border-radius: 4px; background: transparent; cursor: pointer; pointer-events: auto !important;
}
#dynamicStyleProps input[type="range"] {
  -webkit-appearance: auto !important; appearance: auto !important;
  width: 100%; height: 24px; margin: 4px 0; cursor: pointer; accent-color: var(--accent-cyan); pointer-events: auto !important;
}
#dynamicStyleProps select {
  -webkit-appearance: none; appearance: none; width: 100%; padding: 10px 14px;
  background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-sm); font-size: 13px; outline: none; cursor: pointer;
}
#dynamicStyleProps select:focus { border-color: var(--accent-cyan); }
#dynamicStyleProps .preset-select-wrapper { position: relative; width: 100%; }
#dynamicStyleProps .preset-select-wrapper::after {
  content: '▼'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-secondary); pointer-events: none;
}

/* 左右分栏布局 */
.props-split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.props-col { display: flex; flex-direction: column; gap: 10px; }
.props-col-title { font-size: 12px; font-weight: bold; padding-bottom: 4px; border-bottom: 1px dashed var(--bg-tertiary); margin-bottom: 4px; }
.props-col-title.base-color { color: var(--accent-cyan); }
.props-col-title.checked-color { color: #c084fc; }

.beautify-preview-box { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 200px; }

/* 代码高亮 */
.code-output .tag { color: #f472b6; }
.code-output .attr { color: #fbbf24; }
.code-output .val { color: #34d399; }
.code-output .sel { color: #60a5fa; }
.code-output .prop { color: #22d3ee; }
.code-output .comment { color: #64748b; font-style: italic; }

/* ================================================================
   板块 5
   ================================================================ */
.case-form-container { width: 100%; max-width: 320px; }
.style-game .case-form-wrapper {
  padding: 30px; background: #111827; border-radius: 16px;
  border: 1px solid #374151; box-shadow: 0 0 40px rgba(59, 130, 246, 0.2);
}
.style-game h2 { color: #f8fafc; text-align: center; margin-bottom: 24px; letter-spacing: 2px; }
.style-game .case-input {
  width: 100%; padding: 14px 16px; background: #1f2937; border: none;
  border-bottom: 2px solid #374151; color: white; margin-bottom: 20px;
  box-sizing: border-box; transition: 0.3s;
}
.style-game .case-input:focus { border-bottom-color: #3b82f6; outline: none; box-shadow: 0 10px 10px -10px #3b82f6; }
.style-game .case-btn {
  width: 100%; padding: 14px; background: linear-gradient(90deg, #2563eb, #06b6d4);
  border: none; color: white; font-weight: bold; font-size: 16px;
  border-radius: 8px; cursor: pointer; transition: 0.3s;
}
.style-game .case-btn:hover { transform: scale(1.02); box-shadow: 0 0 20px rgba(6, 182, 212, 0.5); }

.style-saas .case-form-wrapper {
  padding: 40px; background: #fff; border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05); color: #333;
}
.style-saas h2 { color: #111827; text-align: center; margin-bottom: 30px; font-weight: 600; }
.style-saas .saas-group { position: relative; margin-bottom: 24px; }
.style-saas .case-input {
  width: 100%; padding: 16px 12px 6px; background: #f9fafb;
  border: 1px solid #d1d5db; border-radius: 6px; color: #111827;
  box-sizing: border-box; outline: none;
}
.style-saas .saas-group label {
  position: absolute; left: 12px; top: 12px; color: #9ca3af;
  font-size: 14px; transition: 0.2s; pointer-events: none;
}
.style-saas .case-input:focus + label,
.style-saas .case-input:not(:placeholder-shown) + label { top: 4px; font-size: 11px; color: #3b82f6; font-weight: 600; }
.style-saas .case-input:focus { border-color: #3b82f6; background: #fff; }
.style-saas .case-btn {
  width: 100%; padding: 14px; background: #111827; color: white;
  border: none; border-radius: 6px; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: 0.2s;
}
.style-saas .case-btn:hover { background: #374151; }

.style-glass .case-form-wrapper {
  padding: 40px; background: rgba(255, 255, 255, 0.1); border-radius: 20px;
  backdrop-filter: blur(15px); border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1);
}
.style-glass h2 { color: #fff; text-align: center; margin-bottom: 30px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
.style-glass .case-input {
  width: 100%; padding: 15px 20px; background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 30px;
  color: #fff; box-sizing: border-box; margin-bottom: 20px; outline: none;
  transition: 0.3s;
}
.style-glass .case-input::placeholder { color: rgba(255, 255, 255, 0.7); }
.style-glass .case-input:focus { background: rgba(255, 255, 255, 0.3); border-color: #fff; }
.style-glass .case-btn {
  width: 100%; padding: 15px; background: #fff; color: #3b82f6;
  border: none; border-radius: 30px; font-weight: bold; font-size: 16px;
  cursor: pointer; transition: 0.3s;
}
.style-glass .case-btn:hover { background: #f0fdf4; box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }