* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Zekton', sans-serif;
}

@font-face {
    font-family: 'Zekton';
    src: url('/fonts/zekton.woff2') format('woff2'),
         url('/fonts/zekton.woff') format('woff'),
         url('/fonts/zekton.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
body {
    font-family: 'Zekton', sans-serif;
}


body {
    background-color: #181818;
    color: #fff;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #111;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo img {
    width: 100px;
}

.header-nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.header-nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.translate-toggle,
.theme-toggle {
    cursor: pointer;
}


main {
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

#search-bar, #type-filter, #attribute-filter {
    padding: 10px;
    border-radius: 5px;
    border: none;
    background-color: #222;
    color: #fff;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.card {
  background-color: #222;
  padding: 20px;
  padding-bottom: 3rem; /* reserve space for fixed bottom bar */
  border-radius: 10px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  position: relative; /* enable positioning for children */
}

.card p {
    display: block;
    max-height: calc(1.2em * 5); /* 1.2em per line × 5 lines */
    overflow-y: auto;
    padding-right: 4px; /* room for scrollbar if needed */
    line-height: 1.2em;
}

.card p::-webkit-scrollbar {
    width: 4px;
}
.card p::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 2px;
}
.card p::-webkit-scrollbar-track {
    background-color: transparent;
}

.hsp-container {
    position: absolute;
    bottom: 0.5rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    color: white;
    font-weight: bold;
}

.hsp-container .hsp-value {
    color: #ffaa00;
}

.attr-text-subterra {
    color: #aa5500;
}
.attr-text-ventus {
    color: #00ff7f;
}
.attr-text-pyrus {
    color: #ff0000;
}
.attr-text-aquos {
    color: #1964fa;
}
.attr-text-haos {
    color: #f3ff70;
}
.attr-text-darkus {
    color: #aa55ff;
}

/* === Card Image Stack Mask Updates === */
.card .mask {
    position: relative;
    width: 100%;
    padding-top: 140%;
    overflow: hidden;
    border-radius: 6px;
    background: #111;
    margin-bottom: 10px;
}

.card .image-stack {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/*Filter*/

.filter-icons {
    display: flex;
    justify-content: center;
    gap: 10px;
    position: relative;
}

.filter-icons .mask {
    position: relative;
    width: 168px;
    height: 228px;
    border-radius: 6px;
    background: #111;
}

.filter-icons .image-stack {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
}

.filter-icons .image-stack > img {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 5;
}

.filter-icons .filter-panel {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.filter-icons .filter-panel img {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    z-index: 4;
}

/* === Selected Outline for Panel Images === */
.filter-panel img.selected,
.mask[data-panel="attributes"] > .image-stack > img.selected,
.mask[data-panel="types"] > .image-stack > img.selected {
    outline: 3px solid #ffaa00;
    outline-offset: -3px;
    box-shadow: 0 0 5px #ffaa00;
    border-radius: 4px;
    transition: outline 0.2s, box-shadow 0.2s;
}

/* === Disabled State for Filter Panels === */
.filter-panel.disabled {
    pointer-events: none;
    opacity: 0.4;
    filter: grayscale(100%) blur(1px);
    transition: opacity 0.4s, filter 0.4s;
}

.filter-panel img.disabled,
#type-panel img.disabled {
    opacity: 0.4 !important;
    pointer-events: none !important;
    filter: grayscale(100%) brightness(0.6) !important;
    transition: filter 0.3s ease;
}

#attribute-panel.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Greys out the AGC icon specifically when disabled */
#attribute-panel.disabled img:first-child,
.mask[data-panel="attributes"].disabled .image-stack > img {
    filter: grayscale(100%) brightness(0.5);
    opacity: 0.6;
}

/* === Ensure Outline When Attribute is Selected (AGC stays outlined) === */
.mask.attributes-selected > .image-stack > img:first-child {
    outline: 3px solid #ffaa00;
    outline-offset: -3px;
    box-shadow: 0 0 5px #ffaa00;
    border-radius: 4px;
    transition: outline 0.2s, box-shadow 0.2s;
}

.filter-icons .filter-panel.active {
    pointer-events: auto;
    z-index: 2;
}
.filter-icons .filter-panel.active img {
    opacity: 1;
}

#type-panel img.active:nth-child(1) {
    transform: translateX(-43px);
    opacity: 1;
    z-index: 7;
}
#type-panel img.active:nth-child(2) {
    transform: translateX(-86px);
    opacity: 1;
    z-index: 6;
}
#type-panel img.active:nth-child(3) {
    transform: translateX(-129px);
    opacity: 1;
    z-index: 5;
}
#type-panel img.active:nth-child(4) {
    transform: translateX(-172px);
    opacity: 1;
    z-index: 4;
}
#type-panel img.active:nth-child(5) {
    transform: translateX(-215px);
    opacity: 1;
    z-index: 3;
}
#type-panel img.active:nth-child(6) {
    transform: translateX(-258px);
    opacity: 1;
    z-index: 2;
}
#type-panel img.active:nth-child(7) {
    transform: translateX(-301px);
    opacity: 1;
    z-index: 1;
}

/* === ATTRIBUTE PANEL: Slides Right with First Image Normal === */
#attribute-panel img.active:nth-child(1) {
    transform: translateX(43px);
    opacity: 1;
    z-index: 7;
}
#attribute-panel img.active:nth-child(2) {
    transform: translateX(86px);
    opacity: 1;
    z-index: 6;
}
#attribute-panel img.active:nth-child(3) {
    transform: translateX(129px);
    opacity: 1;
    z-index: 5;
}
#attribute-panel img.active:nth-child(4) {
    transform: translateX(172px);
    opacity: 1;
    z-index: 4;
}
#attribute-panel img.active:nth-child(5) {
    transform: translateX(215px);
    opacity: 1;
    z-index: 3;
}
#attribute-panel img.active:nth-child(6) {
    transform: translateX(258px);
    opacity: 1;
    z-index: 2;
}
#attribute-panel img.active:nth-child(7) {
    transform: translateX(301px);
    opacity: 1;
    z-index: 1;
}

.card {
    cursor: default;
}

.clickable-keyword {
    cursor: pointer;
    font-weight: bold;
}

.clickable-attribute {
    cursor: pointer;
    font-weight: bold;
}

.clickable-ability {
    cursor: pointer;
    font-weight: bold;
}

.clickable-attribute-gate {
    cursor: pointer;
    font-weight: bold;
}

.clickable-character {
    cursor: pointer;
    color: #ffaa00;
    font-weight: bold;
}

.clickable-character-chgc {
    cursor: pointer;
    font-weight: bold;
}

.image-stack {
    cursor: pointer;
}

.card .image-stack img {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    transition: transform 0.3s;
}

.card.agc .image-stack,
.card.cogc .image-stack,
.card.chgc .image-stack {
    cursor: default;
    pointer-events: none;
}


/* Layer positioning for NAC / SAC left/right/top */
.card .image-stack img:nth-child(1) {
    z-index: 3;
}
.card .image-stack img:nth-child(2),
.card .image-stack img:nth-child(3) {
    z-index: 2;
    transform: translateX(0);
    transition: transform 0.3s;
}
.card .image-stack img:nth-child(4) {
    z-index: 1;
}

.mask.open .image-stack img:nth-child(2) {
    transform: translateX(34.85%);
}
.mask.open .image-stack img:nth-child(3) {
    transform: translateX(-34.85%);
}

/* Non-layered cards remain normal */
.card:not(.nac):not(.unac):not(.sac):not(.usac):not(.sac-vexos):not(.usac-vexos):not(.sac-brontes):not(.usac-brontes) > img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.card img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 10px;
}

.card h2 {
    font-size: 18px;
    margin-bottom: 10px;
}


.card h2 img.attribute-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
}
#colourCardButton,
#openCardButton,
#flipCardButton {
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    background-color: #333;
    cursor: pointer;
}

#colourCardButton i,
#openCardButton i,
#flipCardButton i {
    color: #fff;
    transition: color 0.3s;
}

.clickable-keyword {
    cursor: pointer;
}

.filters-container {
    display: flex;
    align-items: flex-end; /* Align all children to the bottom */
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    padding: 0 20px;
}

.left-search {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
}

.center-filters {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
}

.sort-button-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 10px;
}

#search-bar {
    margin-bottom: 0; /* ensure no accidental offset */
}

.sort-button {
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    background-color: #333;
    cursor: pointer;
}

.sort-button i {
    color: #fff;
}

.card.attr-pyrus {
    background: linear-gradient(
        to top,
        rgba(179, 0, 0, 0.3),
        rgba(255, 77, 77, 0.3)
    );
}

.card.attr-darkus {
    background: linear-gradient(
        to top,
        rgba(132, 8, 255, 0.3),
        rgba(208, 162, 255, 0.3)
    );
}

.card.attr-ventus {
    background: linear-gradient(
        to top,
        rgba(0, 179, 89, 0.3),
        rgba(77, 255, 165, 0.3)
    );
}

.card.attr-subterra {
    background: linear-gradient(
        to top,
        rgba(94, 47, 0, 0.3),
        rgba(247, 123, 0, 0.3)
    );
}

.card.attr-aquos {
    background: linear-gradient(
        to top,
        rgba(4, 68, 194, 0.3),
        rgba(100, 150 ,252, 0.3)
    );
}

.card.attr-haos {
    background: linear-gradient(
        to top,
        rgba(237, 255, 36, 0.3),
        rgba(249, 255, 189, 0.3)
    );
}

.card.attr-dextra {
    background: conic-gradient(
        from 0deg,
        rgba(179, 0, 0, 0.3),    /* Pyrus */
        rgba(94, 47, 0, 0.3),    /* Subterra */
        rgba(237, 255, 36, 0.3), /* Haos */
        rgba(132, 8, 255, 0.3),  /* Darkus */
        rgba(4, 68, 194, 0.3),   /* Aquos */
        rgba(0, 179, 89, 0.3),   /* Ventus */
        rgba(179, 0, 0, 0.3)     /* Close back to Pyrus */
    );
}


.card.dual-aquos-ventus {
    background: linear-gradient(to right, rgba(4, 68, 194, 0.3), rgba(0, 179, 89, 0.3));
}

.card.dual-darkus-aquos {
    background: linear-gradient(to right, rgba(132, 8, 255, 0.3), rgba(4, 68, 194, 0.3));
}

.card.dual-haos-darkus {
    background: linear-gradient(to right, rgba(237, 255, 36, 0.3), rgba(132, 8, 255, 0.3));
}

.card.dual-pyrus-subterra {
    background: linear-gradient(to right, rgba(179, 0, 0, 0.3), rgba(94, 47, 0, 0.3));
}

.card.dual-subterra-haos {
    background: linear-gradient(to right, rgba(94, 47, 0, 0.3), rgba(237, 255, 36, 0.3));
}

.card.dual-ventus-pyrus {
    background: linear-gradient(to right, rgba(0, 179, 89, 0.3), rgba(179, 0, 0, 0.3));
}

.card.dual-pyrus-darkus {
    background: linear-gradient(to right, rgba(179, 0, 0, 0.3), rgba(132, 8, 255, 0.3));
}

.card.dual-aquos-subterra {
    background: linear-gradient(to right, rgba(4, 68, 194, 0.3), rgba(94, 47, 0, 0.3));
}

.card.dual-haos-ventus {
    background: linear-gradient(to right, rgba(237, 255, 36, 0.3), rgba(0, 179, 89, 0.3));
}

/* ------------------------------
   Light Mode Base Overrides
------------------------------ */

#themeToggle {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 20px;
  cursor: pointer;
}

body.light-mode {
    background-color: #f5f5f5;
    color: #000;
}

body.light-mode header {
    background-color: #e0e0e0;
}

body.light-mode nav ul li a {
    color: #000;
}

/* Inputs & Selects */
body.light-mode #search-bar,
body.light-mode #type-filter,
body.light-mode #attribute-filter {
    background-color: #fff;
    color: #000;
    border: 1px solid #ccc;
}

/* Cards */
body.light-mode .card {
    background-color: #f0f0f0;
    color: #000;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

/* Optional: Card hover effect */
body.light-mode .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Main headings */
body.light-mode h1 {
    color: #000;
}

/* Form container area */
body.light-mode .filters {
    background-color: transparent;
}

/* Card grid background (optional) */
body.light-mode .cards-grid {
    background-color: transparent;
}

/* Icons, buttons, and other dark-specific items */
body.light-mode .fa-solid {
    color: #000;
}

/* Light Mode: HSP container */
body.light-mode .hsp-container {
    color: #000;
}

body.light-mode .hsp-container .hsp-value {
    color: #b37700;
}

body.light-mode .catalogue {
    color: #000;
}

/* Dark mode no-color */
body:not(.light-mode) #cards-container.no-color .card {
    background: #222 !important;
}

/* Light mode no-color */
body.light-mode #cards-container.no-color .card {
    background: #f0f0f0 !important;
}

body.light-mode .clickable-character {
    cursor: pointer;
    color: #b37700;
    font-weight: bold;
}

/* Light Mode: number colors (these can stay as-is unless you want variants) */
body.light-mode .number-1 { color: red; }
body.light-mode .number-2 { color: goldenrod; }
body.light-mode .number-3 { color: teal; }

/* Light Mode: card hover effect */
body.light-mode .card:hover {
    transform: translateY(-10px);
    box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.15); /* lighter shadow */
}

body.light-mode #colourCardButton,
body.light-mode #openCardButton,
body.light-mode #flipNoteButton {
    background-color: #e0e0e0;
    border: 1px solid #bbb;
    color: #000;
}
body.light-mode #colourCardButton i,
body.light-mode #openCardButton i,
body.light-mode #flipNoteButton i {
    color: #000;
}

/* Close button in light mode */
body.light-mode .close-button {
    color: #000;
}

/* Sort buttons in light mode */
body.light-mode .sort-button {
    background-color: #e0e0e0;
    border: 1px solid #bbb;
    color: #000;
}

/* Optional: Sort button icon color */
body.light-mode .sort-button i {
    color: #000;
}

body.light-mode .attr-text-subterra {
    color: #5E2F00;
}
body.light-mode .attr-text-ventus {
    color: #00B359;
}
body.light-mode .attr-text-pyrus {
    color: #B30000;
}
body.light-mode .attr-text-aquos {
    color: #0444C2;
}
body.light-mode .attr-text-haos {
    color: #c5d700;
}
body.light-mode .attr-text-darkus {
    color: #8408FF;
}

/* === Google Translate Hider === */
.goog-te-banner-frame.skiptranslate,
.skiptranslate {
  display: none !important;
}

body {
  top: 0 !important;
}

#google_translate_element {
  display: none;
}

/* === Header Layout === */
header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

.header-left {
  flex: 0 0 auto;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.header-center ul {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.header-center ul li a {
  text-decoration: none;
  color: white;
  font-weight: bold;
}

.header-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right button {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

/* === Flag Tray Animation === */
.language-icons {
  position: absolute;
  right: 65px;
  top: 60%;
  transform: translateY(-50%) translateX(10%);
  transform-origin: right center;
  scale: 0.9;
  transition: transform 0.4s ease, opacity 0.4s ease, scale 0.4s ease;
  opacity: 0;
  pointer-events: none;
  display: flex;
  gap: 6px;
  background: transparent;
  z-index: 9999;
}

.language-icons.visible {
  transform: translateY(-50%) translateX(0%);
  opacity: 1;
  pointer-events: auto;
  scale: 1;
}

.language-icons button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.language-icons img {
  width: 32px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #666;
  object-fit: cover;
  transition: transform 0.2s;
}

.language-icons button:hover img {
  transform: scale(1.1);
}

/* === AU Flip Text Logic (No longer needed, but keep transition for smoothness) === */
.card-index-header,
.center-filters,
#search-bar,
#type-filter option,
#attribute-filter option,
.card {
    transition: transform 0.4s ease;
}

.language-icons button img {
    display: inline-block;
    transition: transform 0.4s ease;
    transform-origin: center center;
}

.sort-button-container button {
    display: inline-block;
    transition: transform 0.4s ease;
    transform-origin: center center;
}

.header-nav ul li a {
    display: inline-block;
    transition: transform 0.4s ease;
}

img[src="/images/icon/bloxugan-logo.png"] {
    display: inline-block;
    transition: transform 0.4s ease;
    transform-origin: center center;
}

#toggleFlags,
#themeToggle {
    display: inline-block;
    transition: transform 0.4s ease;
    transform-origin: center center;
}

.card-index-header,
.center-filters {
    justify-content: center;
    align-items: center;
}