body {
  font-family: 'Microsoft YaHei', Arial, sans-serif;
  background: #e9e9e9;
}
.container {
  width: 1020px;
  min-width: 1020px;
  margin: 40px auto;
  background: #f0f0f0;
  border: 1.5px solid #b0b0b0;
  border-radius: 8px;
  box-shadow: 0 2px 12px #bbb;
  padding: 18px 18px 28px 18px;
}
.nav {
  text-align: left;
  margin-bottom: 10px;
}
.nav button {
  background: #e0e0e0;
  border: 1.5px solid #bdbdbd;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 7px 32px;
  margin-right: 2px;
  font-size: 16px;
  cursor: pointer;
  outline: none;
  transition: background 0.2s;
  color: #222;
  position: relative;
  top: 2px;
}
.nav button.active {
  background: #fff;
  color: #1976d2;
  font-weight: bold;
  border-bottom: 1.5px solid #fff;
  z-index: 2;
}
.panel {
  background: #fff;
  border: 1.5px solid #bdbdbd;
  border-radius: 0 0 6px 6px;
  padding: 18px 20px 20px 20px;
  min-height: 260px;
  margin-top: -6px;
}
.groupbox {
  border: 1.5px solid #bdbdbd;
  border-radius: 6px;
  padding: 18px 18px 12px 18px;
  margin-top: 10px;
  background: #fafafa;
  position: relative;
  min-width: 350px;
}
.group-title {
  position: absolute;
  top: -14px;
  left: 18px;
  background: #fafafa;
  padding: 0 8px;
  color: #1976d2;
  font-size: 17px;
  font-weight: bold;
}
label {
  display: flex;
  align-items: center;
  margin: 12px 0 0 0;
  font-size: 15px;
  min-width: 180px;
}
input[type=number], select {
  width: 120px;
  padding: 4px 8px;
  font-size: 15px;
  border: 1.2px solid #bdbdbd;
  border-radius: 3px;
  margin-left: 12px;
  background: #f8f8f8;
}
button {
  margin-top: 12px;
  margin-right: 8px;
  padding: 7px 22px;
  font-size: 15px;
  background: #e0e0e0;
  border: 1.2px solid #bdbdbd;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover {
  background: #d0d0d0;
}
.result {
  margin-top: 18px;
  font-size: 16px;
  color: #1976d2;
  white-space: pre-line;
  min-height: 24px;
}
h2 {
  display: none;
}
@media (max-width: 900px) {
  .container { width: 99vw; min-width: 0; }
}

/* Data panel specific styles (scoped to #panel-data to avoid affecting other panels) */
#panel-data .groupbox {
  min-width: 0; /* allow groupbox to shrink inside the main container */
  padding: 12px; /* slightly reduce padding to gain space */
}

#panel-data label {
  /* slightly narrower labels inside data panel */
  min-width: 120px;
  font-size: 13px;
}

#panel-data input[type=number],
#panel-data select {
  width: 65px; /* further reduce width */
  padding: 4px 6px;
  margin-left: 8px;
}

#panel-data .radio-row,
#panel-data .bit-group,
#panel-data .color-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 25px; /* horizontal gap reduced to 25px */
  align-items: center;
}

#panel-data .radio-row label,
#panel-data .bit-group label,
#panel-data .color-group label {
  margin: 0;
  white-space: nowrap;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#panel-data .bit-group input[type=radio],
#panel-data .color-group input[type=radio] {
  margin: 0;
}

#panel-data .result {
  font-size: 15px;
}

#panel-data .bit-group,
#panel-data .color-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 6px 25px; /* grid horizontal gap reduced to 25px */
  align-items: center;
  width: calc(100% - 140px); /* reserve space for the label on the left */
}

#panel-data .row {
  display: flex;
  align-items: center;
  gap: 8px 25px; /* row horizontal gap reduced to 25px */
}

@media (max-width: 900px) {
  /* ensure data panel radios can wrap on small screens */
  #panel-data input[type=number],
  #panel-data select { width: 44vw; max-width: 180px; }
  #panel-data .bit-group, #panel-data .color-group { width: 100%; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
}
