/**
 * main.css
 * 메인 스타일시트 - 변수는 base/variables.css에서 관리
 */
@import './base/index.css';

/* Flutter BorderedText 스타일 (bordered_text 패키지 재현) */
/* strokeWidth: 3.0 기본 */
.bordered-text {
  color: white;
  font-weight: 900;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

/* strokeWidth: 2.0 얇은 테두리 */
.bordered-text-thin {
  color: white;
  font-weight: 700;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

/* strokeWidth: 5.0 두꺼운 테두리 */
.bordered-text-thick {
  color: white;
  font-weight: 900;
  text-shadow:
    -2px -2px 0 #000,
    2px -2px 0 #000,
    -2px 2px 0 #000,
    2px 2px 0 #000,
    -2px 0 0 #000,
    2px 0 0 #000,
    0 -2px 0 #000,
    0 2px 0 #000;
}

/* Flutter getTextShadows() 8방향 완벽 재현 (strokeWidth: 3.0) */
.bordered-text-8dir {
  color: white;
  font-weight: 900;
  text-shadow:
    -1.5px -1.5px 1.5px #000,
    1.5px -1.5px 1.5px #000,
    -1.5px 1.5px 1.5px #000,
    1.5px 1.5px 1.5px #000,
    -1.5px 0 1.5px #000,
    1.5px 0 1.5px #000,
    0 -1.5px 1.5px #000,
    0 1.5px 1.5px #000;
}

/* 8방향 얇은 버전 (strokeWidth: 2.0) */
.bordered-text-8dir-thin {
  color: white;
  font-weight: 700;
  text-shadow:
    -1px -1px 1px #000,
    1px -1px 1px #000,
    -1px 1px 1px #000,
    1px 1px 1px #000,
    -1px 0 1px #000,
    1px 0 1px #000,
    0 -1px 1px #000,
    0 1px 1px #000;
}

/* 8방향 두꺼운 버전 (strokeWidth: 4.0) */
.bordered-text-8dir-thick {
  color: white;
  font-weight: 900;
  text-shadow:
    -2px -2px 2px #000,
    2px -2px 2px #000,
    -2px 2px 2px #000,
    2px 2px 2px #000,
    -2px 0 2px #000,
    2px 0 2px #000,
    0 -2px 2px #000,
    0 2px 2px #000;
}

/* 다양한 색상의 테두리 */
.bordered-text-gold {
  color: var(--flutter-gold);
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.bordered-text-blue {
  color: var(--flutter-blue);
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

/* ============================================
 * Flutter Google Fonts 유틸리티 클래스
 * ============================================ */
/* Lilita One - 헤더, 점수, 중요 숫자 */
.font-display {
  font-family: var(--font-display);
}

/* Alegreya Sans SC - 게임 버튼, Small Caps UI */
.font-ui {
  font-family: var(--font-ui);
  font-weight: 700;
}

/* Courgette - 장식 텍스트, 필기체 */
.font-decorative {
  font-family: var(--font-decorative);
}

/* Open Sans - 깔끔한 본문 */
.font-body {
  font-family: var(--font-body);
}

/* Noto Sans KR - 한글 본문 (기본) */
.font-primary {
  font-family: var(--font-primary);
}

/* Flutter 스타일 헤더 텍스트 (Lilita One + 테두리) */
.flutter-header {
  font-family: var(--font-display);
  font-weight: 400;
  color: white;
  text-shadow:
    -2px -2px 0 #000,
    2px -2px 0 #000,
    -2px 2px 0 #000,
    2px 2px 0 #000;
}

/* Flutter 스타일 점수 텍스트 */
.flutter-score {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--flutter-gold);
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

/* Flutter 스타일 버튼 텍스트 (Alegreya Sans SC) */
.flutter-button-text {
  font-family: var(--font-ui);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-primary);
  background: #000;
  color: var(--light);
  overflow: hidden;
}

#app {
  container-type: size;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  height: calc(100vh - var(--safe-area-top) - var(--safe-area-bottom));
  margin: 0 auto;
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
  padding-left: var(--safe-area-left);
  padding-right: var(--safe-area-right);
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--darker);
  overflow: hidden;
  overflow-x: hidden;
}

/* viewport-fit=cover 지원 */
@supports (padding: max(0px)) {
  #app {
    padding-top: max(var(--safe-area-top), 0px);
    padding-bottom: max(var(--safe-area-bottom), 0px);
  }
}

.loading-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 9999;
}

.spinner {
  width: var(--spinner-size);
  height: var(--spinner-size);
  border: 4px solid var(--gray);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--base-spacing-lg);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn {
  padding: var(--btn-padding-y) var(--btn-padding-x);
  border: none;
  border-radius: var(--btn-border-radius);
  cursor: pointer;
  font-size: var(--btn-font-size);
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: var(--btn-gap);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-google {
  background: white;
  color: #333;
}

.btn-facebook {
  background: #1877f2;
  color: white;
}

.login-container {
  max-width: var(--modal-max-width);
  margin: 0 auto;
  padding: var(--base-spacing-xl) var(--base-spacing-lg);
  text-align: center;
}

.login-container h1 {
  font-size: var(--base-font-3xl);
  margin-bottom: var(--base-spacing-lg);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-container p {
  color: var(--gray);
  margin-bottom: var(--base-spacing-xl);
  font-size: var(--base-font-md);
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}

.game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

#game-canvas {
  width: 100%;
  height: 100%;
}

.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ui-overlay > * {
  pointer-events: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--top-bar-padding-y) var(--top-bar-padding-x);
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 100;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--gap-lg);
}

.user-avatar {
  width: var(--avatar-size-md);
  height: var(--avatar-size-md);
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--avatar-font-md);
}

.user-stats {
  display: flex;
  gap: var(--gap-xl);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  font-size: var(--base-font-sm);
}

.stat-value {
  font-weight: 700;
  color: var(--secondary);
}

/* 공통 하단 네비게이션 (Flutter 원본: 높이 10cqh, 아이콘만) */
.bottom-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  /* Flutter 원본 그라데이션: #303C67 → #171B20 */
  background: linear-gradient(180deg, #303C67 0%, #171B20 100%);
  height: var(--fl-bottom-nav-height);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  overflow: visible; /* 활성 아이템이 커질 때 잘리지 않도록 */
  /* SafeArea 대응 - 홈바 영역 확보 */
  padding-bottom: var(--safe-area-bottom);
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray);
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 24px;
}

.nav-label {
  font-size: 12px;
}

/* Flutter 하단 네비게이션 아이템 (각 탭 20cqw, 아이콘만 표시) */
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 20cqw;
  max-width: 80px;
  height: 100%;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); /* Spring-like easing */
  position: relative;
  cursor: pointer;
  transform: scale(1);
  transform-origin: center center;
}

.bottom-nav-item:hover {
  color: #ffffff;
  transform: scale(1.05);
}

/* Flutter 활성 탭 배경 (button_blue_for_navi.png 스타일) */
/* Flutter: naviActiveWidth=22cqw, naviActiveHeight=12cqh (normal: 20cqw, 10cqh) */
.bottom-nav-item.active {
  color: #ffffff;
  transform: scale(1.1); /* 22cqw/20cqw = 1.1 scale */
  z-index: 10;
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22cqw;
  max-width: 90px;
  height: 12cqh;
  max-height: 80px;
  background: url('/assets/img/button_blue_for_navi.png') center center / contain no-repeat;
  z-index: -1;
  pointer-events: none;
}

/* 폴백: 이미지 없을 때 그라데이션 배경 */
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18cqw;
  max-width: 72px;
  height: 9cqh;
  max-height: 60px;
  background: linear-gradient(180deg, rgba(52, 152, 219, 0.6) 0%, rgba(41, 128, 185, 0.4) 100%);
  border-radius: 12px;
  z-index: -2;
  pointer-events: none;
}

.bottom-nav-item .nav-icon {
  font-size: clamp(20px, 5cqw, 32px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item.active .nav-icon {
  /* 활성 아이콘 약간 더 커짐 (부모의 scale과 함께) */
  filter: drop-shadow(0 2px 4px rgba(52, 152, 219, 0.5));
}

.bottom-nav-item .nav-icon-img {
  width: clamp(24px, 6cqw, 36px);
  height: clamp(24px, 6cqw, 36px);
  object-fit: contain;
  filter: brightness(0.8);
  transition: filter 0.25s ease-out, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item:hover .nav-icon-img {
  filter: brightness(1);
}

.bottom-nav-item.active .nav-icon-img {
  filter: brightness(1.1) drop-shadow(0 2px 6px rgba(52, 152, 219, 0.6));
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--dark);
  border-radius: var(--modal-border-radius);
  padding: var(--modal-padding);
  max-width: var(--modal-max-width);
  width: 90%;
  max-height: 80cqh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--base-spacing-lg);
}

.modal-title {
  font-size: var(--base-font-xl);
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--light);
}

.hidden {
  display: none !important;
}

/* Chat Page Styles */
.chat-notice {
  background: rgba(0, 129, 242, 1);
  padding: 12px;
  text-align: center;
  color: white;
  font-size: 14px;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--darker);
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(44, 62, 80, 0.5);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-item:hover {
  background: rgba(44, 62, 80, 0.8);
  transform: translateX(4px);
}

.chat-avatar {
  width: var(--avatar-size-lg);
  height: var(--avatar-size-lg);
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--avatar-font-lg);
  flex-shrink: 0;
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-nickname {
  font-weight: 700;
  margin-bottom: 4px;
}

.chat-last-message {
  color: var(--gray);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-time {
  font-size: 12px;
  color: var(--gray);
  flex-shrink: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gray);
}

/* 공통 스피너 */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 50px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Private Chat Styles */
.private-chat-container {
  display: flex;
  flex-direction: column;
  height: 100cqh;
  background: var(--darker);
}

.private-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-target-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.private-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
  gap: 8px;
  max-width: 70%;
}

.chat-message.my-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message.other-message {
  align-self: flex-start;
}

.message-avatar {
  width: var(--avatar-size-sm);
  height: var(--avatar-size-sm);
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--avatar-font-sm);
  flex-shrink: 0;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-nickname {
  font-size: 12px;
  color: var(--gray);
  font-weight: 600;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  background: rgba(48, 147, 204, 1);
  color: white;
}

.chat-message.my-message .message-bubble {
  background: rgba(56, 99, 141, 1);
}

.message-time {
  font-size: 11px;
  color: var(--gray);
}

.private-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(44, 62, 80, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--light);
  font-size: 14px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

.info-message {
  font-size: 14px;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .top-bar {
    padding: 12px 16px;
  }

  .user-stats {
    gap: 12px;
  }

  .stat-item {
    font-size: 12px;
  }

  .login-container h1 {
    font-size: 36px;
  }

  .chat-message {
    max-width: 85%;
  }
}


/* Watch Page Styles */
.watch-mode-selector {
  display: flex;
  background: rgba(26, 26, 46, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.mode-btn {
  flex: 1;
  padding: 16px;
  background: linear-gradient(180deg, #303C67 0%, #171B20 100%);
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mode-btn.active {
  background: linear-gradient(180deg, #5479FE 0%, #708EFF 100%);
}

.mode-btn:hover {
  opacity: 0.8;
}

.mode-icon {
  font-size: 32px;
}

.mode-label {
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.watch-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--darker);
}

.watch-item {
  background: rgba(255, 249, 234, 1);
  border-radius: 8px;
  border: 1px solid rgba(200, 200, 200, 1);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.watch-players {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.player-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.player-emoji {
  font-size: 32px;
}

.player-name {
  color: white;
  font-weight: 900;
  font-size: 16px;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    -2px 0 0 #000,
    2px 0 0 #000,
    0 -2px 0 #000,
    0 2px 0 #000;
  text-align: center;
}

.vs-badge {
  color: #000;
  font-weight: 900;
  font-size: 18px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
}

.watch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #007F0E 0%, #003F06 100%);
  border-radius: 8px;
  border: 1px solid rgba(200, 200, 200, 1);
  min-width: 100px;
}

.watch-btn:hover {
  transform: scale(1.05);
}

/* Organize Troop Page */
.organize-troop-container {
  display: flex;
  flex-direction: column;
  height: 100cqh;
  background: linear-gradient(180deg, #464990 0%, #252D4A 50%, #131622 100%);
}

.organize-header {
  padding: 20px;
  text-align: center;
  background: linear-gradient(180deg, #003305 0%, #007209 100%);
  border-radius: 8px;
  margin: 16px;
}

.troop-categories {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.troop-category {
  background: rgba(44, 62, 80, 0.5);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.category-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: white;
}

.troop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.troop-card {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s;
  position: relative;
}

.troop-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.troop-card.selected {
  border-color: white;
  background: rgba(255, 255, 255, 0.2);
}

.troop-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 8px;
}

.troop-info {
  text-align: center;
}

.troop-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.troop-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: var(--gray);
}

.selected-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
}

.troop-slot-info {
  padding: 16px;
  text-align: center;
}

.slot-count {
  background: linear-gradient(180deg, #102FB7 0%, #1643F7 100%);
  padding: 16px;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
  color: white;
}

.organize-footer {
  padding: 16px;
  text-align: center;
}


/* Tournament Bracket Styles */
.tournament-bracket {
  padding: 20px;
  overflow-x: auto;
}

.bracket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(44, 62, 80, 0.5);
  border-radius: 8px;
}

.phase-badge {
  background: linear-gradient(180deg, #5479FE 0%, #708EFF 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 16px;
}

.place-info {
  font-size: 18px;
  font-weight: 700;
  color: var(--warning);
}

.bracket-container {
  min-width: 1000px;
}

.bracket-rounds {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: center;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.round-label {
  text-align: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(52, 152, 219, 0.2);
  border-radius: 6px;
}

.bracket-match {
  background: rgba(44, 62, 80, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
  position: relative;
}

.match-label {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.match-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  position: relative;
  transition: all 0.3s;
}

.match-player:last-child {
  margin-bottom: 0;
}

.match-player.my-player {
  background: rgba(52, 152, 219, 0.2);
  border: 2px solid var(--primary);
}

.match-player.winner {
  background: rgba(46, 204, 113, 0.2);
  border-color: var(--secondary);
}

.match-player.loser {
  opacity: 0.5;
  background: rgba(231, 76, 60, 0.1);
}

.match-player .player-emoji {
  font-size: 32px;
  flex-shrink: 0;
}

.match-player .player-name {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.match-player .player-placeholder {
  flex: 1;
  color: var(--gray);
  font-style: italic;
}

.match-vs {
  text-align: center;
  font-weight: 900;
  color: var(--warning);
  font-size: 14px;
  margin: 4px 0;
}

.status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
}

.status-badge.win {
  background: var(--secondary);
  color: white;
}

.status-badge.lose {
  background: var(--danger);
  color: white;
}

.winner-slot {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  border: 3px solid #FFD700;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
}

.winner-slot.empty {
  background: rgba(44, 62, 80, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  color: var(--gray);
}

.winner-crown {
  font-size: 48px;
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.winner-emoji {
  font-size: 64px;
  margin: 12px 0;
}

.winner-name {
  font-size: 20px;
  font-weight: 900;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.winner-badge {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 900;
}

.winner-announcement {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.announcement-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.announcement-content {
  position: relative;
  text-align: center;
  z-index: 1;
  animation: zoomIn 0.5s;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.announcement-crown {
  font-size: 80px;
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.winner-profile {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 32px;
  margin-top: 24px;
}

/* Responsive Tournament */
@media (max-width: 1200px) {
  .bracket-container {
    min-width: 800px;
  }

  .bracket-rounds {
    gap: 12px;
  }

  .match-player .player-emoji {
    font-size: 24px;
  }

  .winner-emoji {
    font-size: 48px;
  }
}

/* Post Comments and Likes */
.post-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-count {
  font-size: 14px;
  color: var(--gray);
}

.post-action-btn.active {
  color: var(--danger);
}

.post-comments {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.comments-list {
  margin-bottom: 12px;
}

.comment-item {
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin-bottom: 8px;
  position: relative;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-avatar {
  font-size: 20px;
}

.comment-name {
  font-weight: 700;
  font-size: 14px;
}

.comment-time {
  font-size: 12px;
  color: var(--gray);
  margin-left: auto;
}

.comment-text {
  font-size: 14px;
  line-height: 1.5;
  margin-left: 28px;
}

.comment-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--danger);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.comment-delete:hover {
  opacity: 0.8;
}

.comment-input-box {
  display: flex;
  gap: 8px;
}

.comment-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(44, 62, 80, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--light);
  font-size: 14px;
}

.comment-input:focus {
  outline: none;
  border-color: var(--primary);
}

.comment-submit {
  padding: 8px 16px;
}

.comment-empty {
  text-align: center;
  color: var(--gray);
  padding: 20px;
  font-style: italic;
}

.comment-error {
  text-align: center;
  color: var(--danger);
  padding: 20px;
}

/* Notification Animations */
@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Player Slot Styles */
.slot-emoji {
  font-size: 32px;
  margin-bottom: 8px;
}

.slot-name {
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.slot-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
}

/* 관전 모드 배지 */
.watch-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
  animation: watchPulse 2s ease-in-out infinite;
}

@keyframes watchPulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
  }
  50% {
    box-shadow: 0 2px 16px rgba(243, 156, 18, 0.6);
  }
}

/* 관전 페이지 스타일 */
.watch-mode-selector {
  display: flex;
  gap: 12px;
  padding: 20px;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 120px;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  border-color: #3498db;
  box-shadow: 0 4px 16px rgba(52, 152, 219, 0.4);
}

.mode-icon {
  font-size: 32px;
}

.mode-label {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.watch-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
  overflow-y: auto;
  max-height: calc(100cqh - 250px);
}

.watch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: all 0.3s;
}

.watch-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.watch-players {
  display: flex;
  align-items: center;
  gap: 16px;
}

.vs-badge {
  padding: 4px 12px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  color: white;
}

.watch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.watch-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.4);
}

/* ============================================
 * TroopDisplay Component Styles
 * Flutter TroopDisplay.dart 원본 재현
 * ============================================ */

/* Rage Fire 오버레이 (Flutter: rageCount 1-3) */
.rage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  z-index: 5;
  border-radius: inherit;
}

.rage-overlay.intensity-1 {
  background-image: url('/assets/img/bg_troop_rage_1.png');
  opacity: 0.6;
  animation: rageFlicker 0.5s infinite alternate;
}

.rage-overlay.intensity-2 {
  background-image: url('/assets/img/bg_troop_rage_2.png');
  opacity: 0.8;
  animation: rageFlicker 0.4s infinite alternate;
}

.rage-overlay.intensity-3 {
  background-image: url('/assets/img/bg_troop_rage_3.png');
  opacity: 1;
  animation: rageFlicker 0.3s infinite alternate;
}

@keyframes rageFlicker {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.2); }
}

/* 강화 인디케이터 (Flutter: reinforceIconVisible) */
.reinforce-indicator {
  position: absolute;
  top: 5%;
  right: 5%;
  z-index: 10;
  font-size: min(6cqw, 24px);
}

.reinforce-indicator.reinforce-bounce {
  animation: reinforceBounce 0.5s ease-out;
}

.reinforce-indicator.reinforce-exit {
  animation: reinforceExit 0.3s ease-out forwards;
}

@keyframes reinforceBounce {
  0% { transform: scale(0) translateY(20px); opacity: 0; }
  60% { transform: scale(1.2) translateY(-5px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes reinforceExit {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

/* 레벨업 오버레이 (Flutter: levelUpAnimation) */
.level-up-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 200, 0, 0.4), rgba(0, 255, 0, 0.2));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: inherit;
}

.level-up-text {
  font-family: var(--font-display);
  font-size: min(5cqw, 20px);
  color: #00FF00;
  z-index: 2;
}

.level-up-stars {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.star-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: min(4cqw, 16px);
  animation: starBurst 0.6s ease-out forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes starBurst {
  0% {
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateY(0) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateY(-50px) scale(1);
    opacity: 0;
  }
}

/* XP 바 애니메이션 */
.xp-bar-fill {
  transition: width 0.3s ease-out;
}

/* 페이즈 전환 애니메이션 */
.phase-fade-out {
  animation: phaseFadeOut 0.3s ease-out forwards;
}

.phase-scale-in {
  animation: phaseScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes phaseFadeOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.8); }
}

@keyframes phaseScaleIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* 타일 하이라이트 애니메이션 (Combat Scene) */
.tile-highlight {
  animation: tileGlow 1s ease-in-out infinite;
}

@keyframes tileGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
    border-color: rgba(52, 152, 219, 0.5);
  }
  50% {
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.8);
    border-color: rgba(52, 152, 219, 0.8);
  }
}

.tile-scoutable {
  animation: tilePulse 0.8s ease-in-out infinite;
}

@keyframes tilePulse {
  0%, 100% {
    background-color: rgba(46, 204, 113, 0.2);
  }
  50% {
    background-color: rgba(46, 204, 113, 0.4);
  }
}

.tile-moveable {
  animation: tileMoveGlow 0.6s ease-in-out infinite;
}

@keyframes tileMoveGlow {
  0%, 100% {
    box-shadow: inset 0 0 10px rgba(241, 196, 15, 0.3);
  }
  50% {
    box-shadow: inset 0 0 20px rgba(241, 196, 15, 0.6);
  }
}

