/* =================================
   Design System & Fonts
   ================================= */

:root {
  /* Fonts */
  --font-primary: 'Inter', 'Noto Sans KR', sans-serif;
  --font-display: 'Poppins', sans-serif;
  --font-dfo: 'DNFForgedBlade', sans-serif;

  /* Colors - Background */
  --color-background: #131314;
  --color-surface: #1e1e1e;
  --color-surface-light: #2c2c2c;
  --color-border: #333333;
  
  /* Colors - Text */
  --color-text-primary: #e2e8f0;
  --color-text-secondary: #a0aec0;
  --color-text-tertiary: #718096;

  /* Colors - Accent */
  --color-accent-blue: #58a6ff;
  --color-accent-blue-hover: #79b8ff;
  --color-fame: #81c784;

  /* Equipment Colors */
  --color-reinforce: #68d5ed;
  --color-amplification: #ff00ff;
  --color-refine: #b36bff;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-blue: 0 0 15px -3px rgba(121, 184, 255, 0.3);

  /* Spacing Scale */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;

  /* Transitions */
  --transition-fast: 0.15s;
  --transition-base: 0.2s;
  --transition-slow: 0.3s;

  /* Layout */
  --navbar-height: 60px;
}

@font-face {
  font-family: 'DNFForgedBlade';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('font/DNFForgedBlade-Bold.ttf') format('truetype');
}

/* =================================
   Accessibility Utilities
   ================================= */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible styles for better keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}

.card:focus-visible {
  outline: 3px solid var(--color-accent-blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* Error Toast */
.error-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #dc3545;
  color: white;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transition: bottom var(--transition-slow) ease;
  font-family: var(--font-primary);
  font-weight: 500;
  max-width: 90%;
  text-align: center;
}

.error-toast.show {
  bottom: 32px;
}

/* Breadcrumb Navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--color-accent-blue);
  text-decoration: none;
  transition: color var(--transition-base);
}

.breadcrumb a:hover {
  color: var(--color-accent-blue-hover);
  text-decoration: underline;
}

.breadcrumb span[aria-current="page"] {
  color: var(--color-text-primary);
  font-weight: 500;
}

/* =================================
   Base Styles
   ================================= */

html,
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  background-color: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#body-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url('assets/image/background2.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  filter: brightness(0.5);
}


/* =================================
   Navbar
   ================================= */

.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--navbar-height);
  z-index: 1000;
  background-color: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--spacing-2xl);
  border-bottom: 1px solid var(--color-border);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  grid-column: 1;
  justify-self: start;
}

.navbar-brand img {
  width: 32px;
  height: 32px;
}

.navbar-title {
  color: var(--color-text-primary);
  font-family: var(--font-dfo);
  font-weight: 700;
  font-size: 22px;
  text-decoration: none;
}

.main-nav {
  grid-column: 2;
  justify-self: center;
}

.main-nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-dfo);
  margin: 0 15px;
  transition: color var(--transition-base);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--color-accent-blue);
}


/* =================================
   Main Layout
   ================================= */

.main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - var(--navbar-height));
  width: 100%;
}

.background-sarpoza,
.background-doghead {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 650px;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.background-sarpoza {
  left: 0;
  justify-content: flex-start;
}

.background-doghead {
  right: 0;
  justify-content: flex-end;
}

.background-sarpoza img,
.background-doghead img {
  width: 100%;
  max-height: 85vh;
  object-fit: contain;
  opacity: 0.2;
  user-select: none;
  padding-top: 10vh;
}


/* =================================
   Search Section
   ================================= */

.search-section {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20vh 0 100px;
  position: relative;
  z-index: 10;
}

.main-logo {
  font-family: var(--font-dfo);
  font-size: 52px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.search-box {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  background-color: var(--color-surface);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

select,
input {
  border: none;
  outline: none;
  padding: 14px 18px;
  font-size: 16px;
  background-color: transparent;
  color: var(--color-text-primary);
  font-family: var(--font-primary);
}

select {
  border-right: 1px solid var(--color-border);
  padding-right: 12px;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.03);
}

select option {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

#search-input {
  flex: 1;
  min-width: 500px;
}

/* Fix focus outline for input fields */
input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--color-accent-blue);
}

select:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--color-accent-blue);
}

button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-accent-blue) 0%, rgba(88, 166, 255, 0.85) 100%);
  border: none;
  padding: 0 24px;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-base) ease;
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.2);
  position: relative;
  overflow: hidden;
}

button:hover {
  background: linear-gradient(135deg, var(--color-accent-blue-hover) 0%, rgba(121, 184, 255, 0.85) 100%);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.35);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(88, 166, 255, 0.3);
}

button:disabled {
  background: var(--color-text-tertiary);
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

button.loading {
  background: #666;
  cursor: wait;
  box-shadow: none;
}

/* Search Box Wrapper with Tooltip */
.search-box-wrapper {
  position: relative;
}

.explorer-tooltip-wrapper {
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  z-index: 10;
}

.explorer-tooltip-wrapper:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
}

.explorer-tooltip-wrapper .tooltip-content {
  width: 280px;
  bottom: 125%;
  left: 50%;
}

/* Recent Searches */
.recent-searches {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1400px;
  margin: 12px auto 0;
  padding: 0 4px;
}

.recent-search-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  background-color: transparent;
  color: var(--color-text-secondary);
  padding: 6px 28px 6px 12px;
  border-radius: 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.recent-search-chip:hover {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}

.recent-search-name {
  user-select: none;
}

.recent-search-delete {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: transparent !important;
  background: none !important;
  color: #ff6b6b;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0 !important;
  min-width: 20px !important;
  box-shadow: none !important;
  font-family: inherit;
  font-weight: 400;
  opacity: 0;
  pointer-events: none;
}

.recent-search-chip:hover .recent-search-delete {
  opacity: 1;
  pointer-events: auto;
}

.recent-search-delete:hover {
  background-color: transparent !important;
  background: none !important;
  color: #ff4444;
  transform: translateY(-50%) scale(1.15);
}

/* Advanced Search Options */
.search-advanced-options {
  display: flex;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  font-size: 14px;
  color: var(--color-text-primary);
}

.search-option-checkbox {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  cursor: pointer;
  user-select: none;
}

.search-option-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-accent-blue);
}

.search-option-select {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.search-option-select select {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 14px;
}

/* Pagination */
.search-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
  margin-bottom: 20px;
}

.pagination-btn {
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-base);
  padding: 0 10px;
}

.pagination-btn:hover:not(:disabled) {
  background: none;
  color: var(--color-accent-blue);
}

.pagination-btn:disabled {
  background: none;
  color: var(--color-border);
  cursor: not-allowed;
  opacity: 1;
}

.pagination-number {
  min-width: 36px;
  padding: 8px 12px;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: color var(--transition-base) ease;
  cursor: pointer;
  user-select: none;
  display: inline-block;
}

.pagination-number:hover:not(.active) {
  color: var(--color-accent-blue);
}

.pagination-number.active {
  color: var(--color-accent-blue);
  font-weight: 700;
  cursor: default;
}

/* =================================
   Results Section
   ================================= */

.results-section {
  grid-row: 2;
  padding: 20px 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#results-wrapper {
  width: 100%;
  padding: 0;
}

#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--spacing-xl);
  width: 100%;
  max-width: 1280px;
  padding: 0 20px;
  justify-items: center;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
  justify-items: center;
  padding: 0 20px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}


/* =================================
   Character Cards
   ================================= */

.card {
  width: 270px;
  height: 435px;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(73, 73, 73, 0.2);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-slow) ease;
  background-blend-mode: overlay;
  background-color: rgba(0, 0, 0, 0.65);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-blue);
  border-color: var(--color-accent-blue);
  background-color: rgba(0, 0, 0, 0.3);
}

.card > div:first-child {
  position: absolute;
  top: 16px;
  text-align: center;
  z-index: 10;
}

.card .character-sprite-container {
  width: 256px;
  height: 185px;
  margin: 5px 0 58px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.card .character-sprite-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
}

.card > div:nth-child(7) {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  margin: 5px 0;
}

.card > div:nth-child(7) img {
  height: 24px;
  width: auto;
  margin-top: 5px;
}

.card > div:last-child {
  width: 100%;
  margin-top: auto;
  margin-bottom: 10px;
  padding-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.card-score-value {
  font-size: 1.2em;
  color: var(--color-accent-blue);
  font-family: var(--font-dfo);
}

.card.is-buffer .card-score-value {
  color: var(--color-fame);
}


/* =================================
   Announcement Section
   ================================= */

.announcement-section {
  width: 100%;
  max-width: 800px;
  margin: 60px auto;
  padding: 0 20px;
}

.announcement-section .section-title {
  font-family: var(--font-dfo);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-align: center;
  margin-bottom: 30px;
}

.accordion-container {
  display: flex;
  flex-direction: column;
}

.accordion-item {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.accordion-container .accordion-item:first-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.accordion-container .accordion-item:last-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.accordion-container .accordion-item:not(:first-child):not(:last-child) {
  border-radius: 0;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  transition: background-color var(--transition-base) ease;
}

.accordion-header:hover {
  background-color: var(--color-surface-light);
}

.accordion-header.active {
  border-bottom: 1px solid var(--color-accent-blue);
}

.accordion-header-icon {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-accent-blue);
  transition: transform var(--transition-slow) ease;
}

.accordion-header.active .accordion-header-icon {
  transform: rotate(135deg);
}

.accordion-content {
  max-height: 0;
  padding: 0 24px;
  overflow: hidden;
  opacity: 0;
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1.6;
  transition: max-height var(--transition-slow) ease-out, padding var(--transition-slow) ease-out, opacity var(--transition-slow) ease-out;
}

.accordion-content.open {
  max-height: 500px;
  padding: 20px 24px;
  opacity: 1;
}

.accordion-content p {
  margin-bottom: 10px;
}

.accordion-content ul {
  margin-left: 20px;
  list-style-type: disc;
}

.accordion-content li {
  margin-bottom: 5px;
}


/* =================================
   Detail View - Layout
   ================================= */

.detail-container {
  padding-top: 50px;
}

.detail-grid {
  display: grid;
  grid-template-areas:
    "back    back"
    "profile history"
    "dps     history"
    "fame    history"
    "vp      history"
    "skill   history"
    "buff-enhancement avatar-emblem";
  grid-template-columns: 542px 542px;
  grid-template-rows: auto auto auto auto auto auto auto;
  justify-content: center;
  gap: var(--spacing-xl);
  align-items: start;
  max-width: 1150px;
  margin: 40px auto;
  padding: 0 var(--spacing-xl);
}

.back-button-container {
  grid-area: back;
  padding: var(--spacing-xl) 0 10px;
}

.back-button {
  color: var(--color-text-primary);
  background-color: var(--color-surface-light);
  border: 1px solid var(--color-border);
  padding: var(--spacing-sm) 20px;
  font-weight: 500;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-base) ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
  background-color: var(--color-accent-blue);
  color: #ffffff;
  border-color: var(--color-accent-blue);
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.25);
  transform: translateY(-1px);
}

.back-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(88, 166, 255, 0.2);
}

.detail-widget {
  background-color: var(--color-surface);
  border-radius: 12px;
  padding: var(--spacing-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.detail-widget-profile {
  grid-area: profile;
  align-self: start;
}

#dps-widget-area {
  grid-area: dps;
  align-self: start;
}

.detail-widget-fame {
  grid-area: fame;
  align-self: start;
}

.detail-widget-vp {
  grid-area: vp;
  align-self: start;
}

.detail-widget-skill {
  grid-area: skill;
  align-self: start;
}

.detail-widget-buff-enhancement {
  grid-area: buff-enhancement;
  align-self: start;
}

.detail-widget-avatar-emblem {
  grid-area: avatar-emblem;
  align-self: start;
}

.detail-widget-history {
  grid-area: history;
  grid-row: 2 / 7;
  display: flex;
  flex-direction: column;
  grid-template-rows: auto 1fr;
  align-self: start;
  overflow: hidden;
  padding: 18px;
}

.widget-title {
  font-family: var(--font-dfo);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-accent-blue);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.character-canvas {
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.vp-skill-icon {
  filter: hue-rotate(240deg);
}

/* =================================
   Equipment Tabs & Panels
   ================================= */

.equipment-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
}

.equipment-tab {
  flex: 1;
  padding-bottom: 12px;
  margin-bottom: -2px;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  font-family: var(--font-dfo);
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base) ease;
}

.equipment-tab:hover {
  color: var(--color-text-primary);
}

.equipment-tab.active {
  color: var(--color-accent-blue);
  border-bottom-color: var(--color-accent-blue);
}

#equipment-tab-content {
  position: relative;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.equipment-panel {
  display: none;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-light) var(--color-surface);
}

.equipment-panel::-webkit-scrollbar {
  width: 8px;
}

.equipment-panel::-webkit-scrollbar-track {
  background: var(--color-surface);
}

.equipment-panel::-webkit-scrollbar-thumb {
  background-color: var(--color-surface-light);
  background-clip: padding-box;
  border: 2px solid var(--color-surface);
  border-radius: 6px;
}

.equipment-panel.active {
  display: block;
}

.equipment-item {
  margin-bottom: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md) var(--spacing-xs);
  border-bottom: 1px solid var(--color-border);
  border-radius: 6px;
  transition: background-color var(--transition-base) ease;
  cursor: pointer;
}

.equipment-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.equipment-item:last-child {
  border-bottom: none;
}

.equipment-main {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
}

.equipment-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.equipment-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.equipment-name {
  font-weight: 500;
  font-size: 15px;
}

.equipment-reinforce {
  color: var(--color-reinforce);
  font-weight: 600;
  font-size: 14px;
}

.equipment-amplification {
  color: var(--color-amplification);
  font-weight: 600;
  font-size: 14px;
}

.equipment-refine {
  color: var(--color-refine);
  font-weight: 600;
  font-size: 14px;
}

.equipment-enchants {
  background-color: rgba(0, 0, 0, 0.3);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-left: 34px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.equipment-enchants > div {
  margin: 2px 0;
}

.equipment-empty {
  height: 100%;
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-secondary);
}


/* =================================
   DPS Calculator
   ================================= */

.dps-calculator-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dps-toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.dps-toggle-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  color: var(--color-text-secondary);
  font-weight: 500;
  padding-right: 20px;
  cursor: help;
}

.dps-toggle-switch {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.dps-toggle-option {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  background-color: transparent;
  transition: all var(--transition-base) ease;
}

.dps-toggle-option.active {
  color: var(--color-text-primary);
  background-color: var(--color-accent-blue);
  box-shadow: var(--shadow-blue);
}

.dps-result-display {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  margin-top: 10px;
  text-align: right;
}

.dps-result-label {
  position: relative;
  display: block;
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.dps-result-value {
  font-family: var(--font-dfo);
  font-size: 28px;
  color: var(--color-accent-blue);
}


/* =================================
   Buff Calculator
   ================================= */

.buff-calculator-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.buff-category {
  background-color: transparent;
  padding: 0;
  border: none;
  margin-bottom: 0;
}

.buff-title {
  display: block;
  font-size: 1em;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  padding-bottom: 0;
}

.buff-category > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1em;
  color: var(--color-text-secondary);
  margin-top: 0;
  padding-bottom: 4px;
}

.buff-category > div:last-child {
  padding-bottom: 0;
}

.buff-category span:nth-child(2) {
  color: var(--color-text-primary);
  font-weight: 500;
}

.buff-category .favored-bonus-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9em;
  color: var(--color-text-tertiary);
  margin-top: 4px;
  padding-bottom: 0;
}

.buff-category .favored-bonus-line span:last-child {
  font-weight: 500;
}

.buff-score-display {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  margin-top: 10px;
  text-align: right;
}

.buff-score-label {
  display: block;
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.buff-score-value {
  font-family: var(--font-dfo);
  font-size: 28px;
  color: var(--color-accent-blue);
}


/* =================================
   Tooltip
   ================================= */

.tooltip-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.8em;
  font-weight: bold;
  cursor: help;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    padding: 10px;
    background-color: var(--color-background);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-align: left;
    font-size: 0.9em;
    transition: opacity var(--transition-slow) ease;
}

.tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 8px;
  border-style: solid;
  border-color: var(--color-background) transparent transparent transparent;
}

.tooltip-content p {
  margin: 0;
  padding-bottom: 5px;
}

.tooltip-content p:last-child {
  padding-bottom: 0;
}

.dps-toggle-label:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
}

.dps-result-label .tooltip-content {
  bottom: 125%;
  left: 90%;
  width: 400px;
}

.dps-result-label:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
}

.equipment-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 101;
    padding: 10px;
    background-color: var(--color-background);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-align: left;
    font-size: 0.9em;
    transition: opacity var(--transition-slow) ease;

    width: fit-content;
    max-width: 300px;
    white-space: normal;
    word-wrap: break-word;
}

.equipment-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--color-background) transparent transparent transparent;
}


/* =================================
   History Panel
   ================================= */

#history-panel {
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-light) var(--color-surface);
}

#history-panel::-webkit-scrollbar {
  width: 8px;
}

#history-panel::-webkit-scrollbar-track {
  background: var(--color-surface);
}

#history-panel::-webkit-scrollbar-thumb {
  background-color: var(--color-surface-light);
  background-clip: padding-box;
  border: 2px solid var(--color-surface);
  border-radius: 6px;
}

.history-date-header {
  width: 220px;
  height: 30px;
  margin: 24px auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-dfo);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-secondary);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.history-date-header:first-child {
  margin-top: 0;
}

.history-item {
  width: 100%;
  max-width: 482px;
  height: 79.7px;
  margin-bottom: 12px;
  padding: 0 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: url('assets/image/history.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.history-icon-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
}

.history-icon {
  width: 100%;
  height: 100%;
}

.history-arrow {
  font-size: 24px;
  font-family: var(--font-dfo);
  color: var(--color-text-tertiary);
}

.fame-indicator {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 28px;
  height: 13px;
}

.history-empty {
  height: 100%;
  padding-top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-secondary);
}

/* =================================
   Skill Widget
   ================================= */


#skill-container {
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-light) var(--color-surface);
}

#skill-container::-webkit-scrollbar {
  width: 8px;
}

#skill-container::-webkit-scrollbar-track {
  background: var(--color-surface);
}

#skill-container::-webkit-scrollbar-thumb {
  background-color: var(--color-surface-light);
  background-clip: padding-box;
  border: 2px solid var(--color-surface);
  border-radius: 6px;
}


/* =================================
   Loading & Footer
   ================================= */

#loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-surface-light);
  border-top-color: var(--color-accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.footer {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-top: 60px;
  padding: 24px 0;
  background-color: #181818;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer img {
  height: 40px;
  opacity: 0.7;
  transition: opacity var(--transition-base) ease;
}

.footer img:hover {
  opacity: 1;
}


/* =================================
   Responsive Design
   ================================= */

@media (max-width: 1350px) {
  #results-wrapper {
    max-width: 1030px;
  }
}

@media (max-width: 1150px) {
  .detail-grid {
    grid-template-areas:
      "back"
      "profile"
      "dps"
      "fame"
      "vp"
      "skill"
      "buff-enhancement"
      "avatar-emblem"
      "history";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto auto auto auto;
    gap: 16px;
    padding: 0 16px;
    align-content: start;
  }

  .detail-widget,
  .detail-widget-profile,
  .detail-widget-fame,
  .detail-widget-vp,
  .detail-widget-skill,
  .detail-widget-buff-enhancement,
  .detail-widget-avatar-emblem,
  .detail-widget-history,
  #dps-or-buff-widget-area {
    width: 492px !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    position: relative !important;
    overflow: visible;
  }

  .detail-widget-history {
    grid-row: 9 / 10;
    overflow-y: auto;
  }

  .detail-widget-set-info {
    width: 444px !important; 
  }

  #history-panel {
    max-height: none !important;
    overflow-y: auto;
  }

  #fame-chart-container,
  #fame-chart {
    width: 100% !important;
    height: auto !important;
  }
  
  #skill-container {
    max-height: none !important;
  }
}