

:root{
  /* Core palette (dark fantasy) */
  --bg: #0b0d12;
  --bg-2: #07080c;

  --panel: rgba(18, 22, 33, 0.74);
  --panel-2: rgba(12, 15, 24, 0.80);

  --stroke: rgba(255,255,255,0.10);
  --stroke-2: rgba(255,255,255,0.16);

  --text: rgba(245, 247, 255, 0.92);
  --muted: rgba(245, 247, 255, 0.66);

  /* Accent colors (mana vibe) */
  --accent: #a78bfa;   /* violet */
  --accent-2: #22d3ee; /* cyan */
  --good: #34d399;     /* green */
  --warn: #fbbf24;     /* amber */
  --bad: #fb7185;      /* rose */

  --shadow: 0 10px 30px rgba(0,0,0,0.45);

  --radius: 16px;
  --radius-lg: 22px;

  /* Interaction sizing */
  --tap: 44px;

  /* Layout */
  --max: 1120px;

  /* Typography */
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(167,139,250,0.18), transparent 55%),
    radial-gradient(900px 500px at 95% 0%, rgba(34,211,238,0.14), transparent 55%),
    radial-gradient(1200px 700px at 50% 110%, rgba(251,113,133,0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 40%, #05060a 100%);
  overflow-x: hidden;
}

/* Focus styles that look good on dark UI */
:focus-visible{
  outline: 2px solid rgba(34,211,238,0.55);
  outline-offset: 2px;
  border-radius: 10px;
}

/* --- Header --- */
.app-header{
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: rgba(8,10,14,0.70);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--stroke);
}

.brand{
  display:flex;
  gap: 12px;
  align-items:center;
  min-width: 0;
}
.brand__sigil{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid var(--stroke-2);
  box-shadow: var(--shadow);
  background:
    radial-gradient(12px 12px at 30% 35%, rgba(34,211,238,0.55), transparent 60%),
    radial-gradient(14px 14px at 70% 70%, rgba(167,139,250,0.55), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.18));
}
.brand__text{ min-width: 0; }
.brand__title{
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__sub{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn{
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:active{ transform: translateY(1px); }

/* --- Main container --- */
.app-main{
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 14px 92px; /* bottom nav space on mobile */
}

/* --- Status strip --- */
.status-strip{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}
.status-item__label{
  font-size: 11px;
  color: var(--muted);
}
.status-item__value{
  margin-top: 4px;
  font-weight: 900;
  font-size: 13px;
}

/* --- Views --- */
.view{ margin-top: 16px; }
.view-head{
  display:flex;
  align-items:flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.view-title{
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.2px;
}
.view-actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

/* Segmented control */
.segmented{
  display:flex;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  overflow:hidden;
}
.segmented__btn{
  min-height: 38px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}
.segmented__btn[aria-selected="true"]{
  color: var(--text);
  background: rgba(255,255,255,0.10);
}

/* Buttons */
.btn{
  min-height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  font-size: 12px;
}
.btn:active{ transform: translateY(1px); }

/* --- Cards / Schedule --- */
.schedule-list{
  display:grid;
  gap: 10px;
}

.card{
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 12px;
}
.card--match{
  position: relative;
  overflow: hidden;
}
.card--match::before{
  content:"";
  position:absolute;
  inset: -44px -44px auto auto;
  width: 180px;
  height: 180px;
  pointer-events:none;
  transform: rotate(15deg);
  background:
    radial-gradient(circle at 30% 30%, rgba(167,139,250,0.22), transparent 62%);
}
.card__row{
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  gap: 12px;
}
.card__title{
  font-weight: 900;
  font-size: 14px;
}
.card__meta{
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.card__text{
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Badges */
.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke-2);
  background: rgba(255,255,255,0.06);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.badge__dot{
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--accent-2);
  box-shadow: 0 0 16px rgba(34,211,238,0.45);
}
.badge--done .badge__dot{
  background: var(--good);
  box-shadow: 0 0 16px rgba(52,211,153,0.35);
}
.badge--soon .badge__dot{
  background: var(--accent);
  box-shadow: 0 0 16px rgba(167,139,250,0.35);
}

/* Match lines */
.match-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}
.match-line{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid rgba(255,255,255,0.08);
}
.match-line__names{
  display:flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.match-line__names strong{
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-line__names span{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-line__right{
  text-align: right;
  display:flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}
.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke-2);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 900;
  font-size: 12px;
}

/* --- Table card (Rankings) --- */
.table-card{
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.table-meta{
  padding: 12px 12px 0;
  color: var(--muted);
  font-size: 12px;
}
.table-wrap{
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}
.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 420px; /* allow swipe on small screens */
}
.table th, .table td{
  text-align:left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.table thead th{
  position: sticky;
  top: 0;
  background: rgba(10,12,18,0.86);
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: var(--muted);
  z-index: 1;
}
.table tbody tr:hover{
  background: rgba(255,255,255,0.04);
}
.table .rank{ font-weight: 900; }
.table .pts{ font-weight: 900; }

.table-hint{
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
}

/* --- Gallery placeholder chip --- */
.chip{
  margin-top: 10px;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 12px;
}
.chip__dot{
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--bad);
  box-shadow: 0 0 18px rgba(251,113,133,0.35);
}

/* Hidden helper */
.is-hidden{ display:none !important; }

/* --- Bottom navigation (mobile-first) --- */
.bottom-nav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;

  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  display:flex;
  gap: 8px;
  justify-content: space-between;

  background: rgba(8,10,14,0.80);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--stroke);
}
.nav-btn{
  flex: 1;
  min-height: var(--tap);
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  color: var(--muted);

  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap: 2px;

  cursor: pointer;
}
.nav-btn__icon{ font-size: 16px; }
.nav-btn__label{
  font-size: 11px;
  font-weight: 900;
}
.nav-btn.is-active{
  color: var(--text);
  border-color: rgba(167,139,250,0.35);
  box-shadow: 0 0 0 1px rgba(167,139,250,0.12) inset;
}

/* --- Desktop enhancements (not just stretching mobile) --- */
@media (min-width: 760px){
  /* Give desktop breathing room */
  .app-main{
    padding: 18px 18px 24px;
  }

  /* Nav becomes a second-row sticky control (feels intentional on desktop) */
  .bottom-nav{
    position: sticky;
    top: 64px;
    bottom: auto;

    max-width: var(--max);
    margin: 12px auto 0;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    padding: 10px;
  }

  .nav-btn{
    flex-direction: row;
    gap: 10px;
  }
  .nav-btn__label{ font-size: 12px; }

  /* Schedule becomes multi-column */
  .schedule-list{
    grid-template-columns: 1fr 1fr;
  }

  /* Slightly larger type */
  .view-title{ font-size: 20px; }
  .status-item__value{ font-size: 14px; }

  /* Hover polish */
  .btn:hover,
  .icon-btn:hover,
  .nav-btn:hover,
  .segmented__btn:hover{
    background: rgba(255,255,255,0.08);
  }
  .card:hover{
    border-color: rgba(255,255,255,0.14);
  }
}

@media (min-width: 1100px){
  .schedule-list{
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Optional “glow mode” toggle (hooked to #glowBtn JS later) */
body.glow{
  --panel: rgba(18, 22, 33, 0.80);
  --stroke: rgba(255,255,255,0.12);
  --stroke-2: rgba(255,255,255,0.18);
}