@font-face {
  font-family: 'Iranian Sans';
  src: url('/fonts/IranianSans.woff2') format('woff2'), url('/fonts/IranianSans.woff') format('woff');
  font-weight: 400;
  font-style: normal;
}

*, *::before, *::after {
  box-sizing: border-box;
}

.app-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Iranian Sans', Tahoma, sans-serif;
  background: #120808;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding:
    max(12px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    url(/backgrounds/1.png) center top / cover no-repeat,
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(139, 28, 28, 0.28), transparent),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(255, 215, 0, 0.07), transparent);
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Header ── */
.app-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.user-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.app-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #2a181c 0%, #1a1014 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  min-width: 0;
  overflow: visible;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  color: inherit;
  text-decoration: none;
}

.user-chip-btn {
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.chip-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  overflow: visible;
}

.chip-avatar-frame {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  max-width: none;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}

.chip-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
  background: #000;
}

.clan-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(145deg, #8b1c1c, #4a0f14);
  font-size: 18px;
  border: 1px solid rgba(255, 215, 0, 0.35);
}

.clan-chip-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
  background: #1a1014;
  border: 1px solid rgba(255, 215, 0, 0.35);
  display: block;
}

.clan-chip {
  max-width: min(48vw, 200px);
  text-decoration: none;
}

.clan-chip .chip-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.chip-text {
  min-width: 0;
}

.chip-label {
  font-size: 11px;
  color: #b8b8b8;
  margin-bottom: 2px;
}

.chip-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  color: #fff;
}

.app-gem-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(180deg, #1b5784 0%, #123d5c 100%);
  border: 1px solid #4a9fd4;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, filter 0.12s;
}

.app-gem-chip:hover,
.app-gem-chip:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.app-gem-chip:active {
  transform: scale(0.98);
}

.gem-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(100, 200, 255, 0.6));
}

.gem-count {
  font-size: 15px;
  font-weight: 700;
  color: #e8f7ff;
  min-width: 1ch;
}

/* ── Main content area ── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app-main--menu {
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 0 32px;
}

.app-main--page {
  padding-bottom: 12px;
  overflow-y: auto;
}

.app-main--lobby-list {
  padding-bottom: 12px;
}

  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}

.app-page-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffd700;
}

/* ── Main menu (home) ── */
.menu-btn {
  width: min(100%, 300px);
  padding: 18px 24px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.menu-btn:active {
  transform: scale(0.98);
}

.menu-btn.start {
  background: linear-gradient(180deg, #22884a 0%, #1a6840 100%);
  border: 1px solid rgba(120, 230, 160, 0.45);
}

.menu-btn.start:hover {
  filter: brightness(1.06);
}

.menu-btn.watch,
.menu-btn.history {
  background: linear-gradient(180deg, #4a4440 0%, #363230 100%);
  border: 1px solid rgba(210, 195, 175, 0.35);
  color: rgba(255, 255, 255, 0.95);
}

.menu-btn.watch:hover,
.menu-btn.history:hover {
  filter: brightness(1.08);
}

.menu-btn.start.is-banned {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ban-notice {
  width: min(100%, 300px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #4a1818 0%, #321010 100%);
  border: 1px solid rgba(255, 107, 107, 0.55);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.ban-notice[hidden] {
  display: none !important;
}

.ban-notice-icon {
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1.5;
}

.ban-notice-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #ffd0d0;
  text-align: right;
}

/* ── Footer nav ── */
.app-bottom-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding-top: 10px;
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(20, 12, 14, 0.95) 0%, rgba(14, 8, 10, 0.98) 100%);
  border-radius: 16px 16px 0 0;
  padding-left: 4px;
  padding-right: 4px;
  padding-bottom: 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  color: #bbb;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #ffd700;
  outline: none;
}

.nav-item.is-active {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.12);
}

.nav-item .nav-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}
