:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --border: #1e1e2e;
  --text: #e0e0e8;
  --text-dim: #888898;
  --accent: #6c5ce7;
  --accent-hover: #7f70f0;
  --green: #00c853;
  --red: #ff1744;
  --orange: #ff9100;
  --blue: #448aff;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 860px; margin: 0 auto; padding: 1.5rem; }
header { text-align: center; margin-bottom: 1.5rem; }
header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.25rem; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.7rem 1.2rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.card p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.75rem; }
.card code {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent);
  padding: 0.12em 0.35em;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.82em;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1rem;
  text-align: center;
}

.stat-card.accent { border-color: rgba(108, 92, 231, 0.4); }
.stat-card.red { border-color: rgba(255, 23, 68, 0.4); }
.stat-card.orange { border-color: rgba(255, 145, 0, 0.4); }
.stat-card.green { border-color: rgba(0, 200, 83, 0.4); }

.stat-value { font-size: 2rem; font-weight: 800; font-family: var(--mono); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.green .stat-value { color: var(--green); }
.stat-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.25rem; }

/* Scoreboard */
.score-row { display: flex; align-items: stretch; gap: 0; margin-bottom: 1rem; }

.team {
  flex: 1;
  padding: 1rem;
  border-radius: 8px;
}

.red-team { background: rgba(255, 23, 68, 0.06); border: 1px solid rgba(255, 23, 68, 0.2); }
.blue-team { background: rgba(68, 138, 255, 0.06); border: 1px solid rgba(68, 138, 255, 0.2); }
.red-team h3 { color: var(--red); font-size: 0.9rem; margin-bottom: 0.5rem; }
.blue-team h3 { color: var(--blue); font-size: 0.9rem; margin-bottom: 0.5rem; }

.vs {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text-dim);
}

.team-stats { display: flex; flex-direction: column; gap: 0.25rem; }
.team-stat { font-size: 0.78rem; color: var(--text-dim); }

.verdict-bar { text-align: center; }
.verdict {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(68, 138, 255, 0.1);
  border: 1px solid rgba(68, 138, 255, 0.3);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue);
}

/* Rounds */
.round-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.round-entry.in-progress { border-color: rgba(255, 145, 0, 0.3); }

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.3);
}

.round-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.round-date { font-size: 0.72rem; color: var(--text-dim); }
.round-body { padding: 0.75rem 1rem; }
.round-body p { margin-bottom: 0.4rem; font-size: 0.82rem; }

.badge-blue {
  background: rgba(68, 138, 255, 0.15);
  color: var(--blue);
  padding: 0.15em 0.5em;
  border-radius: 4px;
  font-weight: 700;
}

/* Papers */
.paper-list { display: flex; flex-direction: column; gap: 0.5rem; }

.paper {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.paper:hover { border-color: var(--accent); }

.paper-id {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent);
  border-radius: 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.paper-id.red { background: rgba(255, 23, 68, 0.15); color: var(--red); }
.paper-id.blue { background: rgba(68, 138, 255, 0.15); color: var(--blue); }

.paper h4 { font-size: 0.88rem; font-weight: 600; }
.paper p { font-size: 0.75rem; color: var(--text-dim); margin: 0; }

/* Critical Findings */
.critical-card { border-color: rgba(255, 23, 68, 0.3); }

.critical-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.critical-header h3 { font-size: 0.95rem; }

.severity-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.severity-badge.critical { background: rgba(255, 23, 68, 0.2); color: var(--red); border: 1px solid rgba(255, 23, 68, 0.4); }
.severity-badge.high { background: rgba(255, 145, 0, 0.2); color: var(--orange); border: 1px solid rgba(255, 145, 0, 0.4); }
.severity-badge.medium { background: rgba(108, 92, 231, 0.2); color: var(--accent); border: 1px solid rgba(108, 92, 231, 0.4); }

.critical-desc { font-size: 0.85rem; color: var(--text); line-height: 1.5; margin-bottom: 0.75rem; }

.critical-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.novel-badge {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 145, 0, 0.08);
  border: 1px solid rgba(255, 145, 0, 0.2);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--orange);
}

/* Affected Contracts */
.affected-list { display: flex; flex-direction: column; gap: 1rem; }

.affected-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.affected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.3);
}

.affected-header h4 { font-size: 0.85rem; }

.affected-contracts { padding: 0.5rem 1rem; }

.contract-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(30, 30, 46, 0.3);
  font-size: 0.8rem;
}

.contract-row:last-child { border-bottom: none; }
.contract-name { font-weight: 600; }
.contract-note { color: var(--text-dim); font-size: 0.75rem; max-width: 55%; text-align: right; }
.contract-row.safe .contract-note { color: var(--green); }
.contract-row.vulnerable .contract-note { color: var(--red); }

/* Existing styles */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.secondary { background: rgba(108, 92, 231, 0.15); color: var(--accent); border: 1px solid rgba(108, 92, 231, 0.3); }
.btn.secondary:hover:not(:disabled) { background: rgba(108, 92, 231, 0.25); }
.btn.small { padding: 0.35rem 0.9rem; font-size: 0.8rem; margin-top: 0.75rem; }
.btn.danger { background: rgba(255, 23, 68, 0.15); color: var(--red); border: 1px solid rgba(255, 23, 68, 0.3); }
.btn.danger:hover:not(:disabled) { background: rgba(255, 23, 68, 0.25); }

.address-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.4rem;
}

.address-box label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.mono { font-family: var(--mono); font-size: 0.82rem; word-break: break-all; }

input[type="text"] {
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--text-dim); opacity: 0.5; }

.status { margin-top: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.85rem; }
.status.success { background: rgba(0, 200, 83, 0.1); color: var(--green); }
.status.error { background: rgba(255, 23, 68, 0.1); color: var(--red); }
.status.info { background: rgba(255, 145, 0, 0.1); color: var(--orange); }
.hidden { display: none; }

.setup-grid { display: grid; gap: 0.75rem; margin-top: 1rem; }
.field-label { display: block; font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.address-display { display: block; padding: 0.6rem 1rem; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); border-radius: 8px; }
.inline-row { display: flex; gap: 0.5rem; margin-top: 1rem; align-items: center; }

.challenge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.card.challenge { border-color: var(--red); border-width: 2px; }
.card.challenge h2 { color: var(--red); }

.attack-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.attack-card { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 23, 68, 0.2); border-radius: 8px; padding: 1rem; }
.attack-card h4 { font-size: 0.85rem; color: var(--red); margin-bottom: 0.5rem; font-family: var(--mono); }
.attack-card input { margin-bottom: 0.5rem; }
.attack-card .btn { width: 100%; }
.attack-desc { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.5rem; }

.log-box { background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; max-height: 300px; overflow-y: auto; font-family: var(--mono); font-size: 0.78rem; line-height: 1.7; }
.log-box::-webkit-scrollbar { width: 6px; }
.log-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.log-empty { color: var(--text-dim); text-align: center; padding: 1rem; }

.result-entry { padding: 0.6rem 0; border-bottom: 1px solid rgba(30, 30, 46, 0.5); }
.result-entry:last-child { border-bottom: none; }
.result-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.result-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.result-sim, .result-real { padding: 0.5rem; border-radius: 6px; }
.result-sim { background: rgba(108, 92, 231, 0.08); border: 1px solid rgba(108, 92, 231, 0.2); }
.result-real { background: rgba(255, 23, 68, 0.08); border: 1px solid rgba(255, 23, 68, 0.2); }
.result-label { display: block; font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.15rem; }
.result-pass { display: block; color: var(--green); font-weight: 700; font-size: 0.82rem; }
.result-fail { display: block; color: var(--red); font-weight: 700; font-size: 0.82rem; }
.result-detail { display: block; font-size: 0.7rem; color: var(--text-dim); margin-top: 0.15rem; word-break: break-all; }
.log-time { color: var(--text-dim); font-size: 0.72rem; }
.log-method { color: var(--accent); font-weight: 600; }

footer { text-align: center; margin-top: 2rem; color: var(--text-dim); font-size: 0.75rem; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .container { padding: 1rem; }
  header h1 { font-size: 1.4rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .score-row { flex-direction: column; }
  .vs { padding: 0.5rem 0; justify-content: center; }
  .attack-row, .result-compare, .challenge-grid { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .tab { padding: 0.6rem 0.8rem; font-size: 0.78rem; }
  .critical-meta { flex-direction: column; gap: 0.3rem; }
}
