:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --border: #334155;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

header {
  padding: 2rem 1rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

h1 { margin: 0; font-size: 1.8rem; }
.sub { color: var(--muted); margin-top: 0.25rem; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.head h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.scores { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.score {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
}
.score.bot { background: #0ea5e9; color: #0c4a6e; }
.score.mine { background: #22c55e; color: #052e16; }
.score.total { background: #475569; color: #fff; }
.score.src { background: #475569; color: #fff; text-transform: lowercase; }

.paper { margin: 0.5rem 0; }
.paper a { color: var(--accent); text-decoration: none; }
.paper a:hover { text-decoration: underline; }

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.5rem 1rem;
  margin: 1rem 0;
}

.meta div { display: flex; flex-direction: column; gap: 0.15rem; }
.meta dt { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meta dd { margin: 0; }
.meta ul { margin: 0; padding-left: 1.2rem; }

.annotate {
  display: grid;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.annotate label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.annotate input,
.annotate textarea {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.5rem;
  font-family: inherit;
}

.annotate button {
  justify-self: start;
  background: var(--accent);
  color: #0c4a6e;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.empty { color: var(--muted); }

.logout { color: var(--muted); margin-left: 0.5rem; }

.score.kind.sw { background: #334155; color: #cbd5e1; }
.score.kind.hw { background: #92400e; color: #fde68a; }

/* Ranked summary table */
.ranked {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.75rem 1rem;
}
.ranked summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.ranked summary:hover { color: var(--text); }
.ranked table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.ranked th, .ranked td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.ranked th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ranked td.notes { color: var(--muted); max-width: 22rem; }
.ranked a { color: var(--accent); text-decoration: none; }
.ranked a:hover { text-decoration: underline; }

/* Auth pages */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  max-width: 26rem;
  width: 100%;
  display: grid;
  gap: 1rem;
}
.auth-box h1 { font-size: 1.4rem; }
.big-btn {
  background: var(--accent);
  color: #0c4a6e;
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.field input {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.5rem;
  font-family: inherit;
}
.status { min-height: 1.2em; color: var(--muted); font-size: 0.9rem; margin: 0; }
.status.error { color: #f87171; }

.meta .hw dt { color: #fbbf24; }
.meta .hw dd { font-weight: 600; }

footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

code {
  background: #0f172a;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}
