#tabla-periodica-app,
#tabla-periodica-app * {
  box-sizing: border-box;
}

#tabla-periodica-app {
  width: 100%;
}

.tp-wrapper {
	background: #121520;
	color: #f8fbff;
	padding: 40px 24px 34px;
	border-radius: 22px;
	overflow: visible;
	position: relative;
	box-shadow: 0 14px 40px rgba(2, 8, 35, 0.28);
}

.tp-header {
	text-align: center;
	max-width: 900px;
	margin: 0 auto 28px;
}

.tp-title {
  margin: 0;
  font-size: clamp(34px, 4vw, 64px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #58b9ff 0%, #41d0dc 45%, #36ddaf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tp-subtitle {
	margin: 14px 0 0;
	font-size: 15px;
	line-height: 1.6;
	color: rgba(228, 237, 255, 0.84);
	text-align: center;
}

.tp-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
  max-width: 1120px;
  margin: 0 auto 30px;
  padding: 18px 22px;
   background: rgba(255,255,255,0.03);
  border: 1px solid rgba(130, 160, 255, 0.15);
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.tp-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 10px;
	line-height: 1.2;
	color:#f3f6f4;
}

.tp-wrapper .tp-legend-item,
.tp-wrapper .tp-legend-item * {
	color: #f3f6f4 !important;
	opacity: 1 !important;
	-webkit-text-fill-color: #f3f6f4 !important;
	font-size: 12px;
}

.tp-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid currentColor;
  display: inline-block;
}

.tp-table-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tp-grid {
	min-width: 1340px;
	align-items: stretch;
	position: relative;
	overflow: visible;
	padding: 12px;
}

.tp-element,
.tp-series-placeholder {
	position: relative;
	width: 100%;
	min-height: 72px;
	border-radius: 10px;
	border: 1px solid rgba(255,255,255,0.18);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	overflow: visible;
}

.tp-element {
	appearance: none;
	padding: 10px 6px 8px;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
	box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
	color: #f8fbff;
	transform-origin: center;
}

.tp-element:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 28px rgba(7, 16, 52, 0.5);
  filter: brightness(2.0);
  z-index: 20;
}

.tp-z {
  position: absolute;
  top: 7px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  opacity: 0.92;
}

.tp-symbol {
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

.tp-name {
	margin-top: 8px;
	font-size: 9.5px;
	line-height: 1.15;
	max-width: 100%;
	padding: 0 2px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tp-element .tp-name{
  color:#f3f6f4;
}

.tp-element .tp-symbol{
  color:#f3f6f4;
}

.tp-element .tp-z{
  color:#f3f6f4;
}

.tp-series-placeholder {
  gap: 6px;
  background: rgba(6, 13, 38, 0.45);
  border-style: dashed;
  color: #c6d4ff;
  font-size: 12px;
}

.tp-series-placeholder *,
.tp-series-placeholder span,
.tp-series-placeholder strong {
  color: #f3f6f4 !important;
}

.tp-series-placeholder strong {
  font-size: 14px;
}

.tp-nonmetal { background: rgba(0, 133, 96, 0.28); border-color: #15ce7b; color: #eafff6; }
.tp-noble { background: rgba(113, 49, 191, 0.34); border-color: #a86fff; color: #f5edff; }
.tp-alkali { background: rgba(125, 16, 40, 0.38); border-color: #ff4f72; color: #fff0f3; }
.tp-alkaline { background: rgba(149, 72, 18, 0.36); border-color: #ff8a2b; color: #fff4e7; }
.tp-metalloid { background: rgba(0, 100, 122, 0.32); border-color: #18bed6; color: #e8fbff; }
.tp-halogen { background: rgba(156, 102, 10, 0.36); border-color: #ffc333; color: #fff5d7; }
.tp-post-transition { background: rgba(63, 72, 171, 0.35); border-color: #6d78ff; color: #eef0ff; }
.tp-transition { background: rgba(24, 72, 188, 0.34); border-color: #3a8cff; color: #edf4ff; }
.tp-lanthanide { background: rgba(176, 29, 104, 0.33); border-color: #f54ca5; color: #ffeaf6; }
.tp-actinide { background: rgba(194, 19, 72, 0.34); border-color: #ff4f8b; color: #fff0f5; }
.tp-unknown { background: rgba(60, 69, 95, 0.42); border-color: #7f8ba8; color: #edf1f8; }

.tp-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 18, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 99999;
}

.tp-modal.hidden {
  display: none;
}

.tp-modal-content {
	position: relative;
	width: min(1200px, 100%);
	max-height: calc(100vh - 48px);
	overflow: auto;
	background: linear-gradient(180deg, #171b27 0%, #121520 100%);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 24px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.tp-modal-body {
  padding: 28px;
}

.tp-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.tp-detail {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 28px;
}

.tp-left {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	border-right: 1px solid rgba(255,255,255,0.2);
	padding: 28px 24px;
}

.tp-element-heading {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.tp-symbol-big {
  font-size: 74px;
  line-height: 0.95;
  font-weight: 900;
}

.tp-z-big {
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  color: rgba(226, 236, 255, 0.72);
}

.tp-element-name {
	margin: 0;
	font-size: 30px;
	line-height: 1.1;
	text-align: center;
	color: #f4f7fb;
}

.tp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tp-detail-image,
.tp-detail-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  object-fit: cover;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.tp-detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(230, 238, 255, 0.7);
  font-weight: 600;
}

.tp-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tp-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tp-stat-card {
	padding: 16px 18px;
	border-radius: 16px;
	background: rgba(255,255,255,0.035);
	border: 1px solid rgba(255,255,255,0.2);
}

.tp-stat-wide {
  grid-column: auto;
}

.tp-stat-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8fc6ff;
  margin-bottom: 8px;
}

.tp-stat-value {
  display: block;
  font-size: 17px;
  line-height: 1.45;
  color: #f7fbff;
}

.tp-code {
  word-break: break-word;
}

.tp-section {
	padding: 18px 20px;
	border-radius: 18px;
	background: rgba(255,255,255,0.035);
	border: 1px solid rgba(255,255,255,0.2);
}

.tp-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: #66d0ff;
}

.tp-section p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: #ecf4ff;
}

.tp-highlight {
  background: linear-gradient(180deg, rgba(255, 191, 77, 0.11) 0%, rgba(255, 168, 63, 0.06) 100%);
  border-color: rgba(255, 196, 73, 0.22);
}

.tp-highlight h4 {
  color: #ffc85b;
}

.tp-error {
  margin: 0;
  text-align: center;
  color: #fff;
}

body.tp-modal-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .tp-wrapper {
    padding: 22px 16px 28px;
  }

  .tp-modal-body {
    padding: 22px;
  }

  .tp-detail {
    grid-template-columns: 1fr;
  }

  .tp-left {
    max-width: 360px;
    margin: 0 auto;
  }
}

@media (max-width: 680px) {
  .tp-legend {
    padding: 16px;
    gap: 10px 14px;
  }

  .tp-legend-item {
    font-size: 12px;
  }

  .tp-stats {
    grid-template-columns: 1fr;
  }

  .tp-stat-wide {
    grid-column: auto;
  }

  .tp-symbol-big {
    font-size: 60px;
  }

  .tp-z-big {
    font-size: 26px;
  }

  .tp-element-name {
    font-size: 26px;
  }
}
