
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Montserrat', sans-serif;
}

:root {
  --bg-start: #2c3e50;
  --bg-end: #2c3e50;
  --card-bg: rgba(44,62,80,0.8);
  --card-shadow: rgba(0,0,0,0.5);
  --btn-bg: #34495e;
  --btn-shadow-light: rgba(255,255,255,0.1);
  --btn-shadow-dark: rgba(0,0,0,0.5);
  --info-bg: rgba(44,62,80,0.9);
}


body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  
  animation: none;
  text-align: center;
  padding: 2rem;
  color: #eee;
  transition: background 0.5s, color 0.5s;
  position: relative;
  overflow: auto;
}


body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nNTAwJyBoZWlnaHQ9JzUwMCcgdmVyc2lvbj0nMS4xJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxnIGZpbGw9J25vbmUnIHN0cm9rZT0nd2hpdGUnIHN0cm9rZS13aWR0aD0nMjAnPjxjaXJjbGUgY3g9JzI1MCcgY3k9JzI1MCcgcj0nMjQwJy8+PGxpbmUgeDE9JzUwJyB5MT0nMjUwJyB4Mj0nNDUwJyB5Mj0nMjUwJy8+PC9nPjwvc3ZnPg==") repeat center/200px;
  opacity: 0.05;
  pointer-events: none;
}

body.dark {
  
}

@keyframes bgShift {
  to { background: linear-gradient(135deg, var(--bg-end), var(--bg-start)); }
}

body.dark {
  color: #eee;
}

/* modern visual enhancements */
:root {
    --accent-yellow: #ffc107;
    --accent-green: #4caf50;
    --accent-blue: #2196f3;
    --accent-red: #f44336;
}

@keyframes gradientBG {
    0% {background-position:0% 50%}
    50% {background-position:100% 50%}
    100% {background-position:0% 50%}
}

body {
    background: linear-gradient(-45deg, var(--bg-start), var(--bg-end), #0a1b2c, #112233);
    background-size:400% 400%;
    animation: gradientBG 20s ease infinite;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.37);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.catch-section {
    margin: 0.5rem 0;
}
.catch-section label { display:block; margin-bottom:0.3rem; }
.catch-section select, .catch-section input, .catch-section textarea { width:100%; border-radius:0.5rem; padding:0.4rem; border:none; }

/* highlighted result box */
.calc-result-highlight {
    background: rgba(255,255,0,0.2);
    padding: 0.6rem;
    border-radius: 0.6rem;
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: 0.5rem;
}

#catch-result, #log-result {
    font-size: 1.1rem;
}

#card-result {
    margin-bottom: 0.5rem;
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}

.tabs .tab {
    transition: background 0.3s, transform 0.2s;
}
.tabs .tab:hover,
.tabs .tab.active {
    transform: translateY(-2px);
}

input[type="text"], select, input[type="number"] {
    transition: box-shadow 0.2s ease;
}
input[type="text"]:focus, select:focus, input[type="number"]:focus {
    box-shadow: 0 0 8px var(--accent-yellow);
    outline: none;
}

/* legend colors map to accent vars */
.legend-color.selected {background: var(--accent-yellow);}
.legend-color.strength {background: var(--accent-green);}
.legend-color.resist {background: var(--accent-blue);}
.legend-color.weakness {background: var(--accent-red);}

/* scrollbars */
::-webkit-scrollbar {width:8px;}
::-webkit-scrollbar-track {background: rgba(0,0,0,0.1);}
::-webkit-scrollbar-thumb {background: rgba(255,255,255,0.2); border-radius:4px;}

/* share tooltip */
.share-tooltip {
    position: absolute;
    padding: 0.4rem 0.8rem;
    background: rgba(0,0,0,0.8);
    color: #fff;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    pointer-events: none;
    transform: translateX(-50%);
    z-index: 1000;
}

h1 {
  margin-bottom: 0.2rem;
  font-size: 2rem;
  letter-spacing: 1px;
}


p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  background: rgba(44,62,80,0.7);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.3s;
}

#lang-toggle, #share-btn {
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s;
  font-size:1.5rem;
}
#lang-toggle:hover,
#share-btn:hover { transform: scale(1.2); }

/* catch tab layout */
.catch-section {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.catch-section label {min-width: 120px;}
.catch-section input, .catch-section select, .catch-section textarea {flex:1; padding:0.4rem; border-radius:0.4rem; border:1px solid #ccc;}
.catch-section button {padding:0.5rem 1rem; background: var(--accent-yellow); border:none; border-radius:0.4rem; cursor:pointer;}
.catch-section button:hover {background: #e0a800;}


.legend {
  max-width: 800px;
  margin: 0 auto 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #ccc;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #fff;
}
.legend-color.selected { background: #ffd700; }
.legend-color.strength { background: #8bc34a; }
.legend-color.weakness { background: #e57373; }
.legend-color.resist { background: #42a5f5; }
.legend-color.immune { background: #9e9e9e; }
.legend-color.neutral { background: #666; }



.type-button:focus {
  outline: 3px solid #fff;
  outline-offset: 2px;
}


@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

#theme-toggle:hover {
  transform: rotate(20deg);
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 8px 32px var(--card-shadow);
  backdrop-filter: blur(8px);
  transition: background 0.5s, box-shadow 0.5s, transform 0.3s;
}

.card:hover {
  transform: translateY(-5px);
}

.chart-container {
  position: relative;
}

#connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}


@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

.chart-container .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));

/* quantity label for dna image in fossil results */
.dna-quantity {
  font-weight: bold;
  margin-left: 0.5rem;
  vertical-align: middle;
}
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.type-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3f5a72, var(--btn-bg));
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  box-shadow: 4px 4px 12px var(--btn-shadow-dark), -4px -4px 12px var(--btn-shadow-light);
}

.type-button:active {
  box-shadow: inset 4px 4px 12px var(--btn-shadow-dark), inset -4px -4px 12px var(--btn-shadow-light);
}

.type-button .type-icon {
  width: 50%;
  height: 50%;
  
  filter: drop-shadow(0 0 0.1rem #000);
}

.type-label {
  margin-top: 4px;
  font-size: 0.8rem;
  color: inherit;
  text-transform: capitalize;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.type-button:hover {
  transform: scale(1.1);
}

.type-button:active {
  transform: scale(0.95);
}

.type-button.active {
  background: #ffd700;
  box-shadow: 0 0 0 4px rgba(255,215,0,0.5);
}
.type-button.neutral {
  filter: grayscale(100%) brightness(0.7);
  opacity: 0.6;
}

.type-button.effectiveness {
  background: #8bc34a;
  animation: pulse 1s infinite;
  box-shadow: 0 0 12px rgba(139,195,74,0.7);
}

.type-button.weakness {
  background: #e57373;
  animation: pulse-red 1s infinite;
  box-shadow: 0 0 12px rgba(229,115,115,0.7);
}
.type-button.resist {
  background: #42a5f5;
  animation: pulse-blue 1s infinite;
  box-shadow: 0 0 12px rgba(66,165,245,0.7);
}
@keyframes pulse-blue {
  0% { box-shadow: 0 0 0 rgba(66,165,245,0.7); }
  70% { box-shadow: 0 0 10px rgba(66,165,245,0); }
  100% { box-shadow: 0 0 0 rgba(66,165,245,0); }
}

.type-button.immune {
  background: #9e9e9e;
  box-shadow: 0 0 8px rgba(158,158,158,0.7);
}
.type-button.mixed {
  
  background: linear-gradient(135deg, #8bc34a 50%, #9e9e9e 50%);
  box-shadow: 0 0 12px rgba(139,195,74,0.7);
}


@keyframes pulse-red {
  0% { box-shadow: 0 0 0 rgba(229,115,115,0.7); }
  70% { box-shadow: 0 0 10px rgba(229,115,115,0); }
  100% { box-shadow: 0 0 0 rgba(229,115,115,0); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 rgba(139,195,74,0.7); }
  70% { box-shadow: 0 0 10px rgba(139,195,74,0); }
  100% { box-shadow: 0 0 0 rgba(139,195,74,0); }
}


.water { background: #6493eb; color: #fff; }
.fire  { background: #f08030; color: #fff; }
.grass { background: #78c850; color: #fff; }
.electric { background: #f8d030; color: #000; }
.ice { background: #98d8d8; color: #000; }
.fighting { background: #c03028; color: #fff; }
.poison { background: #a040a0; color: #fff; }
.ground { background: #e0c068; color: #000; }
.flying { background: #a890f0; color: #000; }
.psychic { background: #f85888; color: #fff; }
.bug { background: #a8b820; color: #fff; }
.rock { background: #b8a038; color: #fff; }
.ghost { background: #705898; color: #fff; }
.dragon { background: #7038f8; color: #fff; }
.dark { background: #705848; color: #fff; }
.fairy { background: #ee99ac; color: #000; }
.steel { background: #b8b8d0; color: #000; }
.normal { background: #a8a878; color: #000; }


.info {
  margin-top: 1rem;
  font-size: 1.1rem;
  padding: 1rem;
  background: var(--info-bg);
  border-radius: 12px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  min-height: 2rem;
  max-height: 60vh;
  overflow-y: auto;
  transition: background 0.3s, transform 0.3s;
  box-shadow: 0 4px 16px var(--card-shadow);
}

.info-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  position: sticky;
  top: 0;
  background: var(--info-bg);
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  z-index: 1;
}

.info:hover {
  transform: scale(1.02);
}

.info-icons {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}


.info > div {
  margin-top: 0.5rem;
}

.info > div em {
  font-style: normal;
  font-weight: 600;
  color: #ccc;
}

.info-icon {
  width: 40px;
  height: 40px;
  opacity: 0;
  transform: scale(0.5);
  animation: iconPop 0.5s forwards;
  transition: transform 0.2s;
}

.info-icon-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0.5rem;
}

.info-label {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: #ccc;
  text-transform: capitalize;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-icon:hover {
  transform: scale(1.3);
}

@keyframes iconPop {
  to { opacity: 1; transform: scale(1); }
}

.info strong {
  color: #333;
}

.search-wrapper {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  position: relative;
}

.fossil-img {
  width: 80px;
  cursor: pointer;
  transition: transform 0.2s, border 0.2s;
}
.fossil-img:hover {
  transform: scale(1.1);
}
.fossil-img.selected, .fossil-img.active {
  border: 3px solid #ffd700;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255,215,0,0.6);
  transform: scale(1.1);
}
.fossil-img.compatible {
  opacity: 1;
}
.fossil-img.incompatible {
  opacity: 0.3;
}

#fossil-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.fossil-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fossil-label {
  margin-top: 4px;
  font-size: 0.9rem;
  text-align: center;
}

.fossil-cost {
  text-align: center;
  font-style: italic;
  margin-top: 8px;
}

.result-fossils {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.result-fossil {
  width: 40px;
  height: 40px;
}

.pokemon-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.pokemon-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0.5rem;
  cursor: pointer;
  color: #eee;
}
.pokemon-card img {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.pokemon-card div {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  text-align: center;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tab {
  background: var(--btn-bg);
  color: #eee;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  border: none;
  font-weight: 600;
}

.tab.active,
.tab:focus {
  background: #ffd700;
  color: #000;
  outline: none;
}

.calc-section {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.calc-section label {
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.calc-section input,
.calc-section select {
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  width: 120px;
  text-align: center;
}

.calc-results {
  margin-top: 0.6rem;
  font-size: 1rem;
  color: #fafafa;
}

.calc-info {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  text-align: center;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  font-style: italic;
  line-height: 1.4;
}

.calc-card { max-width: 700px; margin: 0 auto; }
.calc-icons { display: flex; justify-content: center; gap: 1rem; margin-bottom: 0.5rem; }
.small-icon { width: 32px; height: 32px; opacity: 0.8; }

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.calc-inputs, .calc-outputs { display: flex; flex-direction: column; gap: 1rem; }
.calc-inputs { align-items: center; width: 100%; }
.variant-group { display: flex; justify-content: center; }
.variant-options { padding-left: 0; }
.calc-outputs { background: rgba(0,0,0,0.2); padding: 1rem; border-radius: 8px; }

@media (max-width: 600px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-outputs { order: -1; }
}

#calc-instructions {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: #eee;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.calc-section span#pokemon-type-label {
  margin-right: 0.6rem;
  font-weight: 500;
}
.calc-section label {
  margin-right: 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.calc-section input[type="radio"] {
  margin: 0 -30px 0 -30px;
  vertical-align: middle;
  position: relative;
  top: 1px;
}

.variant-group {
  width: 90%;
  display: flex;
  justify-content: center;
  align-items: start;
  gap: 0.5rem;
  flex-wrap: nowrap;
  margin-left: 350px;
}
.variant-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.reset-button {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: #ffd700;
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.reset-button:hover {
  transform: translateY(-50%) scale(1.1);
}

#type-search {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid #aaa;
  font-size: 1rem;
  outline: none;
  transition: box-shadow 0.3s;
}

#type-search:focus {
  box-shadow: 0 0 8px rgba(100,149,237,0.6);
}


@media (max-width: 800px) {
  .card {
    padding: 1rem;
  }
  .grid {
    gap: 0.5rem;
  }
  .type-button {
    width: 60px;
    height: 60px;
  }
  .type-label {
    font-size: 0.7rem;
  }
  #type-search {
    font-size: 0.9rem;
  }
}

@media (max-width: 500px) {
  body {
    padding: 1rem;
  }
  .type-button { padding: 0.3rem; font-size: 0.9rem; }
}


@media (min-width: 1200px) {
  .card {
    max-width: 1200px;
  }
  .type-button {
    width: 100px;
    height: 100px;
  }
  .type-icon {
    width: 60%;
    height: 60%;
  }
}


@media print {
  header, .search-wrapper, #legend, #share-btn, #print-btn, #theme-toggle, #type-search { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none; background: #fff; }
  .type-button { box-shadow: none; }
  .info { background: #f9f9f9; }
}


@media (prefers-contrast: more) {
  body { background: #000; color: #fff; }
  .card { background: #111; }
  .type-button { border: 2px solid #fff; }
}


.modal {
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal[aria-hidden="false"] { display:flex; }
.modal-content {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 12px;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}
#matrix-body table {
  border-collapse: collapse;
  width: 100%;
}
#matrix-body th, #matrix-body td {
  border:1px solid #ccc;
  padding:4px;
  text-align:center;
  font-size:0.9rem;
}
#matrix-body th {
  position: sticky;
  top:0;
  background: var(--card-bg);
}
