/* Clans (25.11.2026): the list (/clans) and a clan (/clans?id=N). The podium, the table and the rows are those of
   the top (pages.css, cn.css); here is what clans add: the emblem, «your clan», the switch of the rating, the
   head of a clan, its applications, its settings and the window that creates a clan. */

/* ── the emblem: the clan's picture, or a red seal with its tag, as a Chinese seal stamp ── */
.clan-emb { --s: 32px; position: relative; display: inline-grid; place-items: center; flex: none; width: var(--s); height: var(--s); border-radius: 7px; overflow: hidden; background: var(--raised); }
.clan-emb img { width: 100%; height: 100%; object-fit: cover; }
.clan-emb.is-seal {
    background: radial-gradient(120% 120% at 30% 20%, #d23a2c, #9e1b17 60%, #6f0f0e);
    box-shadow: inset 0 0 0 calc(var(--s) * 0.05) rgba(255, 226, 160, 0.85), inset 0 0 0 calc(var(--s) * 0.09) #8a1512, 0 1px 3px rgba(0, 0, 0, 0.5);
    border-radius: calc(var(--s) * 0.14);
}
.clan-emb.is-seal b {
    font: 800 calc(var(--s) * 0.36)/1 var(--num); letter-spacing: -0.02em; color: #ffe2a0; text-shadow: 0 1px 0 rgba(80, 8, 6, 0.6);
    max-width: 86%; overflow: hidden; white-space: nowrap;
}
.clan-emb.is-seal[data-len="1"] b, .clan-emb.is-seal[data-len="2"] b { font-size: calc(var(--s) * 0.44); }
.clan-emb.is-seal[data-len="4"] b { font-size: calc(var(--s) * 0.3); }
.clan-emb.is-seal[data-len="5"] b, .clan-emb.is-seal[data-len="6"] b { font-size: calc(var(--s) * 0.24); }
.clan-emb.is-mid { --s: 56px; }
.clan-emb.is-big { --s: 104px; border-radius: 14px; }
.clan-emb.is-pod { --s: 78px; }
.pod.p1 .clan-emb.is-pod { --s: 100px; }
.clan-emb.is-empty { filter: grayscale(1) brightness(0.5); opacity: 0.45; }
.clan-podium .pod-mask { display: flex; align-items: flex-end; justify-content: center; }
/* a clan's name is words: on the podium it may take two lines rather than lose its end */
.clan-podium .pod-name span { white-space: normal; text-align: center; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* the tag next to a name: small gold letters in a thin frame, as it reads in the scoreboard */
.clan-tag { display: inline-block; flex: none; margin-left: 2px; padding: 3px 6px 2px; border: 1px solid rgba(231, 161, 54, 0.45); border-radius: 5px; font: 700 11px/1 var(--sans); font-style: normal; letter-spacing: 0.06em; color: var(--cn-gold-hi, #ffe2a0); vertical-align: 3px; }

/* ── the list ── */
.clans-head .formula b { margin-right: 6px; }
.clans-head .formula i { font-style: normal; }
.clan-mine {
    display: flex; align-items: center; gap: 16px; margin: 28px 0 20px; padding: 16px 18px;
    border: 1px solid var(--line-strong); border-radius: var(--r-lg, 12px); background: linear-gradient(100deg, rgba(122, 18, 20, 0.35), rgba(28, 13, 15, 0.9) 55%);
}
.clan-mine:empty { display: none; }
.clan-mine-text { flex: 1; min-width: 0; }
.clan-mine-text small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.clan-mine-text b { display: block; font-size: 18px; }
.clan-mine-text p { margin: 4px 0 0; color: var(--soft); font-size: 14px; }
.clan-mine .btn { flex: none; }

.clan-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.clan-controls .search { margin-left: auto; }
.clan-tabs { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(18, 8, 9, 0.8); }
.clan-tabs button { border: 0; border-radius: 6px; background: transparent; padding: 8px 14px; color: var(--muted); font: 600 14px/1 var(--sans); cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.clan-tabs button[aria-selected="true"] { background: var(--raised); color: var(--text, #fff); box-shadow: inset 0 0 0 1px var(--cn-edge, rgba(226, 54, 44, 0.5)); }
@media (hover: hover) and (pointer: fine) { .clan-tabs button:hover { color: var(--soft); } }
.clan-tabs button:focus-visible { outline: 2px solid var(--cn-gold-lo, #e7a136); outline-offset: 1px; }
.clan-week-left { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.clan-week-left[hidden] { display: none; }

.clan-lb .clan-link { gap: 10px; }
.clan-lb .clan-link > span { max-width: 300px; }
.clan-lb td.mode { color: var(--muted); font-size: 14px; text-align: left; }
.clan-lb th:nth-child(3) { text-align: left; }
.clan-lb td.members small { font-size: 14px; color: var(--muted); font-style: normal; margin-left: 1px; }

/* ── a clan ── */
.clan-back { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 18px; color: var(--muted); text-decoration: none; font-size: 14px; }
.clan-back::before { content: ""; width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: 45deg; }
@media (hover: hover) and (pointer: fine) { .clan-back:hover { color: var(--soft); } }

.clan-hero {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px 24px;
    padding: 26px 26px 24px; border: 1px solid var(--line-strong); border-radius: var(--r-lg, 12px); overflow: hidden;
    background: linear-gradient(110deg, rgba(122, 18, 20, 0.42), rgba(28, 13, 15, 0.94) 60%);
}
.clan-hero[style*="--banner"] { background: linear-gradient(90deg, rgba(13, 9, 9, 0.92) 30%, rgba(13, 9, 9, 0.55)), var(--banner) center / cover; }
.clan-id { min-width: 0; }
.clan-id h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.05; overflow-wrap: anywhere; }
.clan-id h1 .clan-tag { font-size: 14px; vertical-align: 8px; margin-left: 8px; }
.clan-desc { margin: 10px 0 0; color: var(--soft); max-width: 46em; overflow-wrap: anywhere; }
.clan-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.clan-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.clan-note { color: var(--muted); font-size: 14px; }

.clan-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 22px; }
.clan-stats > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.clan-stats small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.clan-stats b { font: italic 800 28px/1 var(--num); font-variant-numeric: tabular-nums; }
.clan-stats b small { display: inline; font-size: 16px; color: var(--muted); margin: 0 0 0 2px; }

.clan-role { display: inline-block; padding: 4px 8px 3px; border-radius: 5px; background: rgba(255, 255, 255, 0.05); font: 600 12px/1 var(--sans); font-style: normal; color: var(--soft); white-space: nowrap; }
.clan-role.is-owner { background: rgba(231, 161, 54, 0.14); color: var(--cn-gold-hi, #ffe2a0); }
.clan-role.is-officer { background: rgba(226, 54, 44, 0.16); color: #ffb3a8; }
.clan-role[style*="--role"] { color: var(--role); }
.clan-members th:nth-child(2), .clan-members td:nth-child(2), .clan-members th:nth-child(4), .clan-members td:nth-child(4) { text-align: left; }
.clan-members td.when { color: var(--muted); font-size: 14px; }
.clan-members .show-sm { display: none; }
.clan-kick { margin-left: 12px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--muted); font: 600 12px/1 var(--sans); cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
    .clan-kick:hover { color: #ffb3a8; border-color: var(--cn-edge, rgba(226, 54, 44, 0.5)); }
    /* with a mouse the button shows on its row only, so the table stays quiet */
    .clan-members .clan-kick { opacity: 0; transition: opacity 150ms ease; }
    .clan-members tr:is(:hover, :focus-within) .clan-kick, .clan-members .clan-kick[data-armed] { opacity: 1; }
}
.clan-settings input[type="radio"] { accent-color: var(--cn-gold-lo, #e7a136); }

.clan-requests { margin: 0 0 22px; padding: 16px 18px; border: 1px solid var(--cn-edge, rgba(226, 54, 44, 0.5)); border-radius: 12px; background: var(--panel); }
.clan-requests h2 { margin: 0 0 10px; font-size: 18px; }
.clan-requests h2 span { color: var(--cn-gold-hi, #ffe2a0); }
.clan-requests ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.clan-requests li { display: flex; align-items: center; gap: 12px; }
.clan-requests li .player { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-decoration: none; }
.clan-requests li .av { width: 28px; height: 28px; border-radius: 7px; background: var(--raised); flex: none; }
.clan-requests li .player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-requests li small { flex: none; }
.clan-requests li small { color: var(--muted); }
.clan-requests .btn { padding: 8px 12px; }

.clan-settings { display: grid; gap: 10px; max-width: 560px; margin: 26px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.clan-settings h2 { margin: 0 0 4px; font-size: 18px; }
.clan-settings textarea { resize: vertical; }
.clan-settings fieldset { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 0; padding: 0; border: 0; }
.clan-settings legend { padding: 0; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.clan-settings .btn { justify-self: start; }
.clan-empty { color: var(--muted); }

/* ── the window that creates a clan ── */
.clan-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--cn-edge, rgba(226, 54, 44, 0.5)); border-radius: 14px; background: var(--panel); color: var(--text, #fff); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.clan-dialog::backdrop { background: rgba(8, 4, 4, 0.72); }
.clan-form { display: grid; gap: 6px; padding: 22px; }
.clan-form h2 { margin: 0 0 10px; font-size: 22px; }
.clan-form label, .clan-settings label { font-size: 14px; color: var(--soft); }
.clan-form input, .clan-settings textarea { box-sizing: border-box; width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--well, #120809); color: inherit; font: 500 15px/1.3 var(--sans); }
.clan-form input:focus-visible, .clan-settings textarea:focus-visible { outline: 2px solid var(--cn-gold-lo, #e7a136); outline-offset: 1px; }
.clan-form .tag-input { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; max-width: 160px; }
.clan-form small { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.clan-form-pay { margin: 6px 0 0; color: var(--soft); font-size: 14px; }
.clan-form-error { margin: 4px 0 0; color: #ffb3a8; font-size: 14px; }
.clan-form-error a { color: var(--cn-gold-hi, #ffe2a0); }
.clan-form-acts { display: flex; gap: 10px; margin-top: 12px; }

@media (max-width: 860px) {
    .clan-hero { grid-template-columns: auto minmax(0, 1fr); padding: 18px; }
    .clan-acts { grid-column: 1 / -1; align-items: stretch; }
    .clan-emb.is-big { --s: 72px; }
    .clan-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .clan-mine { flex-wrap: wrap; }
    .clan-mine .btn { width: 100%; justify-content: center; }
    .clan-controls .search { margin-left: 0; width: 100%; }
    .clan-lb .clan-link > span { max-width: 150px; }
    .clan-lb .clan-emb { display: none; }
    .clan-members .show-sm { display: inline-block; margin-left: 8px; }
    .clan-requests li { flex-wrap: wrap; }
    .clan-requests li .player { flex: 1 1 100%; }
    .clan-requests li small { flex: 1; }
    /* the rows: the tag goes, the name keeps the room (the seal and the tag are on the clan's own page) */
    .clan-lb .clan-tag { display: none; }
    .clan-lb .clan-link > span { max-width: 170px; }
    .clan-podium .pod-name { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    .clan-tabs button { transition: none; }
}
