.connections-body {
    background-color: #F8C8DC;
    min-height: 100vh;
}

.title-link {
    text-decoration: none;
    color: inherit;
}

.connections-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

.connections-instructions {
    text-align: center;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    margin: 8px 0 24px;
}

.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tile {
    background-color: #ffffff;
    color: #2b1a22;
    border: none;
    border-radius: 8px;
    aspect-ratio: 1.6 / 1;
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    padding: 6px;
    text-align: center;
    line-height: 1.15;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    user-select: none;
    overflow: hidden;
    word-break: break-word;
}

.tile:hover {
    transform: scale(1.03);
}

.tile.selected {
    background-color: #5a3b4a;
    color: #ffffff;
}

.tile.shake {
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.solved-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.solved-group {
    border-radius: 8px;
    padding: 14px 12px;
    text-align: center;
    color: #2b1a22;
    font-family: 'Playfair Display', serif;
    animation: pop 0.4s ease;
}

@keyframes pop {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.solved-group .category {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.solved-group .members {
    font-size: 16px;
    letter-spacing: 0.5px;
}

.solved-group.difficulty-1 { background-color: #f9df6d; }
.solved-group.difficulty-2 { background-color: #a0c35a; }
.solved-group.difficulty-3 { background-color: #b0c4ef; }
.solved-group.difficulty-4 { background-color: #ba81c5; }

.mistakes {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 24px 0 16px;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 20px;
}

.dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #5a3b4a;
    transition: opacity 0.3s, transform 0.3s;
}

.dot.gone {
    opacity: 0.2;
    transform: scale(0.6);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ctrl-btn {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    padding: 10px 20px;
    background-color: white;
    border: 2px solid #2b1a22;
    border-radius: 24px;
    cursor: pointer;
    color: #2b1a22;
    transition: background-color 0.2s, color 0.2s;
}

.ctrl-btn:hover:not(:disabled) {
    background-color: #2b1a22;
    color: white;
}

.ctrl-btn.submit {
    background-color: #2b1a22;
    color: white;
}

.ctrl-btn.submit:hover:not(:disabled) {
    background-color: #5a3b4a;
}

.ctrl-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.message {
    text-align: center;
    margin-top: 18px;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    min-height: 28px;
}

.share-btn {
    display: block;
    margin: 16px auto 0;
}

.board-wrap {
    position: relative;
}

.toast-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.toast {
    background-color: #2b1a22;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 12px 28px;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(43, 26, 34, 0.35);
    white-space: nowrap;
    animation: toast-rise 1.6s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes toast-rise {
    0%   { opacity: 0;   transform: translateY(10px) scale(0.9); }
    15%  { opacity: 1;   transform: translateY(0)   scale(1); }
    55%  { opacity: 1;   transform: translateY(-30px) scale(1); }
    100% { opacity: 0;   transform: translateY(-80px) scale(1); }
}

@media (max-width: 600px) {
    .tile { font-size: 13px; padding: 4px; }
    .connections-instructions { font-size: 22px; }
    .solved-group .category { font-size: 18px; }
    .solved-group .members { font-size: 13px; }
}
