/* ===========================================================================
   Arcane Tourneys — competition hub shell
   ---------------------------------------------------------------------------
   Sidebar command rail on desktop, bottom bar on phones, with a status header
   and a scrolling content area. Tokens live in base.css.

   MOBILE FIRST: base rules are the phone. The sidebar appears at 1024px.
   =========================================================================== */

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ------------------------------------------------------------- sidebar */
.command-rail { display: none; }

@media (min-width: 1024px) {
    .app { flex-direction: row; }
    .command-rail {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: var(--sidebar);
        flex: none;
        min-height: 100vh;
        position: sticky;
        top: 0;
        max-height: 100vh;
        background:
            linear-gradient(180deg, rgba(14,16,13,0.96) 0%, rgba(9,10,8,0.94) 66%, rgba(5,6,5,0.98) 100%);
        border-right: 1px solid var(--line);
        box-shadow: 12px 0 40px rgba(0,0,0,0.58), inset -1px 0 rgba(255,255,255,0.025);
        z-index: 40;
    }
}

.rail-brand {
    padding: 26px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(5,6,5,0.72);
}
.rail-brand .kicker { margin: 0 0 10px; }
.rail-home { display: block; }
.rail-brand .name {
    font-family: var(--font-stencil);
    font-size: clamp(28px, 2.4vw, 38px);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 0.98;
    color: var(--text);
}
.rail-brand .name span { display: block; color: var(--molten); }

.rail-nav { display: flex; flex-direction: column; margin-top: 10px; }

.rail-foot {
    padding: 20px 22px;
    border-top: 1px solid var(--line);
    background: rgba(5,6,5,0.72);
    display: grid;
    gap: 9px;
}
.rail-foot .row { display: flex; justify-content: space-between; gap: 12px; }
.rail-foot .uplink {
    display: flex; align-items: center; gap: 9px;
    margin-top: 6px; padding-top: 12px;
    border-top: 1px solid var(--line-soft);
    color: var(--molten);
}
.rail-foot .uplink .dot { background: var(--molten); }

/* --------------------------------------------------------------- nav btn */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 17px 22px;
    min-height: 56px;
    background: transparent;
    border: 0;
    border-left: 4px solid transparent;
    color: var(--faint);
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.nav-btn svg { width: 22px; height: 22px; flex: none; }
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav-btn[aria-selected="true"] {
    color: var(--text);
    border-left-color: var(--molten);
    background: linear-gradient(90deg, rgba(113, 54, 36, 0.34) 0%, rgba(62, 52, 38, 0.12) 72%, transparent 100%);
}

/* ---------------------------------------------------------- bottom bar */
.bottom-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: flex;
    background: rgba(7,8,7,0.97);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-bar .nav-btn {
    flex: 1 1 0;
    flex-direction: column;
    gap: 5px;
    padding: 9px 4px;
    min-height: 62px;
    justify-content: center;
    border-left: 0;
    border-top: 4px solid transparent;
    font-size: 11px;
    letter-spacing: 0.08em;
}
.bottom-bar .nav-btn svg { width: 21px; height: 21px; }
.bottom-bar .nav-btn[aria-selected="true"] {
    border-left-color: transparent;
    border-top-color: var(--molten);
    background: linear-gradient(180deg, rgba(234, 88, 12, 0.2) 0%, transparent 100%);
}
@media (min-width: 1024px) { .bottom-bar { display: none; } }

/* ------------------------------------------------------------- main col */
.main-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 30;
}

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px var(--gutter);
    min-height: 72px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(255,255,255,0.018), transparent 32%),
        rgba(7,8,7,0.9);
    position: sticky;
    top: 0;
    z-index: 39;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.status-title { display: none; }
.status-title .sub { color: var(--molten); }
.status-title h1 {
    margin: 0;
    font-size: clamp(22px, 2.6vw, 38px);
    font-weight: 800;
    letter-spacing: 0.12em;
}
@media (min-width: 1024px) {
    .status-bar { min-height: 92px; }
    .status-title { display: flex; flex-direction: column; gap: 2px; }
    .status-brand { display: none; }
}

.account-area { display: flex; align-items: center; gap: 10px; flex: none; }
.account-chip {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 0 0 14px;
    min-height: 48px;
    background: rgba(12,13,11,0.92);
    border: 1px solid var(--line);
    color: var(--text);
    font: inherit;
    text-align: right;
    cursor: pointer;
    transition: border-color 0.16s ease;
}
.account-chip:hover { border-color: var(--line-heavy); }
.account-chip .identity { display: none; padding: 6px 12px 6px 0; line-height: 1.15; }
.account-chip .identity b {
    display: block;
    font-family: var(--font-display);
    font-size: 17px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.account-chip .identity small {
    display: block;
    font-family: var(--font-mono);
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--molten);
}
.account-chip .avatar {
    width: 46px; height: 46px; flex: none;
    display: grid; place-items: center;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
    border-left: 1px solid var(--line);
    color: var(--text);
    font-family: var(--font-display); font-weight: 700;
}
@media (min-width: 640px) { .account-chip .identity { display: block; } }

/* ------------------------------------------------------------- content */
.content {
    flex: 1;
    padding: 16px var(--gutter) 0;
    padding-bottom: 96px;   /* clears the bottom bar on phones */
}
@media (min-width: 1024px) { .content { padding-bottom: 24px; } }
.content-inner { max-width: 1600px; margin: 0 auto; width: 100%; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: dataLoad 0.18s ease-out; }
@keyframes dataLoad { 0% { opacity: 0; } 100% { opacity: 1; } }

/* Two-column working area */
.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
@media (min-width: 1280px) { .work { grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 400px); gap: 32px; } }
.col { display: grid; gap: 16px; min-width: 0; align-content: start; }
/* A labelled group: rows sit tight together, groups sit far apart */
.group { display: grid; gap: 8px; }
.group + .group { margin-top: 22px; }
.group > .eyebrow { margin-bottom: 4px; }

/* --------------------------------------------------- primary op button */
.featured {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    padding: clamp(18px, 4vw, 28px);
    background:
        linear-gradient(105deg, rgba(113, 54, 36, 0.18) 0%, transparent 48%),
        radial-gradient(60% 70% at 0% 100%, rgba(0, 0, 0, 0.48), transparent 68%),
        radial-gradient(50% 60% at 100% 0%, rgba(0, 0, 0, 0.38), transparent 66%),
        var(--raised);
    border: 1px solid var(--line-heavy);
    border-left: 5px solid var(--molten);
    box-shadow:
        0 12px 38px rgba(0,0,0,0.46),
        inset 0 0 60px rgba(0,0,0,0.28);
    color: var(--text);
    overflow: hidden;
}
.featured-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.featured .featured-label {
    display: block;
    margin: 14px 0 8px;
    font-family: var(--font-display);
    font-size: clamp(32px, 8vw, 56px);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 0.98;
    margin: 14px 0 8px;
}
.featured .featured-meta { display: block; margin: 0; font-size: 15px; color: var(--muted); max-width: 56ch; }

/* ------------------------------------------------------------ op cards */
.event-btn {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    padding: 18px 20px;
    min-height: 64px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.015), rgba(0,0,0,0.22) 100%),
        var(--surface);
    border: 1px solid var(--line-soft);
    border-left: 3px solid transparent;
    color: var(--text);
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}
.event-btn:hover {
    background:
        linear-gradient(180deg, transparent 58%, rgba(0,0,0,0.24) 100%),
        var(--surface-2);
    border-color: var(--line-heavy);
    border-left-color: var(--rust);
}
.event-btn.is-live { border-left-color: var(--teal); }
.event-btn .row-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; margin-bottom: 6px;
}
.event-btn .title {
    display: block;
    font-family: var(--font-display);
    font-family: var(--font-display);
    font-size: clamp(19px, 4vw, 24px);
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    line-height: 1.15;
}
.event-btn .sub {
    display: block; margin-top: 4px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted);
}
.op-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; }
@media (min-width: 680px) { .op-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* --------------------------------------------------------------- panels */
.panel-head {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 18px;
    background: linear-gradient(90deg, rgba(0,0,0,0.48), rgba(0,0,0,0.25));
    border-bottom: 1px solid var(--line);
}
.panel-head h2, .panel-head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-family: var(--font-display);
    font-size: 15px; font-weight: 600; letter-spacing: 0.2em; color: var(--tan-lt);
}
.panel-body { padding: 18px; }
.muted-copy { font-size: 14.5px; line-height: 1.62; color: var(--muted); margin: 0; }
.muted-copy code {
    font-family: var(--font-mono); font-size: 12.5px;
    background: rgba(255,255,255,0.08); padding: 1px 6px; color: var(--text);
}
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kv + .kv { margin-top: 10px; }
.kv .kv-value {
    font-family: var(--font-display); font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------- roster rows */
.roster-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px;
    min-height: 54px;
    background: rgba(5,6,5,0.76);
    border: 1px solid var(--line);
    width: 100%;
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: default;
}
.roster-row + .roster-row { margin-top: 8px; }
.roster-row.is-you { border-left: 3px solid var(--molten); }
.roster-row.is-empty { background: rgba(0,0,0,0.5); cursor: pointer; }
.roster-row.is-empty:hover { border-color: var(--line-heavy); background: rgba(255,255,255,0.04); }
.roster-row .ident { display: flex; align-items: center; gap: 12px; min-width: 0; }
.roster-row .platform {
    width: 28px; height: 28px; flex: none;
    display: grid; place-items: center;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--line);
    font-family: var(--font-mono); font-size: 9px; font-weight: 700; color: var(--faint);
}
.roster-row .who {
    font-family: var(--font-display);
    font-size: 16px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.roster-row.is-empty .who { color: var(--faint); }
.roster-row.is-empty:hover .who { color: var(--text); }

.meter { height: 8px; background: #000; border: 1px solid var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; }

/* ------------------------------------------------------------ stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.stat {
    padding: 16px 18px;
    background:
        radial-gradient(60% 50% at 100% 100%, rgba(0,0,0,0.3), transparent 70%),
        var(--surface);
    border: 1px solid var(--line-soft);
}
.stat .k {
    font-family: var(--font-mono);
    font-size: 10px; font-weight: 700; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--faint);
}
.stat .v {
    font-family: var(--font-display);
    font-family: var(--font-stencil);
    font-size: clamp(30px, 6.4vw, 44px); font-weight: 700; letter-spacing: 0.03em;
    margin-top: 4px; font-variant-numeric: tabular-nums;
    color: var(--tan-lt);
}

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.records { width: 100%; border-collapse: collapse; min-width: 620px; }
table.records caption {
    text-align: left; padding: 0 18px 12px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted);
}
table.records thead th {
    text-align: left;
    padding: 16px 18px;
    font-family: var(--font-mono);
    font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--faint);
    background: rgba(5,6,5,0.82);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.records tbody td, table.records tbody th {
    padding: 18px; font-size: 15px; border-top: 1px solid var(--line-soft); text-align: left;
}
table.records tbody tr:hover { background: rgba(255,255,255,0.05); }
table.records tbody tr.is-mine { background: rgba(234, 88, 12, 0.12); box-shadow: inset 3px 0 0 var(--molten); }
.rank-cell {
    font-family: var(--font-display);
    font-size: 26px; font-weight: 800; letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}
.empty-cell {
    padding: 44px 18px; text-align: center; color: var(--faint);
    font-family: var(--font-mono); font-size: 11px; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase;
}
.tier-pill {
    display: inline-block;
    padding: 4px 11px;
    border: 1px solid currentColor;
    font-family: var(--font-mono);
    font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    white-space: nowrap;
}

/* ----------------------------------------------------------- squad cards */
.squad-card { padding: 16px; background: rgba(5,6,5,0.74); border: 1px solid var(--line); }
.squad-card + .squad-card { margin-top: 12px; }
.squad-card .row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.squad-card .row-top strong {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.squad-stats {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px 16px; margin-top: 14px;
    font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
.squad-stats b { color: var(--text); margin-left: 5px; }
@media (min-width: 560px) { .squad-stats { grid-template-columns: repeat(4, minmax(0,1fr)); } }

/* ------------------------------------------------------------- highlight */
#highlight-card {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    min-height: 0;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--tan);
    color: var(--text);
    overflow: hidden;
}
.highlight-title {
    font-family: var(--font-display);
    font-size: clamp(17px, 3.2vw, 20px);
    font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    margin: 6px 0 0; line-height: 1.12;
}
.highlight-badge {
    position: absolute;
    top: 15px; right: 15px;
    padding: 5px 10px;
    background: rgba(0,0,0,0.92);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text);
}

/* ----------------------------------------------------------- feed status */
.feed-status {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    font-family: var(--font-mono); font-size: 10px; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live  { background: var(--ok); animation: pulse 2s ease-in-out infinite; }
.dot.stale { background: var(--warn); }
.dot.down  { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* --------------------------------------------------------- deploy screen */
.deploy-screen {
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(24px, 6vw, 64px) clamp(18px, 4vw, 48px);
    background:
        linear-gradient(120deg, rgba(255,255,255,0.018), transparent 34%),
        rgba(9,10,8,0.88);
    border: 1px solid var(--line);
    border-top: 4px solid var(--molten);
    box-shadow: 0 4px 30px rgba(0,0,0,0.6);
    text-align: center;
}
.deploy-screen.neutral { border-top-color: var(--line-heavy); }
.detail-title { margin: 0 0 10px; font-size: clamp(30px, 8vw, 62px); font-weight: 800; letter-spacing: 0.1em; }
.deploy-sub {
    font-family: var(--font-mono);
    font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--faint);
    padding-bottom: 22px;
    margin: 0 auto 26px;
    max-width: 30rem;
    border-bottom: 1px solid var(--line);
}
.detail-pad { padding: clamp(18px, 4vw, 36px); }
.detail-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; justify-content: center; }
.detail-links .btn { flex: 1 1 220px; }
@media (min-width: 680px) { .detail-links .btn { flex: 0 0 auto; } }
.section-title { display: flex; align-items: center; gap: 10px; }
