* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

body {
    font-family: Arial, sans-serif;
}

.wrapper {
    display: flex;
    flex-direction: column;
}

.pruh {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    padding: 20px;    
    border-bottom: 1px solid #ddd;
}

.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
}

.box {    
    background-color: #e0e0e0;
    border: 1px solid #ddd;
    margin: 10px;
    padding: 20px;
    text-align: left;
    flex: 1;
    min-width: calc(25% - 20px);
    min-height: 380px;
}

.n1 {
    margin-bottom: 5px;
    font-weight: bold;
}

@media screen and (min-width: 651px) and (max-width: 1250px) {
    .box {
        flex: 0 0 calc(50% - 20px);
    }
}

@media screen and (max-width: 650px) {
    .box,
    .box-with-nested {
        flex: 0 0 calc(100% - 20px);
    }
}

.box-with-nested {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.nested-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin: 10px 0;    
    margin-bottom: 0; 
}

.nested-box {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    margin: 10px 0;
    padding: 10px;
}

.half {
    flex: 0 0 calc(50% - 10px);
    margin-right: 10px;
}

.third {
    flex: 0 0 calc(33.3333% - 13.3333px);
    margin-right: 10px;
}

.nested-box:last-child {
    margin-right: 0;
}

.red-background {
  background-color: #FFD6D6;
}

.blue-background {
  background-color: #D6E3FF;
}

.green-background {
  background-color: #DCF5DC;
}

.purple-background {
  background-color: #F0D6FF;
}

.tooltip {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    padding: 8px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    border-radius: 4px;
    left: 5%;
    top: 20px;
    z-index: 1000;
}

.nested-box.third:hover .tooltip {
    visibility: visible;
    opacity: 1;
    display: block;    
}
