* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #1c1c1e;
  color: #e5e5e7;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3a3c; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.tof-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem;
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tof-logo {
  display: flex; align-items: center;
  font-size: 1rem; font-weight: 700; letter-spacing: 0.06em;
  color: #e5e5e7; user-select: none;
}
.tof-logo img { height: 1.6rem; width: 1.6rem; border-radius: 50%; object-fit: cover; margin-right: 0.5em; }

/* ── Hamburger ── */
.tof-hamburger {
  display: flex; flex-direction: column; justify-content: center;
  gap: 5px; width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 6px;
  -webkit-tap-highlight-color: transparent;
}
.tof-hamburger span {
  display: block; width: 20px; height: 2px;
  background: #e5e5e7; border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.tof-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.tof-hamburger.open span:nth-child(2) { opacity: 0; }
.tof-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav Dropdown ── */
.tof-nav {
  position: absolute; top: 100%; left: 0; right: 0;
  display: flex; flex-direction: column;
  background: rgba(28, 28, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease;
}
.tof-nav.open { max-height: 280px; }
.tof-nav a {
  color: #a1a1a6; text-decoration: none;
  font-size: 0.95rem; font-weight: 600;
  padding: 0.85rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  transition: color 0.2s, background 0.2s;
}
.tof-nav a:hover, .tof-nav a:active { color: #fff; background: rgba(255,255,255,0.05); }

/* ── Language Selector ── */
.tof-lang-wrapper {
  padding: 0.6rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.tof-lang-select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: #2a2a2d;
  color: #e5e5e7;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}
.tof-lang-select:hover { border-color: rgba(255,255,255,0.2); }
.tof-lang-select:focus { border-color: rgba(255,255,255,0.3); }
.tof-lang-select option { background: #2a2a2d; color: #e5e5e7; }

/* ═══════════════════════════════════════
   MAIN
   ═══════════════════════════════════════ */
main { max-width: 1200px; margin: 0 auto; padding: 0 0.75rem 1rem; }

/* ── Sections ── */
.tof-section {
  margin: 1.2rem 0;
  background: #2a2a2d; border-radius: 16px;
  padding: 1.4rem 1rem 1.2rem;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.tof-section.visible { opacity: 1; transform: translateY(0); }
.tof-section h1 { font-size: 1.25rem; color: #fff; margin-bottom: 0.7rem; font-weight: 700; }
.tof-section p { font-size: 0.9rem; color: #a1a1a6; line-height: 1.7; }

/* ═══════════════════════════════════════
   MEMBER LIST (Mobile-first vertical)
   ═══════════════════════════════════════ */
.tof-members-layout {
  display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.8rem;
}

.tof-member-list {
  display: flex; flex-direction: column; gap: 1px;
  background: #1c1c1e; border-radius: 12px;
  overflow: hidden;
  max-height: 340px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #3a3a3c transparent;
}
.tof-member-list::-webkit-scrollbar { width: 3px; }
.tof-member-list::-webkit-scrollbar-thumb { background: #3a3a3c; border-radius: 3px; }

.tof-member-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  background: #242426; border: none; border-left: 3px solid transparent;
  color: #a1a1a6; font-family: inherit; font-size: 0.84rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; text-align: left; width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.tof-member-item img { width: 28px; height: 28px; flex-shrink: 0; }
.tof-member-item .tof-member-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tof-member-item .tof-member-role {
  font-size: 0.62rem; color: #636366;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  flex-shrink: 0; background: rgba(255,255,255,0.04); padding: 2px 6px; border-radius: 4px;
}
.tof-member-item:active { background: rgba(255,255,255,0.06); }
.tof-member-item.active {
  background: rgba(255,255,255,0.07); border-left-color: #fff; color: #fff;
}
.tof-member-item.memoriam { opacity: 0.4; }
.tof-member-item.memoriam.active { opacity: 0.65; }

/* ═══════════════════════════════════════
   PROFILE CARD
   ═══════════════════════════════════════ */
.tof-profile {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tof-profile-card {
  background: #1c1c1e; border-radius: 14px;
  padding: 1.2rem;
}
.tof-profile-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 2.5rem 1.2rem;
}
.tof-profile-header {
  display: flex; align-items: center; gap: 1rem;
  padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative;
}
.tof-share-btn {
  position: absolute; top: 0; right: 0;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #a1a1a6;
  font-family: inherit; font-size: 0.72rem; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.tof-share-btn svg { flex-shrink: 0; }
.tof-share-btn:hover { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.2); }
.tof-share-btn:active { transform: scale(0.95); }
.tof-share-btn.copied { background: rgba(52, 199, 89, 0.15); color: #34c759; border-color: rgba(52, 199, 89, 0.3); }
.tof-profile-rank { width: 56px; height: 56px; flex-shrink: 0; }
.tof-profile-name { font-size: 1.15rem; font-weight: 700; color: #fff; }
.tof-profile-title { font-size: 0.82rem; color: #a1a1a6; margin-top: 0.15rem; }
.tof-profile-role { font-size: 0.8rem; color: #a1a1a6; margin-top: 0.2rem; }
.tof-profile-info {
  display: flex; gap: 0.6rem; margin-top: 0.4rem;
  font-size: 0.72rem; color: #636366; flex-wrap: wrap;
}
.tof-profile-info strong { color: #a1a1a6; }
.tof-profile-memoriam { font-size: 0.8rem; color: #636366; font-style: italic; margin-top: 0.4rem; }
.tof-profile-placeholder { font-size: 0.85rem; color: #636366; margin-top: 1.2rem; }

/* ═══════════════════════════════════════
   STATS
   ═══════════════════════════════════════ */
.tof-stats-section { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,0.06); }
.tof-stats-section h2 { font-size: 1rem; color: #e5e5e7; font-weight: 700; margin-bottom: 0.8rem; }
.tof-stats-section h3 { font-size: 0.82rem; color: #a1a1a6; font-weight: 600; margin: 1rem 0 0.6rem 0; }

/* Stats Grid - 2 columns on mobile */
.tof-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.tof-stat-box { background: #2a2a2d; border-radius: 12px; padding: 0.75rem 0.5rem; text-align: center; }
.tof-stat-label { font-size: 0.6rem; color: #636366; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.2rem; }
.tof-stat-value { font-size: 1.05rem; font-weight: 700; color: #fff; }
.tof-stat-sub { font-size: 0.65rem; color: #a1a1a6; margin-top: 0.1rem; }

/* ═══════════════════════════════════════
   COMBAT TABLE (Mobile-first: card style)
   ═══════════════════════════════════════ */
.tof-combat-table { display: flex; flex-direction: column; gap: 0.4rem; }
.tof-combat-row {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.6rem; background: #2a2a2d; border-radius: 10px;
}
.tof-combat-unit { display: flex; align-items: center; gap: 0.4rem; grid-column: 1 / -1; }
.tof-combat-unit img { width: 24px; height: 24px; object-fit: contain; }
.tof-combat-unit span { font-size: 0.78rem; color: #e5e5e7; font-weight: 600; }
.tof-combat-bar { height: 6px; background: #48484a; border-radius: 3px; overflow: hidden; grid-column: 1; }
.tof-bar-fill { height: 100%; background: #34c759; border-radius: 3px; transition: width 0.5s ease; }
.tof-combat-kd { display: flex; gap: 0.3rem; font-size: 0.7rem; justify-self: end; }
.tof-kills { color: #34c759; }
.tof-deaths { color: #ff453a; }
.tof-combat-ratio { font-size: 0.75rem; font-weight: 700; text-align: right; grid-column: 2; grid-row: 2; }
.tof-combat-ratio.high { color: #34c759; }
.tof-combat-ratio.mid { color: #ffd60a; }
.tof-combat-ratio.low { color: #ff453a; }

/* ═══════════════════════════════════════
   BUILDINGS
   ═══════════════════════════════════════ */
.tof-buildings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.tof-building { background: #2a2a2d; border-radius: 10px; padding: 0.6rem 0.3rem; text-align: center; }
.tof-building-name { font-size: 0.62rem; color: #a1a1a6; margin-bottom: 0.15rem; }
.tof-building-val { font-size: 0.95rem; font-weight: 700; color: #fff; }
.tof-building-pts { font-size: 0.58rem; color: #636366; }

/* ═══════════════════════════════════════
   ACHIEVEMENTS
   ═══════════════════════════════════════ */
.tof-achievements-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 0.4rem;
}
.tof-achievement { text-align: center; position: relative; cursor: default; }
.tof-achievement img { width: 100%; height: auto; display: block; border-radius: 4px; }
.tof-ach-name {
  font-size: 0.5rem; color: #636366; margin-top: 2px; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
.tof-footer {
  text-align: center; padding: 1.5rem 1rem 2rem;
  font-size: 0.75rem; color: #636366; letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════
   TABLET & DESKTOP (768px+)
   ═══════════════════════════════════════ */
@media (min-width: 768px) {
  .tof-header { padding: 0.9rem 3vw; }
  .tof-logo { font-size: 1.3rem; }
  .tof-logo img { height: 2rem; width: 2rem; }

  main { padding: 0 2rem 2rem; }

  .tof-section {
    margin: 2rem 0;
    padding: 2.2rem 2rem 1.8rem;
    border-radius: 18px;
  }
  .tof-section h1 { font-size: 1.6rem; margin-bottom: 1rem; }
  .tof-section p { font-size: 1rem; }

  .tof-members-layout {
    flex-direction: row; gap: 1.5rem; align-items: flex-start;
  }
  .tof-member-list {
    flex-shrink: 0; width: 240px;
    position: sticky; top: 80px; align-self: flex-start;
    max-height: calc(100vh - 100px);
    border-radius: 14px;
  }
  .tof-member-item { padding: 0.55rem 0.8rem; font-size: 0.84rem; }
  .tof-member-item img { width: 26px; height: 26px; }

  .tof-profile { flex: 1; min-width: 0; }

  .tof-profile-card { padding: 2rem; border-radius: 16px; }
  .tof-profile-header { gap: 1.5rem; padding-bottom: 1.5rem; }
  .tof-profile-rank { width: 72px; height: 72px; }
  .tof-profile-name { font-size: 1.5rem; }
  .tof-profile-title { font-size: 0.95rem; }
  .tof-profile-info { font-size: 0.85rem; gap: 1.2rem; }

  .tof-stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.7rem; }
  .tof-stat-box { padding: 0.85rem; }
  .tof-stat-label { font-size: 0.68rem; }
  .tof-stat-value { font-size: 1.25rem; }
  .tof-stat-sub { font-size: 0.72rem; }

  .tof-combat-row {
    display: grid; grid-template-columns: 140px 1fr 100px 50px;
    gap: 0.6rem; padding: 0.45rem 0;
    background: transparent; border-radius: 0;
  }
  .tof-combat-unit { grid-column: auto; }
  .tof-combat-bar { grid-column: auto; }
  .tof-combat-ratio { grid-column: auto; grid-row: auto; }

  .tof-buildings-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
  .tof-building { padding: 0.65rem; }
  .tof-building-name { font-size: 0.72rem; }
  .tof-building-val { font-size: 1.05rem; }

  .tof-achievements-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 0.6rem; }
  .tof-ach-name { font-size: 0.55rem; }

  .tof-footer { padding: 2rem 4vw 3rem; font-size: 0.8rem; }
}
