:root {
  --primary: #4a90e2;
  --light: #f5f7fa;
}
body {
  font-family: "Segoe UI", sans-serif;
  padding: 20px;
  background: var(--light);
  margin-bottom: 80px;
}
h2 {
  text-align: center;
  color: #333;
}
#upload-zone {
  border: 2px dashed #bbb;
  background: white;
  padding: 40px 20px;
  text-align: center;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease;
  margin-bottom: 20px;
  color: #666;
  position: relative;
}
#upload-zone:hover {
  border-color: var(--primary);
  background: #f0f8ff;
}
/* 追加到 <style> 末尾 */
#upload-zone {
overflow: hidden;
transition: max-height .4s ease, padding .4s ease, opacity .4s ease;
}
body.uploaded #upload-zone {
max-height: 0;
padding: 0;
opacity: 0;
margin-bottom: 0;
}
/* 追加到 <style> 末尾 */
.re-upload-btn {
position: fixed;
top: 10px;
left: 10px;
z-index: 10000;
background: var(--primary);
color: #fff;
border: none;
padding: 8px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
}
#main-container {
  display: flex;
  flex-direction: row;
  gap: 20px;
}
#preview-container,
#inference-result {
  flex: 1;
  background: white;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 8px;
  overflow: auto;
  max-height: 80vh;
  position: relative;
}
canvas, img {
  max-width: 100%;
  margin-bottom: 10px;
  display: block;
  position: relative;
}
table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 10px;
}
table, th, td {
  border: 1px solid #ccc;
}
th, td {
  padding: 4px 6px;
}
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f1f5f9;
  padding: 10px;
  border-radius: 6px;
  margin-top: 8px;
  max-height: 70vh;
  overflow: auto;
}
#footer-action {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: white;
  border-top: 1px solid #eee;
  text-align: right;
  z-index: 999;
}
#inference-btn, #download-btn, #feedback-btn {
  background: var(--primary);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
  margin-left: 8px;
}
#inference-btn:hover, #download-btn:hover , #feedback-btn:hover{
  background: #357bd8;
}
#inference-btn:disabled, #download-btn:disabled, #feedback-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}
#loading_div {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(255, 255, 255, 0.5);
z-index: 9998;
}

#loading_pic {
position: fixed;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
z-index: 9999;
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}

/* 旋转环 */
.ring {
width: 36px;
height: 36px;
border: 4px solid rgba(0, 123, 255, 0.3);
border-top-color: #007bff;
border-radius: 50%;
animation: spin 1s linear infinite;
}

@keyframes spin {
to { transform: rotate(360deg); }
}

/* 文字 */
.txt {
font-size: 14px;
color: #007bff;
font-family: sans-serif;
}

/* 高亮框样式 */
.highlight-box {
  position: absolute;
  border: 2px solid #4a90e2;
  background: rgba(74, 144, 226, 0.2);
  pointer-events: none;
  z-index: 10;
}
@media (max-width: 768px) {
  #main-container {
    flex-direction: column;
  }
  #footer-action {
    text-align: center;
  }
  #inference-btn, #download-btn, #feedback-btn {
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
  }
}
mark.hl {
    background: #ffe16f;
    color: #111;
}
/* 语言选择器样式 */
.language-selector {
position: fixed;
top: 10px;
right: 10px;
z-index: 10001;
background: white;
border: 1px solid #ddd;
border-radius: 6px;
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.language-selector select {
border: none;
background: transparent;
padding: 6px 10px;
font-size: 14px;
cursor: pointer;
outline: none;
}

.language-selector select:focus {
background: #f0f8ff;
}

:root {
  --primary: #4a90e2;
  --primary-hover: #357bd8;
  --light: #f5f7fa;
}

/* 覆盖弹窗层级与布局 */
#feedbackModal {
  position: fixed;
  inset: 0;
  display: none;            /* 默认隐藏 */
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.5);
  z-index: 11000;           /* 高于语言选择器(10001)与loading(9999) */
}

/* 用属性控制显示，更易与JS配合 */
#feedbackModal[aria-hidden="false"] {
  display: flex;
  animation: fadeIn .18s ease;
}

#feedbackModal .modal-content {
  background: #fff;
  padding: 24px 28px;
  border-radius: 12px;
  width: min(90vw, 720px);
  max-width: clamp(520px, 48vw, 720px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  position: relative;
}

/* 标题更清晰 */
#feedbackModal h2 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #222;
  text-align: left;
}

/* 输入元素更舒适 */
#feedbackModal label {
  font-size: 14px;
  color: #333;
}
#feedbackModal input,
#feedbackModal textarea {
  width: 100%;
  padding: 8px 8px;
  margin: 6px 0 14px;
  border: 1px solid #d5d8df;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
#feedbackModal input:focus,
#feedbackModal textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}
#feedbackModal textarea {
  min-height: 160px;
  resize: vertical;
}

/* 右上角关闭按钮 */
#feedbackModal .modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #666;
  font-size: 20px;
  line-height: 32px;
  cursor: pointer;
}
#feedbackModal .modal-close:hover {
  background: #f3f6fb;
  color: #333;
}

/* 按钮风格统一主色 */
#feedbackModal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
#feedbackModal .btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
#feedbackModal .btn-primary:hover {
  background: var(--primary-hover);
}
#feedbackModal .btn-outline {
  background: #fff;
  color: #333;
  padding: 10px 16px;
  border: 1px solid #d5d8df;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
#feedbackModal .btn-outline:hover {
  background: #f7f9fc;
}

/* 打开弹窗时禁用页面滚动 */
body.modal-open {
  overflow: hidden;
}

/* 保留你的淡入动画 */
@keyframes fadeIn {
  from {opacity: 0; transform: translateY(4px);}
  to {opacity: 1; transform: translateY(0);}
}

/* 小屏适配 */
@media (max-width: 480px) {
  #feedbackModal .modal-content {
    padding: 18px 16px;
    border-radius: 10px;
  }
  #feedbackModal .modal-close {
    top: 6px; right: 8px;
  }
}
