* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #241b16 0%, #141110 55%, #0e0c0b 100%);
  color: #e6e1d7;
  font-size: 18px;
}


code {
  background: #2b2b2b;
  padding: 2px 6px;
  border-radius: 4px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(180deg, rgba(24, 18, 14, 0.9), rgba(24, 18, 14, 0));
  border-bottom: 1px solid rgba(80, 60, 40, 0.5);
}

.title-block h1 {
  margin: 0;
  font-size: 26px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.title-logo {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.title-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-text p {
  margin: 0;
}

.title-block p {
  margin: 6px 0 0;
  color: #b8b2a8;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 20px 30px 40px;
}

.sidebar {
  position: sticky;
  top: 20px;
  height: fit-content;
}

.panel {
  background: rgba(30, 24, 20, 0.92);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid rgba(120, 90, 60, 0.35);
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a2c22;
  background: #161310;
  color: #e6e1d7;
}

.list-group {
  margin-top: 16px;
}

.list-group h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #c2bbae;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.character-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.character-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto auto;
  gap: 6px 12px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
  border: 1px solid transparent;
}

.character-row:hover,
.character-row.active {
  background: rgba(66, 48, 36, 0.7);
  border-color: rgba(160, 120, 80, 0.45);
}

.character-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border-radius: 0;
  cursor: default;
  min-width: 0;
}

.character-progress {
  width: 100%;
  height: 6px;
  background: #161310;
  border: 1px solid #3b2f26;
  border-radius: 999px;
  overflow: hidden;
}

.character-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7fb069, #d2a24c);
  transition: width 0.2s ease;
  box-shadow: 0 0 8px rgba(210, 162, 76, 0.45);
}

.character-progress.placeholder {
  visibility: hidden;
}

.character-entry.placeholder {
  visibility: hidden;
}

.character-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3a2b22;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #e4d3c2;
  font-size: 12px;
  border: 2px solid #6a523f;
  overflow: hidden;
  flex: 0 0 34px;
}

.character-entry span {
  min-width: 0;
  white-space: normal;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.character-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.character-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.character-card {
  display: flex;
  gap: 20px;
  align-items: center;
  background: rgba(26, 20, 16, 0.6);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 90, 60, 0.3);
}

.character-subtitle {
  margin: 4px 0 0;
  color: #c2bbae;
}

.sprite {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  background: #3b2d24;
  border: 3px solid #6a523f;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  color: #ead8c9;
  overflow: hidden;
}

.character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
}

.character-image.large {
  width: 72px;
  height: 72px;
}

.character-info h2 {
  margin: 0;
}

.progress {
  margin-top: 8px;
  color: #d3c6b6;
}

.paper {
  margin-top: 18px;
  background: transparent;
  color: #2e2117;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.paper h3 {
  display: none;
}

.marks-grid {
  position: relative;
  --paper-scale: 3;
  width: calc(88px * var(--paper-scale));
  height: calc(82px * var(--paper-scale));
  margin: 0 auto;
  background-image: url("assets/Repentance_Completion_Void.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  image-rendering: pixelated;
}

.marks-grid.hard-paper {
  background-image: url("assets/Repentance_Completion_Void_Hard.png");
}

.mark {
  position: absolute;
  width: calc(16px * var(--paper-scale));
  height: calc(16px * var(--paper-scale));
  background: transparent;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mark:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.mark.checked {
  filter: drop-shadow(0 0 4px rgba(190, 80, 68, 0.8));
}

.mark.dim {
  opacity: 0.45;
}

.mark.pulse {
  animation: pulseGlow 1.2s ease;
}

.marks-grid.pulse {
  animation: pulseGlowPaper 1.2s ease;
  border-radius: 12px;
}

.mark.pulse-strong {
  animation: pulseGlowStrong 1.4s ease;
}

.marks-grid.pulse-strong {
  animation: pulseGlowPaperStrong 1.4s ease;
  border-radius: 12px;
}

@keyframes pulseGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(190, 120, 70, 0.3);
  }
  45% {
    transform: scale(1.06);
    box-shadow: 0 0 14px 4px rgba(255, 200, 120, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(190, 120, 70, 0.3);
  }
}

@keyframes pulseGlowPaper {
  0% {
    box-shadow: 0 0 0 2px rgba(190, 120, 70, 0.35);
  }
  45% {
    box-shadow: 0 0 16px 4px rgba(255, 200, 120, 0.75);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(190, 120, 70, 0.35);
  }
}

@keyframes pulseGlowStrong {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(255, 200, 120, 0.5);
  }
  40% {
    transform: scale(1.1);
    box-shadow: 0 0 22px 8px rgba(255, 220, 140, 0.9);
  }
  75% {
    transform: scale(1.05);
    box-shadow: 0 0 18px 6px rgba(255, 190, 90, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(255, 200, 120, 0.5);
  }
}

@keyframes pulseGlowPaperStrong {
  0% {
    box-shadow: 0 0 0 3px rgba(255, 200, 120, 0.55);
  }
  40% {
    box-shadow: 0 0 26px 9px rgba(255, 220, 140, 0.95);
  }
  75% {
    box-shadow: 0 0 20px 7px rgba(255, 190, 90, 0.75);
  }
  100% {
    box-shadow: 0 0 0 3px rgba(255, 200, 120, 0.55);
  }
}


.special-unlock {
  margin: 12px auto 0;
  display: none;
  justify-content: center;
}

.special-unlock-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 248, 235, 0.92);
  border: 2px solid #7a5a3b;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.special-unlock-card.locked {
  opacity: 0.55;
  filter: grayscale(0.8);
}

.special-unlock-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}

.special-unlock-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.special-unlock-title {
  font-size: 16px;
  font-weight: 700;
}

.special-unlock-subtitle {
  font-size: 13px;
  color: #4b3726;
}

.mark-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
}

.recommendations-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.recommendations-header h3 {
  font-size: 24px;
  /* pick your size */
}
.weights {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: #bdb6aa;
  font-size: 12px;
}

.weights label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recommendations-header button {
  white-space: nowrap;
}

.recommendations {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
}

.recommendations-more {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.recommendations-less {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.card {
  padding: 18px;
  border-radius: 12px;
  background: rgba(36, 28, 22, 0.92);
  border: 1px solid rgba(130, 100, 70, 0.35);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 240px;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.4);
}

.card h4 {
  margin: 0 0 8px;
  font-size: 24px;
}


.card-body {
  flex: 1;
}

.item-icon {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  background: #1b1b1b;
  border: 1px solid #3b3b3b;
  padding: 8px;
  object-fit: contain;
  image-rendering: pixelated;
}

.item-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card .meta {
  font-size: 16px;
  color: #bdb6aa;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-description {
  margin-top: 6px;
  font-size: 16px;
  color: #d8d2c7;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
  white-space: pre-line;
}

.item-description.expanded {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #443529;
  color: #f4e7d6;
  font-size: 12px;
}

.desc-toggle {
  margin-top: 6px;
  align-self: flex-start;
  background: transparent;
  border: 1px solid #3b3b3b;
  color: #d8d2c7;
  font-size: 12px;
  padding: 4px 10px;
}

.badge.quality-q0 {
  background: #f2f2f2;
  color: #2b2b2b;
}

.badge.quality-q1 {
  background: #5edc6a;
  color: #1b2a1f;
}

.badge.quality-q2 {
  background: #5bbcff;
  color: #0f2333;
}

.badge.quality-q3 {
  background: #b27cff;
  color: #201233;
}

.badge.quality-q4 {
  background: #f5d76e;
  color: #3a2b00;
  box-shadow: 0 0 6px rgba(245, 215, 110, 0.5),
    0 0 12px rgba(255, 180, 60, 0.35);
  position: relative;
}

.badge.quality-q4::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  background: radial-gradient(
    circle,
    rgba(255, 210, 120, 0.45),
    rgba(255, 140, 40, 0)
  );
  filter: blur(2px);
  pointer-events: none;
  animation: q4GlowFlicker 3.4s ease-in-out infinite;
}

.card:has(.badge.quality-q4) .item-icon,
.mark-tooltip-card:has(.badge.quality-q4) .item-icon {
  box-shadow: 0 0 6px rgba(255, 210, 120, 0.35),
    0 0 14px rgba(255, 140, 40, 0.28);
  border-color: rgba(255, 210, 120, 0.7);
  animation: q4IconFlicker 3.4s ease-in-out infinite;
}

@keyframes q4GlowFlicker {
  0% {
    opacity: 0.42;
    transform: scale(1);
  }
  35% {
    opacity: 0.6;
    transform: scale(1.02);
  }
  60% {
    opacity: 0.48;
    transform: scale(1.01);
  }
  100% {
    opacity: 0.52;
    transform: scale(1);
  }
}

@keyframes q4IconFlicker {
  0% {
    box-shadow: 0 0 5px rgba(255, 210, 120, 0.28),
      0 0 10px rgba(255, 140, 40, 0.22);
  }
  40% {
    box-shadow: 0 0 7px rgba(255, 210, 120, 0.4),
      0 0 16px rgba(255, 140, 40, 0.3);
  }
  75% {
    box-shadow: 0 0 6px rgba(255, 210, 120, 0.32),
      0 0 12px rgba(255, 140, 40, 0.24);
  }
  100% {
    box-shadow: 0 0 5px rgba(255, 210, 120, 0.28),
      0 0 10px rgba(255, 140, 40, 0.22);
  }
}

.badge.quality-qunknown {
  background: #666;
  color: #eee;
}

.mark-tooltip {
  position: absolute;
  z-index: 50;
  width: 360px;
  pointer-events: auto;
}

.mark-tooltip-card {
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.55);
}

.tooltip-unlock-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tooltip-unlock-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #d8d2c7;
}

.mark-tooltip .desc-toggle {
  font-size: 12px;
  padding: 4px 10px;
}

.muted {
  margin-top: 12px;
  color: #a59e92;
}

.footer {
  padding: 12px 30px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #948c81;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-credits {
  font-size: 14px;
  color: #b6a998;
}

.footer-credits a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(182, 169, 152, 0.6);
}

.footer-credits a:hover {
  color: #e6e1d7;
  border-bottom-color: rgba(230, 225, 215, 0.8);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-github {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(58, 42, 32, 0.7);
  color: #e6e1d7;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(120, 90, 60, 0.4);
}

.footer-github svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.footer-github:hover {
  background: rgba(80, 58, 40, 0.8);
}

button,
.import-label {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #3a2a20;
  color: #e6e1d7;
  font-weight: 600;
}

.action-button {
  min-width: 170px;
  height: 40px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

button.secondary {
  background: #2f241d;
}

button.danger {
  background: #6b2424;
}

.import-label input {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .character-compare {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .layout {
    padding: 16px 16px 28px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .action-button {
    min-width: 140px;
    flex: 1 1 160px;
  }

  .title-logo {
    width: 40px;
    height: 40px;
  }

  .title-block h1 {
    font-size: 22px;
  }

  .character-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .sprite {
    width: 64px;
    height: 64px;
  }

  .character-image.large {
    width: 58px;
    height: 58px;
  }

  .marks-grid {
    --paper-scale: 2.4;
  }

  .recommendations {
    grid-template-columns: 1fr;
  }

  .card {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
  }

  .item-icon {
    width: 56px;
    height: 56px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
