/* Kanal König 4.1.7 – Gilden, Gildenwappen, Gildenchat und gemeinsame Ranglisten */

.guild-crest {
    --guild-bg: #0e76bd;
    --guild-fg: #fff;
    --guild-border: #f3c623;
    position: relative;
    width: 48px;
    height: 54px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 4px solid var(--guild-border);
    color: var(--guild-fg);
    background-color: var(--guild-bg);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .46), 0 5px 12px rgba(5, 68, 104, .2);
    isolation: isolate;
}

.guild-crest::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    opacity: .42;
}

.guild-crest > svg {
    width: 58%;
    height: 58%;
    fill: currentColor;
    filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .2));
}

.guild-crest.small { width: 34px; height: 38px; border-width: 3px; }
.guild-crest.medium { width: 45px; height: 50px; }
.guild-crest.large { width: 92px; height: 104px; border-width: 6px; }
.guild-crest.hero { width: 88px; height: 100px; border-width: 6px; }
.guild-crest.chat { width: 30px; height: 32px; border-width: 2px; box-shadow: none; }
.guild-shape-shield { clip-path: polygon(8% 5%, 92% 5%, 92% 63%, 79% 82%, 50% 98%, 21% 82%, 8% 63%); }
.guild-shape-round { border-radius: 50%; }
.guild-shape-hex { clip-path: polygon(25% 3%, 75% 3%, 98% 27%, 98% 73%, 75% 97%, 25% 97%, 2% 73%, 2% 27%); }
.guild-shape-drop { border-radius: 52% 48% 52% 48% / 38% 38% 62% 62%; clip-path: polygon(50% 0, 92% 42%, 85% 78%, 50% 100%, 15% 78%, 8% 42%); }
.guild-pattern-stripes::before { background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, .75) 10px 18px); }
.guild-pattern-split::before { background: linear-gradient(90deg, transparent 0 50%, rgba(255, 255, 255, .8) 50%); }
.guild-pattern-dots::before { background: radial-gradient(circle, rgba(255, 255, 255, .95) 0 2px, transparent 2.5px) 0 0 / 13px 13px; }
.guild-pattern-waves::before { background: repeating-radial-gradient(ellipse at 0 100%, transparent 0 8px, rgba(255, 255, 255, .72) 9px 12px, transparent 13px 18px); }

.guild-crest-accent {
    position: absolute;
    right: 7%;
    bottom: 8%;
    width: 28%;
    height: 28%;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    color: var(--guild-bg);
    background: var(--guild-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.guild-crest-accent svg { width: 70%; height: 70%; fill: currentColor; }
.ranking-mobile-tabs,
.chat-channel-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 9px;
    padding: 4px;
    overflow-x: auto;
    border: 1px solid #cde6ee;
    border-radius: 15px;
    background: rgba(255, 255, 255, .88);
}

.ranking-mobile-tabs button,
.chat-channel-tabs button {
    flex: 1 0 auto;
    min-height: 38px;
    padding: 8px 10px;
    border: 0;
    border-radius: 11px;
    color: #436775;
    background: transparent;
    font-size: 9px;
    font-weight: 900;
}

.ranking-mobile-tabs button.active,
.chat-channel-tabs button.active {
    color: white;
    background: linear-gradient(145deg, #24c5dc, #1478db);
    box-shadow: 0 3px 8px rgba(12, 104, 169, .2);
}

.chat-channel-tabs [data-open-guild-page] {
    color: #694900;
    background: linear-gradient(145deg, #fff0a4, #f4c537);
}

.dual-ranking-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.ranking-pane,
.guild-panel,
.guild-level-card,
.guild-create-panel,
.guild-search-panel {
    overflow: hidden;
    border: 1px solid white;
    border-radius: 18px;
    background: rgba(255, 255, 255, .93);
    box-shadow: 0 6px 17px rgba(5, 77, 112, .11);
}

.ranking-pane { padding: 10px; }
.ranking-pane > header,
.guild-panel > header,
.guild-create-panel > header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ranking-pane > header > span,
.guild-panel > header > span,
.guild-create-panel > header > span {
    width: 37px;
    height: 37px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: #e5f8fc;
    font-size: 20px;
}

.ranking-pane header small,
.guild-panel header small,
.guild-create-panel header small,
.guild-profile-hero small {
    display: block;
    color: #1478b8;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .09em;
}

.ranking-pane h3,
.guild-panel h3,
.guild-create-panel h3 {
    margin: 1px 0 0;
    font-size: 14px;
}

.ranking-pane > p {
    min-height: 27px;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.4;
}

.guild-ranking-filter {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
}

.guild-ranking-filter span { color: var(--muted); font-size: 8px; font-weight: 900; }
.guild-ranking-filter select {
    min-width: 0;
    height: 31px;
    padding: 0 7px;
    border: 1px solid #c9e0e8;
    border-radius: 10px;
    color: var(--ink);
    background: #f7fcfd;
    font-size: 8px;
    font-weight: 800;
}

.guild-ranking-list { display: grid; gap: 5px; }
.guild-ranking-row {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 28px 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border: 1px solid #d5e8ee;
    border-radius: 12px;
    color: var(--ink);
    background: white;
    text-align: left;
}

.guild-ranking-row > em {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: #1479c9;
    font-style: normal;
    font-size: 9px;
    font-weight: 900;
}

.guild-ranking-row.podium-1 > em { color: #694600; background: #ffd74b; }
.guild-ranking-row.podium-2 > em { color: #455d67; background: #dce8ec; }
.guild-ranking-row.podium-3 > em { color: #713d19; background: #e8a272; }
.guild-ranking-row.own { border-color: #e8bd2e; background: #fff9d9; box-shadow: inset 0 0 0 2px rgba(239, 193, 39, .22); }
.guild-ranking-row > span { min-width: 0; }
.guild-ranking-row > span b,
.guild-ranking-row > span small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-ranking-row > span b { font-size: 9px; }
.guild-ranking-row > span b i { color: #1478b8; font-style: normal; }
.guild-ranking-row > span small { margin-top: 2px; color: var(--muted); font-size: 6px; }
.guild-ranking-row > strong { font-size: 8px; white-space: nowrap; }
.guild-ranking-row > i { grid-column: 4; justify-self: end; font-style: normal; font-size: 7px; font-weight: 900; }
.rank-up { color: #139861; }
.rank-down { color: #d3484b; }
.rank-same { color: #849ba4; }
.own-guild-rank {
    width: 100%;
    margin-top: 7px;
    padding: 8px;
    border: 1px solid #f2ca42;
    border-radius: 11px;
    color: #674900;
    background: #fff9d8;
    font-size: 8px;
}

.guild-chat-page .chat-shell { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.guild-chat-page .chat-shell.guest { grid-template-rows: auto auto minmax(0, 1fr); }
.guild-chat-page .chat-channel-tabs { margin: 7px 7px 0; }
.guild-chat-avatar { overflow: hidden; border: 0; background: transparent !important; }
.chat-avatar-letter { display: grid; place-items: center; width: 100%; height: 100%; }

.guild-page .section-content { padding-bottom: calc(82px + var(--safe-bottom)); }
.guild-loading { min-height: 260px; display: grid; place-items: center; }
.guild-page-hero > span { background: linear-gradient(145deg, #fff17c, #e59b17); }
.guild-panel,
.guild-create-panel,
.guild-search-panel { margin-bottom: 12px; padding: 12px; }
.guild-create-panel > header,
.guild-panel > header { justify-content: space-between; }
.guild-create-panel > header > div:first-child,
.guild-panel > header > div:first-child { min-width: 0; flex: 1; }
.guild-panel > header > button { min-height: 34px; }
.guild-cost-note,
.guild-edit-note,
.guild-moderation-note {
    margin: 8px 0;
    padding: 8px 10px;
    border-radius: 11px;
    color: #4c6975;
    background: #eef9fc;
    font-size: 8px;
    line-height: 1.45;
}

.guild-form { display: grid; gap: 9px; }
.guild-form.compact { gap: 8px; }
.guild-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .55fr); gap: 8px; }
.guild-form label { min-width: 0; display: grid; gap: 4px; }
.guild-form label > span,
.guild-crest-fields label > span {
    color: #456875;
    font-size: 8px;
    font-weight: 900;
}

.guild-form input,
.guild-form textarea,
.guild-form select,
.guild-search-form input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid #bdd8e2;
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: #f9fdff;
    font: inherit;
    font-size: 11px;
}

.guild-form textarea { min-height: 74px; resize: vertical; line-height: 1.4; }
.guild-form input:focus,
.guild-form textarea:focus,
.guild-form select:focus,
.guild-search-form input:focus { border-color: #158bd5; box-shadow: 0 0 0 3px rgba(21, 139, 213, .13); }

.guild-crest-editor {
    display: grid;
    grid-template-columns: 112px 1fr;
    align-items: center;
    gap: 12px;
    padding: 11px;
    border: 1px solid #d2e8ef;
    border-radius: 16px;
    background: linear-gradient(135deg, #f1fbfd, #fff);
}

.guild-crest-preview { min-height: 115px; display: grid; place-items: center; }
.guild-crest-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.guild-crest-fields select { min-height: 34px; padding: 6px; font-size: 8px; }
.guild-search-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-bottom: 10px; }
.guild-search-form button { min-height: 42px; }
.guild-search-results { display: grid; gap: 6px; }
.guild-search-row {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border: 1px solid #d3e8ee;
    border-radius: 14px;
    color: var(--ink);
    background: white;
    text-align: left;
}

.guild-search-row > span { min-width: 0; }
.guild-search-row b,
.guild-search-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-search-row b { font-size: 11px; }
.guild-search-row b i { color: #1478b8; font-style: normal; }
.guild-search-row small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.guild-search-row > em { color: #1478b8; font-style: normal; font-size: 7px; font-weight: 900; }

.guild-invitation {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 7px;
    padding: 8px 0;
    border-top: 1px solid #e0eef2;
}

.guild-invitation:first-of-type { border-top: 0; }
.guild-invitation b,
.guild-invitation small { display: block; }
.guild-invitation b { font-size: 10px; }
.guild-invitation small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.guild-invitation button {
    min-height: 32px;
    padding: 6px 8px;
    border: 0;
    border-radius: 9px;
    color: white;
    background: #1689d4;
    font-size: 7px;
    font-weight: 900;
}

.guild-invitation button.quiet { color: #6a7f88; background: #edf5f7; }
.guild-profile-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 11px;
    padding: 14px;
    overflow: hidden;
    border: 1px solid #fff7c7;
    border-radius: 21px;
    color: white;
    background: radial-gradient(circle at 90% 5%, rgba(255, 221, 70, .34), transparent 38%), linear-gradient(135deg, #0c4f89, #1689ca 58%, #21b5ce);
    box-shadow: 0 8px 22px rgba(4, 72, 113, .2);
}

.guild-profile-hero.public { grid-template-columns: auto minmax(0, 1fr); }
.guild-profile-hero h2 { margin: 2px 0; overflow-wrap: anywhere; font-size: 22px; }
.guild-profile-hero h2 i { color: #ffe56f; font-style: normal; }
.guild-profile-hero p { margin: 4px 0 0; color: rgba(255, 255, 255, .82); font-size: 9px; line-height: 1.45; }
.guild-profile-hero small { color: #bcecff; }
.guild-profile-hero > button {
    align-self: start;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 10px;
    color: white;
    background: rgba(0, 38, 75, .2);
    font-size: 8px;
    font-weight: 900;
}

.guild-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 11px;
}

.guild-stat-grid article {
    min-width: 0;
    padding: 9px 6px;
    border: 1px solid white;
    border-radius: 14px;
    background: white;
    text-align: center;
    box-shadow: 0 4px 11px rgba(4, 72, 105, .09);
}

.guild-stat-grid small,
.guild-stat-grid b { display: block; }
.guild-stat-grid small { color: var(--muted); font-size: 6px; font-weight: 900; }
.guild-stat-grid b { margin-top: 3px; overflow: hidden; color: #0b659f; text-overflow: ellipsis; font-size: 14px; }
.guild-level-card { margin-bottom: 11px; padding: 11px; }
.guild-level-card header { display: flex; justify-content: space-between; gap: 8px; }
.guild-level-card header span { color: #1478b8; font-size: 8px; font-weight: 900; }
.guild-level-card header b { font-size: 9px; }
.guild-level-card > em {
    height: 10px;
    display: block;
    margin: 8px 0 5px;
    overflow: hidden;
    border-radius: 8px;
    background: #dcecf1;
}

.guild-level-card > em i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #21ca9a, #21bfe1, #2f83e8); }
.guild-level-card > small { color: var(--muted); font-size: 7px; }
.guild-primary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 11px; }
.guild-primary-actions > :only-child { grid-column: 1 / -1; }

.guild-task-list,
.guild-member-list,
.guild-application-list { display: grid; gap: 6px; }
.guild-task,
.guild-member,
.guild-application {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #d8eaef;
    border-radius: 13px;
    background: #f9fdff;
}

.guild-task > div,
.guild-member > div,
.guild-application > div { min-width: 0; }
.guild-task,
.guild-application { grid-template-columns: auto minmax(0, 1fr) auto; }
.guild-task > span,
.guild-application > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #e3f6fb;
    font-size: 17px;
    font-weight: 900;
}
.guild-task b,
.guild-task small,
.guild-member b,
.guild-member small,
.guild-application b,
.guild-application small { display: block; }
.guild-task b,
.guild-member b,
.guild-application b { font-size: 10px; }
.guild-task small,
.guild-member small,
.guild-application small { margin-top: 2px; color: var(--muted); font-size: 7px; line-height: 1.35; }
.guild-task button,
.guild-member button,
.guild-application button {
    min-height: 32px;
    padding: 6px 8px;
    border: 0;
    border-radius: 9px;
    color: white;
    background: #1688d3;
    font-size: 7px;
    font-weight: 900;
}

.guild-task-progress {
    width: 100%;
    height: 7px;
    display: block;
    margin-top: 5px;
    overflow: hidden;
    border-radius: 5px;
    background: #dcecf1;
}

.guild-task-progress i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #20c995, #22bce0); }
.guild-member {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.guild-member > button:first-child {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    font-size: 14px;
}

.guild-member-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.guild-member-actions button.danger { background: #db4859; }
.guild-application-actions { display: flex; gap: 5px; }
.guild-application-actions button[data-decision="rejected"] { color: #6b7f87; background: #eaf2f5; }
.guild-edit-panel details > summary {
    cursor: pointer;
    color: #1478b8;
    font-size: 10px;
    font-weight: 900;
}

.guild-edit-panel details[open] > summary { margin-bottom: 11px; }
.guild-leave-button { width: 100%; margin-top: 3px; }
.quiet-button.danger,
.danger-button { color: white; background: linear-gradient(145deg, #eb6470, #bd2f45); }
.empty-line { margin: 8px 0; text-align: center; }
.guild-public-overlay .page-card-body { background: #f1fbfd; }
.public-player-guild {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
    padding: 9px 11px;
    border: 1px solid #cfe5ec;
    border-radius: 15px;
    color: var(--ink);
    background: white;
    text-align: left;
    box-shadow: 0 4px 11px rgba(5, 74, 107, .09);
}

.public-player-guild span { min-width: 0; }
.public-player-guild small,
.public-player-guild b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-player-guild small { color: #1478b8; font-size: 7px; font-weight: 900; }
.public-player-guild b { margin-top: 2px; font-size: 11px; }
.public-player-guild > i { color: #1478b8; font-style: normal; font-size: 22px; }

@media (min-width: 621px) {
    .guild-rankings-page .section-content { width: min(100%, 980px); }
    .ranking-mobile-tabs { display: none; }
}

@media (max-width: 620px) {
    .dual-ranking-layout { display: block; }
    .guild-rankings-page[data-ranking-tab="players"] .guild-ranking-pane,
    .guild-rankings-page[data-ranking-tab="guilds"] .player-ranking-pane { display: none; }
    .ranking-pane { min-height: 260px; }
}

@media (max-width: 420px) {
    .guild-form-grid,
    .guild-crest-editor { grid-template-columns: 1fr; }
    .guild-crest-preview { min-height: 105px; }
    .guild-crest-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .guild-invitation { grid-template-columns: auto minmax(0, 1fr); }
    .guild-invitation button { grid-column: span 1; }
    .guild-profile-hero { grid-template-columns: auto minmax(0, 1fr); }
    .guild-profile-hero > button { grid-column: 1 / -1; width: 100%; }
    .guild-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .guild-ranking-row { grid-template-columns: 28px 34px minmax(0, 1fr) auto; }
    .guild-ranking-row > strong { grid-column: 3; }
    .guild-ranking-row > i { grid-column: 4; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
    .guild-crest,
    .guild-level-card > em i,
    .guild-task-progress i { transition: none !important; }
}
