:root {
  --bg: #0d1013;
  --panel: #151a1f;
  --panel2: #1b2128;
  --line: #262e37;
  --text: #e8edf2;
  --muted: #8995a3;
  --accent: #2ecc71;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.logo { display: flex; align-items: center; }
.logo img { height: 46px; width: auto; display: block; filter: drop-shadow(0 3px 6px rgba(0,0,0,.45)); transition: transform .15s; }
.logo:hover img { transform: scale(1.03); }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.live.on i { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.modes { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.modes-inner { display: flex; gap: 8px; overflow-x: auto; padding-top: 12px; scrollbar-width: thin; }
.mode { flex: none; width: 104px; padding: 10px 6px 9px; border-radius: 12px 12px 0 0; background: var(--panel2); border: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; opacity: .7; transition: opacity .15s, color .15s; }
.mode .ico { width: 26px; height: 26px; filter: grayscale(.35); transition: filter .15s, transform .15s; }
.mode:hover { opacity: 1; color: var(--text); }
.mode:hover .ico { filter: none; transform: translateY(-1px); }
.mode.active { opacity: 1; color: var(--text); background: var(--bg); }
.mode.active .ico { filter: none; }
.mode.active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; border-radius: 2px; background: var(--text); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 14px; }
h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.title-ico { width: 28px; height: 28px; }
#search { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px 14px; width: 260px; max-width: 100%; outline: none; }
#search:focus { border-color: var(--accent); }

.board { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 40px; }
.head, .row { display: grid; grid-template-columns: 56px minmax(160px, 1.4fr) 70px 2fr; align-items: center; gap: 8px; padding: 0 16px; }
.head { height: 40px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); }
.row { height: 74px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel2); }
.row.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(46, 204, 113, .35); } to { background: transparent; } }

.c-rank { font-weight: 800; font-size: 18px; color: var(--muted); }
.row:nth-child(1) .c-rank { color: #f5c542; }
.row:nth-child(2) .c-rank { color: #c0c7d0; }
.row:nth-child(3) .c-rank { color: #d08a4e; }
.c-player { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-player img { width: 40px; height: 40px; border-radius: 6px; image-rendering: pixelated; background: var(--panel2); flex: none; }
.pname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psub { font-size: 12px; color: var(--muted); }
.c-region { font-size: 12px; font-weight: 700; }
.reg { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); }
.c-tiers { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* tier chip: icon in a ring, tier label under it */
.chip { --c: #9aa5b1; width: 40px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.chip .ring { width: 32px; height: 32px; border-radius: 50%; background: #1f262e; border: 2px solid color-mix(in srgb, var(--c) 55%, transparent); display: grid; place-items: center; }
.chip .ring .ico { width: 19px; height: 19px; }
.chip b { font-size: 11px; font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 5px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.chip.none .ring { border: 2px dashed var(--line); background: transparent; }
.chip.none b { color: var(--muted); background: none; }
.chip.t-ht1 { --c: #ffd54a; } .chip.t-lt1 { --c: #f5a742; }
.chip.t-ht2 { --c: #ff7a59; } .chip.t-lt2 { --c: #e85d8a; }
.chip.t-ht3 { --c: #b072f0; } .chip.t-lt3 { --c: #7e8cf0; }
.chip.t-ht4 { --c: #4db6e8; } .chip.t-lt4 { --c: #3ec9b5; }
.chip.t-ht5 { --c: #8bc34a; } .chip.t-lt5 { --c: #9aa5b1; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; background: var(--panel2); border: 1px solid var(--line); }
.badge.big { font-size: 15px; padding: 6px 14px; }
.badge.t-ht1 { color: #ffd54a; border-color: #ffd54a66; background: #ffd54a1a; }
.badge.t-lt1 { color: #f5a742; border-color: #f5a74266; background: #f5a7421a; }
.badge.t-ht2 { color: #ff7a59; border-color: #ff7a5966; background: #ff7a591a; }
.badge.t-lt2 { color: #e85d8a; border-color: #e85d8a66; background: #e85d8a1a; }
.badge.t-ht3 { color: #b072f0; border-color: #b072f066; background: #b072f01a; }
.badge.t-lt3 { color: #7e8cf0; border-color: #7e8cf066; background: #7e8cf01a; }
.badge.t-ht4 { color: #4db6e8; border-color: #4db6e866; background: #4db6e81a; }
.badge.t-lt4 { color: #3ec9b5; border-color: #3ec9b566; background: #3ec9b51a; }
.badge.t-ht5 { color: #8bc34a; border-color: #8bc34a66; background: #8bc34a1a; }
.badge.t-lt5 { color: #9aa5b1; border-color: #9aa5b166; background: #9aa5b11a; }
.pts { font-size: 12px; color: var(--muted); align-self: center; margin-left: 4px; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 420px; max-width: 100%; text-align: center; position: relative; }
.card img.body { height: 220px; image-rendering: pixelated; margin-bottom: 8px; }
.card h2 { margin: 6px 0 2px; }
.card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; text-align: left; }
.card .cell { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.card .cell.none { opacity: .45; }
.cell-name { display: flex; align-items: center; gap: 8px; }
.cell-name .ico { width: 20px; height: 20px; }
.card a.namemc { display: inline-block; margin-top: 4px; color: var(--accent); font-size: 13px; }
.close { position: absolute; top: 10px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }

@media (max-width: 700px) {
  .head, .row { grid-template-columns: 40px 1fr 54px; }
  .head .c-tiers, .row .c-tiers { grid-column: 1 / -1; justify-content: flex-start; }
  .row { height: auto; padding-top: 10px; padding-bottom: 10px; }
  .mode { width: 84px; font-size: 12px; }
  .logo img { height: 34px; }
  .head .c-tiers { display: none; }
}
