/* viewer.css — premium minimal (soft greys), aligned with judge.css look */
:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e6e9f0;
  --shadow: 0 10px 30px rgba(15,23,42,.08);
  --radius: 18px;

  --primary:#111827;
  --accent:#334155;
  --good:#16a34a;
  --danger:#ef4444;

  --tap: 52px;
}

*{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: var(--bg);
  color: var(--text);
}

.app{max-width: 980px; margin:0 auto; padding: 18px 14px 32px;}
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding: 8px 2px 16px;
}
.brand{display:flex; align-items:center; gap:10px;}
.dot{width:14px; height:14px; border-radius:50%; background: linear-gradient(145deg,#d1d5db,#111827);}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{font-size:12px; color:var(--muted); margin-top:2px}
.status{display:flex; align-items:center; gap:10px}

.screen{display:block}
.hidden{display:none !important}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 0;
}

h1{margin:0 0 8px; font-size: 26px; letter-spacing:-.2px}
h2{margin:0 0 10px; font-size: 16px; letter-spacing:-.2px}
p{margin:8px 0}
.muted{color:var(--muted)}
.small{font-size:12px}

.field{display:flex; flex-direction:column; gap:6px; margin-top:10px}
.field span{font-size:12px; color:var(--muted)}
input{
  height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  background: #fff;
}
input:focus{border-color:#cbd5e1; box-shadow: 0 0 0 4px rgba(148,163,184,.25);}

.row{display:flex; gap:10px; align-items:center}
.row.wrap{flex-wrap:wrap}
.row.between{justify-content:space-between}

.btn{
  height: var(--tap);
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active{transform: translateY(1px)}
.btn-primary{
  background: var(--primary);
  color:#fff;
  border-color: transparent;
}
.btn-secondary{
  background: #fff;
  color: var(--primary);
}
.btn-ghost{
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}
.btn[disabled]{opacity:.55; cursor:not-allowed; transform:none}

.badge{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

.divider{height:1px; background: var(--line); margin: 14px 0}

.pill{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  min-width: 140px;
}
.pill-title{font-size: 12px; color: var(--muted)}
.pill-score{font-size: 18px; font-weight: 900; letter-spacing:-.3px}

.toast{
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(22,163,74,.25);
  background: rgba(22,163,74,.06);
  padding: 12px 14px;
  font-weight: 800;
  color: var(--good);
}
.toast.danger{
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.06);
  color: var(--danger);
}

/* Table */
.table-wrap{
  width:100%;
  overflow:auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:#fff;
}
.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 520px;
}
.table thead th{
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  text-align:left;
  font-size: 12px;
  color: var(--muted);
  padding: 12px;
  white-space: nowrap;
}
.table td{
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}
.table tr:last-child td{border-bottom:none}
.table .num{text-align:right; font-variant-numeric: tabular-nums;}
.table tbody tr{
  cursor:pointer;
}
.table tbody tr:hover{
  background: rgba(17,24,39,.03);
}

/* Dialog */
.dialog{
  border:none;
  padding: 0;
  background: transparent;
}
.dialog::backdrop{
  background: rgba(15,23,42,.28);
}
.dialog-card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  width: min(980px, calc(100vw - 24px));
  margin: 12px auto;
}
.dialog-title{font-size:20px; font-weight: 900; letter-spacing:-.2px}

.panel{
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.72);
}

.mini{min-width: 200px}
.mini-strong{font-weight: 900; font-size: 14px}

/* Criterion summary cards */
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
@media (min-width: 760px){
  .grid{grid-template-columns: repeat(3, minmax(0, 1fr));}
}
.stat{
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background:#fff;
}
.stat .k{font-size:12px; color:var(--muted)}
.stat .v{font-size:18px; font-weight: 900; margin-top:4px; font-variant-numeric: tabular-nums;}

/* Submission list */
.list{
  display:flex;
  flex-direction: column;
  gap:10px;
}
.item{
  border: 1px solid var(--line);
  border-radius: 16px;
  background:#fff;
  padding: 12px;
}
.item .top{
  display:flex;
  justify-content: space-between;
  align-items: baseline;
  gap:10px;
  flex-wrap: wrap;
}
.item .who{font-weight: 900}
.item .meta{color: var(--muted); font-size: 12px}
.item .chips{
  display:flex;
  gap:6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.chip{
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--accent);
  background: #fff;
}

/* Overlay fallback (hidden unless needed) */
.overlay{
  position: fixed;
  inset:0;
  background: rgba(15,23,42,.28);
  z-index: 50;
}
