:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0f19;
  color: #e5e9f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top, rgba(76, 86, 114, 0.15), transparent 28%),
    linear-gradient(180deg, #07101d 0%, #091123 48%, #070b12 100%);
  color: #eef2ff;
}

.home-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: unset;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(16, 22, 37, 0.95);
  color: #b8c3e0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.home-btn:hover,
.home-btn:focus-visible {
  color: #eef2ff;
  border-color: rgba(124, 147, 203, 0.45);
  background: rgba(22, 30, 50, 0.98);
}

.app-shell {
  width: min(100%, 1880px);
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.top-panel {
  display: grid;
  gap: 22px;
  margin-bottom: 24px;
  padding: 24px 24px 20px;
  border-radius: 26px;
  background: rgba(16, 22, 37, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.top-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
}

.top-panel .subtitle {
  margin: 8px 0 0;
  font-size: 1rem;
  color: #b8c3e0;
  max-width: 640px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #7c93cb;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.77rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 640px;
  color: #adb8d9;
  line-height: 1.75;
}

.search-panel {
  display: grid;
  gap: 14px;
  width: 100%;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.input-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input[type="search"] {
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  padding: 0 18px;
  font-size: 1rem;
}

input[type="search"]:focus {
  outline: 2px solid #7c93cb;
  outline-offset: 2px;
}

button {
  min-width: 128px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #5b6fe3, #7d86ff);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  filter: saturate(1.15);
}

.result-card,
.message {
  padding: 32px;
  border-radius: 26px;
  background: rgba(10, 16, 29, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.result-card {
  margin-top: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.hidden {
  display: none;
}

.character-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 22px;
  align-items: start;
}

.avatar {
  width: 100%;
  max-width: 240px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: #09111d;
}

.avatar img {
  width: 100%;
  display: block;
}

.stats {
  display: grid;
  gap: 16px;
}

.stats h2 {
  margin: 0;
  font-size: 1.35rem;
}

.stats p {
  margin: 6px 0;
  color: #cfd8f5;
}

.stats-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.stats-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: rgba(105, 118, 157, 0.08);
}

.stats-list strong {
  color: #edf2ff;
}

.stats-list span {
  color: #c0c8e0;
}

.progress-box {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  color: #d1d8ef;
  letter-spacing: 0.01em;
}

.progress-bar {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(34, 142, 111, 0.16);
  overflow: hidden;
  border: 1px solid rgba(34, 142, 111, 0.22);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2be7b5, #0e8f76);
  transition: width 0.3s ease;
}

.percent-value {
  color: #f8d638;
  font-weight: 700;
}

.progress-caption {
  font-size: 0.95rem;
  color: #c3cbef;
  display: flex;
  justify-content: space-between;
}

.progress-caption span {
  font-weight: 600;
}

.footer-note {
  margin-top: 14px;
  font-size: 0.92rem;
  color: #8e9dbc;
}

/* Saved Characters */

.saved-section {
  margin-top: 4px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fa2d1;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.view-toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #9fb0de;
  letter-spacing: 0.04em;
}

.view-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.view-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.22);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.view-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c5cdf5;
  transition: transform 0.2s ease, background 0.2s ease;
}

.view-toggle input:checked + .view-toggle-track {
  background: rgba(91, 111, 227, 0.55);
  border-color: rgba(125, 134, 255, 0.55);
}

.view-toggle input:checked + .view-toggle-track .view-toggle-thumb {
  transform: translateX(20px);
  background: #eef2ff;
}

.saved-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(320px, 1fr));
  gap: 18px;
}

.saved-list.saved-list--table {
  display: block;
}

.saved-table-wrap {
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(10, 16, 29, 0.96);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24);
}

.saved-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.saved-table th,
.saved-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.saved-table th {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fa2d1;
  background: rgba(17, 26, 47, 0.9);
}

.saved-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.saved-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.45);
}

.saved-table tbody tr:last-child td {
  border-bottom: none;
}

.saved-table .col-job {
  font-weight: 700;
  color: #eef2ff;
  white-space: nowrap;
}

.saved-table .col-level {
  font-weight: 700;
  color: #24c1ff;
  white-space: nowrap;
}

.saved-table .col-exp {
  font-weight: 700;
  color: #f5d84c;
  white-space: nowrap;
}

.saved-cell-effect {
  min-width: 220px;
  max-width: 360px;
}

.saved-table td.level-tier--pearl {
  background: linear-gradient(
    125deg,
    rgba(76, 225, 252, 0.699) 0%,
    rgba(52, 191, 255, 0.377) 32%,
    rgba(170, 255, 215, 0) 55%,
    rgba(255, 235, 170, 0) 82%,
    rgba(255, 255, 255, 0) 100%
  );
}

.saved-table td.level-tier--gold {
  background: linear-gradient(
    135deg,
    rgba(255, 53, 53, 0.5) 0%,
    rgba(255, 187, 50, 0) 47%,
    rgba(255, 200, 80, 0) 100%
  );
}

.saved-table td.level-tier--silver {
  background: linear-gradient(
    135deg,
    rgba(216, 60, 255, 0.34) 0%,
    rgba(175, 190, 215, 0) 45%,
    rgba(200, 210, 230, 0) 100%
  );
}

.saved-cell-effect.legion-cell--active {
  background: linear-gradient(
    135deg,
    rgba(0, 255, 140, 0.28) 0%,
    rgba(0, 255, 140, 0.08) 55%,
    rgba(0, 255, 140, 0.02) 100%
  );
}

.saved-cell-effect.legion-cell--inactive {
  background: linear-gradient(
    135deg,
    rgba(255, 50, 50, 0.28) 0%,
    rgba(255, 50, 50, 0.08) 55%,
    rgba(255, 50, 50, 0.02) 100%
  );
}

.saved-table tbody tr:hover td.level-tier--pearl {
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.863) 0%,
    rgba(255, 255, 255, 0.466) 32%,
    rgba(185, 255, 225, 0) 64%,
    rgba(255, 240, 185, 0) 82%,
    rgba(255, 255, 255, 0) 100%
  );
}

.saved-table tbody tr:hover td.level-tier--gold {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.863) 0%,
    rgba(255, 255, 255, 0.466) 32%,
    rgba(185, 255, 225, 0) 64%,
    rgba(255, 240, 185, 0) 82%,
    rgba(255, 255, 255, 0) 100%
  );
}

.saved-table tbody tr:hover td.level-tier--silver {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.863) 0%,
    rgba(255, 255, 255, 0.466) 32%,
    rgba(185, 255, 225, 0) 64%,
    rgba(255, 240, 185, 0) 82%,
    rgba(255, 255, 255, 0) 100%
  );
}

.saved-table tbody tr:hover .legion-cell--active {
  background: linear-gradient(
    135deg,
    rgba(0, 255, 140, 0.34) 0%,
    rgba(0, 255, 140, 0.12) 55%,
    rgba(0, 255, 140, 0.04) 100%
  );
}

.saved-table tbody tr:hover .legion-cell--inactive {
  background: linear-gradient(
    135deg,
    rgba(255, 50, 50, 0.34) 0%,
    rgba(255, 50, 50, 0.12) 55%,
    rgba(255, 50, 50, 0.04) 100%
  );
}

.effect-name {
  display: block;
  font-weight: 700;
  color: #d7e0ff;
  margin-bottom: 4px;
}

.effect-level {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7c93cb;
}

.effect-detail {
  display: block;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #b8c3e0;
}

.effect-missing {
  color: #8e9dbc;
  font-style: italic;
}

.saved-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: start;

  padding: 20px;

  border-radius: 28px;

  background:
    linear-gradient(
      180deg,
      rgba(17, 26, 47, 0.96),
      rgba(8, 11, 22, 0.95)
    );

  border: 1px solid rgba(112, 131, 189, 0.18);

  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24);

  position: relative;
  overflow: hidden;

  min-width: 380px;

  /* NEW */
  min-height: 198px;
  padding-bottom: 34px;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.saved-card:hover {
  transform: translateY(-3px);

  box-shadow:
    0 22px 50px rgba(20, 34, 75, 0.34);

  border-color:
    rgba(126, 150, 229, 0.3);
}

.saved-card img {
  width: 160px;

  aspect-ratio: 1 / 1;

  object-fit: cover;

  border-radius: 22px;

  border: 1px solid rgba(148, 163, 184, 0.18);
  margin: 0 auto;
}

.saved-card-level {
display: flex;

  width: 160px;

  text-align: center;

  font-size: 1.5rem;
  font-weight: 700;

  color: #24c1ff;
}

.saved-card-body {
  display: flex;
  flex-direction: column;

  gap: 14px;

  min-width: 0;
}

.saved-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  gap: 10px;
}

.saved-card-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 8px;
}

.saved-card-title {
  flex: 1;
  margin-bottom: 8px;

  font-size: 1.15rem;
  font-weight: 700;

  color: #eef2ff;

  line-height: 1.2;

  overflow-wrap: anywhere;
}

.saved-card-job {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: bold;
  color: #ffffff;
  line-height: 1.3;
}

.saved-card-controls {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 6px;

  flex-shrink: 0;
}

.saved-gear-btn,
.saved-delete-btn {
  border: none;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  transition:
    transform 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.saved-gear-btn {
  width: 32px;
  height: 32px;

  min-width: unset;

  font-size: 0.95rem;

  background: rgba(255, 255, 255, 0.06);

  color: #ffffff;
}

.saved-gear-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.saved-delete-btn {
  position: absolute;

  top: 38px;
  right: 0;

  min-width: unset;

  padding: 7px 12px;

  background: rgba(20, 24, 38, 0.96);

  border: 1px solid rgba(255, 90, 90, 0.28);

  color: #ff8e8e;

  font-size: 0.82rem;

  opacity: 0;
  pointer-events: none;

  transform: translateY(-6px);

  white-space: nowrap;

  z-index: 10;
}

.saved-delete-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.saved-delete-btn:hover {
  background: rgba(255, 70, 70, 0.12);
}

.saved-exp-group {
  display: flex;
  flex-direction: column;

  gap: 8px;

  margin-top: -2px;
}

.saved-percent {
  color: #f5d84c;

  font-weight: 800;

  font-size: 1.1rem;
}

.mini-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-progress-bar {
  width: 100%;
  height: 10px;

  border-radius: 999px;

  background: rgba(30, 92, 72, 0.16);

  overflow: hidden;

  border: 1px solid rgba(30, 92, 72, 0.22);
}

.mini-progress-fill {
  width: 0%;
  height: 100%;

  background:
    linear-gradient(
      90deg,
      #00ff86 0%,
      #00bcaf 100%
    );

  transition: width 0.25s ease;
}

.mini-progress-caption {
  font-size: 0.82rem;

  color: #c5cdf5;
}

.saved-status-row {
  display: flex;
  gap: 10px;
}

.neon-sign {
  min-width: 84px;
  height: 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  font-size: 0.82rem;
  font-weight: 800;

  letter-spacing: 0.04em;
}

.neon-sign.on,
.neon-sign.level-210,
.neon-sign.level-250 {
  color: #b8ffd7;

  background:
    rgba(0, 255, 140, 0.12);

  border-color:
    rgba(0, 255, 140, 0.45);

  box-shadow:
    0 0 8px rgba(0, 255, 140, 0.5),
    0 0 18px rgba(0, 255, 140, 0.25);
}

.neon-sign.off {
  color: #de5b5b;

  background:
    rgba(255, 50, 50, 0.12);

}

.save-btn {
  margin-left: 12px;
  padding: 6px 10px;
  min-width: auto;
  border-radius: 10px;
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .saved-list:not(.saved-list--table) {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 28px 18px 32px;
  }

  .character-grid {
    grid-template-columns: 1fr;
  }

  .saved-list:not(.saved-list--table) {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .saved-card {
    grid-template-columns: 1fr;
    min-width: unset;
  }

  .saved-card img {
    width: 100%;
  }

  .saved-card-level {
    width: auto;
    margin-top: -6px;
  }
}