* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #FFE5E5 0%, #FFF4E0 25%, #E5F4FF 75%, #FFE5F1 100%);
    height: 100vh;
    padding: 1rem;
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, #FFF9E5 0%, #FFE5F4 100%);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(255, 182, 193, 0.3);
    border: 3px solid rgba(255, 223, 186, 0.5);
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #FFB6C1, #FFD700, #87CEEB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 800;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    color: #FF69B4;
}

.control-group input {
    width: 80px;
    padding: 0.6rem;
    border: 2px solid #FFD700;
    border-radius: 12px;
    font-size: 1rem;
    text-align: center;
    background: white;
}

.shuffle-btn {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, #FFB6C1 0%, #FFD700 50%, #87CEEB 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shuffle-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.6);
}

.shuffle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message {
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
    min-height: 24px;
}

.message.success {
    color: #FF69B4;
}

.message.error {
    color: #FF6B9D;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

/* Member Section */
.member-section {
    background: linear-gradient(135deg, #FFF9E5 0%, #E5F4FF 100%);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(135, 206, 235, 0.3);
    border: 3px solid rgba(255, 223, 186, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.member-section h2 {
    font-size: 1.3rem;
    color: #FF69B4;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.add-member {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.add-member input {
    flex: 1;
    padding: 0.7rem;
    border: 2px solid #FFD700;
    border-radius: 12px;
    font-size: 0.95rem;
    background: white;
}

.add-btn {
    padding: 0.7rem 1.2rem;
    background: linear-gradient(135deg, #FFD700, #FFB6C1);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.5);
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex: 1;
    padding-bottom: 1.5rem;
    min-height: 0;
}

.member-card {
    background: linear-gradient(135deg, #FFFACD, #FFE5F1);
    padding: 0.8rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border: 2px solid rgba(255, 182, 193, 0.3);
}

.member-card.shuffling {
    animation: cardShuffle 0.8s ease-in-out infinite;
}

@keyframes cardShuffle {
    0%, 100% { 
        transform: translateX(0) rotate(0deg) scale(1);
        box-shadow: 0 2px 4px rgba(255, 182, 193, 0.2);
    }
    10% { 
        transform: translateX(-15px) rotate(-8deg) scale(1.05);
        box-shadow: 0 8px 16px rgba(255, 215, 0, 0.5);
    }
    30% { 
        transform: translateX(15px) rotate(8deg) scale(1.05);
        box-shadow: 0 8px 16px rgba(255, 182, 193, 0.5);
    }
    50% { 
        transform: translateX(-10px) rotate(-5deg) scale(1.03);
        box-shadow: 0 6px 12px rgba(135, 206, 235, 0.4);
    }
    70% { 
        transform: translateX(10px) rotate(5deg) scale(1.03);
        box-shadow: 0 6px 12px rgba(255, 182, 193, 0.4);
    }
}

.member-card .name {
    font-weight: 600;
    color: #FF69B4;
}

.member-card .actions {
    display: flex;
    gap: 0.3rem;
}

.member-card button {
    padding: 0.3rem 0.7rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.edit-btn {
    background: linear-gradient(135deg, #87CEEB, #B0E0E6);
    color: white;
}

.edit-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(135, 206, 235, 0.4);
}

.delete-btn {
    background: linear-gradient(135deg, #FFB6C1, #FFC0CB);
    color: white;
}

.delete-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(255, 182, 193, 0.4);
}

/* Group Section */
.group-section {
    background: linear-gradient(135deg, #FFE5F1 0%, #E5F4FF 100%);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(255, 182, 193, 0.3);
    border: 3px solid rgba(255, 182, 193, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.group-section h2 {
    font-size: 1.3rem;
    color: #FF69B4;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.group-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    flex: 1;
    align-content: start;
    padding-bottom: 1rem;
}

@media (min-width: 769px) {
    .group-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, calc(33.333% - 0.67rem)));
    }
}

.group-box {
    background: linear-gradient(135deg, #FFFACD 0%, #FFE5F1 50%, #E5F4FF 100%);
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.3);
    border: 3px solid rgba(255, 215, 0, 0.4);
    opacity: 0;
    animation: groupAppear 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes groupAppear {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.8) rotateX(-20deg);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-10px) scale(1.05) rotateX(5deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

.group-box .group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid rgba(255, 182, 193, 0.4);
}

.group-box .group-name {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFB6C1, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.group-box .member-count {
    background: linear-gradient(135deg, #FFB6C1, #87CEEB);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.3);
}

.group-box .group-members {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.group-box .group-member-card {
    background: white;
    padding: 0.6rem;
    border-radius: 10px;
    font-weight: 600;
    color: #FF69B4;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.3);
    animation: memberPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}

@keyframes memberPop {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    70% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.empty-state {
    text-align: center;
    color: #FFB6C1;
    padding: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }
    
    .container {
        height: auto;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .group-container {
        grid-template-columns: 1fr;
    }
    
    .member-section,
    .group-section {
        max-height: 400px;
    }
}


.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    color: #555;
}

.control-group input {
    width: 80px;
    padding: 0.6rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.shuffle-btn {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.shuffle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.shuffle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message {
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
    min-height: 24px;
}

.message.success {
    color: #10ac84;
}

.message.error {
    color: #ee5a6f;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

/* Member Section */
.member-section {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.member-section h2 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
}

.add-member {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.add-member input {
    flex: 1;
    padding: 0.7rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.add-btn {
    padding: 0.7rem 1.2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn:hover {
    background: #5568d3;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 100%;
    overflow-y: auto;
}

.member-card {
    background: #f8f9fa;
    padding: 0.8rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.member-card.shuffling {
    animation: cardShuffle 0.8s ease-in-out infinite;
}

@keyframes cardShuffle {
    0%, 100% { 
        transform: translateX(0) rotate(0deg) scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    10% { 
        transform: translateX(-15px) rotate(-8deg) scale(1.05);
        box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
    }
    30% { 
        transform: translateX(15px) rotate(8deg) scale(1.05);
        box-shadow: 0 8px 16px rgba(118, 75, 162, 0.4);
    }
    50% { 
        transform: translateX(-10px) rotate(-5deg) scale(1.03);
        box-shadow: 0 6px 12px rgba(102, 126, 234, 0.3);
    }
    70% { 
        transform: translateX(10px) rotate(5deg) scale(1.03);
        box-shadow: 0 6px 12px rgba(118, 75, 162, 0.3);
    }
}

.member-card .name {
    font-weight: 600;
    color: #333;
}

.member-card .actions {
    display: flex;
    gap: 0.3rem;
}

.member-card button {
    padding: 0.3rem 0.7rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn {
    background: #ffa502;
    color: white;
}

.edit-btn:hover {
    background: #ff8c00;
}

.delete-btn {
    background: #ee5a6f;
    color: white;
}

.delete-btn:hover {
    background: #e84118;
}

/* Group Section */
.group-section {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.group-section h2 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
}

.group-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.group-box {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    animation: groupAppear 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes groupAppear {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.8) rotateX(-20deg);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-10px) scale(1.05) rotateX(5deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

.group-box .group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.group-box .group-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
}

.group-box .member-count {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.group-box .group-members {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.group-box .group-member-card {
    background: white;
    padding: 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: memberPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}

@keyframes memberPop {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    70% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .group-container {
        grid-template-columns: 1fr;
    }
}
