:root {
  --cream: #f6ead2;
  --cream-deep: #e8d5b0;
  --ink: #2a1f16;
  --muted: #7a6a58;
  --panel: rgba(255, 250, 240, 0.94);
  --panel-border: #d4c0a0;
  --search-text: #8a7a68;
  --kapamilya: #e11d48;
  --kapuso: #1d4ed8;
  --nominated: #f5c518;
  --evicted: #6b7280;
  --immunity: #d4a017;
  --safe: #1b7a3d;
  --checked: #7b787ae0;
  --a-rank: #e11d48;
  --b-rank: #1d4ed8;
  --no-rank: #252628;
  --banner-gold: #ffde59;
}

* {
  box-sizing: border-box;
}

p {
  margin: 0;
}

/* body chrome owned by PiliX live shell; ranker styles scoped to panel */
#panel-ranker {
  min-width: 100%;
  color: var(--ink);
}

#top-banner {
  padding: clamp(22px, 3.4vw, 34px) clamp(18px, 4.5vw, 42px) clamp(26px, 4vw, 40px);
  color: var(--ink);
  text-align: center;
  background-color: var(--cream);
  background-image: url("/ranker/assets/header_border.jpg");
  /* Stretch full decorative frame so sun + corner motifs stay visible */
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  border: 5px solid #c99700;
  border-bottom-width: 6px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 248, 230, 0.55),
    0 10px 28px rgba(42, 31, 22, 0.2);
  animation: bannerIn 0.7s ease-out;
  min-height: 220px;
}

#version {
  font-family: "Bebas Neue", sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-align: left;
  color: var(--muted);
  opacity: 0.9;
}

#banner-image {
  width: min(320px, 78vw);
  height: auto;
  margin: 4px auto 8px;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
  animation: logoFloat 3.2s ease-in-out infinite;
}

#banner-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0.08em;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 252, 245, 0.7);
}

#banner-subtitle {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  color: var(--kapamilya);
  font-size: clamp(12px, 2.4vw, 14px);
  margin-top: 4px;
  text-shadow: 0 1px 0 rgba(255, 252, 245, 0.65);
}

#table {
  height: 48vh;
  min-height: 340px;
  width: min(340px, 92vw);
  box-shadow: 0 10px 28px rgba(42, 31, 22, 0.12);
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  margin: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  background: var(--panel);
  backdrop-filter: blur(4px);
  overflow: hidden;
  animation: panelIn 0.55s ease-out;
}

#table__filter-container {
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: row;
  position: relative;
  z-index: 1;
}

#table__filter-input {
  padding: 8px 10px 8px 30px;
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  outline: 0;
  font-family: inherit;
  background-color: #fffdf8;
  background-image: url("/ranker/assets/search.png");
  background-size: 12px 12px;
  background-position: 10px center;
  background-repeat: no-repeat;
}

::placeholder {
  color: var(--search-text);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 10px;
}

.filter-chip {
  border: 1px solid var(--panel-border);
  background: #fffdf8;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip.is-active {
  color: #fff;
  border-color: transparent;
  background: var(--ink);
}

.filter-chip.chip-kapamilya.is-active {
  background: var(--kapamilya);
}

.filter-chip.chip-kapuso.is-active {
  background: var(--kapuso);
}

.filter-chip.chip-nominated.is-active {
  background: #c99700;
}

.filter-chip.chip-evicted.is-active {
  background: var(--evicted);
}

.filter-chip.chip-immunity.is-active {
  background: var(--immunity);
}

.filter-chip.chip-safe.is-active {
  background: var(--safe);
}

#sharelink-container {
  margin: 10px;
  display: flex;
}

#saveimage-container {
  margin: 0 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

#getlink-button,
#saveimage-button {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--kapamilya), #0ea5e9);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: white;
  cursor: pointer;
}

#saveimage-button {
  background: linear-gradient(135deg, #0f172a, var(--kapuso));
  min-width: 168px;
}

#getlink-button:active,
#saveimage-button:active {
  transform: scale(0.98);
}

#saveimage-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

#saveimage-hint {
  font-size: 12px;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.35;
}

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

.export-modal[hidden] {
  display: none !important;
}

.export-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.export-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 10, 0.58);
}

.export-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 96vw);
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  background: #fffdf8;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(20, 14, 10, 0.28);
  overflow: hidden;
}

.export-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 8px;
}

.export-modal__header h2 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(16px, 4.2vw, 22px);
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1.15;
  max-width: calc(100% - 36px);
}

.export-modal__close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.export-modal__body {
  padding: 0 14px 10px;
  overflow: auto;
  display: flex;
  justify-content: center;
}

#export-preview-image {
  width: 100%;
  height: auto;
  max-height: min(68vh, 640px);
  object-fit: contain;
  border-radius: 8px;
  background: #efe2c8;
  display: block;
}

.export-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px 14px;
}

.export-modal__actions button {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#export-preview-cancel {
  background: #efe2c8;
  color: var(--ink);
}

#export-preview-download {
  background: linear-gradient(135deg, #0f172a, var(--kapuso));
  color: #fff;
}

#export-preview-download:active,
#export-preview-cancel:active {
  transform: scale(0.98);
}

#getlink-textbox {
  margin-left: 5px;
  width: 145px;
  border: 1px solid var(--panel-border);
  border-radius: 8px 0 0 8px;
  padding: 5px 8px;
  display: none;
  background: #fffdf8;
}

#copylink-button {
  height: inherit;
  width: 54px;
  margin-left: -1px;
  border: 1px solid var(--panel-border);
  border-radius: 0 8px 8px 0;
  background: var(--cream-deep);
  font-weight: 700;
  display: none;
  cursor: pointer;
}

#table__entry-container {
  overflow-y: auto;
  border-top: 1px solid var(--panel-border);
  flex: 1;
}

.table__empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.table__entry {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid rgba(212, 192, 160, 0.55);
  cursor: pointer;
  transition: background 0.15s ease;
}

.table__entry:last-child {
  border-bottom: none;
}

.table__entry:hover {
  background-color: rgba(255, 244, 220, 0.9);
}

.table__entry-icon {
  border-radius: 50%;
  width: 60px;
  height: 60px;
  margin: 8px;
  display: block;
  position: relative;
  flex-shrink: 0;
}

.table__entry-img {
  border-radius: 50%;
  width: inherit;
  height: inherit;
  object-fit: cover;
  background: #efe2c8;
}

.evicted .table__entry-img,
.evicted .ranking__entry-img {
  filter: grayscale(100%);
}

.table__entry-check {
  position: absolute;
  top: 0;
  left: 0;
  width: inherit;
  height: inherit;
  border-radius: 50%;
  background-color: var(--checked);
  padding: 10px;
  box-sizing: border-box;
}

.table__entry-icon-border,
.ranking__entry-icon-border {
  position: absolute;
  top: 0;
  left: 0;
  width: inherit;
  height: inherit;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

/* Match pbbcollab.github.io nominated stamp overlay */
.table__entry-nominated,
.ranking__entry-nominated {
  position: absolute;
  box-sizing: border-box;
  top: 2px;
  left: -2px;
  right: 0;
  margin: auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-image: url(/ranker/assets/nominated.png);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  background-origin: content-box;
  pointer-events: none;
}

.table__entry-immunity,
.ranking__entry-immunity {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-image: url(/ranker/assets/immunity.png);
  background-size: cover;
  background-repeat: no-repeat;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.a-rank-border {
  border: 4px solid var(--a-rank);
}

.b-rank-border {
  border: 4px solid var(--b-rank);
}

.no-rank-border {
  border: none;
}

.evicted .table__entry-icon-border,
.evicted .ranking__entry-icon-border {
  border: 4px solid var(--no-rank);
}

.ranking__entry-icon-border.dragged-over {
  border: 4px solid var(--checked);
}

.table__entry-text {
  margin: auto 6px;
  min-width: 0;
}

.table__entry-text .fullname {
  font-size: 13px;
  color: var(--ink);
  display: block;
}

.table__entry .agency {
  font-size: 12px;
  color: #555;
}

.table__entry .ageandlocation {
  font-size: 10px;
  color: var(--muted);
  display: block;
}

.status-pill {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-safe {
  background: #d9f5de;
  color: var(--safe);
}

.status-nominated {
  background: #fff3c4;
  color: #8a6a00;
}

.status-evicted {
  background: #eceff3;
  color: #4b5563;
}

.status-immunity {
  background: #fff0c2;
  color: #8a6500;
}

#parent-ranking {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
  animation: panelIn 0.7s ease-out;
}

.ranking__pyramid {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  width: 170px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(42, 31, 22, 0.12);
}

.pyramid-kapamilya {
  border-top: 4px solid var(--kapamilya);
}

.pyramid-kapuso {
  border-top: 4px solid var(--kapuso);
}

.ranking__title {
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 20px;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.pyramid-kapamilya .ranking__title {
  color: var(--kapamilya);
}

.pyramid-kapuso .ranking__title {
  color: var(--kapuso);
}

.ranking__row {
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.ranking__entry-view {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 10px 18px 18px;
}

.ranking__entry-icon {
  border-radius: 50%;
  width: inherit;
  height: inherit;
  display: inline-block;
  position: relative;
}

.ranking__entry-img {
  border-radius: 50%;
  width: inherit;
  height: inherit;
  object-fit: cover;
  background: #efe2c8;
}

.ranking__entry-icon-badge {
  position: absolute;
  width: 60px;
  height: 16px;
  left: 0;
  right: 0;
  bottom: -6px;
  margin: auto;
  border-radius: 4px;
  box-sizing: border-box;
  padding: 2px;
  font-weight: 900;
  font-size: 9px;
  text-align: center;
  color: white;
}

.bg-no {
  background-color: var(--no-rank);
}

.bg-a {
  background-color: var(--a-rank);
}

.bg-b {
  background-color: var(--b-rank);
}

.evicted .ranking__entry-icon-badge {
  background-color: var(--no-rank);
}

.padded-box {
  padding: 16px;
}

.flex-container {
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: center;
  gap: 8px;
}

.drag-cursor {
  cursor: grab;
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

body.nominated-float-open {
  overflow: hidden;
}

.nominated-float[hidden] {
  display: none !important;
}

.nominated-float {
  position: fixed;
  inset: 0;
  /* Above livestream tutorial coach-marks (zv-tut-* uses ~3200) */
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
}

.nominated-float__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 12, 8, 0.55);
  cursor: pointer;
}

.nominated-float__content {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  max-height: min(92vh, 980px);
  overflow: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: center;
  padding: 12px 8px 20px;
  animation: nominatedFloatIn 0.35s ease-out;
  -webkit-overflow-scrolling: touch;
}

.nominated-float__close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  color: #2a1f16;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.nominated-float__close:hover {
  background: #fffdf8;
}

.nominated-float__section {
  margin: 36px 0 28px;
}

.nominated-float__section:first-of-type {
  margin-top: 28px;
}

.nominated-float__section:last-child {
  margin-bottom: 0;
}

.nominated-float__title {
  display: inline-block;
  margin: 0 auto 16px;
  padding: 10px 18px;
  border-radius: 10px;
  background: #fffdf8;
  font-family: "Archivo Black", "Arial Black", Impact, sans-serif;
  font-size: clamp(12px, 3.1vw, 24px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(-3deg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.nominated-float__title--kapamilya {
  color: #c8102e;
}

.nominated-float__title--kapuso {
  color: #0057b8;
}

.nominated-float__cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 16px;
}

.nominated-float__card {
  margin: 0;
  width: min(150px, 28vw);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.28));
  animation: nominatedCardIn 0.45s ease-out both;
}

.nominated-float__card:nth-child(2) {
  animation-delay: 0.06s;
}

.nominated-float__card:nth-child(3) {
  animation-delay: 0.12s;
}

.nominated-float__card:nth-child(4) {
  animation-delay: 0.18s;
}

.nominated-float__card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.nominated-float__card--fallback {
  aspect-ratio: 225 / 280;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 253, 248, 0.92);
  color: #2a1f16;
  font-family: "Archivo Black", "Arial Black", Impact, sans-serif;
  font-size: 18px;
}

.nominated-float__empty {
  margin: 0;
  color: rgba(255, 253, 248, 0.9);
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 14px;
}

@keyframes nominatedFloatIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes nominatedCardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.visitor-badge {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 28px rgba(42, 31, 22, 0.16);
  font-family: "Outfit", sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: #e11d48;
  pointer-events: none;
  animation: visitorIn 0.45s ease-out;
}

.visitor-badge[hidden] {
  display: none !important;
}

.visitor-badge .visitor-number,
.visitor-badge .visitor-number #visitor-count {
  color: #1d4ed8 !important;
  font-weight: 800;
}

@keyframes visitorIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
    background-size: cover;
  }

  #top-banner {
    border-width: 4px;
    border-bottom-width: 5px;
    padding: 16px 14px 20px;
  }

  #table {
    width: min(360px, 94vw);
    height: 42vh;
  }

  .ranking__pyramid {
    width: min(170px, 44vw);
  }

  .ranking__entry-view {
    margin: 10px 10px 18px;
  }

  .visitor-badge {
    right: 10px;
    bottom: 10px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .nominated-float__card {
    width: min(118px, 30vw);
  }

  .nominated-float__cards {
    gap: 10px 10px;
  }

  .nominated-float__title {
    padding: 8px 12px;
    font-size: clamp(11px, 3.4vw, 16px);
  }
}
