/* Racer Points Tracker – v2.1 look (glassy) + Teams (v2.2.1) */

:root{
  --bg:#0b0d12;
  --text:#eef0ff;
  --muted:rgba(238,240,255,.65);
  --line:rgba(255,255,255,.10);
  --line2:rgba(255,255,255,.06);
  --danger:#ff5a6e;
  --radius:18px;
}
:root { color-scheme: dark; }

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(255,255,255,.10), transparent 60%),
              radial-gradient(900px 500px at 110% 0%, rgba(60,120,255,.18), transparent 55%),
              var(--bg);
  color:var(--text);
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 12px;
  background: rgba(11,13,18,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line2);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.brand{display:flex; align-items:center; gap:10px; min-width: 0}
.logo{
  width:40px; height:40px;
  display:grid; place-items:center;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.titlewrap{min-width:0}
.title{font-weight: 950; letter-spacing:.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.subtitle{font-size: 12px; color: var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.top-actions{display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end}

/* Layout (flex on mobile for iOS) */
.layout{
  padding: 12px;
  display:flex;
  flex-direction: column;
  gap: 12px;
}
@media(min-width: 980px){
  .layout{flex-direction: row; align-items:flex-start}
  .layout > .card:first-child{flex: 0 0 420px;}
  .layout > .card:last-child{flex: 1 1 auto;}
}

.card{
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 18px 45px rgba(0,0,0,.35);
}
.card-h h2{margin:0 0 4px 0; font-size: 16px}
.hint{color: var(--muted); font-size: 13px; line-height: 1.35}
.hint.small{font-size: 12px}

.grid2{display:grid; grid-template-columns: 1fr; gap: 10px;}
@media(min-width: 680px){ .grid2{grid-template-columns: 1fr 1fr} }

.panel{
  margin-top: 10px;
  background: rgba(0,0,0,.18);
  border:1px solid var(--line2);
  border-radius: 16px;
  padding: 10px;
}
.panel-h{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.panel-h h3{margin:0; font-size: 14px}

.field{display:flex; flex-direction:column; gap:4px; min-width: 160px}
.field.grow{flex: 1 1 auto; min-width: 220px}
label{font-size: 12px; color: var(--muted)}
input, select, button{font: inherit;}

/* Inputs/selects: dark + readable on iPhone */
input, select{
  background: rgba(10,12,18,.92);
  border:1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
select{
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(238,240,255,.85) 50%),
    linear-gradient(135deg, rgba(238,240,255,.85) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
input::placeholder{color: rgba(238,240,255,.45)}
input:focus, select:focus{
  border-color: rgba(120,170,255,.55);
  box-shadow: 0 0 0 3px rgba(120,170,255,.18);
}
/* when the option list opens (best-effort across browsers) */
select option{ color:#0b0d12; background:#eef0ff; }

.row{display:flex; gap:10px; align-items:flex-end; margin-top:10px}
.row.wrap{flex-wrap:wrap}
.grow{flex:1}

.list{display:flex; flex-direction:column; gap:8px; margin-top:8px}
.item{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:flex-start;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.03);
}
.meta{color: var(--muted); font-size: 12px}
.badge{
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
}
.pill{
  font-size: 12px;
  color: var(--text);
  background: rgba(255,255,255,.05);
  border:1px solid var(--line2);
  border-radius: 999px;
  padding: 6px 10px;
}

.btn{
  background: rgba(255,255,255,.10);
  border:1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  cursor:pointer;
  user-select:none;
}
.btn:hover{background: rgba(255,255,255,.14)}
.btn:active{transform: translateY(1px)}
.btn.small{padding:6px 10px; font-size: 12px}
.btn.ghost{background: rgba(255,255,255,.06)}
.btn.danger{border-color: rgba(255,90,110,.45); color: #ffd7dd}
.btn.danger:hover{background: rgba(255,90,110,.12)}
.filebtn input{display:none}

.tabs{display:flex; gap:8px; margin-top: 10px; flex-wrap:wrap;}
.tab{
  padding: 8px 12px;
  border-radius: 999px;
  border:1px solid var(--line2);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
}
.tab.active{background: rgba(120,170,255,.18); border-color: rgba(120,170,255,.35);}
.tabpane{margin-top:10px}
.hidden{display:none !important}

.entry-head{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-top: 10px;}
.entry-actions{display:flex; gap:8px; flex-wrap:wrap}

.tablewrap{overflow:auto; border-radius: 14px; border:1px solid var(--line2); background: rgba(0,0,0,.18); margin-top:10px}
table{width:100%; border-collapse: collapse; min-width: 720px}
th,td{padding: 10px; border-bottom:1px solid var(--line2); text-align:left; vertical-align: middle}
th{font-size: 12px; color: var(--muted); font-weight: 800}
td input, td select{width:100%}

.foot{
  padding: 16px 12px 24px;
  color: var(--muted);
  font-size: 12px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.muted{color: var(--muted)}

/* Clickable driver names */
.driver-link{
  cursor:pointer;
  color: rgba(170,200,255,.95);
  text-decoration: underline;
  text-decoration-color: rgba(170,200,255,.35);
}
.driver-link:active{opacity:.8}

/* Modal – less transparent */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.70);
  display:flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 999;
}
@media (min-width: 760px){
  .modal{ align-items:center; }
}
.modal.hidden{ display:none !important; }

.modal-card{
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: rgba(18,21,34,.96);
  border:1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  padding: 14px;
}

.modal-h{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  position: sticky;
  top:0;
  background: rgba(18,21,34,.98);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 10px;
  border-radius: 14px;
  z-index: 5;
}
.modal-actions{display:flex; gap:8px; align-items:center}

.profile-stats{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  margin-top: 12px;
}
@media (min-width: 700px){
  .profile-stats{ grid-template-columns: repeat(4, 1fr); }
}
.statbox{
  background: rgba(0,0,0,.20);
  border:1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 10px;
}
.statbox .k{color: var(--muted); font-size:12px}
.statbox .v{font-weight:950; font-size:18px; margin-top:4px}


/* Team color chip + banner */
.colorchip{
  width: 34px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}
.team-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 4px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  font-size: 12px;
  white-space:nowrap;
}
.team-dot{
  width:10px;height:10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
}
.banner-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  justify-content:space-between;
}

/* Sprint mini */
td .mini{max-width:120px}
th.center, td.center{text-align:center}
