* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: white;
  color: #333;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  font-size: 16px;
  font-weight: normal;
  margin-bottom: 20px;
}

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

input[type="text"] {
  flex: 1;
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ccc;
}

button {
  padding: 8px 16px;
  font-size: 14px;
  background: white;
  border: 1px solid #ccc;
  cursor: pointer;
}

button:hover {
  background: #f5f5f5;
}

.error {
  color: red;
  margin-bottom: 10px;
  display: none;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
}

.tab-button {
  padding: 8px 16px;
  background: white;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
}

.tab-button.active {
  border-bottom-color: #333;
}

.tab-button:hover {
  background: #f5f5f5;
}

.tab-content {
  margin-bottom: 20px;
}

svg {
  border: 1px solid #ccc;
  width: 100%;
  height: auto;
  display: block;
}

.table-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

table {
  border-collapse: collapse;
  margin-top: 10px;
}

th, td {
  border: 1px solid #ccc;
  padding: 8px 24px;
  text-align: center;
  min-width: 70px;
}

th {
  background: #f5f5f5;
  font-weight: bold;
}

td.high {
  background: #e8f5e9;
  color: #2e7d32;
}

td.low {
  background: #fafafa;
  color: #666;
}

/* K-map table */
.kmap-table {
  border-collapse: collapse;
  margin-top: 10px;
}

.kmap-table th,
.kmap-table td {
  border: 1px solid #ccc;
  padding: 8px 24px;
  text-align: center;
  min-width: 70px;
}

.kmap-table th {
  background: #f5f5f5;
  font-weight: bold;
}

.kmap-table th.kmap-corner {
  background: #f5f5f5;
  font-weight: bold;
}

.kmap-table td.high {
  background: #e8f5e9;
  color: #2e7d32;
}

.kmap-table td.low {
  background: #fafafa;
  color: #666;
}

/* K-map sub-map grid (5+ variables) */
.kmap-grid {
  display: grid;
  gap: 20px;
  margin-top: 10px;
  justify-content: start;
}

.kmap-submap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.kmap-submap-label {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 4px;
  color: #555;
}

/* Help button */
.help-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #f5f5f5;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}

.help-btn:hover {
  background: #e0e0e0;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fefefe;
  margin: 8% auto;
  padding: 30px;
  border: 1px solid #888;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 20px;
  font-size: 18px;
}

.modal-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: black;
}

.format-section {
  margin: 12px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.format-section:last-child {
  border-bottom: none;
}

.format-section h3 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: #333;
  font-weight: bold;
}

.format-section p {
  margin: 0;
  font-size: 14px;
}

.format-section code {
  background: #f0f0f0;
  padding: 3px 8px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  color: #d63384;
}
