/* Base Styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: #f9f9f9;
  box-sizing: border-box;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  min-width: 600px; /* ensure wide enough on desktop */
}

th, td {
  border: 1px solid #ddd;
  padding: 12px;             /* generous padding by default */
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;       /* prevent wrapping until mobile */
}

th {
  background-color: #f2f2f2;
  font-weight: normal;
  font-size: 14px;
}

td {
  font-size: 15px;
}

.select-group small {
  display: block;
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

select {
  padding: 4px;
  width: auto;
  min-width: 60px;
  box-sizing: border-box;
}

.control-btn {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin: 0 2px;
}

.btn-red { background-color: gray; }
.btn-red:hover { background-color: red !important; }
.btn-green { background-color: gray; }
.btn-green:hover { background-color: green !important; }

.result-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 60px;
  box-sizing: border-box;
  border-radius: 12px;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  margin-top: 20px;
  transition: all 0.5s ease;
}

.result-pass { background-color: #28a745; }
.result-fail { background-color: #dc3545; }

.result-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.big-label {
  font-size: 1.4em;
  margin: 0;
}

.score-circle {
  width: 36px;
  height: 36px;
  background: #fff;
  color: inherit;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  font-weight: bold;
}

.reward {
  display: flex;
  align-items: center;
  font-size: 0.9em;
}
.reward .icon { font-size: 1.2em; margin-right: 4px; }
.reward .bronze { color: #cd7f32; }
.reward .silver { color: #c0c0c0; }
.reward .gold   { color: #ffd700; }

/* Responsive Breakpoints */

/* Large tablets / small desktops */
@media (max-width: 1024px) {
  th, td {
    padding: 6px;
    font-size: 13px;
  }
  .control-btn {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 14px;
  }
  select {
    min-width: 50px;
    padding: 3px;
  }
}

/* Tablet and below */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  th, td {
    padding: 8px;
    font-size: 13px;
  }
  .control-btn {
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 16px;
  }
  select {
    width: 60px;
    padding: 4px;
  }
  .result-tab {
    font-size: 22px;
    height: 70px;
    padding: 0 16px;
  }
  .big-label {
    font-size: 1.3em;
  }
}

/* Mobile */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  /* Stack table into cards */
  .table-wrapper,
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    width: 100%;
  }
  thead {
    display: none;
  }
  tr {
    margin-bottom: 16px;
    border-bottom: 2px solid #ddd;
  }
  td {
    position: relative;
    padding-left: 50%;
    text-align: left;
    white-space: normal;
  }
  td:before {
    content: attr(data-label);
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    width: 45%;
    white-space: nowrap;
  }

  table {
    min-width: 480px;
  }
}
