/* edge和chrome在盒模型计算存在差异，需要添加全局box-sizing规则统一元素尺寸计算方式。 */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: white;
    background-image: url('');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* 基础布局 */
@media screen and (min-width: 1024px) {
    body {
        width: 900px;
        margin: 0 auto;
    }
    .col-md-4.col-lg {
        margin: 18px 0 8px;
    }
    .row.g-3 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 0.8rem;
    }
}

/* 题目容器 */
.problems {
    margin: 10px 10px 20px 10px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.85);
}
.problem {
    padding: 5px 8px;
    border-radius: 4px;
}
.problems.three-columns {
    grid-template-columns: repeat(3, 1fr);
}

/* 打印样式 */
@media print {
    .no-print { display: none; }
    select,
    #name {
        border: none !important;
        height: 25px;
        line-height: 16px;
        appearance: none;
        background: none !important;
    }
    select::-ms-expand,
    .name-container select::-ms-expand { display: none; }
    @page { size: auto; margin: 0mm; }
    body {
        margin: 0;
        padding: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .student-info { padding: 20px 20px 0 60px; }
    * { -webkit-print-color-adjust: exact; color-adjust: exact; }
    .problems { 
        padding-right: 0; 
        margin: 15px;
    }
    .problem { padding-right: 4px; }
}

/* 控件面板 */
button {
    font-size: 14px;
    padding: 10px 20px;
    margin: 10px;
}
.control-panel {
    margin: 10px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.85);
}
.control-item {
    margin: 10px 20px 10px 0;
    display: inline-block;
    font-size: 14px;
}
/* 带箭头的打印提示 */
.custom-tooltip {
  position: relative;
  cursor: pointer;
  display: inline-block;
}

.custom-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px); /* 使用calc确保间距 */
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 1000;
  font-size: 12px;
}

.custom-tooltip:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 0px); /* 箭头位置 */
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top: 5px solid #333;
  z-index: 1001;
}

/* 学生信息 */
.student-info {
    padding: 20px 20px 0 60px;
    font-size: 14px;
}
.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.info-line,
.name-line {
    display: inline-block;
    width: 90px;
    border-bottom: 1px solid #000;
    height: 23px;
    line-height: 16px;
}
#currentDate {
    width: 110px;
    margin-top: 3px;
    height: 20px;
}
.name-container {
    position: relative;
    display: inline-block;
}
#name {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: transparent;
    border: none;
    z-index: 2;
    padding: 0;
    margin: 0;
    height: 23px;
}

/* 运算类型 */
.operator-checkboxes {
    display: flex;
    flex-wrap: wrap;
}
.operator-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
input[type="checkbox"] {
    width: 14px;
    height: 14px;
}
label {
    font-size: 14px;
}

/* 响应式布局 */
@media screen and (min-width: 768px) {
    .problems[data-digits="3"] {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media screen and (max-width: 767px) {
    .problems { grid-template-columns: repeat(2, 1fr) !important; }
    .student-info { padding: 15px !important; }
    .info-line, .name-line { width: 70px; }
}
@media screen and (max-width: 480px) {
    .problems { grid-template-columns: 1fr !important; padding: 10px; }
}

/* Bootstrap兼容 */
.form-check {
    margin-right: 0;
    padding-left: 1.5em;
    display: flex;
    align-items: center;
}
.form-check-input {
    position: absolute;
    margin-top: 0.25em;
    margin-left: -1.5em;
}
.form-check-label {
    margin-left: 0.2em;
}
.form-label {
    display: inline-block;
    margin-bottom: 0.3rem;
}
.form-select {
    padding: 3px 5px;
    font-size: 13px;
    min-width: 80px;
}
.d-flex .form-label {
    min-width: 70px;
    white-space: nowrap;
}

/* 其他辅助样式 */
.wallpaper-selector {
    margin-left: 20px;
    display: inline-block;
}
.designer-info {
    display: flex;
    flex-direction: column;
}
.small {
    font-size: 10px;
}
.col-md-12.col-lg-5 .d-flex.align-items-center.flex-wrap {
    min-height: 38px;
    align-items: center;
    margin-bottom: 8px;
}