*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'Noto Sans HK', 'Microsoft YaHei', sans-serif;
  background: #f5f0eb;
  color: #1e1e1e;
  padding: 20px;
}
.container {
  max-width: 900px;
  margin: 0 auto;
}
header { margin-bottom: 24px; }
header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
}
.subtitle {
  color: #7f8c8d;
  font-size: 14px;
  margin-top: 4px;
}
.input-area { margin-bottom: 24px; }
textarea {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  line-height: 1.7;
  border: 2px solid #d5cfc8;
  border-radius: 10px;
  resize: vertical;
  background: #fff;
  font-family: inherit;
  transition: border-color .2s;
}
textarea:focus {
  outline: none;
  border-color: #e67e22;
}
.input-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.mode-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.mode-btn {
  padding: 5px 14px;
  border: 1px solid #ccc;
  border-radius: 18px;
  background: #fff;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.mode-btn.active {
  background: #e67e22;
  color: #fff;
  border-color: #e67e22;
}
.mode-btn:not(.active):hover { background: #f5f0eb; }
#convertBtn {
  padding: 10px 28px;
  background: #e67e22;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
#convertBtn:hover { background: #cf6d17; }
.checkbox-label {
  font-size: 14px;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.copy-btn {
  margin-left: auto;
  padding: 8px 16px;
  border: 1px solid #e67e22;
  border-radius: 8px;
  background: #fff;
  color: #e67e22;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: all .2s;
}
.copy-btn:hover { background: #e67e22; color: #fff; }
.stat-line {
  font-size: 13px;
  color: #999;
  margin-left: 8px;
}
.tab {
  padding: 8px 20px;
  border: none;
  border-radius: 8px 8px 0 0;
  background: #e0dad3;
  color: #666;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}
.tab.active {
  background: #fff;
  color: #e67e22;
  font-weight: 600;
  box-shadow: 0 -1px 3px rgba(0,0,0,.05);
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.hint {
  font-size: 13px;
  color: #999;
  margin-bottom: 12px;
}

/* ── Compact 面板 ── */
.compact-result {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  line-height: 2.2;
  font-size: 17px;
  white-space: pre-wrap;
  word-break: break-all;
}
.char-box {
  display: inline;
  position: relative;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 4px;
  transition: background .15s;
}
.char-box:hover {
  background: #fef3e9;
}
.char-box.highlight {
  background: #fef0d5;
}
.char-box .popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.char-box .popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #2c3e50;
}
.char-box:hover .popup { display: block; }
.char-box.changed {
  background: #d4edda;
  border-radius: 4px;
}
.char-box.space { cursor: default; }
.char-box.space:hover { background: transparent; }

/* ── Blocks 面板 ── */
.blocks-result { }
.block-line {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.9;
}
.block-line .orig { color: #999; margin-right: 8px; font-size: 13px; }
.block-line .changed { }

@media (max-width: 600px) {
  .compact-result { font-size: 15px; }
}
