:root{
  --bg:#0b1020;
  --panel:#121a31;
  --panel2:#0f1630;
  --text:#e9ecff;
  --muted:#aab3d6;
  --border:rgba(255,255,255,.10);
  --accent:#6ea8fe;
  --good:#22c55e;
  --bad:#ef4444;
  --warn:#f59e0b;

  /* Helps native UI (select dropdown list) match the dark theme in modern browsers */
  color-scheme: dark;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(110,168,254,.22), transparent 60%),
              radial-gradient(900px 500px at 90% 10%, rgba(34,197,94,.12), transparent 55%),
              var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; gap:18px;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background: rgba(11,16,32,.86);
  backdrop-filter: blur(10px);
}

.brand{display:flex; align-items:center; gap:12px}
/* legacy (no longer used) */
.brandLeft{display:flex; flex-direction:column; align-items:center; gap:4px}
.brandText{display:flex; flex-direction:column}

/* Logo container + image */
.logo{
  width:44px;height:44px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.04);
  border:1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}
.logoImg{
  width: 38px;
  height: 26px;
  object-fit: contain;
  display:block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}

.title{font-weight:800; letter-spacing:.2px}
/* removed subtitle in navbar */
.subtitle{display:none}

.tabs{display:flex; gap:8px; flex-wrap:wrap}
.tab{
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
}
.tab.active{
  background: rgba(110,168,254,.22);
  border-color: rgba(110,168,254,.5);
}

/* --- Hover glow / shimmer (buttons + tabs) --- */
.btn, .tab{
  position:relative;
  overflow:hidden;
  transition: transform .08s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.btn::before, .tab::before{
  content:"";
  position:absolute;
  inset:-50px;
  background: linear-gradient(120deg, transparent 40%, rgba(110,168,254,.20), transparent 70%);
  transform: translateX(-60%) rotate(12deg);
  opacity:0;
  pointer-events:none;
}
.btn:hover::before, .tab:hover::before{
  opacity:1;
  animation: shimmerOnce 700ms linear;
}
.btn:hover, .tab:hover{
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  border-color: rgba(110,168,254,.35);
  transform: translateY(-1px);
}
.btn:active, .tab:active{transform: translateY(0)}
@keyframes shimmerOnce{
  from{transform: translateX(-60%) rotate(12deg)}
  to{transform: translateX(60%) rotate(12deg)}
}

.container{max-width:1400px; margin:18px auto; padding:0 14px 18px}
.view{display:none}
.view.active{display:block}

.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:14px;
}
.card{
  grid-column: span 12;
  background: linear-gradient(180deg, rgba(18,26,49,.92), rgba(15,22,48,.92));
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}
@media (min-width: 900px){
  /* Dashboard: stack cards vertically + full width */
  #view-dashboard .card{grid-column: span 12}

  #view-settings .card:nth-child(1){grid-column: span 4}
  #view-settings .card:nth-child(2){grid-column: span 4}
  #view-settings .card:nth-child(3){grid-column: span 4}
}

/* Add vertical space between stacked cards (e.g., Randomizer section) */
#view-random > .card + .card{margin-top:16px;}

/* Dashboard tables should fit the full card width without horizontal scrolling */
#view-dashboard .tableWrap{overflow-x:hidden}
#view-dashboard .table{min-width:0; table-layout:fixed}
#view-dashboard .table th, #view-dashboard .table td{overflow:hidden; text-overflow:ellipsis}

.card-title{font-weight:800; margin-bottom:10px}
.hint{color:var(--muted); font-size:12px; margin-top:10px}

/* --- Wheel (Glücksrad) --- */
.wheelLayout{
  display:grid;
  grid-template-columns:minmax(360px, 560px) minmax(280px,1fr);
  gap:16px;
  align-items:start;
}

@media (max-width: 980px){
  .wheelLayout{grid-template-columns:1fr}
}

.wheelCanvasWrap{position:relative; display:flex; justify-content:center; align-items:center; padding:8px}

#wheelCanvas{
  width:100%;
  max-width:520px;
  height:auto;
  border-radius:999px;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.08);
  box-shadow:0 14px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
}

.wheelPointer{
  position:absolute;
  top:6px;
  left:50%;
  width:0;
  height:0;
  transform:translateX(-50%);
  border-left:12px solid transparent;
  border-right:12px solid transparent;
  border-top:18px solid rgba(255,255,255,0.92);
  filter:drop-shadow(0 6px 8px rgba(0,0,0,0.4));
}

.wheelBtns{display:flex; justify-content:center; gap:10px; margin-top:10px}
.wheelLeft .hint{margin-top:10px}

.wheelBoxTitle{font-weight:700; margin-bottom:10px}

.wheelItems{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height:520px;
  overflow:auto;
  padding-right:6px;
}

.wheelRow{display:grid; grid-template-columns:1fr 40px; gap:10px; align-items:center}
.wheelRow .input{height:40px}
.wheelRow .btn{height:40px; width:40px; padding:0}

.wheelActions{display:flex; gap:10px; margin-top:12px}

/* --- Modal --- */
.modal{position:fixed; inset:0; background:rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; padding:18px; z-index:999}
.modal.hidden{display:none}
.modalCard{
  width:min(520px, 100%);
  background:linear-gradient(180deg, rgba(19,28,52,0.95), rgba(8,12,24,0.95));
  border:1px solid rgba(255,255,255,0.10);
  border-radius:18px;
  padding:18px;
  box-shadow:0 30px 80px rgba(0,0,0,0.55);
  animation:modalPop 180ms ease-out both;
}

@keyframes modalPop{from{transform:scale(0.96); opacity:0} to{transform:scale(1); opacity:1}}

.modalTitle{font-weight:800; letter-spacing:0.2px; margin-bottom:8px}
.modalResult{font-size:28px; font-weight:900; padding:10px 12px; border-radius:14px; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08); text-align:center}
.modalActions{display:flex; gap:10px; justify-content:flex-end; margin-top:14px}

.formRow{
  display:grid;
  grid-template-columns: 80px 1fr 90px 1fr 70px 1fr 44px 90px auto;
  gap:10px;
  align-items:center;
}
@media (max-width: 900px){
  .formRow{grid-template-columns: 1fr 1fr; }
  .formRow label{display:none}
}

.input, select, .textarea{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
}

/* Make native select dropdowns readable (especially the opened list) */
select{color-scheme: dark;}
select option{background: var(--panel2); color: var(--text);}
select option:disabled{color: rgba(233,236,255,.35);}

.input:focus, select:focus, .textarea:focus{
  border-color: rgba(110,168,254,.55);
  box-shadow: 0 0 0 3px rgba(110,168,254,.18);
}

/* Champions page controls spacing */
.toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin:10px 0 12px;
}
.toolbar #champSearch{flex: 1 1 360px; min-width: 240px;}
.toolbar #champFilter{flex: 0 0 220px; min-width: 180px;}
.toolbar #refreshBtn{flex: 0 0 auto;}
.textarea{resize: vertical}

/* Draft-Pick */
/* Controls row (custom, not using .formRow grid) */
.draft-controls{
  margin: 6px 0 12px;
  display:flex;
  gap: 12px;
  align-items:flex-end;
  flex-wrap: wrap;
}
.draft-controls .field{
  display:flex;
  flex-direction:column;
  gap: 6px;
  min-width: 170px;
}
.draft-controls .actions{
  display:flex;
  gap: 10px;
  align-items:center;
  margin-left: auto;
}
.draft-controls .btn,
.draft-controls .input,
.draft-controls select{height: 42px;}
/* Make buttons in the draft controls visually equal height */
.draft-controls .btn{padding: 0 14px; line-height: 42px;}
.btn.small{padding: 0 12px;}

/* Picks + comp check layout */
.draft-top{
  display:grid;
  grid-template-columns: minmax(260px, 320px) 1fr minmax(260px, 320px);
  gap: 16px;
  margin-top: 12px;
  align-items:start;
}
@media (max-width: 1100px){
  .draft-top{grid-template-columns: 1fr;}
  .draft-controls .actions{margin-left: 0;}
}
.draft-side.our{justify-self:start;}
.draft-side.enemy{justify-self:end;}
.draft-mid{min-width: 0; margin-top: 108px;}

/* When stacked (mobile / narrow), don't push the comp check down */
@media (max-width: 1100px){
  .draft-mid{margin-top: 18px;}
}

/* Add breathing room between the Draft card and Pick Order card */
#view-draft > .grid{margin-top: 18px;}

.subhead{font-weight:800; color: var(--text); margin-bottom: 10px;}

.pickGrid{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.pickGridOur{align-items:flex-start;}
.pickGridEnemy{align-items:flex-end;}

.pickCard{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  padding: 10px;
  width: 280px;
  max-width: 100%;
  min-height: 92px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap: 8px;
  position: relative;
}

.pickCard.empty{opacity:.75}

.pickIcon{
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
}

.pickName{font-weight:800; text-align:center; font-size: 13px; line-height:1.1}

.pickRemove{
  position:absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}

.suggestGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 900px){
  .suggestGrid{grid-template-columns: 1fr;}
}

.suggestItem{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  gap: 10px;
}
.suggestItem .meta{display:flex; flex-direction:column; gap:2px;}
.suggestItem .meta .t{font-weight:900}
.suggestItem .meta .s{color: var(--muted); font-size: 12px;}

.btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}
.btn.primary{background: rgba(110,168,254,.22); border-color: rgba(110,168,254,.55)}
.btn.danger{background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.5)}

.tableWrap{overflow:auto; border-radius:14px; border:1px solid var(--border)}
.table{
  width:100%;
  border-collapse: collapse;
  font-size:13px;
  min-width: 900px;
}
.table th, .table td{
  padding:10px 10px;
  border-bottom:1px solid rgba(255,255,255,.08);
  vertical-align:middle;
  white-space:nowrap;
}
.table th{
  position:sticky; top:0;
  background: rgba(0,0,0,.18);
  text-align:left;
  font-size:12px;
  color:var(--muted);
}
.table tr:hover td{background: rgba(255,255,255,.03)}
.badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  border:1px solid var(--border);
}
.badge.win{background: rgba(34,197,94,.18); border-color: rgba(34,197,94,.45)}
.badge.done{background: rgba(34,197,94,.14)}
.badge.lost{background: rgba(239,68,68,.14)}
.badge.unplayed{background: rgba(245,158,11,.14)}

.progress{
  display:flex; gap:10px; align-items:flex-end;
  margin-top:6px;
}
.progressBar{
  height:10px; width:100%;
  border:1px solid var(--border);
  border-radius:999px;
  background: rgba(255,255,255,.04);
  overflow:hidden;
}
.progressFill{height:100%}
.mini{color:var(--muted); font-size:12px; margin-top:10px}

.winCell{background: rgba(34,197,94,.20) !important;}
.footer{
  padding:14px 18px;
  color:var(--muted);
  font-size:12px;
  border-top:1px solid var(--border);
  background: rgba(11,16,32,.75);
}
.stack{display:flex; flex-direction:column; gap:10px}

/* --- Randomizer --- */
.random-controls{
  margin-top: 8px;
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
}
.random-controls .field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:160px;
}
.random-controls .actions{
  display:flex;
  gap:10px;
  align-items:center;
  margin-left:auto;
}
.random-controls .btn,
.random-controls .input,
.random-controls select{height:42px;}
.random-controls .btn{padding: 0 16px; line-height:42px;}
@media (max-width: 900px){
  .random-controls .actions{margin-left:0;}
}

.rollStage{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  justify-content:center;
  align-items:stretch;
}

.rollSlot{
  position:relative;
  flex: 1 1 220px;
  min-width: 220px;
  max-width: 340px;
  padding:14px 14px;
  border-radius:16px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  overflow:hidden;
  text-align:center;
}

.rollSlot .slotLabel{color:var(--muted); font-size:12px}
.rollSlot .slotIcon{
  width:78px;
  height:78px;
  border-radius:18px;
  margin:10px auto 0;
  display:block;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  box-shadow: 0 12px 30px rgba(0,0,0,.28);
}
.rollSlot .slotName{font-size:18px; font-weight:900; letter-spacing:.2px; margin-top:6px}

.rollStage.single .rollSlot{
  max-width: 520px;
  min-width: 320px;
  padding:22px 22px;
}
.rollStage.single .rollSlot .slotIcon{
  width:130px;
  height:130px;
  border-radius:26px;
}
.rollStage.single .rollSlot .slotName{
  font-size:26px;
  margin-top:10px;
}

.rollSlot::before{
  content:"";
  position:absolute;
  inset:-40px;
  background: linear-gradient(120deg, transparent 35%, rgba(110,168,254,.18), transparent 65%);
  transform: translateX(-40%);
  opacity:0;
}

.rollStage.rolling .rollSlot{
  box-shadow: 0 0 0 1px rgba(110,168,254,.15), 0 18px 40px rgba(0,0,0,.25);
}

.rollStage.rolling .rollSlot::before{
  opacity:1;
  animation: shimmer 900ms linear infinite;
}

.rollStage.rolling .slotName{
  animation: jitter 180ms linear infinite;
}

.rollStage.reveal .rollSlot{
  animation: pop 420ms ease-out both;
}

@keyframes shimmer{
  from{transform: translateX(-55%) rotate(12deg)}
  to{transform: translateX(55%) rotate(12deg)}
}

@keyframes jitter{
  0%,100%{transform: translateY(0)}
  50%{transform: translateY(-1px)}
}

@keyframes pop{
  from{transform: translateY(6px) scale(.98); opacity:.0}
  to{transform: translateY(0) scale(1); opacity:1}
}

.spark{
  position:absolute;
  width:6px;
  height:6px;
  border-radius:999px;
  background: rgba(110,168,254,.95);
  box-shadow: 0 0 12px rgba(110,168,254,.55);
  animation: spark 650ms ease-out forwards;
  pointer-events:none;
}

@keyframes spark{
  0%{transform: translate(0,0) scale(1); opacity:1}
  100%{transform: translate(var(--dx), var(--dy)) scale(.1); opacity:0}
}

.rollMeta{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:10px;
  color:var(--muted);
  font-size:12px;
}

/* --- Auth / Gate overlays --- */
.authArea {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.authUser { opacity: 0.9; font-weight: 700; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.overlay.hidden { display: none; }

.overlayCard {
  width: min(860px, 96vw);
  background: rgba(15, 18, 30, .95);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}

.overlayTitle {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.overlayText { opacity: 0.85; }
.errorText { color: #ff6b6b; margin-top: 10px; font-weight: 700; }

.gridAuth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .gridAuth { grid-template-columns: 1fr; }
}
.authCol {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.03);
}

/* --- Rooms view --- */
.chatBox {
  height: 320px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.02);
}
.chatMsg {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.03);
}
.chatMsg .meta { opacity: 0.7; font-size: 12px; margin-bottom: 6px; }
