/* =============================================================
   main_mobile.css – Wintergolf Homepage Mobile App Shell
   All rules scoped to @media (max-width: 820px)
   Desktop content uses .desktop-only { display: none }
   ============================================================= */

/* ── Hide desktop shell on mobile ─────────────────────────── */
@media (max-width: 820px) {
  .desktop-only {
    display: none !important;
  }
}

/* ── Hide mobile shell on desktop ─────────────────────────── */
@media (min-width: 821px) {
  #m-home-shell {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════════════
   MOBILE SHELL
   ══════════════════════════════════════════════════════════ */
@media (max-width: 820px) {

  /* CSS Tokens */
  #m-home-shell {
    --mh-bg:        #0e1117;
    --mh-card:      #1a1e2a;
    --mh-card2:     #13172099;
    --mh-border:    #2a2e3a;
    --mh-text:      #c8ccd8;
    --mh-muted:     #6b7485;
    --mh-accent:    #1eba7c;
    --mh-accent-h:  #17a06b;
    --mh-accent-glow: rgba(30, 186, 124, 0.25);
    --mh-blue:      #2c5391;
    --mh-blue-light:#4a7bd4;
    --mh-brown:     #b7754d;
    --mh-brown-light:#d4956a;
    --mh-gold:      #f5c518;
    --mh-silver:    #a8b2be;
    --mh-bronze:    #cd7f32;
    --mh-header-h:  56px;
    --mh-nav-h:     64px;
  }

  #m-home-shell {
    position: fixed;
    inset: 0;
    background: var(--mh-bg);
    color: var(--mh-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 500;
  }

  /* ── Fixed Top Header ─────────────────────────────────── */
  #m-home-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mh-header-h);
    background: #0e1117ee;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--mh-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
    box-sizing: border-box;
  }

  .mh-header-logo {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--mh-accent);
    text-transform: uppercase;
  }

  .mh-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mh-text);
    letter-spacing: -0.01em;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .mh-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mh-card);
    border: 1px solid var(--mh-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--mh-muted);
    font-size: 16px;
    text-decoration: none;
  }

  /* ── Scrollable Content Area ──────────────────────────── */
  #m-home-content {
    position: fixed;
    top: var(--mh-header-h);
    bottom: var(--mh-nav-h);
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--mh-bg);
  }

  /* Tab panels */
  .mh-tab-panel {
    display: none;
    padding: 16px 14px 24px;
    min-height: 100%;
    box-sizing: border-box;
    animation: mhFadeIn 0.2s ease;
  }

  .mh-tab-panel.active {
    display: block;
  }

  @keyframes mhFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── Fixed Bottom Nav ─────────────────────────────────── */
  #m-home-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mh-nav-h);
    background: #0e1117ee;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--mh-border);
    display: flex;
    align-items: stretch;
    z-index: 200;
  }

  .mh-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--mh-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0 8px;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    letter-spacing: 0.02em;
    font-family: inherit;
  }

  .mh-nav-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.15s ease;
  }

  .mh-nav-btn.active {
    color: var(--mh-accent);
  }

  .mh-nav-btn.active svg {
    stroke: var(--mh-accent);
  }

  /* ═══════════════════════════════════════════════════════
     TAB 1 — DASHBOARD
     ═══════════════════════════════════════════════════════ */

  /* Generic Card */
  .mh-card {
    background: var(--mh-card);
    border: 1px solid var(--mh-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  }

  .mh-card-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mh-accent);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* Next Round Card */
  #mh-next-round-card .mh-nr-date {
    font-size: 26px;
    font-weight: 700;
    color: var(--mh-text);
    line-height: 1.1;
    margin-bottom: 6px;
  }

  #mh-next-round-card .mh-nr-time {
    font-size: 15px;
    color: var(--mh-muted);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #mh-next-round-card .mh-nr-time span {
    font-size: 20px;
  }

  /* Aktuelles Card */
  #mh-news-card .mh-news-body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
  }

  #mh-news-card .mh-news-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
  }

  #mh-news-card .mh-news-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--mh-text);
    white-space: pre-line;
  }

  #mh-news-card .mh-news-empty {
    font-size: 14px;
    color: var(--mh-muted);
    font-style: italic;
  }

  /* ═══════════════════════════════════════════════════════
     TAB 2 — LEADERBOARD
     ═══════════════════════════════════════════════════════ */

  /* Segmented Control */
  .mh-segment {
    display: flex;
    background: var(--mh-card);
    border: 1px solid var(--mh-border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
    gap: 4px;
  }

  .mh-segment-btn {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--mh-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
  }

  .mh-segment-btn.active {
    background: var(--mh-accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--mh-accent-glow);
  }

  /* Leaderboard List */
  .mh-lb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Player Row */
  .mh-lb-row {
    background: var(--mh-card);
    border: 1px solid var(--mh-border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease;
  }

  .mh-lb-row.expanded {
    border-color: var(--mh-accent);
  }

  .mh-lb-row-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 14px;
    min-height: 48px;
  }

  /* Position Badge */
  .mh-lb-pos {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    background: var(--mh-card2);
    color: var(--mh-muted);
  }

  .mh-lb-pos[data-pos="1"] {
    background: rgba(245, 197, 24, 0.2);
    color: var(--mh-gold);
    border: 1px solid var(--mh-gold);
  }

  .mh-lb-pos[data-pos="2"] {
    background: rgba(168, 178, 190, 0.2);
    color: var(--mh-silver);
    border: 1px solid var(--mh-silver);
  }

  .mh-lb-pos[data-pos="3"] {
    background: rgba(205, 127, 50, 0.2);
    color: var(--mh-bronze);
    border: 1px solid var(--mh-bronze);
  }

  .mh-lb-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--mh-text);
  }

  .mh-lb-score {
    font-size: 20px;
    font-weight: 800;
    color: var(--mh-accent);
  }

  .mh-lb-chevron {
    width: 18px;
    height: 18px;
    color: var(--mh-muted);
    flex-shrink: 0;
    transition: transform 0.25s ease;
  }

  .mh-lb-row.expanded .mh-lb-chevron {
    transform: rotate(180deg);
  }

  /* Round Detail Panel */
  .mh-lb-detail {
    display: none;
    padding: 0 16px 14px;
    border-top: 1px solid var(--mh-border);
  }

  .mh-lb-row.expanded .mh-lb-detail {
    display: block;
  }

  .mh-lb-rounds {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
  }

  .mh-lb-round-chip {
    background: var(--mh-card2);
    border: 1px solid var(--mh-border);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--mh-muted);
    text-align: center;
    min-width: 60px;
  }

  .mh-lb-round-chip .chip-score {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--mh-text);
    margin-bottom: 2px;
  }

  .mh-lb-round-chip.top5 {
    border-color: var(--mh-accent);
    background: rgba(30, 186, 124, 0.1);
  }

  .mh-lb-round-chip.top5 .chip-score {
    color: var(--mh-accent);
  }

  /* ═══════════════════════════════════════════════════════
     TAB 3 — HISTORIE (Accordion)
     ═══════════════════════════════════════════════════════ */

  .mh-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mh-history-item {
    background: var(--mh-card);
    border: 1px solid var(--mh-border);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.15s ease;
  }

  .mh-history-item.open {
    border-color: var(--mh-accent);
  }

  .mh-history-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    height: 56px;
    background: none;
    border: none;
    color: var(--mh-text);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    text-align: left;
  }

  .mh-history-toggle .mh-history-season {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mh-history-toggle .season-icon {
    font-size: 20px;
  }

  .mh-history-chevron {
    width: 20px;
    height: 20px;
    color: var(--mh-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mh-history-item.open .mh-history-chevron {
    transform: rotate(180deg);
    color: var(--mh-accent);
  }

  .mh-history-detail {
    display: none;
    padding: 0 14px 14px;
    gap: 8px;
    flex-direction: row;
  }

  .mh-history-item.open .mh-history-detail {
    display: flex;
  }

  .mh-winner-card {
    flex: 1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.7;
  }

  .mh-winner-card.damen {
    background: rgba(183, 117, 77, 0.15);
    border: 1px solid var(--mh-brown);
    color: var(--mh-brown-light);
  }

  .mh-winner-card.jungs {
    background: rgba(44, 83, 145, 0.15);
    border: 1px solid var(--mh-blue);
    color: var(--mh-blue-light);
  }

  .mh-winner-card-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
    opacity: 0.8;
  }

  .mh-winner-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mh-text);
    font-weight: 500;
  }

  .mh-winner-entry .place {
    font-size: 11px;
    opacity: 0.65;
    min-width: 16px;
  }

  /* ═══════════════════════════════════════════════════════
     TAB 4 — KONTAKT
     ═══════════════════════════════════════════════════════ */

  .mh-kontakt-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
    text-align: center;
  }

  .mh-kontakt-icon {
    font-size: 56px;
    margin-bottom: 20px;
  }

  .mh-kontakt-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--mh-text);
    margin-bottom: 10px;
  }

  .mh-kontakt-sub {
    font-size: 15px;
    color: var(--mh-muted);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 280px;
  }

  .mh-kontakt-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--mh-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 16px 32px;
    border-radius: 14px;
    text-decoration: none;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 20px var(--mh-accent-glow);
    transition: background 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    min-height: 56px;
  }

  .mh-kontakt-btn:active {
    background: var(--mh-accent-h);
    transform: scale(0.97);
  }

} /* end @media (max-width: 820px) */

  /* -- LIGHT THEME -- */
  :root[data-theme="light"] #m-home-shell {
    --mh-bg:        #f2f5f8;
    --mh-card:      #ffffff;
    --mh-card2:     #f8fafc;
    --mh-border:    #dce4ed;
    --mh-text:      #2d3748;
    --mh-muted:     #5a7a90;
    --mh-accent:    #157a48;
    --mh-accent-h:  #0e5c36;
    --mh-accent-glow: rgba(21, 122, 72, 0.25);
    --mh-blue:      #2c5391;
    --mh-blue-light:#2c5391;
    --mh-brown:     #b7754d;
    --mh-brown-light:#b7754d;
  }

  :root[data-theme="light"] #m-home-header,
  :root[data-theme="light"] #m-home-nav {
    background: rgba(255, 255, 255, 0.95);
  }

