/* Ranking: the first three on a podium in front of the king's painting, then the centred standings. */

.rank-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 16px; margin-top: 18px; font: 400 13px/1.4 var(--f-data); color: var(--ink-2); }
.rank-lang { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.rank-lang button { padding: 4px 11px; font: 500 12px/1.3 var(--f-data); background: none; border: 0; border-radius: 0; color: var(--ink-3); }
.rank-lang button[aria-pressed="true"] { background: var(--gold); color: #1a160d; }

.rank-controls { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rank-controls .page-tabs { margin: 0; }
.rank-controls #mode-tabs button, .rank-controls #cut-tabs button { min-height: 40px; padding: 8px 20px; font: 400 18px/1 var(--f-display); letter-spacing: .02em; }
.rank-levels { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px; max-width: 980px; }
.rank-milestones > button { padding: 7px 13px; font: 500 14px/1 var(--f-data); letter-spacing: 0; }
.rank-level { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); }
.rank-level select { min-width: 76px; font-family: var(--f-data); }
.rank-status { min-height: 1.5em; margin: 10px 0 52px; text-align: center; font: 400 13px/1.5 var(--f-data); color: var(--ink-3); }
.rank-status.is-error { color: #e7b8a5; }
.empty-copy { margin: 26px auto 18px; text-align: center; font: italic 20px/1.5 var(--f-fell); color: var(--ink-2); }
.retry { display: flex; margin: 10px auto 0; }

/* ---------- podium ---------- */
.rank-stage .podium { overflow: hidden; }
.podium { position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: end; gap: clamp(6px, 2.4vw, 34px); max-width: 940px; margin: 0 auto 34px; padding: 44px clamp(4px, 3vw, 40px) 0; }
.podium::before {
  content: ""; position: absolute; inset: -10px 0 0; z-index: -2; opacity: .75;
  background: linear-gradient(180deg, rgba(31, 28, 21, .1), rgba(31, 28, 21, .55) 60%, var(--panel)), url("../assets/site/king-1600.webp") center 26% / cover;
  -webkit-mask: radial-gradient(46% 64% at 50% 40%, #000 52%, transparent 100%);
  mask: radial-gradient(46% 64% at 50% 40%, #000 52%, transparent 100%);
}
.place { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.place-1::before { content: ""; position: absolute; left: 50%; top: -8%; z-index: -1; width: 150%; aspect-ratio: 1.3; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(208, 96, 47, .32), rgba(208, 96, 47, .08) 60%, transparent); }

.place-medal { position: relative; width: clamp(92px, 13vw, 150px); aspect-ratio: 1; }
.place-1 .place-medal { width: clamp(124px, 18vw, 200px); }
.place-portrait { position: absolute; inset: 21%; width: 58%; height: 58%; border-radius: 50%; object-fit: cover; }
.place-ring { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .75)); }
.place-banner { position: absolute; left: 50%; top: -26%; z-index: -1; width: 34%; transform: translateX(-50%); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }

/* nameplates, the game's own: gold winged plate for the first, the item-window plate for the others.
   The halves stretch only the plain stone, so the lantern and the crest keep their shape. */
.place-plate { --h: 56px; position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: max-content; max-width: 100%; height: var(--h); min-width: calc(var(--h) * 3.6); margin-top: 6px; padding: calc(var(--h) * .138) calc(var(--h) * .8) 0; }
.place-plate::before, .place-plate::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: -1; width: 50.5%; border-style: solid; }
.place-plate::before { left: 0; border-width: 0 calc(var(--h) * .714) 0 calc(var(--h) * .663); border-image: url("../assets/site/plate-l.webp") 0 140 0 130 fill / 0 calc(var(--h) * .714) 0 calc(var(--h) * .663) stretch; }
.place-plate::after { right: 0; border-width: 0 calc(var(--h) * .663) 0 calc(var(--h) * .714); border-image: url("../assets/site/plate-r.webp") 0 130 0 140 fill / 0 calc(var(--h) * .663) 0 calc(var(--h) * .714) stretch; }
.place-1 .place-plate { --h: 96px; min-width: calc(var(--h) * 3.2); padding: calc(var(--h) * .24) calc(var(--h) * .56) 0; margin-top: -6px; }
.place-1 .place-plate::before { border-width: 0 calc(var(--h) * .567) 0 calc(var(--h) * .381); border-image: url("../assets/site/gold-l.webp") 0 119 0 80 fill / 0 calc(var(--h) * .567) 0 calc(var(--h) * .381) stretch; }
.place-1 .place-plate::after { border-width: 0 calc(var(--h) * .381) 0 calc(var(--h) * .567); border-image: url("../assets/site/gold-r.webp") 0 80 0 119 fill / 0 calc(var(--h) * .381) 0 calc(var(--h) * .567) stretch; }
.place-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 clamp(16px, 1.7vw, 21px)/1.1 var(--f-display); color: var(--ink); text-shadow: 0 2px 2px #000; }
.place-1 .place-name { font-size: clamp(19px, 2.2vw, 27px); color: var(--gold-hi); }
.place-class { margin: 8px 0 0; font: 500 12px/1.4 var(--f-data); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.place-value { margin: 2px 0 0; font-size: clamp(15px, 1.5vw, 19px); color: var(--ink); }
.place-1 .place-value { font-size: clamp(17px, 1.8vw, 22px); color: var(--gold-hi); }
.place-extra { margin: 2px 0 0; font-size: 14px; color: var(--ink-3); }
.place-extra.is-dead { color: #e09a8a; }
.is-vacant .place-portrait { opacity: .22; filter: grayscale(1); }
.is-vacant .place-name { font-style: italic; color: var(--ink-3); }

.pedestal {
  display: grid; place-items: center; width: min(100%, 210px); margin-top: 12px; padding-top: 7%;
  font: 400 clamp(26px, 3vw, 40px)/1 var(--f-display); color: rgba(240, 212, 153, .66); text-shadow: 0 2px 2px rgba(0, 0, 0, .9);
  background: center bottom / 100% 100% no-repeat; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .6));
}
/* GPT Image pedestals styled on the game's plates (tools/podium_art.py); the aspect keeps the stone unstretched */
.place-1 .pedestal { width: min(100%, 240px); aspect-ratio: 480 / 566; background-image: url("../assets/site/pedestal-1.webp"); }
.place-2 .pedestal { aspect-ratio: 480 / 477; background-image: url("../assets/site/pedestal-2.webp"); }
.place-3 .pedestal { aspect-ratio: 480 / 385; background-image: url("../assets/site/pedestal-3.webp"); }

/* ---------- standings and records ---------- */
.rank-table .rank { width: 90px; font-size: 17px; font-weight: 500; color: var(--ink); }
.rank-table .top-1 .rank { color: #f0d080; }
.rank-table .top-2 .rank { color: #dfe3ec; }
.rank-table .top-3 .rank { color: #e2a46c; }
.rank-table tr.top td { background: rgba(215, 180, 106, .04); }
.rank-table .who-cell { font-size: 17px; color: var(--ink); }
.who-cell img { width: 28px; height: 28px; margin-right: 10px; vertical-align: middle; border-radius: 50%; box-shadow: 0 0 0 1px var(--gold-2); }
.rank-table .main-value { color: var(--ink); }
.rank-table .dim { font-size: 14px; color: var(--ink-3); }
.life { color: #a7c8a0; }
.life.dead { color: #e09a8a; }

.records-table .who { display: block; color: var(--ink); }
.records-table small { color: var(--ink-3); }
.records-table tr.is-current td { background: var(--gold-soft); }
.level-link { min-width: 58px; padding: 4px 12px; font: 500 15px var(--f-data); }
.records-table tr.is-current .level-link { color: var(--gold); border-color: var(--gold); }

.notes-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.notes-cols h3 { margin-bottom: 10px; font-size: 24px; color: var(--gold); }
.notes-cols p { margin: 0; }

@media (max-width: 720px) {
  .notes-cols { grid-template-columns: 1fr; }
  .place-plate { --h: 46px; }
  .place-1 .place-plate { --h: 78px; }
  .place-class { font-size: 11px; letter-spacing: .08em; }
  .place-extra { font-size: 12px; }
  .rank-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .rank-table, .rank-table tbody, .rank-table tr, .rank-table td { display: block; width: 100%; }
  .rank-table tr { padding: 6px 0; border-bottom: 1px solid var(--line); }
  .ledger.rank-table td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 5px 14px; border: 0; text-align: right; }
  .rank-table td::before { content: attr(data-label); font: 500 11.5px/1.4 var(--f-data); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); text-align: left; }
  .rank-table .rank { width: 100%; }
  .records-table .level-link { min-width: 44px; padding: 3px 8px; }
  .records-table .who { font-size: 14.5px; overflow-wrap: anywhere; }
}
@media (max-width: 520px) {
  .podium { grid-template-columns: 1fr 1fr; padding-top: 30px; row-gap: 18px; }
  .place-1 { grid-column: 1 / -1; order: -1; }
  .place-1 .pedestal { display: none; }
  .place-plate { min-width: 0; }
}
