* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    margin: 0;
    background: #0f172a;
    color: #f3f4f6;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a {
    color: #7dd3fc;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

header {
    background: #1f2937;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 2rem;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.nav li {
    display: flex;
    align-items: center;
}

.nav a {
    color: #f3f4f6;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    transition: background 0.2s;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.panel {
    background: #1f2735;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.panel-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-actions.compact {
    margin-bottom: 0;
    gap: 0.5rem;
}

.share-link {
    margin-top: 0.8rem;
}

.share-link label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.3rem;
}

.share-link-control {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.share-link-control input {
    flex: 1;
    background: #0b1220;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}

.share-link-control input:focus {
    outline: none;
    border-color: #5eead4;
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.25);
}

.share-link .hint {
    margin-top: 0.3rem;
}

.party-style-buttons {
    display: inline-flex;
    gap: 0.4rem;
}

.party-style-button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: #0f172a;
    font-weight: 600;
    transition: transform 0.1s, opacity 0.15s;
}

.party-style-button:hover {
    opacity: 0.85;
}

.party-style-button:active {
    transform: translateY(1px);
}

.party-style-button.is-active {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.party-style-button[data-style="style-1"] {
    background: linear-gradient(120deg, #5eead4, #22d3ee);
}

.party-style-button[data-style="style-2"] {
    background: linear-gradient(120deg, #c084fc, #a855f7);
}

.party-style-button[data-style="style-3"] {
    background: linear-gradient(120deg, #38bdf8, #0ea5e9);
}

.party-style-button[data-style="style-4"] {
    background: linear-gradient(120deg, #f97316, #facc15);
}

.party-style-button[data-style="style-5"] {
    background: linear-gradient(120deg, #94a3b8, #cbd5f5);
}

.party-style-button[data-style="style-6"] {
    background: linear-gradient(120deg, #7c3aed, #ec4899);
}

.party-style-button[data-style="style-7"] {
    background: linear-gradient(120deg, #2563eb, #0f172a);
}

.party-style-button[data-style="style-8"] {
    background: linear-gradient(120deg, #22c55e, #16a34a);
}

.party-style-button[data-style="style-9"] {
    background: linear-gradient(120deg, #f97316, #ec4899);
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid.two-columns {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid.two-columns.members-layout {
    grid-template-columns: minmax(520px, 2fr) minmax(260px, 1fr);
    gap: 1.5rem;
}

label {
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #111827;
    color: #f3f4f6;
    margin-top: 0.4rem;
}

button {
    font: inherit;
}

.btn,
.btn-primary,
.btn-ghost,
.btn-danger,
.btn-secondary {
    border: none;
    border-radius: 10px;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    transition: opacity 0.15s, transform 0.1s;
}

.btn:hover {
    opacity: 0.85;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(60deg, #5eead4, #2563eb);
    color: #0f172a;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #f3f4f6;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.full-width {
    width: 100%;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.messages li {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.6rem;
}

.messages .success {
    background: rgba(16, 185, 129, 0.15);
}

.messages .error {
    background: rgba(239, 68, 68, 0.2);
}

.messages .info {
    background: rgba(59, 130, 246, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    font-size: 0.95rem;
}

thead {
    background: rgba(255, 255, 255, 0.05);
}

.class-pill {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
}

.member-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.4rem 1rem;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #0f172a;
}

.member-options::-webkit-scrollbar {
    width: 6px;
}

.member-options::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.member-options::-webkit-scrollbar-thumb {
    background: rgba(94, 234, 212, 0.6);
    border-radius: 999px;
}

.table-scroll {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.table-scroll::-webkit-scrollbar {
    width: 8px;
}

.table-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(94, 234, 212, 0.8), rgba(14, 165, 233, 0.8));
    border-radius: 999px;
}

.table-scroll table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
}

.party-list-scroll {
    max-height: calc(7 * 3.2rem + 2.6rem);
    overflow-y: auto;
}

.party-list-scroll table {
    min-width: 100%;
}

.party-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.party-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    background: #151c2b;
}

.party-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
    background: rgba(248, 250, 252, 0.03);
    border: 1px solid rgba(248, 250, 252, 0.08);
    padding: 0.08rem 0.35rem;
    border-radius: 6px;
}

.party-card header h4 {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.05;
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    color: #f8fafc;
}

.party-member-count {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

.party-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    margin: 0.15rem 0 0.35rem;
    padding: 0.24rem 0.7rem;
    border-radius: 11px;
    background: rgba(248, 250, 252, 0.07);
    border: 1px solid rgba(248, 250, 252, 0.14);
}

.party-header h4 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    display: flex;
    align-items: baseline;
    gap: 0.32rem;
    color: #f8fafc;
}

.party-header .party-member-count {
    font-size: 0.8rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.site-footer {
    text-align: center;
    padding: 1rem 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(56, 189, 248, 0.12));
    border-radius: 18px;
    padding: 1.2rem 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg, rgba(94, 234, 212, 0.4), rgba(14, 165, 233, 0.25));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.stat-card.total {
    background: linear-gradient(135deg, #1d1b38, #2d1f5f);
}

.stat-card.power {
    background: linear-gradient(135deg, #12293e, #1b3f54);
}

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.85);
}

.stat-label {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #f2f6ff;
}

.stat-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.class-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.class-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.drag-board {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .drag-board {
        grid-template-columns: 1fr;
    }
}

.dropzone {
    border: 1px dashed rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 0.8rem;
    min-height: 200px;
    background: #111a2a;
    overflow-y: auto;
}

.dropzone::-webkit-scrollbar {
    width: 6px;
}

.dropzone::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.dropzone::-webkit-scrollbar-thumb {
    background: rgba(94, 234, 212, 0.7);
    border-radius: 999px;
}

.dropzone header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.dropzone-grid-wrapper {
    max-height: calc(2 * 320px + 1.5rem);
    overflow-y: auto;
    padding-right: 0.3rem;
}

.dropzone-grid-wrapper::-webkit-scrollbar {
    width: 6px;
}

.dropzone-grid-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.dropzone-grid-wrapper::-webkit-scrollbar-thumb {
    background: rgba(94, 234, 212, 0.7);
    border-radius: 999px;
}

.dropzone-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 1rem;
}

@media (max-width: 1024px) {
    .nav {
        flex-direction: column;
        gap: 0.8rem;
    }

    .nav ul {
        justify-content: center;
        gap: 0.6rem;
    }

    .container {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .grid.two-columns {
        grid-template-columns: 1fr;
    }

    .grid.two-columns.members-layout {
        grid-template-columns: 1fr;
    }

    .table-scroll {
        max-height: 360px;
    }

    .party-overview-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .dropzone-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 680px) {
    .container {
        padding: 1rem 0.8rem;
    }

    .panel {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    table th,
    table td {
        font-size: 0.85rem;
        padding: 0.45rem;
    }

    .member-options {
        max-height: 200px;
    }
}

.dropzone ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 120px;
}

.member-pool ul {
    max-height: calc(15 * 2.6rem);
    overflow-y: auto;
    padding-right: 0.35rem;
}

.member-pool ul::-webkit-scrollbar {
    width: 6px;
}

.member-pool ul::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.member-pool ul::-webkit-scrollbar-thumb {
    background: rgba(94, 234, 212, 0.7);
    border-radius: 999px;
}

.draggable {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    cursor: grab;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
}

.dropzone.drag-over {
    border-color: #5eead4;
    background: rgba(94, 234, 212, 0.1);
}

.party-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 1rem;
}

@media (max-width: 1024px) {
    .party-overview-grid {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
    }
}

@media (max-width: 680px) {
    .party-overview-grid {
        grid-template-columns: 1fr;
    }
}

.party-card-link {
    display: block;
    color: inherit;
    cursor: pointer;
}

.overview-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    background: #151c2b;
    transition: transform 0.15s;
}

.overview-card:hover {
    transform: translateY(-2px);
}


.party-overview-grid[data-view-style="style-2"] {
    gap: 0.75rem;
}

.party-overview-grid[data-view-style="style-2"] .overview-card {
    padding: 0.65rem;
    border-radius: 9px;
    background: #101827;
    border-color: rgba(148, 163, 184, 0.25);
}

.party-overview-grid[data-view-style="style-2"] .party-header {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.25);
}

.party-overview-grid[data-view-style="style-3"] .overview-card {
    background: linear-gradient(145deg, rgba(14, 165, 233, 0.16), rgba(56, 189, 248, 0.1));
    border: 1px solid rgba(14, 165, 233, 0.5);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.55);
}

.party-overview-grid[data-view-style="style-3"] .party-header {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.4);
}

.party-overview-grid[data-view-style="style-4"] .overview-card {
    background: linear-gradient(145deg, rgba(234, 88, 12, 0.25), rgba(250, 204, 21, 0.15));
    border: 1px solid rgba(249, 115, 22, 0.45);
    box-shadow: 0 16px 28px rgba(30, 64, 175, 0.35);
}

.party-overview-grid[data-view-style="style-4"] .party-header {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(15, 23, 42, 0.45);
}

.party-overview-grid[data-view-style="style-5"] {
    gap: 1.15rem;
}

.party-overview-grid[data-view-style="style-5"] .overview-card {
    background: transparent;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    box-shadow: none;
}

.party-overview-grid[data-view-style="style-5"] .party-header {
    background: rgba(148, 163, 184, 0.08);
    border-style: dashed;
}

.party-overview-grid[data-view-style="style-6"] {
    gap: 0.85rem;
}

.party-overview-grid[data-view-style="style-6"] .overview-card {
    background: linear-gradient(155deg, rgba(124, 58, 237, 0.22), rgba(236, 72, 153, 0.18));
    border: 1px solid rgba(236, 72, 153, 0.5);
    box-shadow: 0 18px 34px rgba(76, 29, 149, 0.45);
}

.party-overview-grid[data-view-style="style-6"] .party-header {
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.4);
}

.party-overview-grid[data-view-style="style-7"] .overview-card {
    background: linear-gradient(165deg, rgba(37, 99, 235, 0.25), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(37, 99, 235, 0.5);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.5);
}

.party-overview-grid[data-view-style="style-7"] .party-header {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(37, 99, 235, 0.45);
}

.party-overview-grid[data-view-style="style-8"] .overview-card {
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.18), rgba(21, 128, 61, 0.18));
    border: 1px solid rgba(34, 197, 94, 0.5);
    box-shadow: 0 18px 30px rgba(5, 46, 22, 0.5);
}

.party-overview-grid[data-view-style="style-8"] .party-header {
    background: rgba(244, 255, 242, 0.12);
    border-color: rgba(34, 197, 94, 0.4);
}

.party-overview-grid[data-view-style="style-9"] .overview-card {
    background: linear-gradient(145deg, rgba(249, 115, 22, 0.25), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(249, 115, 22, 0.45);
    box-shadow: 0 16px 30px rgba(98, 0, 63, 0.5);
}

.party-overview-grid[data-view-style="style-9"] .party-header {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(249, 115, 22, 0.4);
}
.form-compact form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.form-compact form label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}
