:root {
  --bg: #0a1120;
  --panel: #111d33;
  --panel-2: #0d1728;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e9f0fa;
  --muted: #8ca0bd;
  --accent: #33d17a;
  --accent-2: #2f7bff;
  --danger: #ff5a5a;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.5;
}
h1, h2, h3 { font-family: "Sora", sans-serif; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(10, 17, 32, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand { font-family: "Sora"; font-weight: 800; font-size: 20px; }
.userbox { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.userbox button {
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: 8px; padding: 5px 10px; cursor: pointer;
}

section { max-width: 860px; margin: 20px auto; padding: 0 16px; }

/* live feed */
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 20px; }
.live-dot { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.live-card {
  background: linear-gradient(135deg, #14294a, #0e1b32);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.live-card .lc-name { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.live-card .lc-score { font-size: 15px; font-weight: 700; }
.live-card .lc-status { font-size: 12px; color: var(--accent); margin-top: 6px; }
.loading { color: var(--muted); font-size: 14px; }

/* panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.panel h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }

/* auth */
.auth { max-width: 380px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 9px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); cursor: pointer; font-weight: 600;
}
.tab.active { background: var(--accent-2); color: #fff; border-color: transparent; }
.authform { display: flex; flex-direction: column; gap: 10px; }
input {
  padding: 11px 12px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 14px;
}
input:focus { outline: none; border-color: var(--accent-2); }
.btn-primary {
  padding: 11px; background: var(--accent-2); border: none;
  border-radius: 10px; color: #fff; font-weight: 700; cursor: pointer; font-size: 14px;
}
.btn-ghost {
  padding: 9px 14px; background: transparent;
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); cursor: pointer; font-size: 13px;
}
.btn-ghost.danger { border-color: var(--danger); color: #ff9a9a; }
.msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg.err { color: #ff8080; }
.msg.ok { color: var(--accent); }

/* new match */
.new-match { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.new-match input { flex: 1; min-width: 90px; }
.new-match #oversLimit { max-width: 80px; }

.my-matches { display: flex; flex-direction: column; gap: 8px; }
.mm-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.mm-item:hover { border-color: var(--accent-2); }
.mm-item .tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.tag.live { background: rgba(51,209,122,0.15); color: var(--accent); }
.tag.completed { background: rgba(255,255,255,0.08); color: var(--muted); }

/* scorecard */
.scorecard {
  background: linear-gradient(135deg, #14294a, #0e1b32);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.sc-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.sc-score { font-size: 40px; font-weight: 800; margin: 6px 0; }
.sc-players { display: flex; gap: 16px; font-size: 14px; flex-wrap: wrap; margin-top: 8px; }
.sc-over { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.ball {
  min-width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; font-size: 12px; font-weight: 700; padding: 0 4px;
  background: rgba(255,255,255,0.14);
}
.ball.four { background: var(--accent-2); }
.ball.six { background: var(--accent); color: #04210f; }
.ball.wicket { background: var(--danger); }
.ball.extra { background: #e0a020; color: #241a02; }

/* console */
.run-row { display: flex; gap: 8px; flex-wrap: wrap; }
.run-btn {
  width: 52px; height: 52px; border-radius: 12px; border: none;
  background: #1d3a63; color: #fff; font-size: 18px; font-weight: 700; cursor: pointer;
}
.run-btn.w { background: var(--danger); }
.extra-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.extra-row #completeBtn { margin-left: auto; }
.names-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: flex-end; }
.names-row label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.names-row input { padding: 8px 10px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
