@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Inter:wght@400;600;700&display=swap");

:root {
  --font-primary: "Inter", "Noto Sans KR", sans-serif;
  --bg-main: #101213;
  --bg-surface: #1a1c1e;
  --bg-surface-accent: #25282a;
  --border-color: #323537;
  --text-primary: #eaeaea;
  --text-secondary: #8a8f93;
  --accent-blue: #0091ff;
  --accent-red: #ff4d4d;
  --accent-green: #28a745;
  --accent-yellow: #ffc107;
  --bg-main-light: #f0f2f5;
  --bg-surface-light: #ffffff;
  --bg-surface-accent-light: #f0f2f5;
  --border-color-light: #dcdfe3;
  --text-primary-light: #1d1d1f;
  --text-secondary-light: #6e6e73;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family: var(--font-primary);
  background-color: var(--bg-main);
  color: var(--text-primary);
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
}
body.light-mode {
  background-color: var(--bg-main-light);
  color: var(--text-primary-light);
}
.container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}
.desktop-hide {
  display: none !important;
}

/* Spinner */
#spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s;
}
#spinner-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 4px solid var(--accent-blue);
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
#refresh-button i.fa-spin {
  animation: spin 1s linear infinite;
}

/* Ticker */
.ticker-wrap {
  position: fixed; /* 화면 상단에 고정 */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000; /* 다른 요소보다 위에 표시 */
  overflow: hidden;
  background-color: var(--accent-blue);
  border-bottom: 2px solid var(--border-color);
  padding: 12px 0;
  flex-shrink: 0;
}
.ticker {
  display: inline-block;
  white-space: nowrap;
  animation: ticker-move 60s linear infinite;
}
.ticker-item {
  display: inline-block;
  padding: 0 2rem;
  font-size: 16px;
  color: #fff;
}
.ticker-item .name {
  font-weight: 600;
}
.ticker-item .rank {
  font-weight: 700;
  color: var(--accent-yellow);
  margin-right: 8px;
}
.ticker-item .score {
  font-weight: 700;
  margin-left: 8px;
}
.ticker-item .score-final {
  color: var(--accent-red);
}
.ticker-item .ticker-emoji {
  font-size: 18px;
  margin: 0 8px;
  display: inline-block;
  vertical-align: middle;
  animation: ticker-emoji-bounce 2s ease-in-out infinite;
}
.ticker-item .ticker-text-bold {
  font-weight: 700;
  color: var(--accent-yellow);
  margin: 0 4px;
}
.ticker-item .ticker-text-normal {
  font-weight: 500;
  margin: 0 4px;
}
.ticker-item .ticker-separator {
  margin: 0 12px;
  opacity: 0.6;
  font-weight: 300;
}
body.light-mode .ticker-item .ticker-text-bold {
  color: var(--accent-yellow);
}
@keyframes ticker-emoji-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.1);
  }
}
body.light-mode .ticker-wrap {
  background-color: #343a40;
  border-bottom-color: #343a40;
}
body.light-mode .ticker-item {
  color: #fff;
}
body.light-mode .ticker-item .rank {
  color: var(--accent-yellow);
}
body.light-mode .ticker-item .score-final {
  color: var(--accent-red);
}
@keyframes ticker-move {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ticker가 있을 때 container의 상단 여백 추가 */
.ticker-wrap + .container {
  padding-top: 50px; /* 티커의 높이만큼 여백을 주어 내용이 가려지지 않게 함 */
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  flex-shrink: 0;
  margin-bottom: 8px;
}
.title-container {
  flex-shrink: 0;
}
.header-center {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
.header-controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.live-indicator {
  background-color: var(--accent-red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.95);
  }
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
}
.subtitle {
  margin: 4px 0 0 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}
body.light-mode .subtitle {
  color: var(--text-secondary-light);
}
.last-updated {
  font-size: 12px;
  margin-left: 8px;
  opacity: 0.8;
}
.tabs {
  display: flex;
  background-color: var(--bg-surface);
  border-radius: 8px;
  padding: 6px;
  gap: 4px;
}
body.light-mode .tabs {
  background-color: var(--bg-surface-accent-light);
}
.tab-button {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  background-color: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.tab-button.active {
  background-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 145, 255, 0.3);
}

.tab-button:hover:not(.active) {
  background-color: var(--bg-surface-accent);
  color: var(--text-primary);
}

body.light-mode .tab-button:hover:not(.active) {
  background-color: var(--bg-surface-accent-light);
  color: var(--text-primary-light);
}
.controls-container {
  display: flex;
  align-items: center;
  gap: 14px;
}
#theme-toggle,
#refresh-button,
#overview-button,
#sidebar-toggle,
#full-bracket-button {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

#theme-toggle:hover,
#refresh-button:hover,
#overview-button:hover,
#sidebar-toggle:hover,
#full-bracket-button:hover {
  background-color: var(--bg-surface-accent);
  border-color: var(--accent-blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 145, 255, 0.2);
}

body.light-mode #theme-toggle:hover,
body.light-mode #refresh-button:hover,
body.light-mode #overview-button:hover,
body.light-mode #sidebar-toggle:hover,
body.light-mode #full-bracket-button:hover {
  background-color: var(--bg-surface-accent-light);
  border-color: var(--accent-blue);
}
body.light-mode #theme-toggle,
body.light-mode #refresh-button,
body.light-mode #overview-button,
body.light-mode #sidebar-toggle,
body.light-mode #full-bracket-button {
  background: var(--bg-surface-light);
  border-color: var(--border-color-light);
  color: var(--text-primary-light);
}

/* Global scrollbar styling (dark + light) */
/* WebKit-based browsers */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px; /* horizontal bar */
}
*::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
*::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 8px;
}
body.light-mode *::-webkit-scrollbar-track {
  background: var(--bg-surface-light);
}
body.light-mode *::-webkit-scrollbar-thumb {
  background-color: var(--border-color-light);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-surface);
}
body.light-mode * {
  scrollbar-color: var(--border-color-light) var(--bg-surface-light);
}
.search-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  height: 44px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-container:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.1);
}
body.light-mode .search-container {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
#search-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  flex-grow: 1;
  min-width: 0;
}
body.light-mode #search-input {
  color: var(--text-primary-light);
}
#search-button {
  background: var(--bg-surface-accent);
  border: none;
  height: 100%;
  border-left: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 0 7px 7px 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#search-button:hover {
  background-color: var(--accent-blue);
  color: #fff;
}
body.light-mode #search-button {
  background: var(--bg-surface-accent-light);
  border-left: 1px solid var(--border-color-light);
  color: var(--text-secondary-light);
}
.icon-toggle {
  display: flex;
  background-color: var(--bg-surface);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--border-color);
  height: 44px;
  visibility: visible;
  opacity: 1;
  transition: visibility 0.2s, opacity 0.2s;
}
.icon-toggle.hidden {
  visibility: hidden;
  opacity: 0;
}
body.light-mode .icon-toggle {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
.icon-toggle .toggle-btn {
  width: 40px;
  height: 34px;
  font-size: 16px;
  background-color: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}
.icon-toggle .toggle-btn.active {
  background-color: var(--accent-blue);
  color: #fff;
}

/* 텍스트 버튼 스타일 (뷰 모드용) */
.view-toggle-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.view-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  background-color: var(--bg-surface);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--border-color);
  gap: 4px;
  visibility: visible;
  opacity: 1;
  transition: visibility 0.2s, opacity 0.2s;
}
body.light-mode .view-toggle {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
.view-toggle .toggle-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  background-color: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.view-toggle .toggle-btn:hover {
  background-color: var(--bg-surface-accent);
  color: var(--text-primary);
}
.view-toggle .toggle-btn.active {
  background-color: var(--accent-blue);
  color: #fff;
}
body.light-mode .view-toggle .toggle-btn {
  color: var(--text-secondary-light);
}
body.light-mode .view-toggle .toggle-btn:hover {
  background-color: var(--bg-surface-accent-light);
  color: var(--text-primary-light);
}
body.light-mode .view-toggle .toggle-btn.active {
  background-color: var(--accent-blue);
  color: #fff;
}
.tabs-dropdown-container {
  display: none;
}
.view-dropdown-container {
  display: none;
  width: auto;
  min-width: 120px;
}

/* 커스텀 드롭다운 스타일 */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-button {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.custom-dropdown-button:hover {
  background-color: var(--bg-surface-accent);
  border-color: var(--accent-blue);
}

.custom-dropdown-button.active {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.1);
}

body.light-mode .custom-dropdown-button {
  background: var(--bg-surface-light);
  border-color: var(--border-color-light);
  color: var(--text-primary-light);
}

body.light-mode .custom-dropdown-button:hover {
  background-color: var(--bg-surface-accent-light);
  border-color: var(--accent-blue);
}

.dropdown-selected {
  flex: 1;
  text-align: left;
}

.dropdown-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.custom-dropdown-button.active .dropdown-icon {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.custom-dropdown-menu.active {
  max-height: 300px;
  opacity: 1;
  transform: translateY(0);
  overflow-y: auto;
}

body.light-mode .custom-dropdown-menu {
  background: var(--bg-surface-light);
  border-color: var(--border-color-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-option {
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.dropdown-option:last-child {
  border-bottom: none;
}

.dropdown-option:hover {
  background-color: var(--bg-surface-accent);
  color: var(--accent-blue);
}

.dropdown-option.selected {
  background-color: var(--bg-surface-accent);
  color: var(--accent-blue);
  font-weight: 600;
}

body.light-mode .dropdown-option {
  color: var(--text-primary-light);
  border-bottom-color: var(--border-color-light);
}

body.light-mode .dropdown-option:hover,
body.light-mode .dropdown-option.selected {
  background-color: var(--bg-surface-accent-light);
  color: var(--accent-blue);
}

#tabs-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  height: 44px;
  border-radius: 8px;
  padding: 0 12px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
}
body.light-mode #tabs-dropdown {
  background: var(--bg-surface-light);
  border-color: var(--border-color-light);
  color: var(--text-primary-light);
}
#mobile-schedule-info {
  display: none;
}

/* Main Grid Layout */
main.grid-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: stretch;
  flex-grow: 1;
  min-height: 0;
  padding-bottom: 32px;
  transition: grid-template-columns 0.4s ease-in-out;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  transition: opacity 0.4s, width 0.4s, padding 0.4s, margin 0.4s;
  overflow: hidden;
}
main.grid-container.sidebar-collapsed {
  grid-template-columns: 0 1fr;
  gap: 0;
}
main.grid-container.sidebar-collapsed .sidebar {
  opacity: 0;
  width: 0;
  padding: 0;
  margin: 0;
}

#content {
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevents content from overflowing */
  flex-grow: 1;
  min-height: 0;
  height: 100%;
}

/* Side Panels */
.info-panel,
.highlight-panel {
  background-color: var(--bg-surface);
  border-radius: 12px;
  padding: 28px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  white-space: nowrap; /* Prevent text wrapping during transition */
}
body.light-mode .info-panel,
body.light-mode .highlight-panel {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
.info-panel h2,
.highlight-panel h2 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
body.light-mode .info-panel h2,
body.light-mode .highlight-panel h2 {
  color: var(--text-primary-light);
}
.info-group {
  margin-bottom: 20px;
}
.info-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
}
.info-label {
  color: var(--text-secondary);
  font-weight: 500;
}
body.light-mode .info-label {
  color: var(--text-secondary-light);
}
.info-value {
  font-weight: 600;
  color: var(--text-primary);
}
body.light-mode .info-value {
  color: var(--text-primary-light);
}
.schedule-list,
.store-list {
  list-style: none;
  padding-left: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
body.light-mode .schedule-list,
body.light-mode .store-list {
  color: var(--text-primary-light);
}
.schedule-list li,
.store-list li {
  margin-bottom: 8px;
}
.schedule-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.event-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
}
.event-status.current {
  background-color: var(--accent-green);
}
.event-status.upcoming {
  background-color: var(--text-secondary);
}
.highlight-item {
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--bg-surface-accent);
  margin-bottom: 14px;
  border-left: 4px solid var(--accent-blue);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.highlight-item:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 145, 255, 0.15);
}
body.light-mode .highlight-item {
  background: var(--bg-surface-accent-light);
}
.highlight-title {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-blue);
}
body.light-mode .highlight-title {
  color: var(--text-primary-light);
  border-bottom-color: var(--accent-blue);
}
.highlight-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
body.light-mode .highlight-value {
  color: var(--text-primary-light);
}
.highlight-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.highlight-player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-radius: 6px;
  font-size: 13px;
  transition: background-color 0.2s ease;
}
.highlight-player-item:hover {
  background: var(--bg-hover);
}
body.light-mode .highlight-player-item {
  background: var(--bg-surface-light);
}
body.light-mode .highlight-player-item:hover {
  background: var(--bg-surface-accent-light);
}
.highlight-player-rank {
  font-weight: 700;
  color: var(--accent-blue);
  min-width: 36px;
  font-size: 12px;
}
.highlight-player-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}
body.light-mode .highlight-player-name {
  color: var(--text-primary-light);
}
.highlight-course-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
.highlight-course-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
body.light-mode .highlight-course-section {
  border-top-color: var(--border-color-light);
}
.highlight-course-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}
body.light-mode .highlight-course-title {
  color: var(--text-primary-light);
  border-bottom-color: var(--border-color-light);
}
.highlight-course-empty {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px;
  text-align: center;
  font-style: italic;
}
body.light-mode .highlight-course-empty {
  color: var(--text-secondary-light);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
body.light-mode .modal-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.modal-content {
  background: var(--bg-surface);
  padding: 32px 36px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  position: relative;
  min-width: 420px;
  max-width: 90vw;
  transform: scale(0.95);
  transition: transform 0.3s ease-out;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

body.light-mode .modal-content {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
.modal-close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}
body.light-mode .modal-close-button {
  color: var(--text-secondary-light);
}
.modal-close-button:hover {
  color: var(--text-primary);
}
body.light-mode .modal-close-button:hover {
  color: var(--text-primary-light);
}
.modal-body-title {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-primary);
}
body.light-mode .modal-body-title {
  color: var(--text-primary-light);
}
.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}
body.light-mode .search-result-item {
  border-bottom-color: var(--border-color-light);
}
.search-result-item:last-child {
  border-bottom: none;
}
.result-label {
  color: var(--text-secondary);
  font-size: 14px;
}
body.light-mode .result-label {
  color: var(--text-secondary-light);
}
.result-value {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}
body.light-mode .result-value {
  color: var(--text-primary-light);
}
.modal-content.image-modal {
  background: transparent;
  border: none;
  width: auto;
  max-width: 90%;
  padding: 20px;
  min-width: unset;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.modal-content.image-modal img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
}

/* 단일 이미지인 경우 (overview-images-container가 없는 경우) */
.modal-content.image-modal > .overview-image {
  max-width: 85% !important;
  max-height: 90vh !important;
  width: auto !important;
  height: auto !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  display: block !important;
  margin: 0 auto !important;
  object-fit: contain;
}

/* Override for overview images container */
.modal-content.image-modal .overview-images-container img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  display: block;
}

/* Overview images container for 3 images */
.overview-images-container {
  display: flex !important;
  flex-direction: row !important;
  gap: 20px !important;
  align-items: flex-start !important;
  max-height: 90vh !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 20px !important;
  width: 100% !important;
  justify-content: center !important;
}

.overview-image {
  max-width: 30% !important;
  max-height: 80vh !important;
  width: auto !important;
  height: auto !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  transition: transform 0.2s ease !important;
  display: block !important;
  flex-shrink: 0 !important;
}

.overview-image:hover {
  transform: scale(1.02);
}

/* Mobile responsive styles for overview images */
@media (max-width: 768px) {
  .modal-content.image-modal {
    max-width: 95%;
    padding: 0;
  }

  .modal-content.image-modal > .overview-image {
    max-width: 100% !important;
    max-height: 85vh !important;
  }

  .overview-images-container {
    flex-direction: column !important;
    gap: 15px !important;
    padding: 15px !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-items: center !important;
  }

  .overview-image {
    max-width: 100% !important;
    max-height: 75vh !important;
    border-radius: 8px !important;
  }

  .modal-content.image-modal .modal-close-button {
    top: 5px;
    right: 5px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 20px;
  }
}
.modal-content.image-modal .modal-close-button {
  top: -10px;
  right: -10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  line-height: 36px;
  font-size: 22px;
  text-align: center;
  padding: 0;
  z-index: 10;
  transition: all 0.2s ease;
}

.modal-content.image-modal .modal-close-button:hover {
  background: rgba(255, 77, 77, 0.9);
  transform: scale(1.1);
}

.modal-content.wide-modal {
  width: 98%;
  max-width: 98%;
  height: 96vh;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

#full-bracket-content {
  flex-grow: 1;
  overflow-x: auto;
  overflow-y: auto;
  padding: 10px;
}

/* Custom Scrollbar Styles for Full Bracket Modal - Show only on hover/scroll */
#full-bracket-content::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

#full-bracket-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 6px;
}

#full-bracket-content::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: background 0.3s ease;
}

/* Show scrollbar on hover */
#full-bracket-content:hover::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-color: var(--bg-surface-accent);
}

#full-bracket-content:hover::-webkit-scrollbar-track {
  background: var(--bg-surface-accent);
}

#full-bracket-content:hover::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

/* Light Mode Scrollbar */
body.light-mode #full-bracket-content:hover::-webkit-scrollbar-track {
  background: var(--bg-surface-accent-light);
}

body.light-mode #full-bracket-content:hover::-webkit-scrollbar-thumb {
  background: var(--border-color-light);
  border-color: var(--bg-surface-accent-light);
}

body.light-mode #full-bracket-content:hover::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

/* Firefox Scrollbar - auto shows when needed */
#full-bracket-content {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

#full-bracket-content:hover {
  scrollbar-color: var(--border-color) var(--bg-surface-accent);
}

body.light-mode #full-bracket-content:hover {
  scrollbar-color: var(--border-color-light) var(--bg-surface-accent-light);
}

/* Error UI */
.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  height: 100%;
  background-color: var(--bg-surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}
.error-icon {
  font-size: 48px;
  color: var(--accent-red);
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}
.error-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}
.error-message {
  font-size: 14px;
  color: var(--text-secondary);
}
body.light-mode .error-container {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
body.light-mode .error-title {
  color: var(--text-primary-light);
}
body.light-mode .error-message {
  color: var(--text-secondary-light);
}
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* Animations */
@keyframes flash-up {
  0% {
    background-color: rgba(61, 255, 138, 0.2);
  }
  100% {
    background-color: transparent;
  }
}
@keyframes flash-down {
  0% {
    background-color: rgba(255, 77, 77, 0.2);
  }
  100% {
    background-color: transparent;
  }
}
.flash-up {
  animation: flash-up 1.5s ease-out;
}
.flash-down {
  animation: flash-down 1.5s ease-out;
}

/* Footer */
.mobile-footer {
  display: none;
}
.desktop-footer {
  background-color: var(--bg-surface);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  text-align: center;
}
body.light-mode .desktop-footer {
  background-color: var(--bg-surface-light);
  border-color: var(--border-color-light);
}
.desktop-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}
.desktop-footer .footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 18px;
  transition: color 0.2s;
}
.desktop-footer .footer-links a:hover {
  color: var(--text-primary);
}
body.light-mode .desktop-footer .footer-links a:hover {
  color: var(--text-primary-light);
}
.desktop-footer .footer-copyright {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Responsive Adjustments --- */
.mobile-show {
  display: none !important;
}

/* Desktop - 적절한 좌우 여백 유지 */
@media (min-width: 1200px) {
  .container {
    padding: 0 32px;
  }
}

/* Large Desktop - 더 넓은 화면에서도 여백 유지 */
@media (min-width: 1400px) {
  .container {
    padding: 0 48px;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1100px) {
  .container {
    padding: 0 24px;
  }
  .ticker-wrap + .container {
    padding-top: 50px;
  }
  header {
    flex-wrap: wrap;
    gap: 16px;
  }
  .title-container {
    width: 100%;
    margin-bottom: 0;
  }
  .header-controls-row {
    display: flex;
    gap: 12px;
    width: 100%;
  }
  main.grid-container {
    grid-template-columns: 280px 1fr;
    gap: 24px;
  }
  main.grid-container.sidebar-collapsed {
    grid-template-columns: 0 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  #app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
  }
  .desktop-show {
    display: none !important;
  }
  .mobile-show {
    display: block !important;
  }
  .tabs-dropdown-container {
    display: block;
  }
  .view-dropdown-container {
    display: flex !important;
    width: auto;
    flex: 0 0 auto;
    margin-bottom: 0;
    min-width: 120px;
  }
  .custom-dropdown {
    width: auto;
    min-width: 120px;
  }
  .view-toggle {
    display: none !important;
  }
  .container {
    padding: 0 20px;
  }
  .ticker-wrap {
    padding: 10px 0;
  }
  .ticker-item {
    font-size: 13px;
    padding: 0 1rem;
  }
  .ticker-item .ticker-emoji {
    font-size: 15px;
    margin: 0 6px;
  }
  .ticker-item .ticker-text-bold {
    font-size: 13px;
    margin: 0 3px;
  }
  .ticker-item .ticker-text-normal {
    font-size: 12px;
    margin: 0 3px;
  }
  .ticker-item .ticker-separator {
    margin: 0 8px;
    font-size: 11px;
  }
  .ticker-item .rank {
    font-size: 13px;
    margin-right: 6px;
  }
  .ticker-item .name {
    font-size: 13px;
  }
  .ticker-item .score {
    font-size: 13px;
    margin-left: 6px;
  }
  .ticker-wrap + .container {
    padding-top: 45px;
  }
  header {
    flex-direction: column;
    gap: 12px;
    padding: 20px 0;
    margin-bottom: 12px;
  }
  .title-container {
    width: 100%;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
  }
  .header-controls-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .header-center {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
  }
  .controls-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
  }
  .search-container {
    flex: 1;
    min-width: 0;
    max-width: 200px;
  }
  #view-toggle,
  #refresh-button,
  #sidebar-toggle {
    display: none;
  }
  #overview-button {
    display: flex;
  }
  .title-group {
    justify-content: center;
    width: 100%;
    margin-bottom: 4px;
  }
  .subtitle {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 0;
  }
  .subtitle .subtitle-text {
    font-size: 14px;
  }
  .subtitle .tournament-period {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
  }
  body.light-mode .subtitle .tournament-period {
    color: var(--text-secondary-light);
  }
  .subtitle .last-updated {
    display: none;
  }
  #mobile-schedule-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
  }
  #search-input {
    font-size: 16px;
  }
  main.grid-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .modal-content {
    width: 92%;
    min-width: unset;
    padding: 24px;
    margin: 0 16px;
  }
  .modal-body-title {
    font-size: 18px;
  }
  .result-label,
  .result-value {
    font-size: 14px;
  }
  .desktop-footer {
    display: none;
  }
  .mobile-footer {
    display: block;
    padding: 20px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
  }

  .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
  }

  main.grid-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  #content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.light-mode .mobile-footer {
    border-top-color: var(--border-color-light);
  }
  .mobile-footer .footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }
  .mobile-footer .footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
  }
  .mobile-footer .footer-links a:hover {
    color: var(--text-primary);
  }
  body.light-mode .mobile-footer .footer-links a:hover {
    color: var(--text-primary-light);
  }
  .footer-copyright-mobile {
    cursor: default;
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  #full-bracket-button {
    display: none;
  }
}

/* V2 Promotion Toast */
.v2-promotion-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1500;
  opacity: 0;
  transform: translateY(100px);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
  max-width: 400px;
}

.v2-promotion-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.v2-promotion-content {
  background: linear-gradient(
    135deg,
    rgba(0, 145, 255, 0.95) 0%,
    rgba(175, 82, 222, 0.95) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

body.light-mode .v2-promotion-content {
  background: linear-gradient(
    135deg,
    rgba(0, 113, 227, 0.95) 0%,
    rgba(175, 82, 222, 0.95) 100%
  );
  border-color: rgba(255, 255, 255, 0.3);
}

.v2-promotion-icon {
  font-size: 32px;
  flex-shrink: 0;
  animation: float 3s ease-in-out infinite;
}

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

.v2-promotion-text {
  flex: 1;
  min-width: 0;
}

.v2-promotion-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.v2-promotion-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.v2-promotion-button {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 8px;
}

.v2-promotion-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.v2-promotion-button:active {
  transform: translateY(0);
}

.v2-promotion-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.v2-promotion-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

@media (max-width: 768px) {
  .v2-promotion-toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .v2-promotion-content {
    padding: 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .v2-promotion-icon {
    font-size: 28px;
  }

  .v2-promotion-title {
    font-size: 12px;
  }

  .v2-promotion-subtitle {
    font-size: 10px;
  }

  .v2-promotion-button {
    padding: 8px 16px;
    font-size: 10px;
    width: 100%;
    margin-top: 8px;
  }

  .v2-promotion-close {
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
}
