/* NAPFA Scoreboard - minimal, teacher-friendly */

:root{
  --bg: #0b1020;
  --panel: #101a33;
  --panel2: #0e162c;
  --text: #e8eefc;
  --muted: rgba(232,238,252,0.75);
  --muted2: rgba(232,238,252,0.55);
  --line: rgba(232,238,252,0.16);
  --focus: rgba(255,255,255,0.15);

  --gold: #b78628;
  --darkOrange: #b3541e;
  --lightOrange: #c27a2a;
  --silver: #9aa3ad;
  --bronze: #8b6a3a;
  --neutral: rgba(255,255,255,0.04);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 900px at 10% 10%, rgba(43,87,208,0.25), transparent 60%),
              radial-gradient(900px 700px at 90% 0%, rgba(208,120,43,0.18), transparent 55%),
              var(--bg);
  color: var(--text);
}

.topbar{
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16,26,51,0.85), rgba(16,26,51,0.5));
  display:flex;
  gap:18px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}

.brand .title{
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.brand .subtitle{
  margin-top: 2px;
  color: var(--muted2);
  font-size: 13px;
}

.controls{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-end;
  justify-content:flex-end;
}

.control{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width: 220px;
}
.control.row{
  flex-direction:row;
  align-items:center;
  min-width:auto;
  gap:10px;
}

.lbl{
  font-size: 12px;
  color: var(--muted);
}

.input{
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
  color: var(--text);
  outline:none;
}
.input:focus{ box-shadow: 0 0 0 3px rgba(43,87,208,0.28); }

.file{
  padding: 8px 0;
  color: var(--muted);
}

.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(43,87,208,0.25);
  color: var(--text);
  cursor:pointer;
  font-weight: 650;
}
.btn:hover{ filter: brightness(1.06); }
.btn.secondary{ background: rgba(255,255,255,0.06); }
.btn.danger{ background: rgba(208,43,43,0.25); }

.main{
  padding: 16px 18px 20px;
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}

.panel{
  background: linear-gradient(180deg, rgba(16,26,51,0.75), rgba(14,22,44,0.75));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.24);
}
.tablePanel{ min-height: 420px; }

.panelHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:10px;
  margin-bottom: 10px;
}
.panelTitle{
  font-weight: 800;
  letter-spacing: 0.2px;
}
.panelHint{
  color: var(--muted2);
  font-size: 12px;
  text-align:right;
  max-width: 520px;
}

.toggles{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin: 10px 0 14px;
}
.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  cursor:pointer;
  user-select:none;
  font-size: 13px;
}
.toggle input{ accent-color: #6ea0ff; }
.toggle .tag{
  color: var(--muted2);
  font-size: 12px;
}

.stats{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.stat{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}
.stat .k{
  color: var(--muted2);
  font-size: 12px;
}
.stat .v{
  font-size: 18px;
  font-weight: 800;
  margin-top: 4px;
}

.tableWrap{
  overflow:auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.14);
}
.grid{
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1100px;
}
.grid th, .grid td{
  border-bottom: 1px solid rgba(232,238,252,0.10);
  border-right: 1px solid rgba(232,238,252,0.10);
  padding: 10px;
  vertical-align: middle;
}
.grid th{
  position: sticky;
  top: 0;
  background: rgba(16,26,51,0.95);
  z-index: 3;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.grid th:first-child{
  left: 0;
  z-index: 4;
}
.grid td:first-child{
  position: sticky;
  left: 0;
  background: rgba(16,26,51,0.92);
  z-index: 2;
  min-width: 240px;
}

.nameCell .name{
  font-weight: 800;
  margin-bottom: 2px;
}
.nameCell .meta{
  color: var(--muted2);
  font-size: 12px;
}

.tile{
  border-radius: 14px;
  border: 1px solid rgba(232,238,252,0.16);
  background: var(--neutral);
  padding: 10px 10px 9px;
  min-height: 62px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:6px;
  cursor: text;
}
.tile:focus-within, .tile.isFocused{
  outline: 2px solid rgba(110,160,255,0.45);
  outline-offset: 2px;
}
.tileTop{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.grade{
  font-size: 18px;
  font-weight: 900;
}
.points{
  color: rgba(0,0,0,0.85);
  font-weight: 900;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
}
.value{
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  letter-spacing: 0.2px;
}
.sub{
  color: var(--muted2);
  font-size: 12px;
}

.tileInput{
  width: 100%;
  border: 1px solid rgba(0,0,0,0.0);
  background: rgba(0,0,0,0.16);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  outline:none;
}
.tileInput:focus{ box-shadow: 0 0 0 3px rgba(110,160,255,0.22); }

.gradeA{ background: rgba(183,134,40,0.32); border-color: rgba(183,134,40,0.55); }
.gradeB{ background: rgba(179,84,30,0.32); border-color: rgba(179,84,30,0.55); }
.gradeC{ background: rgba(194,122,42,0.28); border-color: rgba(194,122,42,0.48); }
.gradeD{ background: rgba(154,163,173,0.25); border-color: rgba(154,163,173,0.45); }
.gradeE{ background: rgba(139,106,58,0.25); border-color: rgba(139,106,58,0.45); }
.gradeF{ background: var(--neutral); border-color: rgba(232,238,252,0.16); }

.totalTile{
  cursor: default;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(232,238,252,0.16);
  background: rgba(0,0,0,0.16);
  font-weight: 850;
  width: fit-content;
}
.badge.small{ font-size: 12px; font-weight: 800; }
.badge.gold{ background: rgba(183,134,40,0.25); border-color: rgba(183,134,40,0.45); }
.badge.silver{ background: rgba(154,163,173,0.22); border-color: rgba(154,163,173,0.42); }
.badge.bronze{ background: rgba(139,106,58,0.22); border-color: rgba(139,106,58,0.42); }
.badge.fail{ background: rgba(208,43,43,0.22); border-color: rgba(208,43,43,0.42); }

.legend{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.legendItem{ display:flex; align-items:center; gap:8px; }
.swatch{
  width: 14px; height: 14px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.25);
  display:inline-block;
}
.footer{
  padding: 10px 18px 16px;
  color: var(--muted2);
  font-size: 12px;
}
.footer ul{ margin: 6px 0 0 18px; }

@media (max-width: 1100px){
  .main{ grid-template-columns: 1fr; }
  .controls{ justify-content:flex-start; }
}
