/* Player page (PitPanda API layout) */
/* Monocraft (OFL-1.1, github.com/IdreesInc/Monocraft): open-licensed font modelled on the Minecraft font */
@font-face { font-family: 'Monocraft'; src: url('/fonts/Monocraft.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Monocraft'; src: url('/fonts/Monocraft-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
:root { --mc-icon: 32px; --mc-icon-sm: 16px; --mc-head-24: 24px; --mc-head-32: 32px; --mc-head-96: 96px; }

.pp-layout { --slot: 44px; display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 12px; }
.pp-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 1020px) { .pp-layout { grid-template-columns: 1fr; } }
.pp-card-b { overflow-x: auto; }
@media (max-width: 560px) { .pp-layout { --slot: 34px; } }

.pp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pp-card-h { background: var(--card); padding: 11px 16px; font-size: 1.3rem; font-weight: 500; color: #d7d9dd; border-bottom: 1px solid var(--border); }
.pp-card-b { padding: 14px 16px; font-size: .92rem; color: var(--sub); }
.pp-tabs { display: flex; gap: 14px; flex-wrap: wrap; }
.pp-htab { background: none; border: none; font: inherit; color: var(--muted); cursor: pointer; padding: 0 0 2px; border-bottom: 2px solid transparent; }
.pp-htab:hover { color: var(--sub); }
.pp-htab.active { color: #d7d9dd; border-bottom-color: #d7d9dd; }

.mc-font { font-family: 'Monocraft', monospace; font-size: .92em; line-height: 1.25; letter-spacing: 0; font-variant-ligatures: none; }
.mc-font b { font-weight: 700; }
.pp-val { color: var(--text); }
.pp-muted { color: var(--muted); }
.pp-small { font-size: .8rem; margin: 4px 0 8px; }
.pp-line { margin: 2px 0; }

/* Profile */
.pp-profile { display: flex; gap: 12px; align-items: flex-start; }
.pp-head { width: var(--mc-head-96); height: var(--mc-head-96); image-rendering: pixelated; flex-shrink: 0; border-radius: 4px; }
.pp-profile-info { min-width: 0; }
.pp-mcname { font-size: 1.12rem; margin-bottom: 6px; word-break: break-word; }
.pp-links { display: flex; justify-content: center; gap: 14px; margin-top: 12px; }
.pp-links a { color: var(--sub); text-decoration: underline; text-underline-offset: 2px; }
.pp-links a:hover { color: var(--accent); }
.pp-actions { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.pp-linked { margin-top: 10px; font-size: .8rem; color: var(--green); text-align: center; }

/* Status */
.pp-online { color: var(--green); font-weight: 500; }
.pp-offline { color: #ff3b3b; font-weight: 500; }

/* Progress */
.pp-prog { display: flex; align-items: center; gap: 6px; margin: 6px 0 12px; }
.pp-prog-icon { width: calc(var(--mc-icon) + 8px); height: calc(var(--mc-icon) + 8px); padding: 4px; image-rendering: pixelated; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.pp-prog-main { flex: 1; min-width: 0; }
.pp-prog-label { color: var(--sub); margin-bottom: 2px; }
.pp-prog-bar { position: relative; height: 18px; background: #1d1f22; border-radius: 4px; overflow: hidden; }
.pp-prog-fill { height: 100%; }
.pp-prog-bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Monocraft', monospace; font-size: .78rem; color: #fff; text-shadow: 1px 1px 0 #000; }

/* Rankings / prestiges */
.pp-ranks { max-height: 420px; overflow-y: auto; line-height: 1.55; }
.pp-prest { max-height: 260px; overflow-y: auto; }
.pp-prest-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--border); }

/* Minecraft slots */
.mc-grid { display: grid; gap: 4px; justify-content: start; }
.mc-slot { position: relative; width: var(--slot); height: var(--slot); background: #2f3237; border: 1px solid #383c43; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: default; }
.mc-slot:not(.empty):hover { border-color: var(--accent); }
.mc-icon { width: var(--mc-icon); height: var(--mc-icon); image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
.mc-slot.locked .mc-icon { filter: brightness(.18) saturate(0); }
.mc-fallback { color: var(--muted); font-weight: 700; }
.mc-count { position: absolute; right: 3px; bottom: 1px; font-family: 'Monocraft', monospace; font-size: .8rem; line-height: 1; color: #fff; text-shadow: 1px 1px 0 #3f3f3f; pointer-events: none; }

.pp-inv { display: flex; gap: 14px; flex-wrap: wrap; }
.pp-armor { display: grid; gap: 4px; align-content: start; }
.pp-hotbar { margin-top: 10px; }
.pp-sub { font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.pp-section-title { font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--sub); border-bottom: 1px solid var(--border); padding-bottom: 3px; margin: 12px 0 8px; }
.pp-section-title:first-child { margin-top: 0; }

/* Statistics */
.pp-stat-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pp-stat-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid #4a4f58; border-radius: 4px; color: var(--text); font: inherit; font-size: .82rem; font-weight: 500; padding: 4px 9px; cursor: pointer; }
.pp-stat-btn .mc-icon { width: var(--mc-icon-sm); height: var(--mc-icon-sm); }
.pp-stat-btn:hover { border-color: var(--sub); }
.pp-stat-btn.active { background: #8a5a6e; border-color: #b17a91; }
.pp-statline { line-height: 1.6; }
.pp-statline b { color: var(--text); }
.pp-gap { height: 8px; }

/* Perks / renown */
.pp-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pp-hr { border: none; border-top: 1px solid #555a63; width: 140px; margin: 14px auto; }
.pp-renown-grid { display: grid; grid-template-columns: repeat(7, var(--slot)); gap: 4px; justify-content: center; }
@media (max-width: 420px) { .pp-renown-grid { grid-template-columns: repeat(5, var(--slot)); } }

/* Keep the nav from pushing the login button off-screen on narrower windows */
.nav-links { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-right { flex-shrink: 0; padding-left: 8px; }

#itemTooltip { font-family: 'Monocraft', monospace; font-size: .8rem; line-height: 1.35; font-variant-ligatures: none; }

/* Clickable items (have a nonce → item history) */
.mc-slot.has-history { cursor: pointer; }

/* Wipe banner */
.pp-wipe-banner { background: rgba(224,82,82,.1); border: 1px solid rgba(224,82,82,.45); border-radius: 12px; padding: 12px 16px; margin: 12px 0 0; color: var(--text); font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.pp-wipe-title { color: #ff5c5c; font-weight: 700; font-size: 1.05rem; }
.pp-wipe-old { background: rgba(221,160,78,.08); border-color: rgba(221,160,78,.4); flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wipe-saved { font-size: .7rem; font-weight: 600; color: var(--green); background: rgba(82,201,122,.12); border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }

/* Online now */

/* Item history modal */
.ih-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ih-modal { position: relative; width: min(800px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: #16181b; border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.ih-close { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--sub); font-size: 1.1rem; cursor: pointer; }
.ih-close:hover { color: var(--text); }
.ih-title { font-size: 1.15rem; color: #fff; padding-right: 30px; }
.ih-nonce { font-size: .8rem; color: var(--sub); margin: 4px 0 16px; }
.ih-nonce b { color: var(--text); font-family: 'Monocraft', monospace; font-weight: 400; }
.ih-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #24272c; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.ih-tabs button { background: none; border: none; color: var(--sub); font: inherit; font-size: .88rem; padding: 8px; border-radius: 7px; cursor: pointer; }
.ih-tabs button.active { background: #0d0e10; color: #fff; font-weight: 600; }
.ih-body { overflow-y: auto; min-height: 120px; padding-right: 4px; }
.ih-sub { color: var(--accent); margin-bottom: 10px; }
.ih-owner { display: flex; gap: 12px; align-items: center; background: #3a3f48; border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; cursor: pointer; transition: background .12s; }
.ih-owner:hover { background: #454b56; }
.ih-owner img { image-rendering: pixelated; border-radius: 3px; flex-shrink: 0; }
.ih-owner-name { font-size: .95rem; color: var(--text); }
.ih-owner-seen { font-size: .78rem; color: var(--sub); margin-top: 3px; }
.ih-badge { font-family: 'Roboto', sans-serif; font-size: .68rem; font-weight: 600; color: #7ee2a8; background: rgba(82,201,122,.18); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.ih-variant { display: flex; gap: 12px; align-items: flex-start; background: #2a2d33; border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.ih-ench { font-size: .85rem; line-height: 1.5; }
.ih-dupe { border-radius: 8px; padding: 12px 14px; line-height: 1.5; }
.ih-dupe p { margin-top: 4px; color: var(--sub); }
.ih-dupe ul { margin: 8px 0 0 18px; color: var(--sub); font-size: .82rem; }
.ih-dupe code { color: var(--text); }
.ih-dupe.ok { background: rgba(82,201,122,.1); border: 1px solid rgba(82,201,122,.35); color: #7ee2a8; }
.ih-dupe.bad { background: rgba(224,82,82,.1); border: 1px solid rgba(224,82,82,.45); color: #ff7b7b; }

.pp-stat-note { font-size: .8rem; color: var(--accent); background: rgba(221,160,78,.08); border: 1px solid rgba(221,160,78,.3); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }

/* Item search (/items) */
.is-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
@media (max-width: 760px) { .is-panel { grid-template-columns: 1fr; } }
.is-col { display: flex; flex-direction: column; gap: 10px; }
.is-label { font-size: .82rem; font-weight: 700; color: var(--text); }
.is-ench-row { display: grid; grid-template-columns: 1fr 130px; gap: 8px; }
.is-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.is-field { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 700; color: var(--text); }
.is-input { background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px 10px; font: inherit; font-size: .86rem; font-weight: 400; width: 100%; }
.is-input:focus { outline: none; border-color: var(--accent); }
.is-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.is-query { font-size: .78rem; color: var(--muted); margin: 10px 2px; min-height: 1em; }
.is-query code { color: var(--sub); }
.is-query a { color: var(--sub); }
.is-count { font-size: .8rem; color: var(--sub); margin-bottom: 10px; }
.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.is-card { --slot: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s; }
.is-card:hover { border-color: var(--accent); }
.is-card-top { display: flex; gap: 10px; align-items: center; }
.is-name { font-size: .92rem; }
.is-lives { font-size: .8rem; margin-top: 3px; }
.is-ench { font-size: .8rem; line-height: 1.5; flex: 1; }
.is-owner { display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--border); padding-top: 8px; font-size: .8rem; }
.is-owner img { image-rendering: pixelated; border-radius: 2px; }
.is-owner:hover .mc-font { text-decoration: underline; }
.is-seen { margin-left: auto; font-size: .72rem; }

/* Readability fixes */
.mc-font { text-shadow: 1px 1px 0 rgba(0,0,0,.55); }
.num { font-family: 'Roboto', sans-serif; font-weight: 700; letter-spacing: .01em; }
#itemTooltip { max-width: none !important; white-space: nowrap; text-shadow: 1px 1px 0 rgba(0,0,0,.6); }
#itemTooltip .tip-lore div { white-space: nowrap; }
/* Locked renown/upgrade items: greyed out but still recognisable (was nearly black) */
.mc-slot.locked .mc-icon { filter: grayscale(1) brightness(.7); opacity: .45; }
/* 3D block icons are drawn at 64px, so smooth them when scaling down */
.mc-icon.mc-block { image-rendering: auto; }

/* Profile buttons */
.pp-linkbtn { background: none; border: none; color: var(--sub); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 0; }
.pp-linkbtn:hover { color: var(--accent); }
.nh-uuid { background: #24272c; border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; font-size: .8rem; }
.nh-uuid code { display: block; margin-top: 6px; color: var(--teal); font-size: .85rem; }
.nh-names { display: flex; flex-wrap: wrap; gap: 8px; }
.nh-chip { background: #24272c; border-radius: 6px; padding: 7px 12px; font-weight: 600; font-size: .88rem; color: var(--text); cursor: default; }
.bi-status { display: flex; justify-content: space-between; align-items: center; border: 1px solid; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.bi-label { font-size: 1.15rem; font-weight: 700; }
.bi-table { width: 100%; border-collapse: collapse; font-size: .86rem; margin-bottom: 10px; }
.bi-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.bi-table td:first-child { color: var(--sub); }
.bi-reasons { margin: 6px 0 12px 18px; color: var(--text); font-size: .85rem; line-height: 1.6; }

/* Recent-search cards with full info */
.recent-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; }
.player-card.pc-rich { align-items: stretch; text-align: left; gap: 8px; }
.pc-head { display: flex; align-items: center; gap: 10px; }
.pc-head .face { image-rendering: pixelated; border-radius: 4px; flex-shrink: 0; }
.pc-title { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-rows { font-size: .78rem; color: var(--text); line-height: 1.55; }
.pc-k { color: var(--sub); }

/* Home "More" section */
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.more-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-decoration: none; color: var(--text); transition: border-color .12s, transform .12s; }
.more-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.more-icon { font-size: 1.5rem; }
.more-card small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }

/* Footer */
.site-footer { text-align: center; padding: 28px 20px; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--border); margin-top: 40px; }
.footer-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.footer-discord { padding: 8px 18px; font-size: .9rem; }

/* Trade tracker */
.tt-panel { grid-template-columns: 1.2fr 1fr; }
.tt-list { display: flex; flex-direction: column; gap: 8px; }
.tt-row { --slot: 44px; display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.tt-row.tt-click { cursor: pointer; }
.tt-row.tt-click:hover { border-color: var(--accent); }
.tt-main { flex: 1; min-width: 0; }
.tt-flow { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: .84rem; flex-wrap: wrap; }
.tt-who { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tt-who:hover { text-decoration: underline; }
.tt-who img { image-rendering: pixelated; border-radius: 2px; }
.tt-arrow { color: var(--accent); font-weight: 700; }
.tt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tt-badge { font-size: .7rem; font-weight: 700; border: 1px solid; border-radius: 999px; padding: 1px 8px; }

/* ── Watched-players sidebar ── */
.watch-sidebar { position: fixed; top: 52px; left: 0; bottom: 0; width: 230px; background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; overflow-y: auto; z-index: 90; display: none; }
.ws-head { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sub); margin: 0 4px 10px; }
.ws-manage { background: none; border: none; color: var(--muted); font: inherit; font-size: .7rem; cursor: pointer; text-transform: none; letter-spacing: 0; }
.ws-manage:hover { color: var(--accent); }
.ws-list { display: flex; flex-direction: column; gap: 4px; }
.ws-item { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 7px; cursor: pointer; }
.ws-item:hover { background: var(--card); }
.ws-item img, .ap-row img, .ap-card img, .ap-watched img { image-rendering: pixelated; border-radius: 3px; flex-shrink: 0; }
.ws-text { min-width: 0; }
.ws-name { font-size: .84rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-status { font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-empty { font-size: .78rem; padding: 4px; line-height: 1.5; }
.ws-toggle { position: fixed; left: 10px; bottom: 12px; z-index: 95; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--sub); cursor: pointer; display: none; }
.ws-toggle:hover { color: var(--accent); }
@media (min-width: 1280px) {
  body:not(.ws-hidden) .watch-sidebar { display: block; }
  body:not(.ws-hidden) main { margin-left: max(250px, calc((100vw - 1100px) / 2)); }
  .ws-toggle { display: block; }
  body:not(.ws-hidden) .ws-toggle { left: 188px; }
}
/* Narrow screens: sidebar opens as an overlay from the toggle */
@media (max-width: 1279px) {
  .ws-toggle { display: block; }
  body.ws-force .watch-sidebar { display: block; box-shadow: 8px 0 30px rgba(0,0,0,.4); }
  body.ws-force .ws-toggle { left: 188px; }
}

/* ── Active players page ── */
.ap-servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ap-server { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: .82rem; line-height: 1.5; }
.ap-search-row { display: flex; gap: 8px; }
.ap-card { margin-top: 10px; background: var(--card); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.ap-card-head { display: flex; gap: 10px; align-items: center; cursor: pointer; margin-bottom: 4px; }
.ap-srv { font-size: .84rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-srv.on b { color: #55ff55; }
.ap-dot { width: 8px; height: 8px; border-radius: 50%; background: #55ff55; box-shadow: 0 0 6px #55ff55; flex-shrink: 0; }
.ap-dot.off { background: #5c6370; box-shadow: none; }
.ap-watched { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.ap-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.ap-row { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.ap-row:hover { border-color: #55ff55; }
.ap-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }

/* ── Mobile ── */
@media (max-width: 760px) {
  nav { padding: 0 10px; height: auto; min-height: 52px; flex-wrap: wrap; gap: 6px; }
  .logo { margin-right: 8px; }
  /* index.html hides the links on phones; show them as a scrollable row instead */
  .nav-links { display: flex !important; order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .nav-links a { white-space: nowrap; padding: 6px 10px; }
  main { padding: 0 12px 30px; }
  .is-panel, .tt-panel { grid-template-columns: 1fr !important; }
  .is-two { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .hero-search { flex-direction: column; }
}

/* Name autocomplete */
.sg-box { position:absolute; z-index:2000; background:var(--surface); border:1px solid var(--border); border-radius:9px; box-shadow:0 12px 32px #0007; padding:5px; max-height:min(290px,50vh); overflow:auto; }
.sg-box[hidden] { display:none; }
.sg-item { display:flex; min-height:36px; align-items:center; gap:9px; padding:7px 9px; border-radius:6px; cursor:pointer; font-size:.86rem; }
.sg-item img { image-rendering: pixelated; border-radius: 2px; }
.sg-item.active, .sg-item:hover { background:var(--card); box-shadow:inset 2px 0 var(--accent); }
.sg-label { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sg-item small { margin-left:auto; color:var(--sub); white-space:nowrap; }
.sg-item .ap-dot { margin-left: auto; }
.sg-hint { font-size: .68rem; color: var(--muted); padding: 4px 8px 2px; }

/* Progress icons are now rendered items */
.pp-prog-icon { display: flex; align-items: center; justify-content: center; }
.pp-prog-icon .mc-icon { width: var(--mc-icon); height: var(--mc-icon); }
